mirror of
https://github.com/NationalSecurityAgency/ghidra.git
synced 2025-10-05 19:42:36 +02:00
Test timinig fixes
This commit is contained in:
parent
cf95afc23d
commit
900513ba93
9 changed files with 111 additions and 95 deletions
|
@ -177,7 +177,9 @@ public class ClearTest extends AbstractGhidraHeadedIntegrationTest {
|
|||
public void testClearActionEnablement() throws Exception {
|
||||
|
||||
closeProgram();
|
||||
assertTrue(!clearAction.isEnabledForContext(new ActionContext()));
|
||||
|
||||
assertFalse(isEnabled(clearAction, cb.getProvider()));
|
||||
assertFalse(clearAction.isEnabledForContext(new ActionContext()));
|
||||
|
||||
showTool(tool);
|
||||
loadProgram("notepad");
|
||||
|
@ -185,10 +187,10 @@ public class ClearTest extends AbstractGhidraHeadedIntegrationTest {
|
|||
waitForSwing();
|
||||
assertTrue(cb.goToField(addr("0x10026f0"), "Address", 0, 0));
|
||||
|
||||
assertTrue(clearAction.isEnabled());
|
||||
assertTrue(isEnabled(clearAction, cb.getProvider()));
|
||||
closeProgram();
|
||||
|
||||
assertTrue(!clearAction.isEnabledForContext(new ActionContext()));
|
||||
assertFalse(isEnabled(clearAction, cb.getProvider()));
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -201,7 +203,6 @@ public class ClearTest extends AbstractGhidraHeadedIntegrationTest {
|
|||
doClearAction(true);
|
||||
|
||||
assertEquals(numInstructions, program.getListing().getNumInstructions());
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -284,7 +285,7 @@ public class ClearTest extends AbstractGhidraHeadedIntegrationTest {
|
|||
}
|
||||
|
||||
/*
|
||||
* This tests that a selection that includes the outermost header of does not change the
|
||||
* This tests that a selection that includes the outermost header of does not change the
|
||||
* selection, but instead removes the structure from the listing at that address.
|
||||
*/
|
||||
@Test
|
||||
|
@ -453,7 +454,7 @@ public class ClearTest extends AbstractGhidraHeadedIntegrationTest {
|
|||
|
||||
Symbol[] symbols = program.getSymbolTable().getSymbols(addr("0x01001010"));
|
||||
assertEquals(1, symbols.length);
|
||||
assertTrue(!symbols[0].isDynamic());
|
||||
assertFalse(symbols[0].isDynamic());
|
||||
int id = program.startTransaction("Anchor");
|
||||
symbols[0].setPinned(true);
|
||||
program.endTransaction(id, true);
|
||||
|
@ -467,7 +468,7 @@ public class ClearTest extends AbstractGhidraHeadedIntegrationTest {
|
|||
|
||||
symbols = program.getSymbolTable().getSymbols(addr("0x01001010"));
|
||||
assertEquals(1, symbols.length);
|
||||
assertTrue(!symbols[0].isDynamic());
|
||||
assertFalse(symbols[0].isDynamic());
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -639,7 +640,7 @@ public class ClearTest extends AbstractGhidraHeadedIntegrationTest {
|
|||
assertTrue(l.getNumInstructions() > 0);
|
||||
assertTrue(l.getNumDefinedData() > 0);
|
||||
|
||||
assertTrue(!program.getListing().getFunctions(true).hasNext());
|
||||
assertFalse(program.getListing().getFunctions(true).hasNext());
|
||||
|
||||
assertTrue(program.getSymbolTable().getNumSymbols() > 0);
|
||||
undo(program);
|
||||
|
@ -674,7 +675,7 @@ public class ClearTest extends AbstractGhidraHeadedIntegrationTest {
|
|||
|
||||
okOnClearDialog();
|
||||
|
||||
assertTrue(!context.hasValueOverRange(ax, BigInteger.valueOf(5),
|
||||
assertFalse(context.hasValueOverRange(ax, BigInteger.valueOf(5),
|
||||
new AddressSet(addr("0x10022cc"))));
|
||||
undo(program);
|
||||
assertTrue(context.hasValueOverRange(ax, BigInteger.valueOf(5),
|
||||
|
|
|
@ -94,8 +94,6 @@ public class QualifiedSelectionPluginTest extends AbstractGhidraHeadedIntegratio
|
|||
}
|
||||
|
||||
private void showProgramTree() {
|
||||
|
||||
ProgramTreePlugin ptree = env.getPlugin(ProgramTreePlugin.class);
|
||||
programTreeProvider = (ComponentProvider) getInstanceField("viewProvider", pt);
|
||||
tool.showComponentProvider(programTreeProvider, true);
|
||||
}
|
||||
|
@ -219,7 +217,7 @@ public class QualifiedSelectionPluginTest extends AbstractGhidraHeadedIntegratio
|
|||
@Test
|
||||
public void testSelectWithView() throws Exception {
|
||||
AddressSet rsrcSet = new AddressSet(addr("0100a000"), addr("0100f3ff"));
|
||||
JTree tree = findComponent(tool.getToolFrame(), JTree.class);
|
||||
JTree tree = waitFor(() -> findComponent(tool.getToolFrame(), JTree.class));
|
||||
|
||||
// Replace view with .rsrc
|
||||
selectTreeNodeByText(tree, ".rsrc", true);
|
||||
|
@ -396,9 +394,6 @@ public class QualifiedSelectionPluginTest extends AbstractGhidraHeadedIntegratio
|
|||
}, wait);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param instructionSet
|
||||
*/
|
||||
private void checkForInstructions(ProgramSelection instructionSet) {
|
||||
Listing listing = program.getListing();
|
||||
AddressIterator iter = instructionSet.getAddresses(true);
|
||||
|
@ -409,9 +404,6 @@ public class QualifiedSelectionPluginTest extends AbstractGhidraHeadedIntegratio
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param dataSet
|
||||
*/
|
||||
private void checkForDefinedData(ProgramSelection dataSet) {
|
||||
Listing listing = program.getListing();
|
||||
AddressIterator iter = dataSet.getAddresses(true);
|
||||
|
@ -422,9 +414,6 @@ public class QualifiedSelectionPluginTest extends AbstractGhidraHeadedIntegratio
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param undefinedSet
|
||||
*/
|
||||
private void checkForUndefined(ProgramSelection undefinedSet) {
|
||||
Listing listing = program.getListing();
|
||||
AddressIterator iter = undefinedSet.getAddresses(true);
|
||||
|
|
|
@ -97,7 +97,8 @@ public class TableChooserDialogTest extends AbstractGhidraHeadedIntegrationTest
|
|||
|
||||
Program program = builder.getProgram();
|
||||
Navigatable navigatable = null;
|
||||
dialog = new TableChooserDialog(tool, executor, program, "Dialog Title", navigatable);
|
||||
runSwing(() -> dialog =
|
||||
new TableChooserDialog(tool, executor, program, "Dialog Title", navigatable));
|
||||
|
||||
testAction = new TestAction();
|
||||
dialog.addAction(testAction);
|
||||
|
|
|
@ -43,7 +43,6 @@ public class CloseToolTest extends AbstractGhidraHeadedIntegrationTest {
|
|||
|
||||
@Before
|
||||
public void setUp() throws Exception {
|
||||
|
||||
env = new TestEnv();
|
||||
}
|
||||
|
||||
|
@ -62,7 +61,6 @@ public class CloseToolTest extends AbstractGhidraHeadedIntegrationTest {
|
|||
assertNotNull(tool.getToolFrame());
|
||||
closeTool(tool);
|
||||
assertNull("Tool did not close after task", tool.getToolFrame());
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -87,7 +85,7 @@ public class CloseToolTest extends AbstractGhidraHeadedIntegrationTest {
|
|||
assertNotNull(closeOthersAction);
|
||||
ProgramActionContext context = new ProgramActionContext(null, program1);
|
||||
assertEquals(true, closeOthersAction.isEnabledForContext(context));
|
||||
performAction(closeOthersAction, true);
|
||||
performAction(closeOthersAction, context, true);
|
||||
|
||||
allOpenPrograms = pm.getAllOpenPrograms();
|
||||
assertEquals(1, allOpenPrograms.length);
|
||||
|
@ -185,8 +183,8 @@ public class CloseToolTest extends AbstractGhidraHeadedIntegrationTest {
|
|||
}
|
||||
|
||||
//==================================================================================================
|
||||
// Inner Classes
|
||||
//==================================================================================================
|
||||
// Inner Classes
|
||||
//==================================================================================================
|
||||
|
||||
private class ControllableBackgroundCommand extends BackgroundCommand {
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue