Skip to content

Deflake test that relies on unreliable instrumentation #8875

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 13, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -54,22 +54,25 @@ def do_test(self):
runtimes.append(os.path.join(libspec.GetDirectory(), libspec.GetFilename()))
self.registerSharedLibrariesWithTarget(target, runtimes)

self.runCmd("run")

stop_reason = self.dbg.GetSelectedTarget().process.GetSelectedThread().GetStopReason()
if stop_reason == lldb.eStopReasonExec:
# On OS X 10.10 and older, we need to re-exec to enable
# interceptors.
self.runCmd("continue")
# Unfortunatley the runtime itself isn't 100% reliable in reporting TSAN errors.
process = None
stop_reason = lldb.eStopReasonInvalid
for retry in range(5):

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: make this a constant RETRY_COUNT or something.

process = target.LaunchSimple(None, None, self.get_process_working_directory())

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't understand how not being reliable in reporting TSAN errors would cause target.LaunchSimple to fail to produce a process. I would have expected the process to run to completion and then you have a process in eStateExited. What's actually happening here?

if not process:
continue
stop_reason = process.GetSelectedThread().GetStopReason()
if stop_reason == lldb.eStopReasonInstrumentation:
break

self.assertEqual(
process.GetSelectedThread().GetStopReason(),
lldb.eStopReasonInstrumentation)

# the stop reason of the thread should be a TSan report.
self.expect("thread list", "A Swift access race should be detected",
substrs=['stopped', 'stop reason = Swift access race detected'])

self.assertEqual(
self.dbg.GetSelectedTarget().process.GetSelectedThread().GetStopReason(),
lldb.eStopReasonInstrumentation)

self.expect(
"thread info -s",
"The extended stop info should contain the TSan provided fields",
Expand Down