[Piglit] [PATCH] framework: add support for a "timeout" status

Thomas Wood thomas.wood at intel.com
Thu Apr 24 08:39:02 PDT 2014


Signed-off-by: Thomas Wood <thomas.wood at intel.com>
Cc: Daniel Vetter <daniel.vetter at ffwll.ch>
---
 framework/log.py                 |  3 ++-
 framework/status.py              | 12 ++++++++----
 framework/summary.py             |  6 ++++--
 framework/tests/status_tests.py  |  3 ++-
 framework/tests/summary_tests.py |  5 ++++-
 templates/index.css              |  5 ++++-
 6 files changed, 24 insertions(+), 10 deletions(-)

diff --git a/framework/log.py b/framework/log.py
index d045847..e5154aa 100644
--- a/framework/log.py
+++ b/framework/log.py
@@ -39,7 +39,8 @@ class Log(object):
         self.__generator = (x for x in xrange(self.__total))
         self.__pad = len(str(self.__total))
         self.__summary_keys = set(['pass', 'fail', 'warn', 'crash', 'skip',
-                                   'dmesg-warn', 'dmesg-fail', 'dry-run'])
+                                   'dmesg-warn', 'dmesg-fail', 'dry-run',
+                                   'timeout'])
         self.__summary = collections.defaultdict(lambda: 0)
         self.__lastlength = 0
 
diff --git a/framework/status.py b/framework/status.py
index aa42487..8ab72f7 100644
--- a/framework/status.py
+++ b/framework/status.py
@@ -40,8 +40,8 @@ dmesg-warn
 warn
 dmesg-fail
 fail
-crash
 timeout
+crash
 
 SKIP and NOTRUN are not factored into regressions and fixes, they are counted
 seperately. They also derive from a sublcass of Status, which always returns
@@ -63,6 +63,7 @@ __all__ = ['NOTRUN',
            'DMESG_WARN',
            'DMESG_FAIL',
            'SKIP',
+           'TIMEOUT',
            'ALL']
 
 
@@ -81,7 +82,8 @@ def status_lookup(status):
                    'crash': CRASH,
                    'dmesg-warn': DMESG_WARN,
                    'dmesg-fail': DMESG_FAIL,
-                   'notrun': NOTRUN}
+                   'notrun': NOTRUN,
+                   'timeout': TIMEOUT}
 
     try:
         return status_dict[status]
@@ -223,7 +225,9 @@ FAIL = Status('fail', 30)
 
 DMESG_FAIL = Status('dmesg-fail', 40)
 
-CRASH = Status('crash', 50)
+TIMEOUT = Status('timeout', 50)
+
+CRASH = Status('crash', 60)
 
 # A tuple (ordered, immutable) of all statuses in this module
-ALL = (PASS, WARN, DMESG_WARN, FAIL, DMESG_FAIL, CRASH, SKIP, NOTRUN)
+ALL = (PASS, WARN, DMESG_WARN, FAIL, DMESG_FAIL, TIMEOUT, CRASH, SKIP, NOTRUN)
diff --git a/framework/summary.py b/framework/summary.py
index 47138bf..9228330 100644
--- a/framework/summary.py
+++ b/framework/summary.py
@@ -342,8 +342,9 @@ class Summary:
         Private: Find the total number of pass, fail, crash, skip, and warn in
         the *last* set of results stored in self.results.
         """
-        self.totals = {'pass': 0, 'fail': 0, 'crash': 0, 'skip': 0, 'warn': 0,
-                       'dmesg-warn': 0, 'dmesg-fail': 0}
+        self.totals = {'pass': 0, 'fail': 0, 'crash': 0, 'skip': 0,
+                       'timeout': 0, 'warn': 0, 'dmesg-warn': 0,
+                       'dmesg-fail': 0}
 
         for test in self.results[-1].tests.itervalues():
             self.totals[str(test['result'])] += 1
@@ -472,6 +473,7 @@ class Summary:
               "       fail: {fail}\n"
               "      crash: {crash}\n"
               "       skip: {skip}\n"
+              "    timeout: {timeout}\n"
               "       warn: {warn}\n"
               " dmesg-warn: {dmesg-warn}\n"
               " dmesg-fail: {dmesg-fail}".format(**self.totals))
diff --git a/framework/tests/status_tests.py b/framework/tests/status_tests.py
index c1d8c86..599225f 100644
--- a/framework/tests/status_tests.py
+++ b/framework/tests/status_tests.py
@@ -31,7 +31,8 @@ import framework.status as status
 
 # Statuses from worst to last. NotRun is intentionally not in this list and
 # tested separately because of upcoming features for it
-STATUSES = ["pass", "warn", "dmesg-warn", "fail", "dmesg-fail", "crash"]
+STATUSES = ["pass", "warn", "dmesg-warn", "fail", "dmesg-fail", "timeout",
+            "crash"]
 
 # all statuses except pass are problems
 PROBLEMS = STATUSES[1:]
diff --git a/framework/tests/summary_tests.py b/framework/tests/summary_tests.py
index 1ad51b5..a573e39 100644
--- a/framework/tests/summary_tests.py
+++ b/framework/tests/summary_tests.py
@@ -51,7 +51,10 @@ def test_summary_add_to_set():
                                ('skip', 'skip', 'skipped'),
                                ('notrun', 'fail', 'problems'),
                                ('fail', 'notrun', 'problems'),
-                               ('pass', 'fail', 'problems')]:
+                               ('pass', 'fail', 'problems'),
+                               ('timeout', 'pass', 'fixes'),
+                               ('pass', 'timeout', 'regressions'),
+                               ('pass', 'timeout', 'problems')]:
         check_sets.description = "{0} -> {1} should be added to {2}".format(
                 ostat, nstat, set_)
 
diff --git a/templates/index.css b/templates/index.css
index 577370c..3389738 100644
--- a/templates/index.css
+++ b/templates/index.css
@@ -36,7 +36,7 @@ td:first-child > div {
 	background-color: #c8c838
 }
 
-td.skip, td.warn, td.fail, td.pass, td.trap, td.abort, td.crash, td.dmesg-warn, td.dmesg-fail {
+td.skip, td.warn, td.fail, td.pass, td.trap, td.abort, td.crash, td.dmesg-warn, td.dmesg-fail, td.timeout {
 	text-align: right;
 }
 
@@ -67,6 +67,9 @@ tr:nth-child(even) td.fail  { background-color: #e00505; }
 tr:nth-child(odd)  td.dmesg-fail  { background-color: #ff2020; }
 tr:nth-child(even) td.dmesg-fail  { background-color: #e00505; }
 
+tr:nth-child(odd)  td.timeout  { background-color: #83bdf6; }
+tr:nth-child(even) td.timeout  { background-color: #4a9ef2; }
+
 tr:nth-child(odd)  td.trap  { background-color: #111111; }
 tr:nth-child(even) td.trap  { background-color: #000000; }
 tr:nth-child(odd)  td.abort { background-color: #111111; }
-- 
1.9.0



More information about the Piglit mailing list