Skip to content

[lldb] Make libc++ simulator tests compatible with category-based ski… #111353

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
Oct 7, 2024

Conversation

labath
Copy link
Collaborator

@labath labath commented Oct 7, 2024

…pping, which works by setting a field on the function object. This doesn't work on a functools.partial object. Use a real function instead.

…pping

.. which works by setting a field on the function object. This doesn't
work on a functools.partial object. Use a real function instead.
@labath labath requested a review from Michael137 October 7, 2024 10:14
@labath labath requested a review from JDevlieghere as a code owner October 7, 2024 10:14
@llvmbot llvmbot added the lldb label Oct 7, 2024
@llvmbot
Copy link
Member

llvmbot commented Oct 7, 2024

@llvm/pr-subscribers-lldb

Author: Pavel Labath (labath)

Changes

…pping, which works by setting a field on the function object. This doesn't work on a functools.partial object. Use a real function instead.


Full diff: https://github.com/llvm/llvm-project/pull/111353.diff

3 Files Affected:

  • (modified) lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx-simulators/optional/TestDataFormatterLibcxxOptionalSimulator.py (+6-4)
  • (modified) lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx-simulators/string/TestDataFormatterLibcxxStringSimulator.py (+6-4)
  • (modified) lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx-simulators/unique_ptr/TestDataFormatterLibcxxUniquePtrSimulator.py (+6-4)
diff --git a/lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx-simulators/optional/TestDataFormatterLibcxxOptionalSimulator.py b/lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx-simulators/optional/TestDataFormatterLibcxxOptionalSimulator.py
index 20822c4deada0f..7167f4c6c9b5b1 100644
--- a/lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx-simulators/optional/TestDataFormatterLibcxxOptionalSimulator.py
+++ b/lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx-simulators/optional/TestDataFormatterLibcxxOptionalSimulator.py
@@ -46,7 +46,9 @@ def _run_test(self, defines):
 for r in range(2):
     name = f"test_r{r}"
     defines = [f"REVISION={r}"]
-    f = functools.partialmethod(
-        LibcxxOptionalDataFormatterSimulatorTestCase._run_test, defines
-    )
-    setattr(LibcxxOptionalDataFormatterSimulatorTestCase, name, f)
+
+    @functools.wraps(LibcxxOptionalDataFormatterSimulatorTestCase._run_test)
+    def test_method(self, defines=defines):
+        LibcxxOptionalDataFormatterSimulatorTestCase._run_test(self, defines)
+
+    setattr(LibcxxOptionalDataFormatterSimulatorTestCase, name, test_method)
diff --git a/lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx-simulators/string/TestDataFormatterLibcxxStringSimulator.py b/lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx-simulators/string/TestDataFormatterLibcxxStringSimulator.py
index fff181440b6d7c..c996fff4fb7aab 100644
--- a/lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx-simulators/string/TestDataFormatterLibcxxStringSimulator.py
+++ b/lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx-simulators/string/TestDataFormatterLibcxxStringSimulator.py
@@ -34,7 +34,9 @@ def _run_test(self, defines):
             if v:
                 name += "_" + v
                 defines += [v]
-            f = functools.partialmethod(
-                LibcxxStringDataFormatterSimulatorTestCase._run_test, defines
-            )
-            setattr(LibcxxStringDataFormatterSimulatorTestCase, name, f)
+
+            @functools.wraps(LibcxxStringDataFormatterSimulatorTestCase._run_test)
+            def test_method(self, defines=defines):
+                LibcxxStringDataFormatterSimulatorTestCase._run_test(self, defines)
+
+            setattr(LibcxxStringDataFormatterSimulatorTestCase, name, test_method)
diff --git a/lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx-simulators/unique_ptr/TestDataFormatterLibcxxUniquePtrSimulator.py b/lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx-simulators/unique_ptr/TestDataFormatterLibcxxUniquePtrSimulator.py
index 0026eca8eebeae..4ee97e10de84cd 100644
--- a/lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx-simulators/unique_ptr/TestDataFormatterLibcxxUniquePtrSimulator.py
+++ b/lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx-simulators/unique_ptr/TestDataFormatterLibcxxUniquePtrSimulator.py
@@ -29,7 +29,9 @@ def _run_test(self, defines):
 for r in range(3):
     name = "test_r%d" % r
     defines = ["COMPRESSED_PAIR_REV=%d" % r]
-    f = functools.partialmethod(
-        LibcxxUniquePtrDataFormatterSimulatorTestCase._run_test, defines
-    )
-    setattr(LibcxxUniquePtrDataFormatterSimulatorTestCase, name, f)
+
+    @functools.wraps(LibcxxUniquePtrDataFormatterSimulatorTestCase._run_test)
+    def test_method(self, defines=defines):
+        LibcxxUniquePtrDataFormatterSimulatorTestCase._run_test(self, defines)
+
+    setattr(LibcxxUniquePtrDataFormatterSimulatorTestCase, name, test_method)

Copy link
Member

@Michael137 Michael137 left a comment

Choose a reason for hiding this comment

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

Nice! thanks!

@labath labath merged commit 0e2970f into llvm:main Oct 7, 2024
10 checks passed
@labath labath deleted the cat branch October 7, 2024 18:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants