Run teardown and setup before retry for expectedFlakey tests

Summary:
If test is decorated with expectedFlakey*, run teardown and setup before retry
Don't run retry if the test is already decorated with xfail or skip

Test Plan:
Mark TestMultithreaded.test_sb_api_listener_event_process_state as expectedFlakey
Run ./dotest.py -p TestMultithreaded.py -A x86_64 -C gcc4.9.2

Reviewers: vharron, tberghammer

Subscribers: lldb-commits

Differential Revision: http://reviews.llvm.org/D10830

llvm-svn: 241202
This commit is contained in:
Ying Chen 2015-07-01 22:44:27 +00:00
parent 84f9042fae
commit 0a7202bb5d
1 changed files with 6 additions and 1 deletions

View File

@ -723,10 +723,15 @@ def expectedFlakey(expected_fn, bugnumber=None):
self = args[0]
try:
func(*args, **kwargs)
# don't retry if the test case is already decorated with xfail or skip
except (case._ExpectedFailure, case.SkipTest, case._UnexpectedSuccess):
raise
except Exception:
if expected_fn(self):
# retry
# before retry, run tearDown for previous run and setup for next
try:
self.tearDown()
self.setUp()
func(*args, **kwargs)
except Exception:
# oh snap! two failures in a row, record a failure/error