[llvm-commits] [zorg] r146880 - in /zorg/trunk/lnt: lnt/__init__.py lnt/lnttool/create.py lnt/server/db/testsuitedb.py tests/server/db/ImportV4TestSuiteInstance.py tests/server/db/Inputs/ tests/server/db/Inputs/sample-a-small.plist tests/server/db/Inputs/sample-b-small.plist

Daniel Dunbar daniel at zuster.org
Mon Dec 19 09:11:56 PST 2011


Author: ddunbar
Date: Mon Dec 19 11:11:56 2011
New Revision: 146880

URL: http://llvm.org/viewvc/llvm-project?rev=146880&view=rev
Log:
[lnt/v0.4] lnt create: Add a --use-v4 option, which will create an 0.4 style database (preconfigured with an NT compatible test suite) for the default database.
 - Start sketching a V4 based import test.
 - Also, bump version to 0.4.

Added:
    zorg/trunk/lnt/tests/server/db/ImportV4TestSuiteInstance.py
    zorg/trunk/lnt/tests/server/db/Inputs/
    zorg/trunk/lnt/tests/server/db/Inputs/sample-a-small.plist
    zorg/trunk/lnt/tests/server/db/Inputs/sample-b-small.plist
Modified:
    zorg/trunk/lnt/lnt/__init__.py
    zorg/trunk/lnt/lnt/lnttool/create.py
    zorg/trunk/lnt/lnt/server/db/testsuitedb.py

Modified: zorg/trunk/lnt/lnt/__init__.py
URL: http://llvm.org/viewvc/llvm-project/zorg/trunk/lnt/lnt/__init__.py?rev=146880&r1=146879&r2=146880&view=diff
==============================================================================
--- zorg/trunk/lnt/lnt/__init__.py (original)
+++ zorg/trunk/lnt/lnt/__init__.py Mon Dec 19 11:11:56 2011
@@ -1,6 +1,6 @@
 __author__ = 'Daniel Dunbar'
 __email__ = 'daniel at zuster.org'
-__versioninfo__ = (0, 3, 1)
+__versioninfo__ = (0, 4, 0)
 __version__ = '.'.join(map(str, __versioninfo__)) + 'dev'
 
 __all__ = []

Modified: zorg/trunk/lnt/lnt/lnttool/create.py
URL: http://llvm.org/viewvc/llvm-project/zorg/trunk/lnt/lnt/lnttool/create.py?rev=146880&r1=146879&r2=146880&view=diff
==============================================================================
--- zorg/trunk/lnt/lnt/lnttool/create.py (original)
+++ zorg/trunk/lnt/lnt/lnttool/create.py Mon Dec 19 11:11:56 2011
@@ -79,6 +79,49 @@
 
 import lnt.db.perfdb
 
+def _create_v4_nt_database(db_path):
+    from lnt.server.db import v4db, testsuite
+
+    # Create the initial database.
+    db = lnt.server.db.v4db.V4DB('sqlite:///' + db_path)
+    db.commit()
+
+    # Create an NT compatible test suite, automatically.
+    ts = testsuite.TestSuite("nt", "NT")
+
+    # Define the default sample types.
+    #
+    # FIXME: This should probably be done by V4DB.
+    real_sample_type = testsuite.SampleType("Real")
+    status_sample_type = testsuite.SampleType("Status")
+
+    # Promote the natural information produced by 'runtest nt' to fields.
+    ts.machine_fields.append(testsuite.MachineField("hardware", "hardware"))
+    ts.machine_fields.append(testsuite.MachineField("os", "os"))
+
+    # The only reliable order currently is the "run_order" field. We will want
+    # to revise this over time.
+    ts.order_fields.append(testsuite.OrderField("llvm_project_revision",
+                                                "run_order", 0))
+
+    # We are only interested in simple runs, so we expect exactly four fields
+    # per test.
+    ts.sample_fields.append(testsuite.SampleField(
+            "compile_time", real_sample_type, ".compile.time"))
+    ts.sample_fields.append(testsuite.SampleField(
+            "compile_status", status_sample_type, ".compile.status"))
+    ts.sample_fields.append(testsuite.SampleField(
+            "execution_time", real_sample_type, ".exec.time"))
+    ts.sample_fields.append(testsuite.SampleField(
+            "execution_status", status_sample_type, ".exec.status"))
+
+    db.add(ts)
+    db.commit()
+
+    # Finally, ensure the tables for the test suite we just defined are
+    # constructed.
+    ts_db = db.testsuite['nt']
+
 def action_create(name, args):
     """create an LLVM nightly test installation"""
 
@@ -102,6 +145,9 @@
     parser.add_option("", "--hostsuffix", dest="hostsuffix", default="perf",
                       help="suffix at which WSGI app lives [%default]",
                       metavar="NAME")
+    parser.add_option("", "--use-v4", dest="use_v4",
+                      help="use the v0.4 database schema [%default]",
+                      action="store_true", default=False)
 
     (opts, args) = parser.parse_args(args)
     if len(args) != 1:
@@ -118,6 +164,10 @@
     hostname = opts.hostname
     hostsuffix = opts.hostsuffix
     default_db_version = "0.3"
+    if opts.use_v4:
+        default_db_version = "0.4"
+    else:
+        default_db_version = "0.3"
 
     basepath = os.path.abspath(path)
     if os.path.exists(basepath):
@@ -146,8 +196,11 @@
     wsgi_file.close()
     os.chmod(wsgi_path, 0755)
 
-    db = lnt.db.perfdb.PerfDB('sqlite:///' + db_path)
-    db.commit()
+    if opts.use_v4:
+        _create_v4_nt_database(db_path)
+    else:
+        db = lnt.db.perfdb.PerfDB('sqlite:///' + db_path)
+        db.commit()
 
     print 'created LNT configuration in %r' % basepath
     print '  configuration file: %s' % cfg_path

Modified: zorg/trunk/lnt/lnt/server/db/testsuitedb.py
URL: http://llvm.org/viewvc/llvm-project/zorg/trunk/lnt/lnt/server/db/testsuitedb.py?rev=146880&r1=146879&r2=146880&view=diff
==============================================================================
--- zorg/trunk/lnt/lnt/server/db/testsuitedb.py (original)
+++ zorg/trunk/lnt/lnt/server/db/testsuitedb.py Mon Dec 19 11:11:56 2011
@@ -193,7 +193,7 @@
         self.Order = Order
 
         # Create the compound index we cannot declare inline.
-        sqlalchemy.schema.Index("ix_Sample_RunID_TestID",
+        sqlalchemy.schema.Index("ix_%s_Sample_RunID_TestID" % db_key_name,
                                 Sample.run_id, Sample.test_id)
 
         # Create the test suite database tables in case this is a new database.

Added: zorg/trunk/lnt/tests/server/db/ImportV4TestSuiteInstance.py
URL: http://llvm.org/viewvc/llvm-project/zorg/trunk/lnt/tests/server/db/ImportV4TestSuiteInstance.py?rev=146880&view=auto
==============================================================================
--- zorg/trunk/lnt/tests/server/db/ImportV4TestSuiteInstance.py (added)
+++ zorg/trunk/lnt/tests/server/db/ImportV4TestSuiteInstance.py Mon Dec 19 11:11:56 2011
@@ -0,0 +1,44 @@
+# Check the import process into a v4 test suite DB.
+#
+# We first construct a temporary LNT instance.
+# RUN: rm -rf %t.install
+# RUN: lnt create --use-v4 %t.install
+
+# Import the first test set.
+# RUNX: lnt import %t.install %S/Inputs/sample-a-small.plist \
+# RUNX:     --commit=1 --show-sample-count | \
+# RUNX:   FileCheck -check-prefix=IMPORT-A-1 %s
+#
+# IMPORT-A-1: Added Machines: 1
+# IMPORT-A-1: Added Runs : 1
+# IMPORT-A-1: Added Tests : 8
+# IMPORT-A-1: Added Samples : 8
+
+# Import the second test set.
+# RUNX: lnt import %t.install %S/Inputs/sample-b-small.plist \
+# RUNX:     --commit=1 --show-sample-count |\
+# RUNX:   FileCheck -check-prefix=IMPORT-B %s
+#
+# IMPORT-B: Added Runs : 1
+# IMPORT-B: Added Samples : 8
+
+# Check that reimporting the first test set properly reports as a duplicate.
+# RUNX: lnt import %t.install %S/Inputs/sample-a-small.plist \
+# RUNX:     --commit=1 --show-sample-count | \
+# RUNX:   FileCheck -check-prefix=IMPORT-A-2 %s
+#
+# IMPORT-A-2: This submission is a duplicate of run 1
+
+# Run consistency checks on the final database, to validate the import.
+# RUN: python %s %t.install/data/lnt.db
+
+import datetime, sys
+
+from lnt.server.db import testsuite
+from lnt.server.db import v4db
+
+# Load the test database.
+db = v4db.V4DB("sqlite:///%s" % sys.argv[1], echo=True)
+
+# Load the imported test suite.
+ts = db.testsuite['nt']

Added: zorg/trunk/lnt/tests/server/db/Inputs/sample-a-small.plist
URL: http://llvm.org/viewvc/llvm-project/zorg/trunk/lnt/tests/server/db/Inputs/sample-a-small.plist?rev=146880&view=auto
==============================================================================
--- zorg/trunk/lnt/tests/server/db/Inputs/sample-a-small.plist (added)
+++ zorg/trunk/lnt/tests/server/db/Inputs/sample-a-small.plist Mon Dec 19 11:11:56 2011
@@ -0,0 +1,81 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+<dict>
+	<key>Machine</key>
+	<dict>
+		<key>Info</key>
+		<dict>
+			<key>gcc_version</key>
+			<string> i686-apple-darwin10-gcc-4.2.1 (GCC) 4.2.1 (Apple Inc. build 5646)</string>
+			<key>name</key>
+			<string> smoosh-01</string>
+			<key>os</key>
+			<string> Darwin 10.2.0</string>
+			<key>uname</key>
+			<string> Darwin smoosh-01 10.2.0 Darwin Kernel Version 10.2.0: Tue Nov  3 10:37:10 PST 2009; root:xnu-1486.2.11~1/RELEASE_I386 i386hardware: i386</string>
+		</dict>
+		<key>Name</key>
+		<string>LNT SAMPLE MACHINE</string>
+	</dict>
+	<key>Run</key>
+	<dict>
+		<key>End Time</key>
+		<string>2009-11-17 03:44:48</string>
+		<key>Info</key>
+		<dict>
+			<key>tag</key>
+			<string>nts</string>
+		</dict>
+		<key>Start Time</key>
+		<string>2009-11-17 02:12:25</string>
+	</dict>
+	<key>Tests</key>
+	<array>
+		<dict>
+			<key>Data</key>
+			<array>
+				<integer>0</integer>
+			</array>
+			<key>Info</key>
+			<dict>
+			</dict>
+			<key>Name</key>
+			<string>nightlytest.SingleSource/Benchmarks/BenchmarkGame/fannkuch.compile.status</string>
+		</dict>
+		<dict>
+			<key>Data</key>
+			<array>
+				<real>0.019</real>
+			</array>
+			<key>Info</key>
+			<dict>
+			</dict>
+			<key>Name</key>
+			<string>nightlytest.SingleSource/Benchmarks/BenchmarkGame/fannkuch.compile.time</string>
+		</dict>
+		<dict>
+			<key>Data</key>
+			<array>
+				<integer>0</integer>
+			</array>
+			<key>Info</key>
+			<dict>
+			</dict>
+			<key>Name</key>
+			<string>nightlytest.SingleSource/Benchmarks/BenchmarkGame/fannkuch.exec.status</string>
+		</dict>
+		<dict>
+			<key>Data</key>
+			<array>
+				<real>0.3</real>
+			</array>
+			<key>Info</key>
+			<dict>
+			</dict>
+			<key>Name</key>
+			<string>nightlytest.SingleSource/Benchmarks/BenchmarkGame/fannkuch.exec.time</string>
+		</dict>
+	</array>
+</dict>
+</plist>

Added: zorg/trunk/lnt/tests/server/db/Inputs/sample-b-small.plist
URL: http://llvm.org/viewvc/llvm-project/zorg/trunk/lnt/tests/server/db/Inputs/sample-b-small.plist?rev=146880&view=auto
==============================================================================
--- zorg/trunk/lnt/tests/server/db/Inputs/sample-b-small.plist (added)
+++ zorg/trunk/lnt/tests/server/db/Inputs/sample-b-small.plist Mon Dec 19 11:11:56 2011
@@ -0,0 +1,81 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+<dict>
+	<key>Machine</key>
+	<dict>
+		<key>Info</key>
+		<dict>
+			<key>gcc_version</key>
+			<string> i686-apple-darwin10-gcc-4.2.1 (GCC) 4.2.1 (Apple Inc. build 5646)</string>
+			<key>name</key>
+			<string> smoosh-01</string>
+			<key>os</key>
+			<string> Darwin 10.2.0</string>
+			<key>uname</key>
+			<string> Darwin smoosh-01 10.2.0 Darwin Kernel Version 10.2.0: Tue Nov  3 10:37:10 PST 2009; root:xnu-1486.2.11~1/RELEASE_I386 i386hardware: i386</string>
+		</dict>
+		<key>Name</key>
+		<string>LNT SAMPLE MACHINE</string>
+	</dict>
+	<key>Run</key>
+	<dict>
+		<key>End Time</key>
+		<string>2009-11-19 03:00:12</string>
+		<key>Info</key>
+		<dict>
+			<key>tag</key>
+			<string>nts</string>
+		</dict>
+		<key>Start Time</key>
+		<string>2009-11-19 01:27:49</string>
+	</dict>
+	<key>Tests</key>
+	<array>
+		<dict>
+			<key>Data</key>
+			<array>
+				<integer>0</integer>
+			</array>
+			<key>Info</key>
+			<dict>
+			</dict>
+			<key>Name</key>
+			<string>nightlytest.SingleSource/Benchmarks/BenchmarkGame/fannkuch.compile.status</string>
+		</dict>
+		<dict>
+			<key>Data</key>
+			<array>
+				<real>0.022</real>
+			</array>
+			<key>Info</key>
+			<dict>
+			</dict>
+			<key>Name</key>
+			<string>nightlytest.SingleSource/Benchmarks/BenchmarkGame/fannkuch.compile.time</string>
+		</dict>
+		<dict>
+			<key>Data</key>
+			<array>
+				<integer>0</integer>
+			</array>
+			<key>Info</key>
+			<dict>
+			</dict>
+			<key>Name</key>
+			<string>nightlytest.SingleSource/Benchmarks/BenchmarkGame/fannkuch.exec.status</string>
+		</dict>
+		<dict>
+			<key>Data</key>
+			<array>
+				<real>0.32</real>
+			</array>
+			<key>Info</key>
+			<dict>
+			</dict>
+			<key>Name</key>
+			<string>nightlytest.SingleSource/Benchmarks/BenchmarkGame/fannkuch.exec.time</string>
+		</dict>
+	</array>
+</dict>
+</plist>





More information about the llvm-commits mailing list