2 Test ThreadSanitizer when multiple different issues are found.
6 from lldbsuite
.test
.lldbtest
import *
7 from lldbsuite
.test
.decorators
import *
8 import lldbsuite
.test
.lldbutil
as lldbutil
12 class TsanMultipleTestCase(TestBase
):
15 bugnumber
="non-core functionality, need to reenable and fix later (DES 2014.11.07)",
17 @expectedFailureNetBSD
18 @skipIfFreeBSD # llvm.org/pr21136 runtimes not yet available by default
20 @skipUnlessThreadSanitizer
21 @add_test_categories(["objc"])
27 exe
= self
.getBuildArtifact("a.out")
28 self
.expect("file " + exe
, patterns
=["Current executable set to .*a.out"])
30 self
.runCmd("env TSAN_OPTIONS=abort_on_error=0")
35 self
.dbg
.GetSelectedTarget().process
.GetSelectedThread().GetStopReason()
37 if stop_reason
== lldb
.eStopReasonExec
:
38 # On OS X 10.10 and older, we need to re-exec to enable
40 self
.runCmd("continue")
44 self
.dbg
.GetSelectedTarget().process
.GetSelectedThread().GetStopReason()
45 == lldb
.eStopReasonInstrumentation
50 self
.dbg
.GetSelectedTarget()
51 .process
.GetSelectedThread()
52 .GetStopDescription(100)
56 (stop_description
== "Data race detected")
57 or (stop_description
== "Use of deallocated memory detected")
58 or (stop_description
== "Thread leak detected")
61 == "Use of an uninitialized or destroyed mutex detected"
65 == "Unlock of an unlocked mutex (or by a wrong thread) detected"
71 "The extended stop info should contain the TSan provided fields",
72 substrs
=["instrumentation_class", "description", "mops"],
75 output_lines
= self
.res
.GetOutput().split("\n")
76 json_line
= "\n".join(output_lines
[2:])
77 data
= json
.loads(json_line
)
78 self
.assertEqual(data
["instrumentation_class"], "ThreadSanitizer")
81 self
.dbg
.GetSelectedTarget()
82 .process
.GetSelectedThread()
83 .GetStopReasonExtendedBacktraces(
84 lldb
.eInstrumentationRuntimeTypeThreadSanitizer
87 self
.assertTrue(backtraces
.GetSize() >= 1)
89 self
.runCmd("continue")
92 self
.dbg
.GetSelectedTarget().process
.GetState(),