summaryrefslogtreecommitdiffstats
path: root/lldb/packages/Python/lldbsuite/test/functionalities/signal/raise/TestRaise.py
diff options
context:
space:
mode:
authorPavel Labath <labath@google.com>2018-02-08 10:37:23 +0000
committerPavel Labath <labath@google.com>2018-02-08 10:37:23 +0000
commit014e4654d496a7c6dfeb28903079bd324c16fc2b (patch)
tree54a8332cad068222adf099b668df5e3d528f2b59 /lldb/packages/Python/lldbsuite/test/functionalities/signal/raise/TestRaise.py
parentc8016e7a65ffc6f0266845c4674f7a08dffff3ea (diff)
downloadbcm5719-llvm-014e4654d496a7c6dfeb28903079bd324c16fc2b.tar.gz
bcm5719-llvm-014e4654d496a7c6dfeb28903079bd324c16fc2b.zip
Rewrite the flaky test_restart_bug test in a more deterministic way
Summary: The test was trying to reproduce a bug in handling of two concurrent events, which was impossible to do reliably in a black-box style test. In practice, this meant the test was only ever failing on remote targets, as these were slow enough to trigger this. Fortunately, we now have the ability to mock the server side of the connection, which means we can simulate the failure deterministically, so I rewrite the test to use the new gdb-client framework. I've needed to add a couple of new packets to the mock server to be able to do this. Instead of trying to guess how a "typical" gdb-client test will want to handle this, I throw an exception in the implementation to force the user to override them (the packets are only sent if the test explicitly performs some action which will trigger them, so a basic test which e.g. does not need the "continue" functionality will not need to implement them). Reviewers: owenpshaw Subscribers: srhines, lldb-commits Differential Revision: https://reviews.llvm.org/D42959 llvm-svn: 324590
Diffstat (limited to 'lldb/packages/Python/lldbsuite/test/functionalities/signal/raise/TestRaise.py')
-rw-r--r--lldb/packages/Python/lldbsuite/test/functionalities/signal/raise/TestRaise.py86
1 files changed, 0 insertions, 86 deletions
diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/signal/raise/TestRaise.py b/lldb/packages/Python/lldbsuite/test/functionalities/signal/raise/TestRaise.py
index e8a2c598e27..dfc54a639ea 100644
--- a/lldb/packages/Python/lldbsuite/test/functionalities/signal/raise/TestRaise.py
+++ b/lldb/packages/Python/lldbsuite/test/functionalities/signal/raise/TestRaise.py
@@ -188,89 +188,3 @@ class RaiseTestCase(TestBase):
# reset signal handling to default
self.set_handle(signal, default_pass, default_stop, default_notify)
-
- @skipIfTargetAndroid()
- def test_restart_bug(self):
- """Test that we catch a signal in the edge case where the process receives it while we are
- about to interrupt it"""
- self.build()
- exe = self.getBuildArtifact("a.out")
-
- # Create a target by the debugger.
- target = self.dbg.CreateTarget(exe)
- self.assertTrue(target, VALID_TARGET)
- bkpt = target.BreakpointCreateByName("main")
- self.assertTrue(bkpt.IsValid(), VALID_BREAKPOINT)
-
- # launch the inferior and don't wait for it to stop
- self.dbg.SetAsync(True)
- error = lldb.SBError()
- listener = lldb.SBListener("my listener")
- process = target.Launch(listener,
- ["SIGSTOP"], # argv
- None, # envp
- None, # stdin_path
- None, # stdout_path
- None, # stderr_path
- None, # working directory
- 0, # launch flags
- False, # Stop at entry
- error) # error
-
- self.assertTrue(process and process.IsValid(), PROCESS_IS_VALID)
-
- event = lldb.SBEvent()
-
- # Give the child enough time to reach the breakpoint,
- # while clearing out all the pending events.
- # The last WaitForEvent call will time out after 2 seconds.
- while listener.WaitForEvent(2, event):
- if self.TraceOn():
- print(
- "Process changing state to:",
- self.dbg.StateAsCString(
- process.GetStateFromEvent(event)))
-
- # now the process should be stopped
- self.assertEqual(
- process.GetState(),
- lldb.eStateStopped,
- PROCESS_STOPPED)
- self.assertEqual(len(lldbutil.get_threads_stopped_at_breakpoint(
- process, bkpt)), 1, "A thread should be stopped at breakpoint")
-
- # Remove all breakpoints. This makes sure we don't have to single-step over them when we
- # resume the process below
- target.DeleteAllBreakpoints()
-
- # resume the process and immediately try to set another breakpoint. When using the remote
- # stub, this will trigger a request to stop the process just as it is about to stop
- # naturally due to a SIGSTOP signal it raises. Make sure we do not lose
- # this signal.
- process.Continue()
- self.assertTrue(target.BreakpointCreateByName(
- "handler").IsValid(), VALID_BREAKPOINT)
-
- # Clear the events again
- while listener.WaitForEvent(2, event):
- if self.TraceOn():
- print(
- "Process changing state to:",
- self.dbg.StateAsCString(
- process.GetStateFromEvent(event)))
-
- # The process should be stopped due to a signal
- self.assertEqual(process.GetState(), lldb.eStateStopped)
- thread = lldbutil.get_stopped_thread(process, lldb.eStopReasonSignal)
- self.assertTrue(
- thread.IsValid(),
- "Thread should be stopped due to a signal")
- self.assertTrue(
- thread.GetStopReasonDataCount() >= 1,
- "There was data in the event.")
- signo = process.GetUnixSignals().GetSignalNumberFromName("SIGSTOP")
- self.assertEqual(thread.GetStopReasonDataAtIndex(0), signo,
- "The stop signal was %s" % signal)
-
- # We are done
- process.Kill()
OpenPOWER on IntegriCloud