@@ -54,22 +54,25 @@ def do_test(self):
54
54
runtimes .append (os .path .join (libspec .GetDirectory (), libspec .GetFilename ()))
55
55
self .registerSharedLibrariesWithTarget (target , runtimes )
56
56
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
64
67
68
+ self .assertEqual (
69
+ process .GetSelectedThread ().GetStopReason (),
70
+ lldb .eStopReasonInstrumentation )
71
+
65
72
# the stop reason of the thread should be a TSan report.
66
73
self .expect ("thread list" , "A Swift access race should be detected" ,
67
74
substrs = ['stopped' , 'stop reason = Swift access race detected' ])
68
75
69
- self .assertEqual (
70
- self .dbg .GetSelectedTarget ().process .GetSelectedThread ().GetStopReason (),
71
- lldb .eStopReasonInstrumentation )
72
-
73
76
self .expect (
74
77
"thread info -s" ,
75
78
"The extended stop info should contain the TSan provided fields" ,
0 commit comments