mirror of
https://github.com/NationalSecurityAgency/ghidra.git
synced 2025-10-06 12:00:04 +02:00
GP-0 corrected test issues
This commit is contained in:
parent
0d33fa9b24
commit
a3fe3d4dbc
3 changed files with 30 additions and 5 deletions
|
@ -597,6 +597,15 @@ public class ProgramBuilder {
|
|||
returnType, params);
|
||||
}
|
||||
|
||||
public void deleteFunction(String address) throws Exception {
|
||||
|
||||
tx(() -> {
|
||||
Address entryPoint = addr(address);
|
||||
FunctionManager functionManager = program.getFunctionManager();
|
||||
functionManager.removeFunction(entryPoint);
|
||||
});
|
||||
}
|
||||
|
||||
public Library createLibrary(String libraryName)
|
||||
throws DuplicateNameException, InvalidInputException {
|
||||
return createLibrary(libraryName, SourceType.USER_DEFINED);
|
||||
|
|
|
@ -341,6 +341,12 @@ public abstract class AbstractStackEditorTest extends AbstractEditorTest {
|
|||
waitForBusyTool(tool);
|
||||
}
|
||||
|
||||
void deleteFunction(String address) throws Exception {
|
||||
setLocation(address);
|
||||
builder.deleteFunction(address);
|
||||
waitForBusyTool(tool);
|
||||
}
|
||||
|
||||
void analyzeStack(String address) {
|
||||
setLocation(address);
|
||||
DockingActionIf analyzeStack =
|
||||
|
|
|
@ -25,6 +25,7 @@ import javax.swing.SwingUtilities;
|
|||
import org.junit.Test;
|
||||
|
||||
import docking.action.DockingActionIf;
|
||||
import ghidra.app.util.datatype.EmptyCompositeException;
|
||||
import ghidra.framework.options.Options;
|
||||
import ghidra.program.model.data.*;
|
||||
import ghidra.program.model.listing.*;
|
||||
|
@ -139,10 +140,12 @@ public class StackEditorProvider1Test extends AbstractStackEditorProviderTest {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testUndoAssociatedFunctionCreate() throws Exception {
|
||||
public void testDeleteAssociatedFunction() throws Exception {
|
||||
Window dialog;
|
||||
// Create the stack frame @ 00000200.
|
||||
createFunction("0x200");
|
||||
waitForBusyTool(tool); // wait for analysis to complete
|
||||
|
||||
editStack("0x200");
|
||||
|
||||
Function f = program.getFunctionManager().getFunctionAt(addr("0x200"));
|
||||
|
@ -159,16 +162,23 @@ public class StackEditorProvider1Test extends AbstractStackEditorProviderTest {
|
|||
// Put byte at -0x18
|
||||
setType(new ByteDataType(), 0);
|
||||
|
||||
// Undo the apply of a new data type to an editor component.
|
||||
undo(program, false); // don't wait, in case there is a modal dialog
|
||||
waitForSwing();
|
||||
runSwing(() -> {
|
||||
try {
|
||||
model.apply();
|
||||
}
|
||||
catch (EmptyCompositeException | InvalidDataTypeException e) {
|
||||
failWithException("Editor apply failure", e);
|
||||
}
|
||||
});
|
||||
|
||||
deleteFunction("0x200");
|
||||
|
||||
// Verify the Reload Stack Editor? dialog is not displayed.
|
||||
dialog = getWindow("Reload Stack Editor?");
|
||||
assertNull(dialog);
|
||||
|
||||
// Verify the stack editor is not displayed.
|
||||
assertStackEditorHidden(f);
|
||||
assertStackEditorHidden(f); // This occurs if function is removed
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue