[Lldb-commits] [lldb] 2aed0d9 - [lldb][test] Fix `LibCxxInternalsRecognizerTestCase` on clang <= 17 (#114122)

via lldb-commits lldb-commits at lists.llvm.org
Thu Oct 31 09:01:52 PDT 2024


Author: Adrian Vogelsgesang
Date: 2024-10-31T09:01:46-07:00
New Revision: 2aed0d9cd3fc8f3c600d59b8b10d10a4466e50c6

URL: https://github.com/llvm/llvm-project/commit/2aed0d9cd3fc8f3c600d59b8b10d10a4466e50c6
DIFF: https://github.com/llvm/llvm-project/commit/2aed0d9cd3fc8f3c600d59b8b10d10a4466e50c6.diff

LOG: [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/

Added: 
    

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

Removed: 
    


################################################################################
diff  --git a/lldb/test/API/lang/cpp/libcxx-internals-recognizer/TestLibcxxInternalsRecognizer.py b/lldb/test/API/lang/cpp/libcxx-internals-recognizer/TestLibcxxInternalsRecognizer.py
index ad48208f21e502..5cc43f3cd9910c 100644
--- a/lldb/test/API/lang/cpp/libcxx-internals-recognizer/TestLibcxxInternalsRecognizer.py
+++ b/lldb/test/API/lang/cpp/libcxx-internals-recognizer/TestLibcxxInternalsRecognizer.py
@@ -3,11 +3,13 @@
 from lldbsuite.test.lldbtest import *
 from lldbsuite.test import lldbutil
 
+import re
 
 class LibCxxInternalsRecognizerTestCase(TestBase):
     NO_DEBUG_INFO_TESTCASE = True
 
     @add_test_categories(["libc++"])
+    @skipIf(compiler="clang", compiler_version=["<", "16.0"])
     def test_frame_recognizer(self):
         """Test that implementation details of libc++ are hidden"""
         self.build()
@@ -21,7 +23,7 @@ def test_frame_recognizer(self):
             # We never hide the frame of the entry-point into the standard library, even
             # if the name starts with `__` which usually indicates an internal function.
             "ranges_sort_less(int, int)": [
-                "ranges::__sort::operator()",
+                re.compile("ranges::__sort::(__fn::)?operator\(\)"),
                 "test_algorithms",
             ],
             # `ranges::views::transform` internally uses `std::invoke`, and that
@@ -57,9 +59,14 @@ def test_frame_recognizer(self):
                 ):
                     frame_id = frame_id + 1
                 # Expect the correct parent frame
-                self.assertIn(
-                    expected_parent, thread.GetFrameAtIndex(frame_id).GetFunctionName()
-                )
+                func_name = thread.GetFrameAtIndex(frame_id).GetFunctionName()
+                if isinstance(expected_parent, re.Pattern):
+                    self.assertTrue(
+                        expected_parent.search(func_name) is not None,
+                        f"'{expected_parent}' not found in '{func_name}'"
+                    )
+                else:
+                    self.assertIn(expected_parent, func_name)
                 frame_id = frame_id + 1
             process.Continue()
 


        


More information about the lldb-commits mailing list