Skip to content

Commit 1b8c735

Browse files
committed
[lldb] Use assertState in even more tests (NFC)
Followup to D127355 and D127378, converting more instances of assertEqual to assertState.
1 parent 798e92c commit 1b8c735

File tree

29 files changed

+40
-42
lines changed

29 files changed

+40
-42
lines changed

lldb/packages/Python/lldbsuite/test/lldbutil.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -945,7 +945,7 @@ def run_to_breakpoint_do_run(test, target, bkpt, launch_info = None,
945945
test.assertFalse(error.Fail(),
946946
"Process launch failed: %s" % (error.GetCString()))
947947

948-
test.assertEqual(process.GetState(), lldb.eStateStopped)
948+
test.assertState(process.GetState(), lldb.eStateStopped)
949949

950950
# Frame #0 should be at our breakpoint.
951951
threads = get_threads_stopped_at_breakpoint(

lldb/test/API/android/platform/TestDefaultCacheLineSize.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,4 +40,4 @@ def test_cache_line_size(self):
4040

4141
# Run to completion.
4242
process.Continue()
43-
self.assertEqual(process.GetState(), lldb.eStateExited, PROCESS_EXITED)
43+
self.assertState(process.GetState(), lldb.eStateExited, PROCESS_EXITED)

lldb/test/API/arm/breakpoint-it/TestBreakpointIt.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ def test_false(self):
2424
extra_options="--skip-prologue 0")
2525

2626
self.runCmd("run")
27-
self.assertEqual(self.process().GetState(), lldb.eStateExited,
27+
self.assertState(self.process().GetState(), lldb.eStateExited,
2828
"Breakpoint does not get hit")
2929

3030
@skipIf(archs=no_match(["arm"]))

lldb/test/API/arm/breakpoint-thumb-codesection/TestBreakpointThumbCodesection.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,4 +29,4 @@ def test_breakpoint(self):
2929
self.process(), bpid), "Process is not stopped at breakpoint")
3030

3131
self.process().Continue()
32-
self.assertEqual(self.process().GetState(), lldb.eStateExited, PROCESS_EXITED)
32+
self.assertState(self.process().GetState(), lldb.eStateExited, PROCESS_EXITED)

lldb/test/API/commands/expression/expr-in-syscall/TestExpressionInSyscall.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,5 +80,5 @@ def expr_syscall(self):
8080
if new_state == lldb.eStateExited:
8181
break
8282

83-
self.assertEqual(process.GetState(), lldb.eStateExited)
83+
self.assertState(process.GetState(), lldb.eStateExited)
8484
self.assertEqual(process.GetExitStatus(), 0)

lldb/test/API/commands/process/handle/TestProcessHandle.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ def test_process_handle(self):
3434

3535
process.Continue()
3636

37-
self.assertEqual(process.GetState(), lldb.eStateExited)
37+
self.assertState(process.GetState(), lldb.eStateExited)
3838
self.assertEqual(process.GetExitStatus(), 0)
3939

4040
# Check that we preserved the setting:

lldb/test/API/commands/process/launch/TestProcessLaunch.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -199,4 +199,4 @@ def test_environment_with_special_char(self):
199199

200200
self.assertEqual(value, evil_var)
201201
process.Continue()
202-
self.assertEqual(process.GetState(), lldb.eStateExited, PROCESS_EXITED)
202+
self.assertState(process.GetState(), lldb.eStateExited, PROCESS_EXITED)

lldb/test/API/functionalities/breakpoint/breakpoint_hit_count/TestBreakpointHitCount.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ def test_breakpoint_one_shot(self):
3939
self.assertTrue(frame0.GetFunctionName() == "a(int)" or frame0.GetFunctionName() == "int a(int)");
4040

4141
process.Continue()
42-
self.assertEqual(process.GetState(), lldb.eStateExited)
42+
self.assertState(process.GetState(), lldb.eStateExited)
4343

4444
def setUp(self):
4545
# Call super's setUp().

lldb/test/API/functionalities/breakpoint/debugbreak/TestDebugBreak.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,4 +52,4 @@ def test_asm_int_3(self):
5252
process.Continue()
5353

5454
# The inferior should exit after the last iteration.
55-
self.assertEqual(process.GetState(), lldb.eStateExited)
55+
self.assertState(process.GetState(), lldb.eStateExited)

lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/list/loop/TestDataFormatterGenericListLoop.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ def do_test_with_run_command(self, stdlib_type):
6464

6565
# Run to completion.
6666
process.Continue()
67-
self.assertEqual(process.GetState(), lldb.eStateExited, PROCESS_EXITED)
67+
self.assertState(process.GetState(), lldb.eStateExited, PROCESS_EXITED)
6868

6969
@add_test_categories(["libstdcxx"])
7070
def test_with_run_command_libstdcpp(self):

lldb/test/API/functionalities/gdb_remote_client/TestRecognizeBreakpoint.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ def other (self, packet):
122122
# Now continue and we will fake hitting a breakpoint.
123123
process.Continue()
124124

125-
self.assertEqual(process.GetState(),lldb.eStateStopped, "Process is stopped")
125+
self.assertState(process.GetState(),lldb.eStateStopped, "Process is stopped")
126126
num_threads = len(process.threads)
127127

128128
num_threads = len(process.threads)

lldb/test/API/functionalities/jitloader_gdb/TestJITLoaderGDB.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ def test_bogus_values(self):
3131

3232
# The inferior will now pass bogus values over the interface. Make sure
3333
# we don't crash.
34-
self.assertEqual(process.GetState(), lldb.eStateExited)
34+
self.assertState(process.GetState(), lldb.eStateExited)
3535
self.assertEqual(process.GetExitStatus(), 0)
3636

3737
def gen_log_file(self):
@@ -67,7 +67,7 @@ def cleanup():
6767
None, None, self.get_process_working_directory())
6868
self.assertTrue(process, PROCESS_IS_VALID)
6969

70-
self.assertEqual(process.GetState(), lldb.eStateExited)
70+
self.assertState(process.GetState(), lldb.eStateExited)
7171
self.assertEqual(process.GetExitStatus(), 0)
7272

7373
self.assertTrue(os.path.exists(logfile))
@@ -95,7 +95,7 @@ def cleanup():
9595
None, None, self.get_process_working_directory())
9696
self.assertTrue(process, PROCESS_IS_VALID)
9797

98-
self.assertEqual(process.GetState(), lldb.eStateExited)
98+
self.assertState(process.GetState(), lldb.eStateExited)
9999
self.assertEqual(process.GetExitStatus(), 0)
100100

101101
self.assertTrue(os.path.exists(logfile))

lldb/test/API/functionalities/plugins/python_os_plugin/stepping_plugin_threads/TestOSPluginStepping.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ def run_python_os_step_missing_thread(self, do_prune):
103103
self.assertFalse(result.Succeeded(), "We still found plans for the unreported thread.")
104104

105105
self.process.Continue()
106-
self.assertEqual(self.process.GetState(), lldb.eStateExited, "We exited.")
106+
self.assertState(self.process.GetState(), lldb.eStateExited, "We exited.")
107107
else:
108108
# Now we are going to continue, and when we hit the step-out breakpoint, we will
109109
# put the OS plugin thread back, lldb will recover its ThreadPlanStack, and
@@ -112,5 +112,3 @@ def run_python_os_step_missing_thread(self, do_prune):
112112
os_thread = self.get_os_thread()
113113
self.assertTrue(os_thread.IsValid(), "The OS thread is back after continue")
114114
self.assertIn("step out", os_thread.GetStopDescription(100), "Completed step out plan")
115-
116-

lldb/test/API/functionalities/process_group/TestChangeProcessGroup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,4 +87,4 @@ def cleanupChild():
8787

8888
# run to completion
8989
process.Continue()
90-
self.assertEqual(process.GetState(), lldb.eStateExited)
90+
self.assertState(process.GetState(), lldb.eStateExited)

lldb/test/API/functionalities/signal/handle-abrt/TestHandleAbort.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,5 +64,5 @@ def test_inferior_handle_sigabrt(self):
6464

6565
# Continue until we exit.
6666
process.Continue()
67-
self.assertEqual(process.GetState(), lldb.eStateExited)
67+
self.assertState(process.GetState(), lldb.eStateExited)
6868
self.assertEqual(process.GetExitStatus(), 0)

lldb/test/API/functionalities/signal/handle-segv/TestHandleSegv.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,5 +41,5 @@ def test_inferior_handle_sigsegv(self):
4141

4242
# Continue until we exit.
4343
process.Continue()
44-
self.assertEqual(process.GetState(), lldb.eStateExited)
44+
self.assertState(process.GetState(), lldb.eStateExited)
4545
self.assertEqual(process.GetExitStatus(), 0)

lldb/test/API/functionalities/signal/raise/TestRaise.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ def signal_test(self, signal, test_passing):
9393

9494
# Continue until we exit.
9595
process.Continue()
96-
self.assertEqual(process.GetState(), lldb.eStateExited)
96+
self.assertState(process.GetState(), lldb.eStateExited)
9797
self.assertEqual(process.GetExitStatus(), 0)
9898

9999
process = self.launch(target, signal)
@@ -106,7 +106,7 @@ def signal_test(self, signal, test_passing):
106106
substrs=[
107107
"stopped and restarted",
108108
signal])
109-
self.assertEqual(process.GetState(), lldb.eStateExited)
109+
self.assertState(process.GetState(), lldb.eStateExited)
110110
self.assertEqual(process.GetExitStatus(), 0)
111111

112112
# launch again
@@ -119,7 +119,7 @@ def signal_test(self, signal, test_passing):
119119
"process continue",
120120
substrs=["stopped and restarted"],
121121
matching=False)
122-
self.assertEqual(process.GetState(), lldb.eStateExited)
122+
self.assertState(process.GetState(), lldb.eStateExited)
123123
self.assertEqual(process.GetExitStatus(), 0)
124124

125125
if not test_passing:
@@ -149,7 +149,7 @@ def signal_test(self, signal, test_passing):
149149

150150
# Continue until we exit. The process should receive the signal.
151151
process.Continue()
152-
self.assertEqual(process.GetState(), lldb.eStateExited)
152+
self.assertState(process.GetState(), lldb.eStateExited)
153153
self.assertEqual(process.GetExitStatus(), signo)
154154

155155
# launch again
@@ -163,7 +163,7 @@ def signal_test(self, signal, test_passing):
163163
substrs=[
164164
"stopped and restarted",
165165
signal])
166-
self.assertEqual(process.GetState(), lldb.eStateExited)
166+
self.assertState(process.GetState(), lldb.eStateExited)
167167
self.assertEqual(process.GetExitStatus(), signo)
168168

169169
# launch again
@@ -176,7 +176,7 @@ def signal_test(self, signal, test_passing):
176176
"process continue",
177177
substrs=["stopped and restarted"],
178178
matching=False)
179-
self.assertEqual(process.GetState(), lldb.eStateExited)
179+
self.assertState(process.GetState(), lldb.eStateExited)
180180
self.assertEqual(process.GetExitStatus(), signo)
181181

182182
# reset signal handling to default

lldb/test/API/functionalities/thread/exit_during_step/TestExitDuringStep.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,4 +142,4 @@ def exit_during_step_base(self, step_cmd, step_stop_reason, by_instruction):
142142
self.runCmd("continue")
143143

144144
# At this point, the inferior process should have exited.
145-
self.assertEqual(process.GetState(), lldb.eStateExited, PROCESS_EXITED)
145+
self.assertState(process.GetState(), lldb.eStateExited, PROCESS_EXITED)

lldb/test/API/functionalities/thread/state/TestThreadStates.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -320,4 +320,4 @@ def thread_states_test(self):
320320
self.runCmd("continue")
321321

322322
# At this point, the inferior process should have exited.
323-
self.assertEqual(process.GetState(), lldb.eStateExited, PROCESS_EXITED)
323+
self.assertState(process.GetState(), lldb.eStateExited, PROCESS_EXITED)

lldb/test/API/functionalities/thread/thread_exit/TestThreadExit.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,4 +116,4 @@ def test(self):
116116
self.runCmd("continue")
117117

118118
# At this point, the inferior process should have exited.
119-
self.assertEqual(process.GetState(), lldb.eStateExited, PROCESS_EXITED)
119+
self.assertState(process.GetState(), lldb.eStateExited, PROCESS_EXITED)

lldb/test/API/functionalities/tty/TestTerminal.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,4 +46,4 @@ def test_launch_in_terminal(self):
4646
"Make sure launch happened successfully in a terminal window")
4747
# Running in synchronous mode our process should have run and already
4848
# exited by the time target.Launch() returns
49-
self.assertEqual(process.GetState(), lldb.eStateExited)
49+
self.assertState(process.GetState(), lldb.eStateExited)

lldb/test/API/linux/aarch64/unwind_signal/TestUnwindSignal.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,5 +73,5 @@ def test_unwind_signal(self):
7373

7474
# Continue until we exit.
7575
process.Continue()
76-
self.assertEqual(process.GetState(), lldb.eStateExited)
76+
self.assertState(process.GetState(), lldb.eStateExited)
7777
self.assertEqual(process.GetExitStatus(), 0)

lldb/test/API/linux/thread/create_during_instruction_step/TestCreateDuringInstructionStep.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,4 +74,4 @@ def test_step_inst(self):
7474
process.Continue()
7575

7676
# At this point, the inferior process should have exited.
77-
self.assertEqual(process.GetState(), lldb.eStateExited, PROCESS_EXITED)
77+
self.assertState(process.GetState(), lldb.eStateExited, PROCESS_EXITED)

lldb/test/API/macosx/posix_spawn/TestLaunchProcessPosixSpawn.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ def run_arch(self, exe, arch):
3535
self.runCmd('run')
3636

3737
process = self.dbg.GetSelectedTarget().process
38-
self.assertEqual(process.GetState(), lldb.eStateExited)
38+
self.assertState(process.GetState(), lldb.eStateExited)
3939
self.assertIn('slice: {}'.format(arch), process.GetSTDOUT(1000))
4040

4141
@skipUnlessDarwin

lldb/test/API/macosx/profile_vrs_detach/TestDetachVrsProfile.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ def cleanup():
6868
success = listener.WaitForEventForBroadcaster(0, process.GetBroadcaster(), event)
6969
self.assertTrue(success, "Got an event which should be running.")
7070
event_state = process.GetStateFromEvent(event)
71-
self.assertEqual(event_state, lldb.eStateRunning, "Got the running event")
71+
self.assertState(event_state, lldb.eStateRunning, "Got the running event")
7272

7373
# Now detach:
7474
error = process.Detach()

lldb/test/API/python_api/process/io/TestProcessIO.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,7 @@ def run_process(self, put_stdin):
209209
# Let process continue so it will exit
210210
self.process.Continue()
211211
state = self.process.GetState()
212-
self.assertEqual(state, lldb.eStateExited, PROCESS_IS_VALID)
212+
self.assertState(state, lldb.eStateExited, PROCESS_IS_VALID)
213213

214214
def check_process_output(self, output, error):
215215
# Since we launched the process without specifying stdin/out/err,

lldb/test/API/python_api/target/TestTargetAPI.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ def test_get_ABIName(self):
118118

119119
abi_pre_launch = target.GetABIName()
120120
self.assertTrue(len(abi_pre_launch) != 0, "Got an ABI string")
121-
121+
122122
breakpoint = target.BreakpointCreateByLocation(
123123
"main.c", self.line_main)
124124
self.assertTrue(breakpoint, VALID_BREAKPOINT)
@@ -178,7 +178,7 @@ def test_launch_simple(self):
178178
process = target.LaunchSimple(
179179
['foo', 'bar'], ['baz'], self.get_process_working_directory())
180180
process.Continue()
181-
self.assertEqual(process.GetState(), lldb.eStateExited)
181+
self.assertState(process.GetState(), lldb.eStateExited)
182182
output = process.GetSTDOUT(9999)
183183
self.assertIn('arg: foo', output)
184184
self.assertIn('arg: bar', output)
@@ -189,7 +189,7 @@ def test_launch_simple(self):
189189
process = target.LaunchSimple(None, None,
190190
self.get_process_working_directory())
191191
process.Continue()
192-
self.assertEqual(process.GetState(), lldb.eStateExited)
192+
self.assertState(process.GetState(), lldb.eStateExited)
193193
output = process.GetSTDOUT(9999)
194194
self.assertIn('arg: foo', output)
195195
self.assertIn('env: bar=baz', output)
@@ -198,7 +198,7 @@ def test_launch_simple(self):
198198
process = target.LaunchSimple(
199199
None, None, self.get_process_working_directory())
200200
process.Continue()
201-
self.assertEqual(process.GetState(), lldb.eStateExited)
201+
self.assertState(process.GetState(), lldb.eStateExited)
202202
output = process.GetSTDOUT(9999)
203203
self.assertEqual(output, "")
204204

lldb/test/API/python_api/watchpoint/TestWatchpointIgnoreCount.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ def test_set_watch_ignore_count(self):
8787
process.Continue()
8888

8989
# At this point, the inferior process should have exited.
90-
self.assertEqual(process.GetState(), lldb.eStateExited, PROCESS_EXITED)
90+
self.assertState(process.GetState(), lldb.eStateExited, PROCESS_EXITED)
9191

9292
# Verify some vital statistics.
9393
self.assertTrue(watchpoint)

lldb/test/API/qemu/TestQemuLaunch.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ def _run_and_get_state(self, target=None, info=None):
6666
process = target.Launch(info, error)
6767
self.assertSuccess(error)
6868
self.assertIsNotNone(process)
69-
self.assertEqual(process.GetState(), lldb.eStateExited)
69+
self.assertState(process.GetState(), lldb.eStateExited)
7070
self.assertEqual(process.GetExitStatus(), 0x47)
7171

7272
# Verify the qemu invocation parameters.
@@ -142,7 +142,7 @@ def test_stdio_redirect(self):
142142

143143
process = target.Launch(info, error)
144144
self.assertSuccess(error)
145-
self.assertEqual(process.GetState(), lldb.eStateExited)
145+
self.assertState(process.GetState(), lldb.eStateExited)
146146

147147
with open(self.getBuildArtifact("stdout.txt")) as f:
148148
self.assertEqual(f.read(), "STDOUT CONTENT")

0 commit comments

Comments
 (0)