[llvm-commits] [zorg] r147164 - in /zorg/trunk/lnt/lnt: lnttool/create.py server/db/testsuite.py server/db/testsuitedb.py
Daniel Dunbar
daniel at zuster.org
Thu Dec 22 11:24:27 PST 2011
Author: ddunbar
Date: Thu Dec 22 13:24:26 2011
New Revision: 147164
URL: http://llvm.org/viewvc/llvm-project?rev=147164&view=rev
Log:
[lnt/v0.4] lnt.server.db/v4: Add metadata to sample fields so we can explicitly specify the association between status sample fields and the value they control.
Modified:
zorg/trunk/lnt/lnt/lnttool/create.py
zorg/trunk/lnt/lnt/server/db/testsuite.py
zorg/trunk/lnt/lnt/server/db/testsuitedb.py
Modified: zorg/trunk/lnt/lnt/lnttool/create.py
URL: http://llvm.org/viewvc/llvm-project/zorg/trunk/lnt/lnt/lnttool/create.py?rev=147164&r1=147163&r2=147164&view=diff
==============================================================================
--- zorg/trunk/lnt/lnt/lnttool/create.py (original)
+++ zorg/trunk/lnt/lnt/lnttool/create.py Thu Dec 22 13:24:26 2011
@@ -114,14 +114,20 @@
# 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"))
- 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"))
- ts.sample_fields.append(testsuite.SampleField(
- "execution_status", status_sample_type, ".exec.status"))
+ compile_status = testsuite.SampleField(
+ "compile_status", status_sample_type, ".compile.status")
+ compile_time = testsuite.SampleField(
+ "compile_time", real_sample_type, ".compile",
+ status_field = compile_status)
+ exec_status = testsuite.SampleField(
+ "execution_status", status_sample_type, ".exec.status")
+ exec_time = testsuite.SampleField(
+ "execution_time", 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)
db.add(ts)
db.commit()
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=147164&r1=147163&r2=147164&view=diff
==============================================================================
--- zorg/trunk/lnt/lnt/server/db/testsuite.py (original)
+++ zorg/trunk/lnt/lnt/server/db/testsuite.py Thu Dec 22 13:24:26 2011
@@ -171,18 +171,25 @@
# The type of sample this is.
type_id = Column("Type", Integer, ForeignKey('SampleType.ID'))
+ type = relation(SampleType)
# 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)
+ # The status field is used to create a relation to the sample field that
+ # reports the status (pass/fail/etc.) code related to this value. This
+ # association is used by UI code to present the two status fields together.
+ status_field_id = Column("status_field", Integer, ForeignKey(
+ 'TestSuiteSampleFields.ID'))
+ status_field = relation('SampleField', remote_side=id)
- def __init__(self, name, type, info_key):
+ def __init__(self, name, type, info_key, status_field = None):
self.name = name
self.type = type
self.info_key = info_key
+ self.status_field = status_field
# Column instance for fields which have been bound (non-DB
# parameter). This is provided for convenience in querying.
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=147164&r1=147163&r2=147164&view=diff
==============================================================================
--- zorg/trunk/lnt/lnt/server/db/testsuitedb.py (original)
+++ zorg/trunk/lnt/lnt/server/db/testsuitedb.py Thu Dec 22 13:24:26 2011
@@ -231,6 +231,21 @@
run = sqlalchemy.orm.relation(Run)
test = sqlalchemy.orm.relation(Test)
+ @staticmethod
+ def get_primary_fields():
+ """
+ get_primary_fields() -> [SampleField*]
+
+ Get the primary sample fields (those which are not associated
+ with some other sample field).
+ """
+ status_fields = set(s.status_field
+ for s in self.Sample.fields
+ if s.status_field is not None)
+ for field in self.Sample.fields:
+ if field not in status_fields:
+ yield field
+
# Dynamically create fields for all of the test suite defined sample
# fields.
#
More information about the llvm-commits
mailing list