Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 5326b3b

Browse files
committed
[lldb][test] Only assert function name is in user-code on Darwin platforms
The frame recognizer for the instrumentation runtimes (added in #133079) only triggers on Darwin for `libclang_rt`. Adjust the tests accordingly.
1 parent 7dd63e1 commit 5326b3b

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
@@ -94,9 +94,10 @@ def libsanitizers_asan_tests(self):
9494
)
9595
self.check_traces()
9696

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

101102
# do the same using SB API
102103
process = self.dbg.GetSelectedTarget().process
@@ -222,9 +223,10 @@ def compiler_rt_asan_tests(self):
222223

223224
self.check_traces()
224225

225-
# Make sure we're not stopped in the sanitizer library but instead at the
226-
# point of failure in the user-code.
227-
self.assertEqual(self.frame().GetFunctionName(), "main")
226+
if self.platformIsDarwin():
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")
228230

229231
# make sure the 'memory history' command still works even when we're
230232
# 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)