[Lldb-commits] [lldb] [lldb] Make libc++ simulator tests compatible with category-based ski… (PR #111353)

via lldb-commits lldb-commits at lists.llvm.org
Mon Oct 7 03:14:59 PDT 2024


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-lldb

Author: Pavel Labath (labath)

<details>
<summary>Changes</summary>

…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
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)

``````````

</details>


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


More information about the lldb-commits mailing list