Skip to content

Commit 2aed0d9

Browse files
authored
[lldb][test] Fix LibCxxInternalsRecognizerTestCase on clang <= 17 (#114122)
We had to disable the tests for libc++ <= 15 because the `std::ranges` functions were not available, yet. Also, on libc++17 there was still an additional `__fn` struct withing `ranges::__sort`. The test expectation was updated to use a regular expression, so we can match both the old and the new name. See https://green.lab.llvm.org/job/llvm.org/view/LLDB/job/lldb-cmake-matrix/912/execution/node/107/log/
1 parent c7ef002 commit 2aed0d9

File tree

1 file changed

+11
-4
lines changed

1 file changed

+11
-4
lines changed

lldb/test/API/lang/cpp/libcxx-internals-recognizer/TestLibcxxInternalsRecognizer.py

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,13 @@
33
from lldbsuite.test.lldbtest import *
44
from lldbsuite.test import lldbutil
55

6+
import re
67

78
class LibCxxInternalsRecognizerTestCase(TestBase):
89
NO_DEBUG_INFO_TESTCASE = True
910

1011
@add_test_categories(["libc++"])
12+
@skipIf(compiler="clang", compiler_version=["<", "16.0"])
1113
def test_frame_recognizer(self):
1214
"""Test that implementation details of libc++ are hidden"""
1315
self.build()
@@ -21,7 +23,7 @@ def test_frame_recognizer(self):
2123
# We never hide the frame of the entry-point into the standard library, even
2224
# if the name starts with `__` which usually indicates an internal function.
2325
"ranges_sort_less(int, int)": [
24-
"ranges::__sort::operator()",
26+
re.compile("ranges::__sort::(__fn::)?operator\(\)"),
2527
"test_algorithms",
2628
],
2729
# `ranges::views::transform` internally uses `std::invoke`, and that
@@ -57,9 +59,14 @@ def test_frame_recognizer(self):
5759
):
5860
frame_id = frame_id + 1
5961
# Expect the correct parent frame
60-
self.assertIn(
61-
expected_parent, thread.GetFrameAtIndex(frame_id).GetFunctionName()
62-
)
62+
func_name = thread.GetFrameAtIndex(frame_id).GetFunctionName()
63+
if isinstance(expected_parent, re.Pattern):
64+
self.assertTrue(
65+
expected_parent.search(func_name) is not None,
66+
f"'{expected_parent}' not found in '{func_name}'"
67+
)
68+
else:
69+
self.assertIn(expected_parent, func_name)
6370
frame_id = frame_id + 1
6471
process.Continue()
6572

0 commit comments

Comments
 (0)