public TargetEventArgs AssertTargetEvent(Thread thread, TargetEventType type) { DebuggerEvent e = AssertEvent(); if (e.Type != DebuggerEventType.TargetEvent) { Assert.Fail("Received event {0}, but expected {1}.", e, type); } if ((thread != null) && (e.Data != thread)) { Assert.Fail("Received event {0} while waiting for {1} in thread {2}.", e, type, thread); } TargetEventArgs args = (TargetEventArgs)e.Data2; if (args.Type != type) { Assert.Fail("Received event {0} while waiting for {1} in thread {2}.", e, type, thread); } return(args); }
public void AssertTargetExited() { while (true) { DebuggerEvent e = Interpreter.Wait(); if (e == null) { Assert.Fail("Time-out while waiting for target to exit."); } if (e.Type == DebuggerEventType.TargetExited) { break; } else if ((e.Type == DebuggerEventType.ThreadExited) || (e.Type == DebuggerEventType.ProcessExited)) { continue; } else if (e.Type == DebuggerEventType.TargetEvent) { TargetEventArgs args = (TargetEventArgs)e.Data2; if ((args.Type == TargetEventType.TargetExited) || (args.Type == TargetEventType.TargetSignaled)) { continue; } } Assert.Fail("Received event {0} while waiting for target to exit.", e); } AssertNoTargetOutput(); }
public Thread AssertProcessCreated() { AssertEvent(DebuggerEventType.ProcessCreated); DebuggerEvent ee = AssertEvent(DebuggerEventType.ThreadCreated); return((Thread)ee.Data); }
public void AssertNoEvent() { if (Interpreter.HasEvent) { DebuggerEvent e = Interpreter.Wait(); Assert.Fail("Received unexpected event {0}.", e); } }
internal void AddEvent(DebuggerEvent e) { Report.Debug(DebugFlags.NUnit, "ADD EVENT: {0}", e); lock (queue.SyncRoot) { queue.Enqueue(e); wait_event.Set(); } }
private void AssertMainProcessCreated(Process process) { DebuggerEvent e = AssertEvent(DebuggerEventType.MainProcessCreated); Process main = (Process)e.Data; Assert.AreEqual(process, main, "Created main process `{0}', but expected `{1}'.", main, process); }
public void AssertNestedBreakState(Thread exp_thread, string exp_func, int exp_line) { bool seen_stopped = false, seen_enter = false; while (!seen_stopped || !seen_enter) { DebuggerEvent e = Interpreter.Wait(); if (e == null) { Assert.Fail("Time-out while waiting for nested break state."); } if (e.Type == DebuggerEventType.EnterNestedBreakState) { if (e.Data != exp_thread) { Assert.Fail("Received event {0} while waiting for nested break state.", e); } seen_enter = true; } else if (e.Type == DebuggerEventType.TargetEvent) { if (e.Data != exp_thread) { Assert.Fail("Received event {0} while waiting for nested break state.", e); } TargetEventArgs args = (TargetEventArgs)e.Data2; if ((args.Type == TargetEventType.TargetStopped) && ((int)args.Data != 0)) { Assert.Fail("Received event {0} while waiting for {1} to stop.", args, exp_thread); } else if ((args.Type != TargetEventType.TargetStopped) && (args.Type != TargetEventType.TargetHitBreakpoint) && (args.Type != TargetEventType.Exception) && (args.Type != TargetEventType.UnhandledException)) { Assert.Fail("Received event {0} while waiting for {1} to stop.", args, exp_thread); } seen_stopped = true; } else { Assert.Fail("Received event {0} while waiting for nested break state.", e); } } if (exp_func != null) { AssertFrame(exp_thread, exp_func, exp_line); } }
public void AssertProcessExited(Process exp_process) { DebuggerEvent e = AssertEvent(DebuggerEventType.ProcessExited); Process process = (Process)e.Data; if (process != exp_process) { Assert.Fail("Process {0} exited, but expected process {1} to exit.", process.ID, exp_process.ID); } }
public DebuggerEvent AssertEvent(DebuggerEventType type) { DebuggerEvent e = AssertEvent(); if (e.Type != type) { Assert.Fail("Received event {0}, but expected {1}.", e, type); } return(e); }
public DebuggerEvent AssertEvent() { DebuggerEvent e = Interpreter.Wait(); if (e == null) { Assert.Fail("Time-out while waiting for debugger event."); } return(e); }
internal void AddEvent(DebuggerEvent e) { Report.Debug (DebugFlags.NUnit, "ADD EVENT: {0}", e); lock (queue.SyncRoot) { queue.Enqueue (e); wait_event.Set (); } }
public Thread AssertThreadCreated() { DebuggerEvent te = AssertEvent(DebuggerEventType.ThreadCreated); return((Thread)te.Data); }
public Process AssertMainProcessCreated() { DebuggerEvent e = AssertEvent(DebuggerEventType.MainProcessCreated); return((Process)e.Data); }
public void AssertTargetExited(Process process) { bool process_exited = false; bool target_exited = false; bool target_event = Interpreter.IgnoreThreadCreation; bool thread_exited = Interpreter.IgnoreThreadCreation; while (true) { DebuggerEvent e = Interpreter.Wait(); if (e == null) { Assert.Fail("Time-out while waiting for target to exit."); } if (e.Type == DebuggerEventType.TargetExited) { target_exited = true; break; } else if (e.Type == DebuggerEventType.ThreadExited) { if (e.Data == process.MainThread) { thread_exited = true; } continue; } else if (e.Type == DebuggerEventType.ProcessExited) { if (e.Data == process) { process_exited = true; } continue; } else if (e.Type == DebuggerEventType.TargetEvent) { TargetEventArgs args = (TargetEventArgs)e.Data2; if ((args.Type == TargetEventType.TargetExited) || (args.Type == TargetEventType.TargetSignaled)) { if (e.Data == process.MainThread) { target_event = true; } continue; } } Assert.Fail("Received event {0} while waiting for target to exit.", e); } if (!target_event) { Assert.Fail("Did not receive `TargetEventType.TargetExited' event " + "while waiting for target to exit."); } if (!process_exited) { Assert.Fail("Did not receive `ProcessExitedEvent' while waiting for " + "target to exit."); } if (!thread_exited) { Assert.Fail("Did not receive `ThreadExitedEvent' while waiting for " + "target to exit."); } if (!target_exited) { Assert.Fail("Did not receive `TargetExitedEvent' while waiting for " + "target to exit."); } AssertNoTargetOutput(); }