[llvm-commits] [zorg] r146790 - in /zorg/trunk/lnt: docs/todo.rst lnt/server/db/testsuite.py lnt/server/db/testsuitedb.py tests/server/db/CreateV4TestSuite.py tests/server/db/CreateV4TestSuiteInstance.py
Daniel Dunbar
daniel at zuster.org
Fri Dec 16 16:12:27 PST 2011
Author: ddunbar
Date: Fri Dec 16 18:12:26 2011
New Revision: 146790
URL: http://llvm.org/viewvc/llvm-project?rev=146790&view=rev
Log:
[lnt/v0.4] docs: Eliminate the "proposed table design" section, the code is much more definitive now.
Modified:
zorg/trunk/lnt/docs/todo.rst
zorg/trunk/lnt/lnt/server/db/testsuite.py
zorg/trunk/lnt/lnt/server/db/testsuitedb.py
zorg/trunk/lnt/tests/server/db/CreateV4TestSuite.py
zorg/trunk/lnt/tests/server/db/CreateV4TestSuiteInstance.py
Modified: zorg/trunk/lnt/docs/todo.rst
URL: http://llvm.org/viewvc/llvm-project/zorg/trunk/lnt/docs/todo.rst?rev=146790&r1=146789&r2=146790&view=diff
==============================================================================
--- zorg/trunk/lnt/docs/todo.rst (original)
+++ zorg/trunk/lnt/docs/todo.rst Fri Dec 16 18:12:26 2011
@@ -188,163 +188,6 @@
one group of tests was split up into multiple Runs. We should also eventually
support submitting multiple runs in one submission.
-Proposed Table Design
-~~~~~~~~~~~~~~~~~~~~~
-
-Global
-++++++
-StatusKind
- - ID
- - Name
-
-SampleType
- - ID
- - Name
-
- Initially, we will only have Real and Status. Integer and Hash are obvious
- extensions.
-
-TestSuite
- - ID
- - Name
- - DBKeyName
-
- The name we use to prefix the per test suite databases.
-
- - Version
-
- The version of the schema used for the per-test suite databases (probably
- encoded as LNT version).
-
-TestSuiteMachineKeys
- - ID INTEGER PRIMARY KEY
- - TestSuite FOREIGN KEY TestSuite(ID)
- - Name VARCHAR(256)
- - Type?
- - Default?
- - InfoKey
-
- This is used for migration purposes (possibly permanent), it is the key name
- to expect this field to be present as in a submitted info dictionary.
-
-TestSuiteOrderKeys
- - ID INTEGER PRIMARY KEY
- - TestSuite FOREIGN KEY TestSuite(ID)
- - Name VARCHAR(256)
- - Index INTEGER
-
- The ordinal index this order key should appear in.
-
- - Type?
- - Default?
-
-TestSuiteRunKeys
- - ID INTEGER PRIMARY KEY
- - TestSuite FOREIGN KEY TestSuite(ID)
- - Name VARCHAR(256)
- - Type?
- - Default?
- - InfoKey
-
- This is used for migration purposes (possibly permanent), it is the key name
- to expect this field to be present as in a submitted info dictionary.
-
-TestSuiteSampleKeys
- - ID INTEGER PRIMARY KEY
- - TestSuite FOREIGN KEY TestSuite(ID)
- - Name VARCHAR(256)
- - Type FOREIGN KEY SampleType(ID)
- - Default?
- - InfoKey
-
- This is used for migration purposes (possibly permanent), it is the key name
- to expect this field to be present as in a submitted info dictionary.
-
-Per Test Suite
-++++++++++++++
-
-<TS>_Machine
- - ID INTEGER PRIMARY KEY
- - Name VARCHAR(512)
- - Number INTEGER
- - ... additional keys here are defined by TestSuite(MachineKeys) relation ...
-
- Examples would be things like "uname", "CPU". These are all specified by the
- test suite.
-
- - Parameters JSON BLOB
- - Indices::
-
- CREATE INDEX [<TS>_Machine_ID_IDX] ON Machine(ID);
- CREATE INDEX [<TS>_Machine_Name_IDX] ON Machine(Name);
-
-<TS>_Run
- - ID INTEGER PRIMARY KEY
- - Machine FOREIGN KEY <TS>_Machine(ID)
- - Order FOREIGN KEY <TS>_Order(ID)
-
- This is the order of the tested products. The schema doesn't explicitly
- record any information about what the actual products under test are, though,
- so we just refer to this as the "order" of the run.
- - ImportedFrom VARCHAR(512)
-
- Field used to store the filesystem path of the interchange file used to
- import the run into the database. Mostly used for paranoid future proofing to
- allow more sophisticated rebuild tools.
-
- - StartTime DATETIME
- - EndTime DATETIME
-
- - ... additional keys here are defined by TestSuite(RunKeys) relation ...
-
- Examples would be things like "optimization level", "architecture",
- etc. These are all specified by the test suite.
-
- - Parameters JSON BLOB
-
- Additional information a client might want to report in a run, but this will
- only be used for display on a per-Run basis. It is not information that we
- should ever attempt to construct queries on.
-
- - Indices::
-
- CREATE INDEX [<TS>_Run_ID_IDX] ON <TS>_Run(ID);
-
-<TS>_Test
- - ID INTEGER PRIMARY KEY
- - Name VARCHAR(512)
- - Indices::
-
- CREATE INDEX [<TS>_Tests_ID_IDX] ON <TS>_Tests(ID);
- CREATE INDEX [<TS>_Tests_Name_IDX] ON <TS>_Tests(Name);
-
-<TS>_Sample
- - ID INTEGER PRIMARY KEY
- - Run FOREIGN Key <TS>_Run(ID)
- - Test FOREIGN KEY <TS>_Test(ID)
- - ... keys here are defined by TestSuite(SampleKeys) relation ...
- - Indices::
-
- CREATE INDEX [<TS>_Samples_RunID_IDX] ON <TS>_Sample(RunID);
- CREATE INDEX [<TS>_Samples_TestID_IDX] ON <TS>_Sample(TestID);
- CREATE INDEX [<TS>_Samples_TestIDRunID_IDX] ON <TS>_Sample(TestID, RunID);
-
-<TS>_Order
- - ID
- - ... keys here are defined by TestSuite(OrderKeys) relation ...
-
- Examples would be LLVMRevision, ClangRevision, etc. Eventually we could also
- support the use of git hashes to support users who have other test components
- or software in git repositories (the server would handle using those git
- hashes to construct an ordering).
-
- The order of these keys is the lexicographic ordering that defines the total
- ordering.
-
- - Indices::
-
- CREATE INDEX [<TS>_Order_ID_IDX] ON <TS>_Order(ID);
-
Proposed Migration Path
~~~~~~~~~~~~~~~~~~~~~~~
Modified: zorg/trunk/lnt/lnt/server/db/testsuite.py
URL: http://llvm.org/viewvc/llvm-project/zorg/trunk/lnt/lnt/server/db/testsuite.py?rev=146790&r1=146789&r2=146790&view=diff
==============================================================================
--- zorg/trunk/lnt/lnt/server/db/testsuite.py (original)
+++ zorg/trunk/lnt/lnt/server/db/testsuite.py Fri Dec 16 18:12:26 2011
@@ -2,6 +2,8 @@
Database models for the TestSuites abstraction.
"""
+import lnt
+
import sqlalchemy
import sqlalchemy.ext.declarative
import sqlalchemy.orm
@@ -10,12 +12,21 @@
from sqlalchemy.orm import relation
Base = sqlalchemy.ext.declarative.declarative_base()
+
class SampleType(Base):
+ """
+ The SampleType table describes an enumeration for the possible types clients
+ can configure for different sample fields.
+ """
__tablename__ = 'SampleType'
id = Column("ID", Integer, primary_key=True)
-
name = Column("Name", String(256), unique=True)
+
+ # FIXME: We expect the database to have a limited number of instances of
+ # this class, we should just provide static class variables for the various
+ # types once bound.
+
def __init__(self, name):
self.name = name
@@ -23,6 +34,13 @@
return '%s%r' % (self.__class__.__name__, (self.name,))
class StatusKind(Base):
+ """
+ The StatusKind table describes an enumeration for the possible values
+ clients can use for "Status" typed samples. This is designed to match the
+ values which are in use by test produces and are defined in the lnt.testing
+ module.
+ """
+
__tablename__ = 'StatusKind'
id = Column("ID", Integer, primary_key=True)
@@ -39,18 +57,23 @@
id = Column("ID", Integer, primary_key=True)
name = Column("Name", String(256), unique=True)
+
+ # The name we use to prefix the per-testsuite databases.
db_key_name = Column("DBKeyName", String(256))
- version = Column("Version", Integer)
+
+ # The version of the schema used for the per-testsuite databases (encoded as
+ # the LNT version).
+ version = Column("Version", String(16))
machine_fields = relation('MachineField', backref='test_suite')
order_fields = relation('OrderField', backref='test_suite')
run_fields = relation('RunField', backref='test_suite')
sample_fields = relation('SampleField', backref='test_suite')
- def __init__(self, name, db_key_name, version):
+ def __init__(self, name, db_key_name):
self.name = name
self.db_key_name = db_key_name
- self.version = version
+ self.version = lnt.__version__
def __repr__(self):
return '%s%r' % (self.__class__.__name__, (self.name, self.db_key_name,
@@ -63,6 +86,10 @@
test_suite_id = Column("TestSuiteID", Integer, ForeignKey('TestSuite.ID'),
index=True)
name = Column("Name", String(256))
+
+ # The info key describes the key to expect this field to be present as in
+ # the reported machine information. Missing keys result in NULL values in
+ # the database.
info_key = Column("InfoKey", String(256))
def __init__(self, name, info_key):
@@ -79,7 +106,14 @@
test_suite_id = Column("TestSuiteID", Integer, ForeignKey('TestSuite.ID'),
index=True)
name = Column("Name", String(256))
+
+ # The info key describes the key to expect this field to be present as in
+ # the reported machine information. Missing keys result in NULL values in
+ # the database.
info_key = Column("InfoKey", String(256))
+
+ # The ordinal index this field should be used at for creating a
+ # lexicographic ordering amongst runs.
ordinal = Column("Ordinal", Integer)
def __init__(self, name, info_key, ordinal):
@@ -100,6 +134,10 @@
test_suite_id = Column("TestSuiteID", Integer, ForeignKey('TestSuite.ID'),
index=True)
name = Column("Name", String(256))
+
+ # The info key describes the key to expect this field to be present as in
+ # the reported machine information. Missing keys result in NULL values in
+ # the database.
info_key = Column("InfoKey", String(256))
def __init__(self, name, info_key):
@@ -116,7 +154,13 @@
test_suite_id = Column("TestSuiteID", Integer, ForeignKey('TestSuite.ID'),
index=True)
name = Column("Name", String(256))
+
+ # The type of sample this is.
type_id = Column("Type", Integer, ForeignKey('SampleType.ID'))
+
+ # The info key describes the key to expect this field to be present as in
+ # the reported machine information. Missing keys result in NULL values in
+ # the database.
info_key = Column("InfoKey", String(256))
type = relation(SampleType)
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=146790&r1=146789&r2=146790&view=diff
==============================================================================
--- zorg/trunk/lnt/lnt/server/db/testsuitedb.py (original)
+++ zorg/trunk/lnt/lnt/server/db/testsuitedb.py Fri Dec 16 18:12:26 2011
@@ -25,6 +25,10 @@
id = Column("ID", Integer, primary_key=True)
name = Column("Name", String(256), index=True)
number = Column("Number", Integer)
+
+ # The parameters blob is used to store any additional information
+ # reported by the run but not promoted into the machine record. Such
+ # data is stored as a JSON encoded blob.
parameters = Column("Parameters", Binary)
# Dynamically create fields for all of the test suite defined
@@ -81,6 +85,10 @@
imported_from = Column("ImportedFrom", String(512))
start_time = Column("StartTime", DateTime)
end_time = Column("EndTime", DateTime)
+
+ # The parameters blob is used to store any additional information
+ # reported by the run but not promoted into the machine record. Such
+ # data is stored as a JSON encoded blob.
parameters = Column("Parameters", Binary)
machine = sqlalchemy.orm.relation(Machine)
Modified: zorg/trunk/lnt/tests/server/db/CreateV4TestSuite.py
URL: http://llvm.org/viewvc/llvm-project/zorg/trunk/lnt/tests/server/db/CreateV4TestSuite.py?rev=146790&r1=146789&r2=146790&view=diff
==============================================================================
--- zorg/trunk/lnt/tests/server/db/CreateV4TestSuite.py (original)
+++ zorg/trunk/lnt/tests/server/db/CreateV4TestSuite.py Fri Dec 16 18:12:26 2011
@@ -13,7 +13,7 @@
db = v4db.V4DB("sqlite:///:memory:", echo=True)
# Create a new TestSuite.
-ts = testsuite.TestSuite("nt", "NT", 0)
+ts = testsuite.TestSuite("nt", "NT")
db.add(ts)
db.commit()
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=146790&r1=146789&r2=146790&view=diff
==============================================================================
--- zorg/trunk/lnt/tests/server/db/CreateV4TestSuiteInstance.py (original)
+++ zorg/trunk/lnt/tests/server/db/CreateV4TestSuiteInstance.py Fri Dec 16 18:12:26 2011
@@ -12,7 +12,7 @@
db = v4db.V4DB("sqlite:///:memory:", echo=True)
# Create a new TestSuite.
-ts = testsuite.TestSuite("nt", "NT", 0)
+ts = testsuite.TestSuite("nt", "NT")
# Define the default sample types.
real_sample_type = testsuite.SampleType("Real")
More information about the llvm-commits
mailing list