Skip to content

Commit 2c8cb31

Browse files
Michael137tstellar
authored andcommitted
[lldb][test] Only assert function name is in user-code on Darwin platforms
The frame recognizer for the instrumentation runtimes (added in llvm#133079) only triggers on Darwin for `libclang_rt`. Adjust the tests accordingly. (cherry picked from commit 5326b3b)
1 parent f5ba883 commit 2c8cb31

File tree

4 files changed

+24
-15
lines changed

4 files changed

+24
-15
lines changed

lldb/test/API/functionalities/asan/TestMemoryHistory.py

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,14 @@
22
Test that ASan memory history provider returns correct stack traces
33
"""
44

5-
65
import lldb
76
from lldbsuite.test.decorators import *
87
from lldbsuite.test.lldbtest import *
98
from lldbsuite.test import lldbplatform
109
from lldbsuite.test import lldbutil
1110
from lldbsuite.test_event.build_exception import BuildError
1211

12+
1313
class MemoryHistoryTestCase(TestBase):
1414
@skipIfFreeBSD # llvm.org/pr21136 runtimes not yet available by default
1515
@expectedFailureNetBSD
@@ -96,9 +96,10 @@ def libsanitizers_asan_tests(self):
9696
)
9797
self.check_traces(skip_line_numbers=True)
9898

99-
# Make sure we're not stopped in the sanitizer library but instead at the
100-
# point of failure in the user-code.
101-
self.assertEqual(self.frame().GetFunctionName(), "main")
99+
if self.platformIsDarwin():
100+
# Make sure we're not stopped in the sanitizer library but instead at the
101+
# point of failure in the user-code.
102+
self.assertEqual(self.frame().GetFunctionName(), "main")
102103

103104
# do the same using SB API
104105
process = self.dbg.GetSelectedTarget().process
@@ -224,9 +225,10 @@ def compiler_rt_asan_tests(self):
224225

225226
self.check_traces()
226227

227-
# Make sure we're not stopped in the sanitizer library but instead at the
228-
# point of failure in the user-code.
229-
self.assertEqual(self.frame().GetFunctionName(), "main")
228+
if self.platformIsDarwin():
229+
# Make sure we're not stopped in the sanitizer library but instead at the
230+
# point of failure in the user-code.
231+
self.assertEqual(self.frame().GetFunctionName(), "main")
230232

231233
# make sure the 'memory history' command still works even when we're
232234
# generating a report now

lldb/test/API/functionalities/asan/TestReportData.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,14 @@
22
Test the AddressSanitizer runtime support for report breakpoint and data extraction.
33
"""
44

5-
65
import json
76
import lldb
87
from lldbsuite.test.decorators import *
98
from lldbsuite.test.lldbtest import *
109
from lldbsuite.test import lldbutil
1110
from lldbsuite.test_event.build_exception import BuildError
1211

12+
1313
class AsanTestReportDataCase(TestBase):
1414
@skipIfFreeBSD # llvm.org/pr21136 runtimes not yet available by default
1515
@expectedFailureNetBSD
@@ -67,9 +67,10 @@ def asan_tests(self, libsanitizers=False):
6767
lldb.eStopReasonInstrumentation,
6868
)
6969

70-
# Make sure we're not stopped in the sanitizer library but instead at the
71-
# point of failure in the user-code.
72-
self.assertEqual(self.frame().GetFunctionName(), "main")
70+
if self.platformIsDarwin():
71+
# Make sure we're not stopped in the sanitizer library but instead at the
72+
# point of failure in the user-code.
73+
self.assertEqual(self.frame().GetFunctionName(), "main")
7374

7475
self.expect(
7576
"bt",

lldb/test/API/functionalities/tsan/basic/TestTsanBasic.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,11 +63,14 @@ def tsan_tests(self):
6363
substrs=["1 match found"],
6464
)
6565

66-
# We should not be stopped in the sanitizer library.
6766
process = self.dbg.GetSelectedTarget().process
6867
thread = process.GetSelectedThread()
6968
frame = thread.GetSelectedFrame()
70-
self.assertIn("f2", frame.GetFunctionName())
69+
if self.platformIsDarwin():
70+
# We should not be stopped in the sanitizer library.
71+
self.assertIn("f2", frame.GetFunctionName())
72+
else:
73+
self.assertIn("__tsan_on_report", frame.GetFunctionName())
7174

7275
# The stopped thread backtrace should contain either line1 or line2
7376
# from main.c.

lldb/test/API/functionalities/ubsan/basic/TestUbsanBasic.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,11 @@ def ubsan_tests(self):
5252
substrs=["1 match found"],
5353
)
5454

55-
# We should not be stopped in the sanitizer library.
56-
self.assertIn("main", frame.GetFunctionName())
55+
if self.platformIsDarwin():
56+
# We should not be stopped in the sanitizer library.
57+
self.assertIn("main", frame.GetFunctionName())
58+
else:
59+
self.assertIn("__ubsan_on_report", frame.GetFunctionName())
5760

5861
# The stopped thread backtrace should contain either 'align line'
5962
found = False

0 commit comments

Comments
 (0)