Bug 1081970 - Gracefully handle interrupts when running test suite. r=dburns

--HG--
extra : commitid : 9JQBIHQNMoV
extra : rebase_source : 9db8ccab407a78095fb67ee61e574d301364d416
This commit is contained in:
Julien Pagès 2015-07-17 23:00:26 +02:00
Родитель 1b995b9a16
Коммит 7a736df66f
1 изменённых файлов: 25 добавлений и 7 удалений

Просмотреть файл

@ -808,6 +808,8 @@ setReq.onerror = function() {
message=test['disabled'])
self.todo += 1
interrupted = None
try:
counter = self.repeat
while counter >=0:
round = self.repeat - counter
@ -815,7 +817,23 @@ setReq.onerror = function() {
self.logger.info('\nREPEAT %d\n-------' % round)
self.run_test_sets()
counter -= 1
except KeyboardInterrupt:
# in case of KeyboardInterrupt during the test execution
# we want to display current test results.
# so we keep the exception to raise it later.
interrupted = sys.exc_info()
try:
self._print_summary(tests)
except:
# raise only the exception if we were not interrupted
if not interrupted:
raise
finally:
# reraise previous interruption now
if interrupted:
raise interrupted[0], interrupted[1], interrupted[2]
def _print_summary(self, tests):
self.logger.info('\nSUMMARY\n-------')
self.logger.info('passed: %d' % self.passed)
if self.unexpected_successes == 0: