[llvm-commits] [LNT] r154558 - in /lnt/trunk/lnt/server/db: migrations/upgrade_0_to_1.py testsuitedb.py testsuitetypes.py v4db.py
Daniel Dunbar
daniel at zuster.org
Wed Apr 11 16:15:12 PDT 2012
Author: ddunbar
Date: Wed Apr 11 18:15:12 2012
New Revision: 154558
URL: http://llvm.org/viewvc/llvm-project?rev=154558&view=rev
Log:
Stop creating test suite definitions and tables on the fly.
- We do it all at initialization (or upgrade) time now.
Removed:
lnt/trunk/lnt/server/db/testsuitetypes.py
Modified:
lnt/trunk/lnt/server/db/migrations/upgrade_0_to_1.py
lnt/trunk/lnt/server/db/testsuitedb.py
lnt/trunk/lnt/server/db/v4db.py
Modified: lnt/trunk/lnt/server/db/migrations/upgrade_0_to_1.py
URL: http://llvm.org/viewvc/llvm-project/lnt/trunk/lnt/server/db/migrations/upgrade_0_to_1.py?rev=154558&r1=154557&r2=154558&view=diff
==============================================================================
--- lnt/trunk/lnt/server/db/migrations/upgrade_0_to_1.py (original)
+++ lnt/trunk/lnt/server/db/migrations/upgrade_0_to_1.py Wed Apr 11 18:15:12 2012
@@ -99,17 +99,20 @@
status_sample_type = session.query(SampleType).\
filter_by(name = "Status").first()
+ # Create a test suite compile with "lnt runtest nt".
ts = TestSuite(name="nts", db_key_name="NT")
- # Machine fields.
+ # Promote the natural information produced by 'runtest nt' to fields.
ts.machine_fields.append(MachineField(name="hardware", info_key="hardware"))
ts.machine_fields.append(MachineField(name="os", info_key="os"))
- # Order fields.
+ # The only reliable order currently is the "run_order" field. We will want
+ # to revise this over time.
ts.order_fields.append(OrderField(name="llvm_project_revision",
info_key="run_order", ordinal=0))
- # Sample fields.
+ # We are only interested in simple runs, so we expect exactly four fields
+ # per test.
compile_status = SampleField(name="compile_status", type=status_sample_type,
info_key=".compile.status")
compile_time = SampleField(name="compile_time", type=real_sample_type,
@@ -135,18 +138,20 @@
status_sample_type = session.query(SampleType).\
filter_by(name = "Status").first()
+ # Create a test suite compile with "lnt runtest compile".
ts = TestSuite(name="compile", db_key_name="compile")
- # Machine fields.
+ # Promote some natural information to fields.
ts.machine_fields.append(MachineField(name="hardware", info_key="hw.model"))
ts.machine_fields.append(MachineField(name="os_version",
info_key="kern.version"))
- # Order fields.
+ # The only reliable order currently is the "run_order" field. We will want
+ # to revise this over time.
ts.order_fields.append(OrderField(name="llvm_project_revision",
info_key="run_order", ordinal=0))
- # Sample fields.
+ # We expect up to five fields per test, each with a status field.
for name,type_name in (('user', 'time'),
('sys', 'time'),
('wall', 'time'),
Modified: lnt/trunk/lnt/server/db/testsuitedb.py
URL: http://llvm.org/viewvc/llvm-project/lnt/trunk/lnt/server/db/testsuitedb.py?rev=154558&r1=154557&r2=154558&view=diff
==============================================================================
--- lnt/trunk/lnt/server/db/testsuitedb.py (original)
+++ lnt/trunk/lnt/server/db/testsuitedb.py Wed Apr 11 18:15:12 2012
@@ -315,9 +315,6 @@
sqlalchemy.schema.Index("ix_%s_Machine_Unique" % db_key_name,
*args, unique = True)
- # Create the test suite database tables in case this is a new database.
- self.base.metadata.create_all(self.v4db.engine)
-
# Add several shortcut aliases, similar to the ones on the v4db.
self.session = self.v4db.session
self.add = self.v4db.add
Removed: lnt/trunk/lnt/server/db/testsuitetypes.py
URL: http://llvm.org/viewvc/llvm-project/lnt/trunk/lnt/server/db/testsuitetypes.py?rev=154557&view=auto
==============================================================================
--- lnt/trunk/lnt/server/db/testsuitetypes.py (original)
+++ lnt/trunk/lnt/server/db/testsuitetypes.py (removed)
@@ -1,85 +0,0 @@
-"""
-This module maintains information on the "known" test suite types.
-
-In order to follow the existing usage model for LNT with the v0.4 design (in
-which test suites get customized databases), we support dynamically creating
-appropriate test suites on the fly for these known types.
-"""
-
-from lnt.server.db import testsuite
-
-def get_compile_testsuite(db):
- # Create a test suite compile with "lnt runtest compile".
- ts = testsuite.TestSuite("compile", "compile")
-
- # Promote some natural information to fields.
- ts.machine_fields.append(testsuite.MachineField("hardware",
- "hw.model"))
- ts.machine_fields.append(testsuite.MachineField("os_version",
- "kern.version"))
-
- # 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 expect up to five fields per test, each with a status field.
- for name,type_name in (('user', 'time'),
- ('sys', 'time'),
- ('wall', 'time'),
- ('size', 'bytes'),
- ('mem', 'bytes')):
- status = testsuite.SampleField(
- "%s_status" % (name,), db.status_sample_type,
- ".%s.status" % (name,))
- ts.sample_fields.append(status)
- value = testsuite.SampleField(
- "%s_%s" % (name,type_name), db.real_sample_type, ".%s" % (name,),
- status_field = status)
- ts.sample_fields.append(value)
-
- return ts
-
-def get_nts_testsuite(db):
- # Create a test suite compile with "lnt runtest nt".
- ts = testsuite.TestSuite("nts", "NT")
-
- # 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.
- compile_status = testsuite.SampleField(
- "compile_status", db.status_sample_type, ".compile.status")
- compile_time = testsuite.SampleField(
- "compile_time", db.real_sample_type, ".compile",
- status_field = compile_status)
- exec_status = testsuite.SampleField(
- "execution_status", db.status_sample_type, ".exec.status")
- exec_time = testsuite.SampleField(
- "execution_time", db.real_sample_type, ".exec",
- status_field = exec_status)
- ts.sample_fields.append(compile_time)
- ts.sample_fields.append(compile_status)
- ts.sample_fields.append(exec_time)
- ts.sample_fields.append(exec_status)
-
- return ts
-
-_registry = {
- 'compile' : get_compile_testsuite,
- 'nts' : get_nts_testsuite,
- }
-def get_testsuite_for_type(typename, db):
- method = _registry.get(typename)
- if method:
- return method(db)
- return None
-
-__all__ = ['get_testsuite_for_type']
Modified: lnt/trunk/lnt/server/db/v4db.py
URL: http://llvm.org/viewvc/llvm-project/lnt/trunk/lnt/server/db/v4db.py?rev=154558&r1=154557&r2=154558&view=diff
==============================================================================
--- lnt/trunk/lnt/server/db/v4db.py (original)
+++ lnt/trunk/lnt/server/db/v4db.py Wed Apr 11 18:15:12 2012
@@ -2,11 +2,11 @@
import lnt.testing
-from lnt.server.db import testsuite
-from lnt.server.db import testsuitedb
-from lnt.server.db import testsuitetypes
+import lnt.server.db.testsuitedb
import lnt.server.db.migrate
+from lnt.server.db import testsuite
+
class V4DB(object):
"""
Wrapper object for LNT v0.4+ databases.
@@ -32,30 +32,10 @@
ts = self.v4db.query(testsuite.TestSuite).\
filter(testsuite.TestSuite.name == name).first()
if ts is None:
- # Check to see if this is a test suite we know how to
- # dynamically instantiate.
- #
- # FIXME: For now, we assume the typename matches the test suite
- # name. It would be nice to allow tests to report the typename.
- ts = testsuitetypes.get_testsuite_for_type(name, self.v4db)
- if ts is not None:
- self.v4db.add(ts)
- # FIXME: I'm not really sure why we need to commit here. It
- # may be an SA bug. I think we should just be able to flush
- # but then there is an issue when the tables will get
- # realized by the TestSuiteDB constructor below.
- #
- # FIXME: This commit makes me a bit nervous because clients
- # most likely won't expect us to be
- # maybe-commit'ing. However, this is unlikely to be a
- # problem in practice.
- self.v4db.commit()
- else:
- # Otherwise, return the default value.
- return default
+ return default
# Instantiate the per-test suite wrapper object for this test suite.
- self._cache[name] = ts = testsuitedb.TestSuiteDB(
+ self._cache[name] = ts = lnt.server.db.testsuitedb.TestSuiteDB(
self.v4db, name, ts)
return ts
@@ -114,7 +94,7 @@
.filter_by(id = lnt.testing.FAIL).first()
self.xfail_status_kind = self.query(testsuite.StatusKind)\
.filter_by(id = lnt.testing.XFAIL).first()
- assert (self.pass_status_kind, self.fail_status_kind,
+ assert (self.pass_status_kind and self.fail_status_kind and
self.xfail_status_kind), \
"status kinds not initialized!"
More information about the llvm-commits
mailing list