diff options
| author | Jim Ingham <jingham@apple.com> | 2023-08-15 11:32:55 -0700 |
|---|---|---|
| committer | Jim Ingham <jingham@apple.com> | 2023-08-16 10:35:32 -0700 |
| commit | 2e7aa2ee34eb53347396731dc8a3b2dbc6a3df45 (patch) | |
| tree | e7f177dd895d505e1ec24419b76e48201cd3f777 /lldb/test/API/functionalities/interactive_scripted_process | |
| parent | 329979cf3771759646b47395384e06eb271f485f (diff) | |
Replace the singleton "ShadowListener" with a primary and N secondary Listeners
Before the addition of the process "Shadow Listener" you could only have one
Listener observing the Process Broadcaster. That was necessary because fetching the
Process event is what switches the public process state, and for the execution
control logic to be manageable you needed to keep other listeners from causing
this to happen before the main process control engine was ready.
Ismail added the notion of a "ShadowListener" - which allowed you ONE
extra process listener. This patch inverts that setup by designating the
first listener as primary - and giving it priority in fetching events.
Differential Revision: https://reviews.llvm.org/D157556
Diffstat (limited to 'lldb/test/API/functionalities/interactive_scripted_process')
| -rw-r--r-- | lldb/test/API/functionalities/interactive_scripted_process/TestInteractiveScriptedProcess.py | 35 |
1 files changed, 23 insertions, 12 deletions
diff --git a/lldb/test/API/functionalities/interactive_scripted_process/TestInteractiveScriptedProcess.py b/lldb/test/API/functionalities/interactive_scripted_process/TestInteractiveScriptedProcess.py index 6c531550c95e..528c9fdce69c 100644 --- a/lldb/test/API/functionalities/interactive_scripted_process/TestInteractiveScriptedProcess.py +++ b/lldb/test/API/functionalities/interactive_scripted_process/TestInteractiveScriptedProcess.py @@ -22,8 +22,10 @@ class TestInteractiveScriptedProcess(TestBase): self.script_module = "interactive_scripted_process" self.script_file = self.script_module + ".py" + # These tests are flakey and sometimes timeout. They work most of the time + # so the basic event flow is right, but somehow the handling is off. @skipUnlessDarwin - @skipIfDarwin + @skipIfDarwin def test_passthrough_launch(self): """Test a simple pass-through process launch""" self.passthrough_launch() @@ -35,6 +37,15 @@ class TestInteractiveScriptedProcess(TestBase): self.assertTrue(self.mux_process.IsValid(), "Got a valid process") event = lldbutil.fetch_next_event( + self, self.dbg.GetListener(), self.mux_process.GetBroadcaster(), timeout=20 + ) + self.assertState(lldb.SBProcess.GetStateFromEvent(event), lldb.eStateRunning) + event = lldbutil.fetch_next_event( + self, self.dbg.GetListener(), self.mux_process.GetBroadcaster() + ) + self.assertState(lldb.SBProcess.GetStateFromEvent(event), lldb.eStateStopped) + + event = lldbutil.fetch_next_event( self, self.mux_process_listener, self.mux_process.GetBroadcaster() ) self.assertState(lldb.SBProcess.GetStateFromEvent(event), lldb.eStateRunning) @@ -178,6 +189,13 @@ class TestInteractiveScriptedProcess(TestBase): ) execution_events[event_target_idx][state] = True + for _ in range((self.dbg.GetNumTargets() - 1) * 2): + fetch_process_event(self, execution_events) + + for target_index, event_states in execution_events.items(): + for state, is_set in event_states.items(): + self.assertTrue(is_set, f"Target {target_index} has state {state} set") + event = lldbutil.fetch_next_event( self, self.mux_process_listener, self.mux_process.GetBroadcaster() ) @@ -188,13 +206,6 @@ class TestInteractiveScriptedProcess(TestBase): ) self.assertState(lldb.SBProcess.GetStateFromEvent(event), lldb.eStateStopped) - for _ in range((self.dbg.GetNumTargets() - 1) * 2): - fetch_process_event(self, execution_events) - - for target_index, event_states in execution_events.items(): - for state, is_set in event_states.items(): - self.assertTrue(is_set, f"Target {target_index} has state {state} set") - def duplicate_target(self, driving_target): exe = driving_target.executable.fullpath triple = driving_target.triple @@ -248,14 +259,14 @@ class TestInteractiveScriptedProcess(TestBase): self.assertSuccess(error, "Launched multiplexer scripted process") self.assertTrue(self.mux_process.IsValid(), "Got a valid process") - # Check that the mux process started running + # Check that the real process started running event = lldbutil.fetch_next_event( - self, self.mux_process_listener, self.mux_process.GetBroadcaster() + self, self.dbg.GetListener(), self.mux_process.GetBroadcaster() ) self.assertState(lldb.SBProcess.GetStateFromEvent(event), lldb.eStateRunning) - # Check that the real process started running + # Check that the mux process started running event = lldbutil.fetch_next_event( - self, self.dbg.GetListener(), self.mux_process.GetBroadcaster() + self, self.mux_process_listener, self.mux_process.GetBroadcaster() ) self.assertState(lldb.SBProcess.GetStateFromEvent(event), lldb.eStateRunning) |
