GP-0: Improve pop-up test reliability. Fix typo in GDB.

This commit is contained in:
Dan 2024-02-20 12:20:52 -05:00
parent f5008f9f99
commit 0432872e22
3 changed files with 74 additions and 41 deletions

View File

@ -484,7 +484,7 @@ def launch_loader(inferior: sch.Schema('Inferior'),
''')
@REGISTRY.method(action='launch', display='Land and Run')
@REGISTRY.method(action='launch', display='Launch and Run')
def launch_run(inferior: sch.Schema('Inferior'),
file: ParamDesc(str, display='File'),
args: ParamDesc(str, display='Arguments')=''):

View File

@ -412,6 +412,16 @@ public abstract class AbstractGhidraHeadedDebuggerTest
robot.keyRelease(KeyEvent.VK_ESCAPE);
}
protected static void escapePopupMenu() {
waitForPass(noExc(() -> {
pressEscape();
assertEquals(0, runSwing(() -> {
return MenuSelectionManager.defaultManager().getSelectedPath().length;
}).intValue());
}));
waitForSwing();
}
protected static Point getViewportPosition(Component comp) {
Component parent = comp.getParent();
if (!(parent instanceof JViewport)) {

View File

@ -346,26 +346,31 @@ public abstract class AbstractDebuggerBreakpointMarkerPluginTest<T>
waitForPass(
() -> assertEquals(State.ENABLED, lb.computeStateForProgram(program)));
clickListing(codeBrowserPlugin.getListingPanel(), addr(program, 0x00400123),
MouseEvent.BUTTON3);
assertMenu(POPUP_ACTIONS,
Set.of(AbstractSetBreakpointAction.NAME, AbstractToggleBreakpointAction.NAME,
waitForPass(noExc(() -> {
clickListing(codeBrowserPlugin.getListingPanel(), addr(program, 0x00400123),
MouseEvent.BUTTON3);
assertMenu(POPUP_ACTIONS, Set.of(
AbstractSetBreakpointAction.NAME, AbstractToggleBreakpointAction.NAME,
AbstractDisableBreakpointAction.NAME, AbstractClearBreakpointAction.NAME));
}));
escapePopupMenu();
pressEscape();
lb.disableForProgram();
waitForDomainObject(program);
waitForPass(
() -> assertEquals(State.INCONSISTENT_DISABLED, lb.computeStateForProgram(program)));
() -> assertEquals(State.INCONSISTENT_DISABLED,
lb.computeStateForProgram(program)));
clickListing(codeBrowserPlugin.getListingPanel(), addr(program, 0x00400123),
MouseEvent.BUTTON3);
assertMenu(POPUP_ACTIONS,
Set.of(AbstractSetBreakpointAction.NAME, AbstractToggleBreakpointAction.NAME,
AbstractEnableBreakpointAction.NAME, AbstractDisableBreakpointAction.NAME,
AbstractClearBreakpointAction.NAME));
waitForPass(noExc(() -> {
clickListing(codeBrowserPlugin.getListingPanel(), addr(program, 0x00400123),
MouseEvent.BUTTON3);
assertMenu(POPUP_ACTIONS,
Set.of(AbstractSetBreakpointAction.NAME, AbstractToggleBreakpointAction.NAME,
AbstractEnableBreakpointAction.NAME, AbstractDisableBreakpointAction.NAME,
AbstractClearBreakpointAction.NAME));
}));
escapePopupMenu();
pressEscape();
CompletableFuture<Void> dis = lb.disableForTrace(trace);
handleToggleBreakpointInvocation(Unique.assertOne(lb.getTraceBreakpoints(trace)), false);
waitOn(dis);
@ -373,24 +378,29 @@ public abstract class AbstractDebuggerBreakpointMarkerPluginTest<T>
waitForPass(
() -> assertEquals(State.DISABLED, lb.computeStateForProgram(program)));
clickListing(codeBrowserPlugin.getListingPanel(), addr(program, 0x00400123),
MouseEvent.BUTTON3);
assertMenu(POPUP_ACTIONS,
Set.of(AbstractSetBreakpointAction.NAME, AbstractToggleBreakpointAction.NAME,
AbstractEnableBreakpointAction.NAME, AbstractClearBreakpointAction.NAME));
waitForPass(noExc(() -> {
clickListing(codeBrowserPlugin.getListingPanel(), addr(program, 0x00400123),
MouseEvent.BUTTON3);
assertMenu(POPUP_ACTIONS,
Set.of(AbstractSetBreakpointAction.NAME, AbstractToggleBreakpointAction.NAME,
AbstractEnableBreakpointAction.NAME, AbstractClearBreakpointAction.NAME));
}));
escapePopupMenu();
pressEscape();
lb.enableForProgram();
waitForDomainObject(program);
waitForPass(
() -> assertEquals(State.INCONSISTENT_ENABLED, lb.computeStateForProgram(program)));
clickListing(codeBrowserPlugin.getListingPanel(), addr(program, 0x00400123),
MouseEvent.BUTTON3);
assertMenu(POPUP_ACTIONS,
Set.of(AbstractSetBreakpointAction.NAME, AbstractToggleBreakpointAction.NAME,
AbstractEnableBreakpointAction.NAME, AbstractDisableBreakpointAction.NAME,
AbstractClearBreakpointAction.NAME));
waitForPass(noExc(() -> {
clickListing(codeBrowserPlugin.getListingPanel(), addr(program, 0x00400123),
MouseEvent.BUTTON3);
assertMenu(POPUP_ACTIONS,
Set.of(AbstractSetBreakpointAction.NAME, AbstractToggleBreakpointAction.NAME,
AbstractEnableBreakpointAction.NAME, AbstractDisableBreakpointAction.NAME,
AbstractClearBreakpointAction.NAME));
}));
escapePopupMenu();
// TODO: Margin, too?
}
@ -405,24 +415,30 @@ public abstract class AbstractDebuggerBreakpointMarkerPluginTest<T>
waitForPass(
() -> assertEquals(State.ENABLED, lb.computeStateForTrace(trace)));
clickListing(listingPlugin.getListingPanel(), addr(trace, 0x55550123), MouseEvent.BUTTON3);
assertMenu(POPUP_ACTIONS,
Set.of(AbstractSetBreakpointAction.NAME, AbstractToggleBreakpointAction.NAME,
waitForPass(noExc(() -> {
clickListing(listingPlugin.getListingPanel(), addr(trace, 0x55550123),
MouseEvent.BUTTON3);
assertMenu(POPUP_ACTIONS, Set.of(
AbstractSetBreakpointAction.NAME, AbstractToggleBreakpointAction.NAME,
AbstractDisableBreakpointAction.NAME, AbstractClearBreakpointAction.NAME));
}));
escapePopupMenu();
pressEscape();
lb.disableForProgram(); // Adds "enable", which will only affect bookmark
waitForDomainObject(program);
waitForPass(
() -> assertEquals(State.INCONSISTENT_ENABLED, lb.computeStateForTrace(trace)));
clickListing(listingPlugin.getListingPanel(), addr(trace, 0x55550123), MouseEvent.BUTTON3);
assertMenu(POPUP_ACTIONS,
Set.of(AbstractSetBreakpointAction.NAME, AbstractToggleBreakpointAction.NAME,
waitForPass(noExc(() -> {
clickListing(listingPlugin.getListingPanel(), addr(trace, 0x55550123),
MouseEvent.BUTTON3);
assertMenu(POPUP_ACTIONS, Set.of(
AbstractSetBreakpointAction.NAME, AbstractToggleBreakpointAction.NAME,
AbstractEnableBreakpointAction.NAME, AbstractDisableBreakpointAction.NAME,
AbstractClearBreakpointAction.NAME));
}));
escapePopupMenu();
pressEscape();
CompletableFuture<Void> dis = lb.disableForTrace(trace);
handleToggleBreakpointInvocation(Unique.assertOne(lb.getTraceBreakpoints(trace)), false);
waitOn(dis);
@ -430,22 +446,29 @@ public abstract class AbstractDebuggerBreakpointMarkerPluginTest<T>
waitForPass(
() -> assertEquals(State.DISABLED, lb.computeStateForTrace(trace)));
clickListing(listingPlugin.getListingPanel(), addr(trace, 0x55550123), MouseEvent.BUTTON3);
assertMenu(POPUP_ACTIONS,
Set.of(AbstractSetBreakpointAction.NAME, AbstractToggleBreakpointAction.NAME,
waitForPass(noExc(() -> {
clickListing(listingPlugin.getListingPanel(), addr(trace, 0x55550123),
MouseEvent.BUTTON3);
assertMenu(POPUP_ACTIONS, Set.of(
AbstractSetBreakpointAction.NAME, AbstractToggleBreakpointAction.NAME,
AbstractEnableBreakpointAction.NAME, AbstractClearBreakpointAction.NAME));
}));
escapePopupMenu();
pressEscape();
lb.enableForProgram(); // This time, adds "disable", which will only affect bookmark
waitForDomainObject(program);
waitForPass(
() -> assertEquals(State.INCONSISTENT_DISABLED, lb.computeStateForTrace(trace)));
clickListing(listingPlugin.getListingPanel(), addr(trace, 0x55550123), MouseEvent.BUTTON3);
assertMenu(POPUP_ACTIONS,
Set.of(AbstractSetBreakpointAction.NAME, AbstractToggleBreakpointAction.NAME,
waitForPass(noExc(() -> {
clickListing(listingPlugin.getListingPanel(), addr(trace, 0x55550123),
MouseEvent.BUTTON3);
assertMenu(POPUP_ACTIONS, Set.of(
AbstractSetBreakpointAction.NAME, AbstractToggleBreakpointAction.NAME,
AbstractEnableBreakpointAction.NAME, AbstractDisableBreakpointAction.NAME,
AbstractClearBreakpointAction.NAME));
}));
escapePopupMenu();
// TODO: Should mixed trace enablement be considered?
// TODO: Margin, too?