Skip to content

Commit 0f520c0

Browse files
authored
Merge pull request #11990 from swiftlang/revert-11351-improved-logging-lldb-testTsanSwiftAccessRace
Revert "[lldb] Add extra verbose logging to flaky TestTsanSwiftAccessRace.py "
2 parents 36e0771 + 149c980 commit 0f520c0

File tree

1 file changed

+16
-33
lines changed

1 file changed

+16
-33
lines changed

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

Lines changed: 16 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ class TsanSwiftAccessRaceTestCase(lldbtest.TestBase):
2828
@swiftTest
2929
@skipIfLinux
3030
@skipUnlessSwiftThreadSanitizer
31-
@skipIfAsan # This test does not behave reliable with an ASANified LLDB.
31+
@skipIfAsan # This test does not behave reliable with an ASANified LLDB.
3232
def test_tsan_swift(self):
3333
self.build()
3434
self.do_test()
@@ -50,15 +50,9 @@ def do_test(self):
5050
for m in target.module_iter():
5151
libspec = m.GetFileSpec()
5252
if "clang_rt" in libspec.GetFilename():
53-
runtimes.append(
54-
os.path.join(libspec.GetDirectory(), libspec.GetFilename())
55-
)
53+
runtimes.append(os.path.join(libspec.GetDirectory(), libspec.GetFilename()))
5654
self.registerSharedLibrariesWithTarget(target, runtimes)
5755

58-
# Enable verbose logging to help diagnose rdar://153220781
59-
self.runCmd("log enable lldb break platform process target thread")
60-
self.addTearDownHook(lambda: self.runCmd("log disable gdb-remote packets"))
61-
6256
# Unfortunately the runtime itself isn't 100% reliable in reporting TSAN errors.
6357
failure_reasons = []
6458
stop_reason = None
@@ -68,47 +62,36 @@ def do_test(self):
6862
info.SetWorkingDirectory(self.get_process_working_directory())
6963
process = target.Launch(info, error)
7064
if not error.success:
71-
failure_reasons.append(
72-
f"Failed to bring up process, error: {error.value}"
73-
)
65+
failure_reasons.append(f"Failed to bring up process, error: {error.value}")
7466
continue
7567

7668
stop_reason = process.GetSelectedThread().GetStopReason()
7769
if stop_reason == lldb.eStopReasonInstrumentation:
7870
break
79-
80-
thread = process.GetSelectedThread()
81-
stop_reason_data = [
82-
thread.GetStopReasonDataAtIndex(index)
83-
for index in range(thread.GetStopReasonDataCount())
84-
]
85-
failure_reasons.append(
86-
f"Invalid stop_reason: {stop_reason}, stop_reason_data: {stop_reason_data}"
87-
)
71+
failure_reasons.append(f"Invalid stop_reason: {stop_reason}")
8872

8973
self.assertEqual(
90-
stop_reason,
74+
stop_reason,
9175
lldb.eStopReasonInstrumentation,
92-
f"Failed with {len(failure_reasons)} attempts with reasons: {failure_reasons}",
93-
)
94-
76+
f"Failed with {len(failure_reasons)} attempts with reasons: {failure_reasons}")
77+
9578
# the stop reason of the thread should be a TSan report.
96-
self.expect(
97-
"thread list",
98-
"A Swift access race should be detected",
99-
substrs=["stopped", "stop reason = Swift access race detected"],
100-
)
79+
self.expect("thread list", "A Swift access race should be detected",
80+
substrs=['stopped', 'stop reason = Swift access race detected'])
10181

10282
self.expect(
10383
"thread info -s",
10484
"The extended stop info should contain the TSan provided fields",
105-
substrs=["instrumentation_class", "description", "mops"],
106-
)
85+
substrs=[
86+
"instrumentation_class",
87+
"description",
88+
"mops"])
10789

108-
output_lines = self.res.GetOutput().split("\n")
109-
json_line = "\n".join(output_lines[2:])
90+
output_lines = self.res.GetOutput().split('\n')
91+
json_line = '\n'.join(output_lines[2:])
11092
data = json.loads(json_line)
11193
self.assertEqual(data["instrumentation_class"], "ThreadSanitizer")
11294
self.assertEqual(data["issue_type"], "external-race")
11395
self.assertEqual(len(data["mops"]), 2)
11496
self.assertTrue(data["location_filename"].endswith("/main.swift"))
97+

0 commit comments

Comments
 (0)