[Piglit] [PATCH 1/2] framework: If exiting a run, ensure that the status is readable
Dylan Baker
dylan at pnwbakers.com
Fri Sep 30 19:57:35 UTC 2016
This patch catches C-c, and any Exception while tests are running,
prints the status again with a newline, and then raises the exception.
This makes the output visible even when a stacktrace is printed.
Signed-off-by: Dylan Baker <dylanx.c.baker at intel.com>
---
framework/profile.py | 34 +++++++++++++++++++++-------------
1 file changed, 21 insertions(+), 13 deletions(-)
diff --git a/framework/profile.py b/framework/profile.py
index 34c1a3c..7b0cb07 100644
--- a/framework/profile.py
+++ b/framework/profile.py
@@ -350,19 +350,27 @@ class TestProfile(object):
single = multiprocessing.dummy.Pool(1)
multi = multiprocessing.dummy.Pool()
- if options.OPTIONS.concurrent == "all":
- run_threads(multi, six.iteritems(self.test_list))
- elif options.OPTIONS.concurrent == "none":
- run_threads(single, six.iteritems(self.test_list))
- else:
- # Filter and return only thread safe tests to the threaded pool
- run_threads(multi, (x for x in six.iteritems(self.test_list)
- if x[1].run_concurrent))
- # Filter and return the non thread safe tests to the single pool
- run_threads(single, (x for x in six.iteritems(self.test_list)
- if not x[1].run_concurrent))
-
- log.get().summary()
+ try:
+ if options.OPTIONS.concurrent == "all":
+ run_threads(multi, six.iteritems(self.test_list))
+ elif options.OPTIONS.concurrent == "none":
+ run_threads(single, six.iteritems(self.test_list))
+ else:
+ # Filter and return only thread safe tests to the threaded pool
+ run_threads(multi, (x for x in six.iteritems(self.test_list)
+ if x[1].run_concurrent))
+ # Filter and return the non thread safe tests to the single
+ # pool
+ run_threads(single, (x for x in six.iteritems(self.test_list)
+ if not x[1].run_concurrent))
+
+ log.get().summary()
+ except (KeyboardInterrupt, Exception):
+ # In the event that C-c is pressed, or any sort of exception would
+ # generate a stacktrace, print the status line so that it's clear,
+ # then die. Pressing C-c again will kill immediately.
+ log.get().summary()
+ raise
self._post_run_hook()
--
2.10.0
More information about the Piglit
mailing list