GP-0: More timing issues in breakpoint tests.

This commit is contained in:
Dan 2022-05-03 11:09:11 -04:00
parent afb63d811c
commit e3aa733c0c
14 changed files with 32 additions and 55 deletions

View File

@ -54,6 +54,7 @@ import ghidra.app.util.viewer.listingpanel.ListingPanel;
import ghidra.dbg.model.AbstractTestTargetRegisterBank;
import ghidra.dbg.model.TestDebuggerModelBuilder;
import ghidra.dbg.target.*;
import ghidra.dbg.testutil.DebuggerModelTestUtils;
import ghidra.framework.model.*;
import ghidra.framework.plugintool.PluginTool;
import ghidra.program.database.ProgramDB;
@ -77,7 +78,7 @@ import ghidra.util.exception.CancelledException;
import ghidra.util.task.ConsoleTaskMonitor;
public abstract class AbstractGhidraHeadedDebuggerGUITest
extends AbstractGhidraHeadedIntegrationTest {
extends AbstractGhidraHeadedIntegrationTest implements DebuggerModelTestUtils {
public static final String LANGID_TOYBE64 = "Toy:BE:64:default";
@ -531,6 +532,15 @@ public abstract class AbstractGhidraHeadedDebuggerGUITest
};
protected ConsoleTaskMonitor monitor = new ConsoleTaskMonitor();
protected void waitRecorder(TraceRecorder recorder) throws Throwable {
if (recorder == null) {
return;
}
waitOn(recorder.getTarget().getModel().flushEvents());
waitOn(recorder.flushTransactions());
waitForDomainObject(recorder.getTrace());
}
@Before
public void setUp() throws Exception {
ListenerMap.clearErr();

View File

@ -200,7 +200,7 @@ public class DebuggerBreakpointMarkerPluginTest extends AbstractGhidraHeadedDebu
}
@Test
public void testBreakpointMarked() throws Exception {
public void testBreakpointMarked() throws Throwable {
TraceRecorder recorder = addMappedBreakpointOpenAndWait();
Trace trace = recorder.getTrace();
traceManager.activateTrace(trace);
@ -229,8 +229,8 @@ public class DebuggerBreakpointMarkerPluginTest extends AbstractGhidraHeadedDebu
waitForPass(() -> assertEquals(COLOR_FOR_STATE.get(State.INCONSISTENT_DISABLED),
getBackgroundColor(program, sAddr)));
lb.disableForTrace(trace);
waitForDomainObject(trace);
waitOn(lb.disableForTrace(trace));
waitRecorder(recorder);
waitForPass(() -> assertEquals(State.DISABLED, lb.computeStateForTrace(trace)));
waitForPass(() -> assertEquals(COLOR_FOR_STATE.get(State.DISABLED),
@ -293,7 +293,7 @@ public class DebuggerBreakpointMarkerPluginTest extends AbstractGhidraHeadedDebu
}
@Test
public void testProgramBreakpointPopupMenus() throws Exception {
public void testProgramBreakpointPopupMenus() throws Throwable {
TraceRecorder recorder = addMappedBreakpointOpenAndWait();
Trace trace = recorder.getTrace();
LogicalBreakpoint lb = Unique.assertOne(breakpointService.getAllBreakpoints());
@ -320,8 +320,8 @@ public class DebuggerBreakpointMarkerPluginTest extends AbstractGhidraHeadedDebu
AbstractClearBreakpointAction.NAME));
pressEscape();
lb.disableForTrace(trace);
waitForDomainObject(trace);
waitOn(lb.disableForTrace(trace));
waitRecorder(recorder);
waitForPass(
() -> assertEquals(State.DISABLED, lb.computeStateForProgram(program)));
@ -348,7 +348,7 @@ public class DebuggerBreakpointMarkerPluginTest extends AbstractGhidraHeadedDebu
}
@Test
public void testTraceBreakpointPopupMenus() throws Exception {
public void testTraceBreakpointPopupMenus() throws Throwable {
TraceRecorder recorder = addMappedBreakpointOpenAndWait();
Trace trace = recorder.getTrace();
LogicalBreakpoint lb = Unique.assertOne(breakpointService.getAllBreakpoints());
@ -375,8 +375,8 @@ public class DebuggerBreakpointMarkerPluginTest extends AbstractGhidraHeadedDebu
AbstractClearBreakpointAction.NAME));
pressEscape();
lb.disableForTrace(trace);
waitForDomainObject(trace);
waitOn(lb.disableForTrace(trace));
waitRecorder(recorder);
waitForPass(
() -> assertEquals(State.DISABLED, lb.computeStateForTrace(trace)));

View File

@ -38,7 +38,6 @@ import ghidra.app.plugin.core.debug.gui.console.DebuggerConsolePlugin;
import ghidra.app.plugin.core.debug.service.modules.DebuggerStaticMappingUtils;
import ghidra.app.services.*;
import ghidra.app.services.LogicalBreakpoint.State;
import ghidra.async.AsyncTestUtils;
import ghidra.dbg.model.TestTargetProcess;
import ghidra.dbg.target.TargetBreakpointSpec.TargetBreakpointKind;
import ghidra.dbg.target.TargetBreakpointSpecContainer;
@ -57,8 +56,7 @@ import ghidra.util.exception.DuplicateNameException;
import ghidra.util.task.TaskMonitor;
@Category(NightlyCategory.class) // this may actually be an @PortSensitive test
public class DebuggerBreakpointsProviderTest extends AbstractGhidraHeadedDebuggerGUITest
implements AsyncTestUtils {
public class DebuggerBreakpointsProviderTest extends AbstractGhidraHeadedDebuggerGUITest {
protected static final long TIMEOUT_MILLIS =
SystemUtilities.isInTestingBatchMode() ? 5000 : Long.MAX_VALUE;

View File

@ -38,7 +38,6 @@ import ghidra.app.plugin.core.debug.gui.listing.DebuggerListingProvider;
import ghidra.app.plugin.core.debug.service.modules.DebuggerStaticMappingServicePlugin;
import ghidra.app.services.ActionSource;
import ghidra.app.services.DebuggerStaticMappingService;
import ghidra.async.AsyncTestUtils;
import ghidra.dbg.DebuggerModelListener;
import ghidra.dbg.target.TargetObject;
import ghidra.program.model.address.*;
@ -53,8 +52,7 @@ import ghidra.trace.model.memory.TraceMemoryFlag;
import ghidra.util.database.UndoableTransaction;
@Category(NightlyCategory.class)
public class DebuggerCopyActionsPluginTest extends AbstractGhidraHeadedDebuggerGUITest
implements AsyncTestUtils {
public class DebuggerCopyActionsPluginTest extends AbstractGhidraHeadedDebuggerGUITest {
DebuggerCopyActionsPlugin copyActionsPlugin;
DebuggerListingPlugin listingPlugin;

View File

@ -26,7 +26,6 @@ import ghidra.app.plugin.core.debug.gui.AbstractGhidraHeadedDebuggerGUITest;
import ghidra.app.plugin.core.debug.gui.listing.DebuggerListingPlugin;
import ghidra.app.plugin.core.debug.gui.listing.DebuggerListingProvider;
import ghidra.app.plugin.core.debug.gui.time.DebuggerTimeSelectionDialog;
import ghidra.async.AsyncTestUtils;
import ghidra.program.model.address.AddressSetView;
import ghidra.program.util.ProgramLocation;
import ghidra.trace.database.memory.DBTraceMemoryManager;
@ -35,8 +34,7 @@ import ghidra.trace.model.time.schedule.TraceSchedule;
import ghidra.util.Swing;
import ghidra.util.database.UndoableTransaction;
public class DebuggerTraceViewDiffPluginTest extends AbstractGhidraHeadedDebuggerGUITest
implements AsyncTestUtils {
public class DebuggerTraceViewDiffPluginTest extends AbstractGhidraHeadedDebuggerGUITest {
protected DebuggerTraceViewDiffPlugin traceDiffPlugin;
protected DebuggerListingPlugin listingPlugin;

View File

@ -31,11 +31,9 @@ import ghidra.app.plugin.core.debug.gui.AbstractGhidraHeadedDebuggerGUITest;
import ghidra.app.plugin.core.interpreter.InterpreterComponentProvider;
import ghidra.dbg.model.TestTargetInterpreter.ExecuteCall;
import ghidra.dbg.target.TargetConsole.Channel;
import ghidra.dbg.testutil.DebuggerModelTestUtils;
@Category(NightlyCategory.class)
public class DebuggerInterpreterPluginTest extends AbstractGhidraHeadedDebuggerGUITest
implements DebuggerModelTestUtils {
public class DebuggerInterpreterPluginTest extends AbstractGhidraHeadedDebuggerGUITest {
private DebuggerInterpreterPlugin interpreterPlugin;
@Before

View File

@ -37,7 +37,6 @@ import ghidra.app.plugin.core.debug.service.editing.DebuggerStateEditingServiceP
import ghidra.app.services.DebuggerStateEditingService;
import ghidra.app.services.DebuggerStateEditingService.StateEditingMode;
import ghidra.app.services.TraceRecorder;
import ghidra.async.AsyncTestUtils;
import ghidra.program.model.data.*;
import ghidra.program.model.lang.Register;
import ghidra.program.model.util.CodeUnitInsertionException;
@ -52,8 +51,7 @@ import ghidra.util.database.UndoableTransaction;
import ghidra.util.exception.DuplicateNameException;
@Category(NightlyCategory.class) // this may actually be an @PortSensitive test
public class DebuggerRegistersProviderTest extends AbstractGhidraHeadedDebuggerGUITest
implements AsyncTestUtils {
public class DebuggerRegistersProviderTest extends AbstractGhidraHeadedDebuggerGUITest {
protected DebuggerRegistersPlugin registersPlugin;
protected DebuggerRegistersProvider registersProvider;

View File

@ -37,7 +37,6 @@ import ghidra.app.plugin.core.debug.service.editing.DebuggerStateEditingServiceP
import ghidra.app.plugin.core.debug.service.modules.DebuggerStaticMappingServicePlugin;
import ghidra.app.services.*;
import ghidra.app.services.DebuggerStateEditingService.StateEditingMode;
import ghidra.async.AsyncTestUtils;
import ghidra.dbg.model.TestTargetRegisterBankInThread;
import ghidra.program.model.address.*;
import ghidra.program.model.data.*;
@ -55,8 +54,7 @@ import ghidra.util.Msg;
import ghidra.util.database.UndoableTransaction;
import ghidra.util.task.TaskMonitor;
public class DebuggerWatchesProviderTest extends AbstractGhidraHeadedDebuggerGUITest
implements AsyncTestUtils {
public class DebuggerWatchesProviderTest extends AbstractGhidraHeadedDebuggerGUITest {
protected static void assertNoErr(WatchRow row) {
Throwable error = row.getError();

View File

@ -34,7 +34,6 @@ import ghidra.dbg.model.TestTargetMemoryRegion;
import ghidra.dbg.model.TestTargetProcess;
import ghidra.dbg.target.*;
import ghidra.dbg.target.TargetBreakpointSpec.TargetBreakpointKind;
import ghidra.dbg.testutil.DebuggerModelTestUtils;
import ghidra.program.model.address.Address;
import ghidra.program.model.listing.Bookmark;
import ghidra.program.model.listing.Program;
@ -49,8 +48,7 @@ import ghidra.util.SystemUtilities;
import ghidra.util.database.UndoableTransaction;
import ghidra.util.datastruct.ListenerMap;
public class DebuggerLogicalBreakpointServiceTest extends AbstractGhidraHeadedDebuggerGUITest
implements DebuggerModelTestUtils {
public class DebuggerLogicalBreakpointServiceTest extends AbstractGhidraHeadedDebuggerGUITest {
protected static final long TIMEOUT_MILLIS =
SystemUtilities.isInTestingBatchMode() ? 5000 : Long.MAX_VALUE;
@ -174,15 +172,6 @@ public class DebuggerLogicalBreakpointServiceTest extends AbstractGhidraHeadedDe
createTargetTraceMapper(mb.testProcess3), ActionSource.AUTOMATIC);
}
protected void waitRecorder(TraceRecorder recorder) throws Throwable {
if (recorder == null) {
return;
}
waitOn(recorder.getTarget().getModel().flushEvents());
waitOn(recorder.flushTransactions());
waitForDomainObject(recorder.getTrace());
}
@After
public void tearDownBreakpointServiceTest() throws Throwable {
Msg.debug(this, "Tearing down");

View File

@ -31,7 +31,6 @@ import ghidra.app.services.DebuggerStateEditingService;
import ghidra.app.services.DebuggerStateEditingService.StateEditingMode;
import ghidra.app.services.DebuggerStateEditingService.StateEditor;
import ghidra.app.services.TraceRecorder;
import ghidra.async.AsyncTestUtils;
import ghidra.dbg.target.TargetRegisterBank;
import ghidra.pcode.exec.AsyncPcodeExecutor;
import ghidra.pcode.exec.TracePcodeUtils;
@ -43,8 +42,7 @@ import ghidra.trace.model.thread.TraceThread;
import ghidra.trace.model.time.schedule.TraceSchedule;
import ghidra.util.database.UndoableTransaction;
public class DebuggerStateEditingServiceTest extends AbstractGhidraHeadedDebuggerGUITest
implements AsyncTestUtils {
public class DebuggerStateEditingServiceTest extends AbstractGhidraHeadedDebuggerGUITest {
private DebuggerStateEditingService editingService;
private Register r0;

View File

@ -45,7 +45,6 @@ import ghidra.dbg.DebuggerObjectModel;
import ghidra.dbg.model.TestDebuggerModelFactory;
import ghidra.dbg.model.TestDebuggerObjectModel;
import ghidra.dbg.target.TargetEnvironment;
import ghidra.dbg.testutil.DebuggerModelTestUtils;
import ghidra.trace.model.Trace;
import ghidra.trace.model.thread.TraceThread;
import ghidra.util.Swing;
@ -61,8 +60,7 @@ import mockit.VerificationsInOrder;
* TODO: Cover cases where multiple recorders are present
*/
@Category(NightlyCategory.class)
public class DebuggerModelServiceTest extends AbstractGhidraHeadedDebuggerGUITest
implements DebuggerModelTestUtils {
public class DebuggerModelServiceTest extends AbstractGhidraHeadedDebuggerGUITest {
protected static final long TIMEOUT_MILLIS =
SystemUtilities.isInTestingBatchMode() ? 5000 : Long.MAX_VALUE;

View File

@ -31,7 +31,6 @@ import ghidra.app.plugin.core.debug.gui.AbstractGhidraHeadedDebuggerGUITest;
import ghidra.app.plugin.core.debug.mapping.*;
import ghidra.app.services.ActionSource;
import ghidra.app.services.TraceRecorder;
import ghidra.async.AsyncTestUtils;
import ghidra.dbg.error.DebuggerMemoryAccessException;
import ghidra.dbg.model.*;
import ghidra.dbg.target.*;
@ -52,8 +51,7 @@ import ghidra.trace.model.time.TraceSnapshot;
import ghidra.trace.model.time.TraceTimeManager;
import ghidra.util.task.TaskMonitor;
public class ObjectBasedTraceRecorderTest extends AbstractGhidraHeadedDebuggerGUITest
implements AsyncTestUtils {
public class ObjectBasedTraceRecorderTest extends AbstractGhidraHeadedDebuggerGUITest {
DebuggerMappingOpinion opinion = new ObjectBasedDebuggerMappingOpinion();
TraceRecorder recorder;

View File

@ -30,7 +30,6 @@ import ghidra.app.services.ActionSource;
import ghidra.app.services.TraceRecorder;
import ghidra.dbg.model.TestTargetStack;
import ghidra.dbg.model.TestTargetStackFrameHasRegisterBank;
import ghidra.dbg.testutil.DebuggerModelTestUtils;
import ghidra.framework.model.DomainFile;
import ghidra.trace.model.Trace;
import ghidra.trace.model.stack.TraceStack;
@ -38,8 +37,7 @@ import ghidra.trace.model.thread.TraceThread;
import ghidra.util.database.UndoableTransaction;
@Category(NightlyCategory.class) // this may actually be an @PortSensitive test
public class DebuggerTraceManagerServiceTest extends AbstractGhidraHeadedDebuggerGUITest
implements DebuggerModelTestUtils {
public class DebuggerTraceManagerServiceTest extends AbstractGhidraHeadedDebuggerGUITest {
@Test
public void testGetOpenTraces() throws Exception {

View File

@ -29,14 +29,12 @@ import ghidra.app.plugin.processors.sleigh.SleighLanguage;
import ghidra.app.services.ActionSource;
import ghidra.app.services.TraceRecorder;
import ghidra.dbg.model.TestTargetRegisterBankInThread;
import ghidra.dbg.testutil.DebuggerModelTestUtils;
import ghidra.pcode.utils.Utils;
import ghidra.program.model.lang.Register;
import ghidra.trace.model.Trace;
import ghidra.trace.model.thread.TraceThread;
public class TraceRecorderAsyncPcodeExecTest extends AbstractGhidraHeadedDebuggerGUITest
implements DebuggerModelTestUtils {
public class TraceRecorderAsyncPcodeExecTest extends AbstractGhidraHeadedDebuggerGUITest {
@Test
public void testExecutorEval() throws Throwable {