summaryrefslogtreecommitdiff
path: root/tko/frontend.py
diff options
context:
space:
mode:
authormbligh <mbligh@592f7852-d20e-0410-864c-8624ca9c26a4>2007-09-13 17:29:56 +0000
committermbligh <mbligh@592f7852-d20e-0410-864c-8624ca9c26a4>2007-09-13 17:29:56 +0000
commit04eb95a55a0fb0c757784a349f757f4026ec6883 (patch)
tree435bbabcd36839399e947922203df5eda11d9eab /tko/frontend.py
parentcaf2352dbd40e7f71384adafc3fb249b73c1f192 (diff)
update tko
Signed-off-by: Martin J. Bligh <mbligh@google.com> git-svn-id: svn://test.kernel.org/autotest/trunk@663 592f7852-d20e-0410-864c-8624ca9c26a4
Diffstat (limited to 'tko/frontend.py')
-rwxr-xr-xtko/frontend.py89
1 files changed, 51 insertions, 38 deletions
diff --git a/tko/frontend.py b/tko/frontend.py
index a7bedbbd..c04ff935 100755
--- a/tko/frontend.py
+++ b/tko/frontend.py
@@ -1,51 +1,64 @@
#!/usr/bin/python
import os, re, db
-statuses = ['NOSTATUS', 'ERROR', 'ABORT', 'FAIL', 'WARN', 'GOOD']
-status_num = {}
-for x in range(0, len(statuses)):
- status_num[statuses[x]] = x
-
-
-class job:
- def __init__(self):
- self.idx = None
- self.tag = None
- self.machine = None
- self.tests = []
-
+# Pulling hierarchy:
+#
+# test pulls in (kernel, job, attributes, iterations)
+# kernel pulls in (patches)
+#
+# Note that job does put pull test - test is the primary object.
class kernel:
- fields = ['kernel_idx', 'kernel_hash', 'base', 'printable']
+ @classmethod
+ def select(klass, db, where = {}):
+ fields = ['kernel_idx', 'kernel_hash', 'base', 'printable']
+ kernels = []
+ for row in db.select(','.join(fields), 'kernels', where):
+ kernels.append(klass(db, *row))
+ return kernels
- def __init__(self, db, where):
- self.db = db
- self.base = None
- self.patches = []
-
- db.select(fields, kernels,
-
-class patch:
- def __init__(self):
- self.spec = spec
- self.reference = reference
+ def __init__(self, db, idx, hash, base, printable):
+ self.db = db
+ self.idx = idx
self.hash = hash
+ self.base = base
+ self.printable = printable
+ self.patches = [] # THIS SHOULD PULL IN PATCHES!
class test:
- def __init__(self, dir, status, reason, kernel):
- self.dir = dir
- self.status = status
- self.reason = reason
- self.keyval = os.path.join(dir, 'results/keyval')
- self.iterations = []
- self.testname = re.sub(r'\..*', '', self.dir)
- self.kernel = kernel
-
+ @classmethod
+ def select(klass, db, where = {}):
+ fields = ['test_idx', 'job_idx', 'test', 'subdir',
+ 'kernel_idx', 'status', 'reason', 'machine']
+ tests = []
+ for row in db.select(','.join(fields), 'tests', where):
+ tests.append(klass(db, *row))
+ return tests
-class iteration:
- def __init__(self, index, lines):
- self.index = index
- self.keyval = {}
+ def __init__(self, db, test_idx, job_idx, testname, subdir, kernel_idx, status_num, reason, machine):
+ self.idx = test_idx
+ self.job = None
+ # self.job = job.select(db, {'job_idx' : job_idx})
+ # self.machine = self.job.machine
+ self.test = testname
+ self.subdir = subdir
+ self.kernel = None
+ # self.kernel = kernel.select(db, {'kernel_idx' : kernel_idx})
+ self.status_num = status_num
+ self.status_word = db.status_word[status_num]
+ self.reason = reason
+
+
+
+# class patch:
+# def __init__(self):
+# self.spec = None
+#
+#
+# class iteration:
+# def __init__(self):
+# self.a = None
+#