import time
+class Test(object):
+
+ def __init__(self, name):
+ self.name = name
+
+
+
+class TestResult(object):
+
+ def __init__(self, build, test, result):
+ self.build = build
+ self.test = test
+ self.result = result
+
+
class BuildSummary(object):
def __init__(self, host, tree, compiler, revision, status):
BuildResultStore,
BuildStatus,
NoSuchBuildError,
+ Test,
+ TestResult,
)
from buildfarm.hostdb import (
Host,
import sqlite3
from storm.database import create_database
from storm.expr import EXPR, FuncExpr, compile
-from storm.locals import Bool, Desc, Int, Unicode, RawStr
+from storm.locals import Bool, Desc, Int, RawStr, Reference, Unicode
from storm.store import Store
scm = RawStr()
+class StormTest(Test):
+ __storm_table__ = "test"
+
+ id = Int(primary=True)
+ name = RawStr()
+
+
+class StormTestResult(TestResult):
+ __storm_table__ = "test_result"
+
+ id = Int(primary=True)
+ build_id = Int(name="build")
+ build = Reference(build_id, StormBuild)
+
+ test_id = Int(name="test")
+ test = Reference(test_id, StormTest)
+
+
def setup_schema(db):
db.execute("PRAGMA foreign_keys = 1;", noresult=True)
db.execute("""
db.execute("""
CREATE UNIQUE INDEX IF NOT EXISTS unique_compiler_name ON compiler(name);
""", noresult=True)
+ db.execute("""
+CREATE TABLE IF NOT EXISTS test (
+ id integer primary key autoincrement,
+ name text not null);
+ """, noresult=True)
+ db.execute("CREATE UNIQUE INDEX IF NOT EXISTS test_name ON test(name);",
+ noresult=True)
+ db.execute("""CREATE TABLE IF NOT EXISTS test_result (
+ build int,
+ test int,
+ result int
+ );""", noresult=True)
+ db.execute("""CREATE UNIQUE INDEX IF NOT EXISTS build_test_result ON test_result(build, test);""", noresult=True)
def memory_store():