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