[llvm-commits] [zorg] r150744 - in /zorg/trunk/lnt: lnt/lnttool/create.py lnt/server/db/v4db.py tests/server/db/CreateV4TestSuiteInstance.py
Daniel Dunbar
daniel at zuster.org
Thu Feb 16 14:54:19 PST 2012
Author: ddunbar
Date: Thu Feb 16 16:54:19 2012
New Revision: 150744
URL: http://llvm.org/viewvc/llvm-project?rev=150744&view=rev
Log:
[lnt/v0.4] lnt.server.db.v4db: Change V4DB to automatically populate the known
status kind and sample type tables.
Modified:
zorg/trunk/lnt/lnt/lnttool/create.py
zorg/trunk/lnt/lnt/server/db/v4db.py
zorg/trunk/lnt/tests/server/db/CreateV4TestSuiteInstance.py
Modified: zorg/trunk/lnt/lnt/lnttool/create.py
URL: http://llvm.org/viewvc/llvm-project/zorg/trunk/lnt/lnt/lnttool/create.py?rev=150744&r1=150743&r2=150744&view=diff
==============================================================================
--- zorg/trunk/lnt/lnt/lnttool/create.py (original)
+++ zorg/trunk/lnt/lnt/lnttool/create.py Thu Feb 16 16:54:19 2012
@@ -90,19 +90,6 @@
# Create an NT compatible test suite, automatically.
ts = testsuite.TestSuite("nts", "NT")
- # Define the default status kinds.
- #
- # FIXME: This should probably be done by V4DB.
- db.add(testsuite.StatusKind(lnt.testing.PASS, "PASS"))
- db.add(testsuite.StatusKind(lnt.testing.FAIL, "FAIL"))
- db.add(testsuite.StatusKind(lnt.testing.XFAIL, "XFAIL"))
-
- # 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"))
@@ -115,14 +102,14 @@
# We are only interested in simple runs, so we expect exactly four fields
# per test.
compile_status = testsuite.SampleField(
- "compile_status", status_sample_type, ".compile.status")
+ "compile_status", db.status_sample_type, ".compile.status")
compile_time = testsuite.SampleField(
- "compile_time", real_sample_type, ".compile",
+ "compile_time", db.real_sample_type, ".compile",
status_field = compile_status)
exec_status = testsuite.SampleField(
- "execution_status", status_sample_type, ".exec.status")
+ "execution_status", db.status_sample_type, ".exec.status")
exec_time = testsuite.SampleField(
- "execution_time", real_sample_type, ".exec",
+ "execution_time", db.real_sample_type, ".exec",
status_field = exec_status)
ts.sample_fields.append(compile_time)
ts.sample_fields.append(compile_status)
@@ -135,6 +122,7 @@
# Finally, ensure the tables for the test suite we just defined are
# constructed.
ts_db = db.testsuite['nts']
+ db.commit()
def action_create(name, args):
"""create an LLVM nightly test installation"""
Modified: zorg/trunk/lnt/lnt/server/db/v4db.py
URL: http://llvm.org/viewvc/llvm-project/zorg/trunk/lnt/lnt/server/db/v4db.py?rev=150744&r1=150743&r2=150744&view=diff
==============================================================================
--- zorg/trunk/lnt/lnt/server/db/v4db.py (original)
+++ zorg/trunk/lnt/lnt/server/db/v4db.py Thu Feb 16 16:54:19 2012
@@ -2,6 +2,8 @@
import testsuite
import testsuitedb
+import lnt.testing
+
class V4DB(object):
"""
Wrapper object for LNT v0.4+ databases.
@@ -81,6 +83,38 @@
self.StatusKind = testsuite.StatusKind
self.TestSuite = testsuite.TestSuite
+ # Resolve or create the known status kinds.
+ self.pass_status_kind = self.query(testsuite.StatusKind)\
+ .filter_by(id = lnt.testing.PASS).first()
+ if self.pass_status_kind is None:
+ self.pass_status_kind = testsuite.StatusKind(lnt.testing.PASS,
+ "PASS")
+ self.add(self.pass_status_kind)
+ self.fail_status_kind = self.query(testsuite.StatusKind)\
+ .filter_by(id = lnt.testing.FAIL).first()
+ if self.fail_status_kind is None:
+ self.fail_status_kind = testsuite.StatusKind(lnt.testing.FAIL,
+ "FAIL")
+ self.add(self.fail_status_kind)
+ self.xfail_status_kind = self.query(testsuite.StatusKind)\
+ .filter_by(id = lnt.testing.XFAIL).first()
+ if self.xfail_status_kind is None:
+ self.xfail_status_kind = testsuite.StatusKind(lnt.testing.XFAIL,
+ "XFAIL")
+ self.add(self.xfail_status_kind)
+
+ # Resolve or create the known sample types.
+ self.real_sample_type = self.query(testsuite.SampleType)\
+ .filter_by(name = "Real").first()
+ if self.real_sample_type is None:
+ self.real_sample_type = testsuite.SampleType("Real")
+ self.add(self.real_sample_type)
+ self.status_sample_type = self.query(testsuite.SampleType)\
+ .filter_by(name = "Status").first()
+ if self.status_sample_type is None:
+ self.status_sample_type = testsuite.SampleType("Status")
+ self.add(self.status_sample_type)
+
@property
def testsuite(self):
# This is the start of "magic" part of V4DB, which allows us to get
Modified: zorg/trunk/lnt/tests/server/db/CreateV4TestSuiteInstance.py
URL: http://llvm.org/viewvc/llvm-project/zorg/trunk/lnt/tests/server/db/CreateV4TestSuiteInstance.py?rev=150744&r1=150743&r2=150744&view=diff
==============================================================================
--- zorg/trunk/lnt/tests/server/db/CreateV4TestSuiteInstance.py (original)
+++ zorg/trunk/lnt/tests/server/db/CreateV4TestSuiteInstance.py Thu Feb 16 16:54:19 2012
@@ -14,18 +14,14 @@
# Create a new TestSuite.
ts = testsuite.TestSuite("nt", "NT")
-# Define the default sample types.
-real_sample_type = testsuite.SampleType("Real")
-status_sample_type = testsuite.SampleType("Status")
-
# Add reasonable definitions for the machine, run, order, and sample fields.
ts.machine_fields.append(testsuite.MachineField("uname", "uname"))
ts.order_fields.append(testsuite.OrderField("llvm_revision", "llvm_revision",
1))
ts.run_fields.append(testsuite.RunField("arch", "ARCH"))
-ts.sample_fields.append(testsuite.SampleField("value", real_sample_type,
+ts.sample_fields.append(testsuite.SampleField("value", db.real_sample_type,
".value"))
-ts.sample_fields.append(testsuite.SampleField("status", status_sample_type,
+ts.sample_fields.append(testsuite.SampleField("status", db.status_sample_type,
".value.status"))
db.add(ts)
More information about the llvm-commits
mailing list