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.ba...@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 _______________________________________________ Piglit mailing list Piglit@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/piglit