Skip to content

Commit 6694ebd

Browse files
Merge pull request #8875 from adrian-prantl/103598293
Deflake test that relies on unreliable instrumentation
2 parents 6e13b8b + 827c482 commit 6694ebd

File tree

1 file changed

+14
-11
lines changed

1 file changed

+14
-11
lines changed

lldb/test/API/functionalities/tsan/swift-access-race/TestTsanSwiftAccessRace.py

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -54,22 +54,25 @@ def do_test(self):
5454
runtimes.append(os.path.join(libspec.GetDirectory(), libspec.GetFilename()))
5555
self.registerSharedLibrariesWithTarget(target, runtimes)
5656

57-
self.runCmd("run")
58-
59-
stop_reason = self.dbg.GetSelectedTarget().process.GetSelectedThread().GetStopReason()
60-
if stop_reason == lldb.eStopReasonExec:
61-
# On OS X 10.10 and older, we need to re-exec to enable
62-
# interceptors.
63-
self.runCmd("continue")
57+
# Unfortunatley the runtime itself isn't 100% reliable in reporting TSAN errors.
58+
process = None
59+
stop_reason = lldb.eStopReasonInvalid
60+
for retry in range(5):
61+
process = target.LaunchSimple(None, None, self.get_process_working_directory())
62+
if not process:
63+
continue
64+
stop_reason = process.GetSelectedThread().GetStopReason()
65+
if stop_reason == lldb.eStopReasonInstrumentation:
66+
break
6467

68+
self.assertEqual(
69+
process.GetSelectedThread().GetStopReason(),
70+
lldb.eStopReasonInstrumentation)
71+
6572
# the stop reason of the thread should be a TSan report.
6673
self.expect("thread list", "A Swift access race should be detected",
6774
substrs=['stopped', 'stop reason = Swift access race detected'])
6875

69-
self.assertEqual(
70-
self.dbg.GetSelectedTarget().process.GetSelectedThread().GetStopReason(),
71-
lldb.eStopReasonInstrumentation)
72-
7376
self.expect(
7477
"thread info -s",
7578
"The extended stop info should contain the TSan provided fields",

0 commit comments

Comments
 (0)