[Lldb-commits] [lldb] 3d7e6db - [lldb][test] Remove `reason` from `unittest2.expectedFailure` usage (#73028)

via lldb-commits lldb-commits at lists.llvm.org
Tue Nov 28 21:36:10 PST 2023


Author: Jordan Rupprecht
Date: 2023-11-28T23:36:05-06:00
New Revision: 3d7e6db12072c26c7ad42c2c473d1dc321725db4

URL: https://github.com/llvm/llvm-project/commit/3d7e6db12072c26c7ad42c2c473d1dc321725db4
DIFF: https://github.com/llvm/llvm-project/commit/3d7e6db12072c26c7ad42c2c473d1dc321725db4.diff

LOG: [lldb][test] Remove `reason` from `unittest2.expectedFailure` usage (#73028)

Added: 
    

Modified: 
    lldb/packages/Python/lldbsuite/test/decorators.py
    lldb/test/API/commands/expression/test/TestExprs.py
    lldb/test/API/functionalities/jitloader_gdb/TestJITLoaderGDB.py
    lldb/test/API/functionalities/thread/state/TestThreadStates.py
    lldb/test/API/lang/c/shared_lib/TestSharedLib.py
    lldb/test/API/lang/c/shared_lib_stripped_symbols/TestSharedLibStrippedSymbols.py
    lldb/test/API/lang/cpp/namespace/TestNamespaceLookup.py
    lldb/test/API/lang/cpp/reference-to-outer-type/TestCppReferenceToOuterClass.py
    lldb/test/API/lang/objc/hidden-ivars/TestHiddenIvars.py

Removed: 
    


################################################################################
diff  --git a/lldb/packages/Python/lldbsuite/test/decorators.py b/lldb/packages/Python/lldbsuite/test/decorators.py
index bb06a5ee20f2532..a4cee1f5761625a 100644
--- a/lldb/packages/Python/lldbsuite/test/decorators.py
+++ b/lldb/packages/Python/lldbsuite/test/decorators.py
@@ -113,10 +113,6 @@ def _compiler_supports(
     return True
 
 
-def expectedFailure(func):
-    return unittest2.expectedFailure(func)
-
-
 def expectedFailureIfFn(expected_fn, bugnumber=None):
     def expectedFailure_impl(func):
         if isinstance(func, type) and issubclass(func, unittest2.TestCase):

diff  --git a/lldb/test/API/commands/expression/test/TestExprs.py b/lldb/test/API/commands/expression/test/TestExprs.py
index 76a5e9efebb1866..e95c76b7104c2a9 100644
--- a/lldb/test/API/commands/expression/test/TestExprs.py
+++ b/lldb/test/API/commands/expression/test/TestExprs.py
@@ -12,6 +12,7 @@
 """
 
 
+import unittest2
 import lldb
 from lldbsuite.test.decorators import *
 from lldbsuite.test.lldbtest import *
@@ -43,9 +44,9 @@ def build_and_run(self):
 
         self.runCmd("run", RUN_SUCCEEDED)
 
-    @expectedFailure(
-        "llvm.org/pr17135 <rdar://problem/14874559> APFloat::toString does not identify the correct (i.e. least) precision."
-    )
+    # llvm.org/pr17135 <rdar://problem/14874559>
+    # APFloat::toString does not identify the correct (i.e. least) precision.
+    @unittest2.expectedFailure
     def test_floating_point_expr_commands(self):
         self.build_and_run()
 

diff  --git a/lldb/test/API/functionalities/jitloader_gdb/TestJITLoaderGDB.py b/lldb/test/API/functionalities/jitloader_gdb/TestJITLoaderGDB.py
index e93f566ea7ea63c..a07421524478744 100644
--- a/lldb/test/API/functionalities/jitloader_gdb/TestJITLoaderGDB.py
+++ b/lldb/test/API/functionalities/jitloader_gdb/TestJITLoaderGDB.py
@@ -1,6 +1,7 @@
 """Test for the JITLoaderGDB interface"""
 
 
+import unittest2
 import os
 import lldb
 from lldbsuite.test import lldbutil
@@ -13,7 +14,7 @@ class JITLoaderGDBTestCase(TestBase):
         lambda: "Skipped because the test crashes the test runner",
         bugnumber="llvm.org/pr24702",
     )
-    @expectedFailure("llvm.org/pr24702")
+    @unittest2.expectedFailure  # llvm.org/pr24702
     def test_bogus_values(self):
         """Test that we handle inferior misusing the GDB JIT interface"""
         self.build()

diff  --git a/lldb/test/API/functionalities/thread/state/TestThreadStates.py b/lldb/test/API/functionalities/thread/state/TestThreadStates.py
index ad1edff6ae3f354..e128ca84977b411 100644
--- a/lldb/test/API/functionalities/thread/state/TestThreadStates.py
+++ b/lldb/test/API/functionalities/thread/state/TestThreadStates.py
@@ -3,6 +3,7 @@
 """
 
 
+import unittest2
 import lldb
 from lldbsuite.test.decorators import *
 from lldbsuite.test.lldbtest import *
@@ -40,14 +41,14 @@ def test_state_after_continue(self):
     @expectedFailureAll(oslist=["windows"], bugnumber="llvm.org/pr24660")
     @expectedFailureNetBSD
     # thread states not properly maintained
-    @expectedFailure("llvm.org/pr16712")
+    @unittest2.expectedFailure  # llvm.org/pr16712
     def test_state_after_expression(self):
         """Test thread state after expression."""
         self.build()
         self.thread_state_after_expression_test()
 
     # thread states not properly maintained
-    @expectedFailure("llvm.org/pr15824 and <rdar://problem/28557237>")
+    @unittest2.expectedFailure  # llvm.org/pr15824 and <rdar://problem/28557237>
     @expectedFailureAll(
         oslist=["windows"],
         bugnumber="llvm.org/pr24668: Breakpoints not resolved correctly",

diff  --git a/lldb/test/API/lang/c/shared_lib/TestSharedLib.py b/lldb/test/API/lang/c/shared_lib/TestSharedLib.py
index b375aa6a86e14fb..235b9b4ce3442df 100644
--- a/lldb/test/API/lang/c/shared_lib/TestSharedLib.py
+++ b/lldb/test/API/lang/c/shared_lib/TestSharedLib.py
@@ -1,6 +1,7 @@
 """Test that types defined in shared libraries work correctly."""
 
 
+import unittest2
 import lldb
 from lldbsuite.test.decorators import *
 from lldbsuite.test.lldbtest import *
@@ -34,7 +35,7 @@ def test_expr_no_preload(self):
         """Test that types work when defined in a shared library and forward-declared in the main executable, but with preloading disabled"""
         self.common_test_expr(False)
 
-    @expectedFailure("llvm.org/PR36712")
+    @unittest2.expectedFailure  # llvm.org/PR36712
     def test_frame_variable(self):
         """Test that types work when defined in a shared library and forward-declared in the main executable"""
         self.build()

diff  --git a/lldb/test/API/lang/c/shared_lib_stripped_symbols/TestSharedLibStrippedSymbols.py b/lldb/test/API/lang/c/shared_lib_stripped_symbols/TestSharedLibStrippedSymbols.py
index f7035edddaf09b8..070bd88d8db942c 100644
--- a/lldb/test/API/lang/c/shared_lib_stripped_symbols/TestSharedLibStrippedSymbols.py
+++ b/lldb/test/API/lang/c/shared_lib_stripped_symbols/TestSharedLibStrippedSymbols.py
@@ -1,6 +1,7 @@
 """Test that types defined in shared libraries with stripped symbols work correctly."""
 
 
+import unittest2
 import lldb
 from lldbsuite.test.decorators import *
 from lldbsuite.test.lldbtest import *
@@ -27,7 +28,7 @@ def test_expr(self):
         )
 
     @expectedFailureAll(oslist=["windows"])
-    @expectedFailure("llvm.org/PR36712")
+    @unittest2.expectedFailure  # llvm.org/PR36712
     def test_frame_variable(self):
         """Test that types work when defined in a shared library and forward-declared in the main executable"""
         self.build()

diff  --git a/lldb/test/API/lang/cpp/namespace/TestNamespaceLookup.py b/lldb/test/API/lang/cpp/namespace/TestNamespaceLookup.py
index f88667b9dfa2ae9..44cfbd2df5f346e 100644
--- a/lldb/test/API/lang/cpp/namespace/TestNamespaceLookup.py
+++ b/lldb/test/API/lang/cpp/namespace/TestNamespaceLookup.py
@@ -3,6 +3,7 @@
 """
 
 
+import unittest2
 import lldb
 from lldbsuite.test.decorators import *
 from lldbsuite.test.lldbtest import *
@@ -40,7 +41,7 @@ def runToBkpt(self, command):
         )
 
     @skipIfWindows  # This is flakey on Windows: llvm.org/pr38373
-    @expectedFailure("CU-local objects incorrectly scoped")
+    @unittest2.expectedFailure  # CU-local objects incorrectly scoped
     def test_scope_lookup_with_run_command_globals(self):
         """Test scope lookup of functions in lldb."""
         self.build()
@@ -210,7 +211,7 @@ def test_scope_lookup_with_run_command(self):
         # Evaluate B::func() - should call B::func()
         self.expect_expr("B::func()", result_type="int", result_value="4")
 
-    @expectedFailure("lldb scope lookup of functions bugs")
+    @unittest2.expectedFailure  # lldb scope lookup of functions bugs
     def test_function_scope_lookup_with_run_command(self):
         """Test scope lookup of functions in lldb."""
         self.build()
@@ -271,7 +272,7 @@ def test_scope_after_using_directive_lookup_with_run_command(self):
         # Evaluate func2() - should call A::func2()
         self.expect_expr("func2()", result_type="int", result_value="3")
 
-    @expectedFailure("lldb scope lookup after using declaration bugs")
+    @unittest2.expectedFailure  # lldb scope lookup after using declaration bugs
     # NOTE: this test may fail on older systems that don't emit import
     # emtries in DWARF - may need to add checks for compiler versions here.
     def test_scope_after_using_declaration_lookup_with_run_command(self):
@@ -293,7 +294,7 @@ def test_scope_after_using_declaration_lookup_with_run_command(self):
         # Evaluate func() - should call A::func()
         self.expect_expr("func()", result_type="int", result_value="3")
 
-    @expectedFailure("lldb scope lookup ambiguity after using bugs")
+    @unittest2.expectedFailure  # lldb scope lookup ambiguity after using bugs
     def test_scope_ambiguity_after_using_lookup_with_run_command(self):
         """Test scope lookup ambiguity after using in lldb."""
         self.build()

diff  --git a/lldb/test/API/lang/cpp/reference-to-outer-type/TestCppReferenceToOuterClass.py b/lldb/test/API/lang/cpp/reference-to-outer-type/TestCppReferenceToOuterClass.py
index a7b02baeb13c58d..3172b5f2fe384ff 100644
--- a/lldb/test/API/lang/cpp/reference-to-outer-type/TestCppReferenceToOuterClass.py
+++ b/lldb/test/API/lang/cpp/reference-to-outer-type/TestCppReferenceToOuterClass.py
@@ -1,3 +1,4 @@
+import unittest2
 import lldb
 from lldbsuite.test.decorators import *
 from lldbsuite.test.lldbtest import *
@@ -5,7 +6,7 @@
 
 
 class TestCase(TestBase):
-    @expectedFailure("The fix for this was reverted due to llvm.org/PR52257")
+    @unittest2.expectedFailure  # The fix for this was reverted due to llvm.org/PR52257
     def test(self):
         self.build()
         self.dbg.CreateTarget(self.getBuildArtifact("a.out"))

diff  --git a/lldb/test/API/lang/objc/hidden-ivars/TestHiddenIvars.py b/lldb/test/API/lang/objc/hidden-ivars/TestHiddenIvars.py
index 8153376b4c6feea..479f4379a530238 100644
--- a/lldb/test/API/lang/objc/hidden-ivars/TestHiddenIvars.py
+++ b/lldb/test/API/lang/objc/hidden-ivars/TestHiddenIvars.py
@@ -3,6 +3,7 @@
 
 import subprocess
 
+import unittest2
 import lldb
 from lldbsuite.test.decorators import *
 from lldbsuite.test.lldbtest import *
@@ -57,7 +58,7 @@ def test_frame_variable(self):
             self.build()
             self.frame_var(False)
 
-    @expectedFailure("rdar://18683637")
+    @unittest2.expectedFailure  # rdar://18683637
     def test_frame_variable_across_modules(self):
         if self.getArchitecture() == "i386":
             self.skipTest("requires modern objc runtime")


        


More information about the lldb-commits mailing list