[lldb] Use assertState in even more tests (NFC)
authorJonas Devlieghere <jonas@devlieghere.com>
Thu, 30 Jun 2022 00:01:36 +0000 (17:01 -0700)
committerJonas Devlieghere <jonas@devlieghere.com>
Thu, 30 Jun 2022 00:05:58 +0000 (17:05 -0700)
Followup to D127355 and D127378, converting more instances of
assertEqual to assertState.

29 files changed:
lldb/packages/Python/lldbsuite/test/lldbutil.py
lldb/test/API/android/platform/TestDefaultCacheLineSize.py
lldb/test/API/arm/breakpoint-it/TestBreakpointIt.py
lldb/test/API/arm/breakpoint-thumb-codesection/TestBreakpointThumbCodesection.py
lldb/test/API/commands/expression/expr-in-syscall/TestExpressionInSyscall.py
lldb/test/API/commands/process/handle/TestProcessHandle.py
lldb/test/API/commands/process/launch/TestProcessLaunch.py
lldb/test/API/functionalities/breakpoint/breakpoint_hit_count/TestBreakpointHitCount.py
lldb/test/API/functionalities/breakpoint/debugbreak/TestDebugBreak.py
lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/list/loop/TestDataFormatterGenericListLoop.py
lldb/test/API/functionalities/gdb_remote_client/TestRecognizeBreakpoint.py
lldb/test/API/functionalities/jitloader_gdb/TestJITLoaderGDB.py
lldb/test/API/functionalities/plugins/python_os_plugin/stepping_plugin_threads/TestOSPluginStepping.py
lldb/test/API/functionalities/process_group/TestChangeProcessGroup.py
lldb/test/API/functionalities/signal/handle-abrt/TestHandleAbort.py
lldb/test/API/functionalities/signal/handle-segv/TestHandleSegv.py
lldb/test/API/functionalities/signal/raise/TestRaise.py
lldb/test/API/functionalities/thread/exit_during_step/TestExitDuringStep.py
lldb/test/API/functionalities/thread/state/TestThreadStates.py
lldb/test/API/functionalities/thread/thread_exit/TestThreadExit.py
lldb/test/API/functionalities/tty/TestTerminal.py
lldb/test/API/linux/aarch64/unwind_signal/TestUnwindSignal.py
lldb/test/API/linux/thread/create_during_instruction_step/TestCreateDuringInstructionStep.py
lldb/test/API/macosx/posix_spawn/TestLaunchProcessPosixSpawn.py
lldb/test/API/macosx/profile_vrs_detach/TestDetachVrsProfile.py
lldb/test/API/python_api/process/io/TestProcessIO.py
lldb/test/API/python_api/target/TestTargetAPI.py
lldb/test/API/python_api/watchpoint/TestWatchpointIgnoreCount.py
lldb/test/API/qemu/TestQemuLaunch.py

index e3e81a7..74ca7dd 100644 (file)
@@ -945,7 +945,7 @@ def run_to_breakpoint_do_run(test, target, bkpt, launch_info = None,
     test.assertFalse(error.Fail(),
                      "Process launch failed: %s" % (error.GetCString()))
 
-    test.assertEqual(process.GetState(), lldb.eStateStopped)
+    test.assertState(process.GetState(), lldb.eStateStopped)
 
     # Frame #0 should be at our breakpoint.
     threads = get_threads_stopped_at_breakpoint(
index 7e8f88e..0a07766 100644 (file)
@@ -40,4 +40,4 @@ class DefaultCacheLineSizeTestCase(TestBase):
 
         # Run to completion.
         process.Continue()
-        self.assertEqual(process.GetState(), lldb.eStateExited, PROCESS_EXITED)
+        self.assertState(process.GetState(), lldb.eStateExited, PROCESS_EXITED)
index 7d8da02..a2164e7 100644 (file)
@@ -24,7 +24,7 @@ class TestBreakpointIt(TestBase):
                 extra_options="--skip-prologue 0")
 
         self.runCmd("run")
-        self.assertEqual(self.process().GetState(), lldb.eStateExited,
+        self.assertState(self.process().GetState(), lldb.eStateExited,
                 "Breakpoint does not get hit")
 
     @skipIf(archs=no_match(["arm"]))
index c318f74..a340dcb 100644 (file)
@@ -29,4 +29,4 @@ class TestBreakpointThumbCodesection(TestBase):
             self.process(), bpid), "Process is not stopped at breakpoint")
 
         self.process().Continue()
-        self.assertEqual(self.process().GetState(), lldb.eStateExited, PROCESS_EXITED)
+        self.assertState(self.process().GetState(), lldb.eStateExited, PROCESS_EXITED)
index 4c20c7f..1003c2f 100644 (file)
@@ -80,5 +80,5 @@ class ExprSyscallTestCase(TestBase):
             if new_state == lldb.eStateExited:
                 break
 
-        self.assertEqual(process.GetState(), lldb.eStateExited)
+        self.assertState(process.GetState(), lldb.eStateExited)
         self.assertEqual(process.GetExitStatus(), 0)
index 14e118b..68d8e66 100644 (file)
@@ -34,7 +34,7 @@ class TestProcessHandle(TestBase):
 
         process.Continue()
         
-        self.assertEqual(process.GetState(), lldb.eStateExited)
+        self.assertState(process.GetState(), lldb.eStateExited)
         self.assertEqual(process.GetExitStatus(), 0)
         
         # Check that we preserved the setting:
index e03cc6e..a7ce5bf 100644 (file)
@@ -199,4 +199,4 @@ class ProcessLaunchTestCase(TestBase):
 
         self.assertEqual(value, evil_var)
         process.Continue()
-        self.assertEqual(process.GetState(), lldb.eStateExited, PROCESS_EXITED)
+        self.assertState(process.GetState(), lldb.eStateExited, PROCESS_EXITED)
index 3c8dd11..4633d65 100644 (file)
@@ -39,7 +39,7 @@ class BreakpointHitCountTestCase(TestBase):
         self.assertTrue(frame0.GetFunctionName() == "a(int)" or frame0.GetFunctionName() == "int a(int)");
 
         process.Continue()
-        self.assertEqual(process.GetState(), lldb.eStateExited)
+        self.assertState(process.GetState(), lldb.eStateExited)
 
     def setUp(self):
         # Call super's setUp().
index 3d8dcc9..6da37e9 100644 (file)
@@ -52,4 +52,4 @@ class DebugBreakTestCase(TestBase):
             process.Continue()
 
         # The inferior should exit after the last iteration.
-        self.assertEqual(process.GetState(), lldb.eStateExited)
+        self.assertState(process.GetState(), lldb.eStateExited)
index 0577e02..7c47ebe 100644 (file)
@@ -64,7 +64,7 @@ class GenericListDataFormatterTestCase(TestBase):
 
         # Run to completion.
         process.Continue()
-        self.assertEqual(process.GetState(), lldb.eStateExited, PROCESS_EXITED)
+        self.assertState(process.GetState(), lldb.eStateExited, PROCESS_EXITED)
 
     @add_test_categories(["libstdcxx"])
     def test_with_run_command_libstdcpp(self):
index ce57da1..783240b 100644 (file)
@@ -122,7 +122,7 @@ class TestRecognizeBreakpoint(GDBRemoteTestBase):
         # Now continue and we will fake hitting a breakpoint.
         process.Continue()
 
-        self.assertEqual(process.GetState(),lldb.eStateStopped, "Process is stopped")
+        self.assertState(process.GetState(),lldb.eStateStopped, "Process is stopped")
         num_threads = len(process.threads)
 
         num_threads = len(process.threads)
index a857e28..7dab9b7 100644 (file)
@@ -31,7 +31,7 @@ class JITLoaderGDBTestCase(TestBase):
 
         # The inferior will now pass bogus values over the interface. Make sure
         # we don't crash.
-        self.assertEqual(process.GetState(), lldb.eStateExited)
+        self.assertState(process.GetState(), lldb.eStateExited)
         self.assertEqual(process.GetExitStatus(), 0)
 
     def gen_log_file(self):
@@ -67,7 +67,7 @@ class JITLoaderGDBTestCase(TestBase):
             None, None, self.get_process_working_directory())
         self.assertTrue(process, PROCESS_IS_VALID)
 
-        self.assertEqual(process.GetState(), lldb.eStateExited)
+        self.assertState(process.GetState(), lldb.eStateExited)
         self.assertEqual(process.GetExitStatus(), 0)
 
         self.assertTrue(os.path.exists(logfile))
@@ -95,7 +95,7 @@ class JITLoaderGDBTestCase(TestBase):
             None, None, self.get_process_working_directory())
         self.assertTrue(process, PROCESS_IS_VALID)
 
-        self.assertEqual(process.GetState(), lldb.eStateExited)
+        self.assertState(process.GetState(), lldb.eStateExited)
         self.assertEqual(process.GetExitStatus(), 0)
 
         self.assertTrue(os.path.exists(logfile))
index 17c5d9c..a04bf3b 100644 (file)
@@ -103,7 +103,7 @@ class TestOSPluginStepping(TestBase):
             self.assertFalse(result.Succeeded(), "We still found plans for the unreported thread.")
             
             self.process.Continue()
-            self.assertEqual(self.process.GetState(), lldb.eStateExited, "We exited.")
+            self.assertState(self.process.GetState(), lldb.eStateExited, "We exited.")
         else:
             # Now we are going to continue, and when we hit the step-out breakpoint, we will
             # put the OS plugin thread back, lldb will recover its ThreadPlanStack, and
@@ -112,5 +112,3 @@ class TestOSPluginStepping(TestBase):
             os_thread = self.get_os_thread()
             self.assertTrue(os_thread.IsValid(), "The OS thread is back after continue")
             self.assertIn("step out", os_thread.GetStopDescription(100), "Completed step out plan")
-        
-        
index 8a63cb3..98f3552 100644 (file)
@@ -87,4 +87,4 @@ class ChangeProcessGroupTestCase(TestBase):
 
         # run to completion
         process.Continue()
-        self.assertEqual(process.GetState(), lldb.eStateExited)
+        self.assertState(process.GetState(), lldb.eStateExited)
index fd35e1d..aea0e37 100644 (file)
@@ -64,5 +64,5 @@ class HandleAbortTestCase(TestBase):
 
         # Continue until we exit.
         process.Continue()
-        self.assertEqual(process.GetState(), lldb.eStateExited)
+        self.assertState(process.GetState(), lldb.eStateExited)
         self.assertEqual(process.GetExitStatus(), 0)
index 9802c4e..7922a88 100644 (file)
@@ -41,5 +41,5 @@ class HandleSegvTestCase(TestBase):
 
         # Continue until we exit.
         process.Continue()
-        self.assertEqual(process.GetState(), lldb.eStateExited)
+        self.assertState(process.GetState(), lldb.eStateExited)
         self.assertEqual(process.GetExitStatus(), 0)
index eea97fa..67e7a88 100644 (file)
@@ -93,7 +93,7 @@ class RaiseTestCase(TestBase):
 
         # Continue until we exit.
         process.Continue()
-        self.assertEqual(process.GetState(), lldb.eStateExited)
+        self.assertState(process.GetState(), lldb.eStateExited)
         self.assertEqual(process.GetExitStatus(), 0)
 
         process = self.launch(target, signal)
@@ -106,7 +106,7 @@ class RaiseTestCase(TestBase):
             substrs=[
                 "stopped and restarted",
                 signal])
-        self.assertEqual(process.GetState(), lldb.eStateExited)
+        self.assertState(process.GetState(), lldb.eStateExited)
         self.assertEqual(process.GetExitStatus(), 0)
 
         # launch again
@@ -119,7 +119,7 @@ class RaiseTestCase(TestBase):
             "process continue",
             substrs=["stopped and restarted"],
             matching=False)
-        self.assertEqual(process.GetState(), lldb.eStateExited)
+        self.assertState(process.GetState(), lldb.eStateExited)
         self.assertEqual(process.GetExitStatus(), 0)
 
         if not test_passing:
@@ -149,7 +149,7 @@ class RaiseTestCase(TestBase):
 
         # Continue until we exit. The process should receive the signal.
         process.Continue()
-        self.assertEqual(process.GetState(), lldb.eStateExited)
+        self.assertState(process.GetState(), lldb.eStateExited)
         self.assertEqual(process.GetExitStatus(), signo)
 
         # launch again
@@ -163,7 +163,7 @@ class RaiseTestCase(TestBase):
             substrs=[
                 "stopped and restarted",
                 signal])
-        self.assertEqual(process.GetState(), lldb.eStateExited)
+        self.assertState(process.GetState(), lldb.eStateExited)
         self.assertEqual(process.GetExitStatus(), signo)
 
         # launch again
@@ -176,7 +176,7 @@ class RaiseTestCase(TestBase):
             "process continue",
             substrs=["stopped and restarted"],
             matching=False)
-        self.assertEqual(process.GetState(), lldb.eStateExited)
+        self.assertState(process.GetState(), lldb.eStateExited)
         self.assertEqual(process.GetExitStatus(), signo)
 
         # reset signal handling to default
index b9be2c8..bfa5aa0 100644 (file)
@@ -142,4 +142,4 @@ class ExitDuringStepTestCase(TestBase):
         self.runCmd("continue")
 
         # At this point, the inferior process should have exited.
-        self.assertEqual(process.GetState(), lldb.eStateExited, PROCESS_EXITED)
+        self.assertState(process.GetState(), lldb.eStateExited, PROCESS_EXITED)
index 4c5ebcd..9d6863f 100644 (file)
@@ -320,4 +320,4 @@ class ThreadStateTestCase(TestBase):
         self.runCmd("continue")
 
         # At this point, the inferior process should have exited.
-        self.assertEqual(process.GetState(), lldb.eStateExited, PROCESS_EXITED)
+        self.assertState(process.GetState(), lldb.eStateExited, PROCESS_EXITED)
index 4f8951f..e9788f7 100644 (file)
@@ -116,4 +116,4 @@ class ThreadExitTestCase(TestBase):
         self.runCmd("continue")
 
         # At this point, the inferior process should have exited.
-        self.assertEqual(process.GetState(), lldb.eStateExited, PROCESS_EXITED)
+        self.assertState(process.GetState(), lldb.eStateExited, PROCESS_EXITED)
index 57da57f..e4af08f 100644 (file)
@@ -46,4 +46,4 @@ class LaunchInTerminalTestCase(TestBase):
             "Make sure launch happened successfully in a terminal window")
         # Running in synchronous mode our process should have run and already
         # exited by the time target.Launch() returns
-        self.assertEqual(process.GetState(), lldb.eStateExited)
+        self.assertState(process.GetState(), lldb.eStateExited)
index a635fb4..f5039a3 100644 (file)
@@ -73,5 +73,5 @@ class UnwindSignalTestCase(TestBase):
 
         # Continue until we exit.
         process.Continue()
-        self.assertEqual(process.GetState(), lldb.eStateExited)
+        self.assertState(process.GetState(), lldb.eStateExited)
         self.assertEqual(process.GetExitStatus(), 0)
index e6d4db9..a06533a 100644 (file)
@@ -74,4 +74,4 @@ class CreateDuringInstructionStepTestCase(TestBase):
         process.Continue()
 
         # At this point, the inferior process should have exited.
-        self.assertEqual(process.GetState(), lldb.eStateExited, PROCESS_EXITED)
+        self.assertState(process.GetState(), lldb.eStateExited, PROCESS_EXITED)
index e028ebf..229faa0 100644 (file)
@@ -35,7 +35,7 @@ class TestLaunchProcessPosixSpawn(TestBase):
         self.runCmd('run')
 
         process = self.dbg.GetSelectedTarget().process
-        self.assertEqual(process.GetState(), lldb.eStateExited)
+        self.assertState(process.GetState(), lldb.eStateExited)
         self.assertIn('slice: {}'.format(arch), process.GetSTDOUT(1000))
 
     @skipUnlessDarwin
index 7e28870..624f52d 100644 (file)
@@ -68,7 +68,7 @@ class TestDetachVrsProfile(TestBase):
         success = listener.WaitForEventForBroadcaster(0, process.GetBroadcaster(), event)
         self.assertTrue(success, "Got an event which should be running.")
         event_state = process.GetStateFromEvent(event)
-        self.assertEqual(event_state, lldb.eStateRunning, "Got the running event")
+        self.assertState(event_state, lldb.eStateRunning, "Got the running event")
 
         # Now detach:
         error = process.Detach()
index fa6a434..0051a4b 100644 (file)
@@ -209,7 +209,7 @@ class ProcessIOTestCase(TestBase):
         # Let process continue so it will exit
         self.process.Continue()
         state = self.process.GetState()
-        self.assertEqual(state, lldb.eStateExited, PROCESS_IS_VALID)
+        self.assertState(state, lldb.eStateExited, PROCESS_IS_VALID)
 
     def check_process_output(self, output, error):
             # Since we launched the process without specifying stdin/out/err,
index e24f0b5..bebbb08 100644 (file)
@@ -118,7 +118,7 @@ class TargetAPITestCase(TestBase):
 
         abi_pre_launch = target.GetABIName()
         self.assertTrue(len(abi_pre_launch) != 0, "Got an ABI string")
-        
+
         breakpoint = target.BreakpointCreateByLocation(
             "main.c", self.line_main)
         self.assertTrue(breakpoint, VALID_BREAKPOINT)
@@ -178,7 +178,7 @@ class TargetAPITestCase(TestBase):
         process = target.LaunchSimple(
             ['foo', 'bar'], ['baz'], self.get_process_working_directory())
         process.Continue()
-        self.assertEqual(process.GetState(), lldb.eStateExited)
+        self.assertState(process.GetState(), lldb.eStateExited)
         output = process.GetSTDOUT(9999)
         self.assertIn('arg: foo', output)
         self.assertIn('arg: bar', output)
@@ -189,7 +189,7 @@ class TargetAPITestCase(TestBase):
         process = target.LaunchSimple(None, None,
                                       self.get_process_working_directory())
         process.Continue()
-        self.assertEqual(process.GetState(), lldb.eStateExited)
+        self.assertState(process.GetState(), lldb.eStateExited)
         output = process.GetSTDOUT(9999)
         self.assertIn('arg: foo', output)
         self.assertIn('env: bar=baz', output)
@@ -198,7 +198,7 @@ class TargetAPITestCase(TestBase):
         process = target.LaunchSimple(
             None, None, self.get_process_working_directory())
         process.Continue()
-        self.assertEqual(process.GetState(), lldb.eStateExited)
+        self.assertState(process.GetState(), lldb.eStateExited)
         output = process.GetSTDOUT(9999)
         self.assertEqual(output, "")
 
index 7c33dec..4e8288a 100644 (file)
@@ -87,7 +87,7 @@ class WatchpointIgnoreCountTestCase(TestBase):
         process.Continue()
 
         # At this point, the inferior process should have exited.
-        self.assertEqual(process.GetState(), lldb.eStateExited, PROCESS_EXITED)
+        self.assertState(process.GetState(), lldb.eStateExited, PROCESS_EXITED)
 
         # Verify some vital statistics.
         self.assertTrue(watchpoint)
index 072efe6..d934270 100644 (file)
@@ -66,7 +66,7 @@ class TestQemuLaunch(TestBase):
         process = target.Launch(info, error)
         self.assertSuccess(error)
         self.assertIsNotNone(process)
-        self.assertEqual(process.GetState(), lldb.eStateExited)
+        self.assertState(process.GetState(), lldb.eStateExited)
         self.assertEqual(process.GetExitStatus(), 0x47)
 
         # Verify the qemu invocation parameters.
@@ -142,7 +142,7 @@ class TestQemuLaunch(TestBase):
 
         process = target.Launch(info, error)
         self.assertSuccess(error)
-        self.assertEqual(process.GetState(), lldb.eStateExited)
+        self.assertState(process.GetState(), lldb.eStateExited)
 
         with open(self.getBuildArtifact("stdout.txt")) as f:
             self.assertEqual(f.read(), "STDOUT CONTENT")