Skip to content

Ghidra is a software reverse engineering (SRE) framework

GP-0: second pass at cleaning up Frida tests

d-millardf1c6f307efb
diff --git a/Ghidra/Debug/Debugger-agent-frida/src/test/java/agent/frida/model/invm/InVmFridaModelHost.java b/Ghidra/Debug/Debugger-agent-frida/src/main/java/agent/frida/model/invm/InVmFridaModelHost.java
similarity index 100%
rename from Ghidra/Debug/Debugger-agent-frida/src/test/java/agent/frida/model/invm/InVmFridaModelHost.java
rename to Ghidra/Debug/Debugger-agent-frida/src/main/java/agent/frida/model/invm/InVmFridaModelHost.java
diff --git a/Ghidra/Debug/Debugger-agent-frida/src/test/java/agent/frida/model/invm/InVmModelForFridaFactoryTest.java b/Ghidra/Debug/Debugger-agent-frida/src/main/java/agent/frida/model/invm/InVmModelForFridaFactoryTest.java
similarity index 100%
rename from Ghidra/Debug/Debugger-agent-frida/src/test/java/agent/frida/model/invm/InVmModelForFridaFactoryTest.java
rename to Ghidra/Debug/Debugger-agent-frida/src/main/java/agent/frida/model/invm/InVmModelForFridaFactoryTest.java
diff --git a/Ghidra/Debug/Debugger-agent-frida/src/test/java/agent/frida/model/invm/InVmModelForFridaInterpreterTest.java b/Ghidra/Debug/Debugger-agent-frida/src/main/java/agent/frida/model/invm/InVmModelForFridaInterpreterTest.java
similarity index 100%
rename from Ghidra/Debug/Debugger-agent-frida/src/test/java/agent/frida/model/invm/InVmModelForFridaInterpreterTest.java
rename to Ghidra/Debug/Debugger-agent-frida/src/main/java/agent/frida/model/invm/InVmModelForFridaInterpreterTest.java
diff --git a/Ghidra/Debug/Debugger-agent-frida/src/test/java/agent/frida/model/invm/InVmModelForFridaMethodsTest.java b/Ghidra/Debug/Debugger-agent-frida/src/main/java/agent/frida/model/invm/InVmModelForFridaMethodsTest.java
similarity index 100%
rename from Ghidra/Debug/Debugger-agent-frida/src/test/java/agent/frida/model/invm/InVmModelForFridaMethodsTest.java
rename to Ghidra/Debug/Debugger-agent-frida/src/main/java/agent/frida/model/invm/InVmModelForFridaMethodsTest.java
diff --git a/Ghidra/Debug/Debugger-agent-frida/src/test/java/agent/frida/model/invm/InVmModelForFridaRootAttacherTest.java b/Ghidra/Debug/Debugger-agent-frida/src/main/java/agent/frida/model/invm/InVmModelForFridaRootAttacherTest.java
similarity index 100%
rename from Ghidra/Debug/Debugger-agent-frida/src/test/java/agent/frida/model/invm/InVmModelForFridaRootAttacherTest.java
rename to Ghidra/Debug/Debugger-agent-frida/src/main/java/agent/frida/model/invm/InVmModelForFridaRootAttacherTest.java
diff --git a/Ghidra/Debug/Debugger-agent-frida/src/test/java/agent/frida/model/invm/InVmModelForFridaRootLauncherTest.java b/Ghidra/Debug/Debugger-agent-frida/src/main/java/agent/frida/model/invm/InVmModelForFridaRootLauncherTest.java
similarity index 100%
rename from Ghidra/Debug/Debugger-agent-frida/src/test/java/agent/frida/model/invm/InVmModelForFridaRootLauncherTest.java
rename to Ghidra/Debug/Debugger-agent-frida/src/main/java/agent/frida/model/invm/InVmModelForFridaRootLauncherTest.java
diff --git a/Ghidra/Debug/Debugger-agent-frida/src/test/java/agent/frida/model/invm/InVmModelForFridaScenarioStackTest.java b/Ghidra/Debug/Debugger-agent-frida/src/main/java/agent/frida/model/invm/InVmModelForFridaScenarioStackTest.java
similarity index 100%
rename from Ghidra/Debug/Debugger-agent-frida/src/test/java/agent/frida/model/invm/InVmModelForFridaScenarioStackTest.java
rename to Ghidra/Debug/Debugger-agent-frida/src/main/java/agent/frida/model/invm/InVmModelForFridaScenarioStackTest.java
diff --git a/Ghidra/Debug/Debugger-agent-frida/src/test/java/agent/frida/model/invm/InVmModelForFridaX64RegistersTest.java b/Ghidra/Debug/Debugger-agent-frida/src/main/java/agent/frida/model/invm/InVmModelForFridaX64RegistersTest.java
similarity index 100%
rename from Ghidra/Debug/Debugger-agent-frida/src/test/java/agent/frida/model/invm/InVmModelForFridaX64RegistersTest.java
rename to Ghidra/Debug/Debugger-agent-frida/src/main/java/agent/frida/model/invm/InVmModelForFridaX64RegistersTest.java
diff --git a/Ghidra/Debug/Debugger-agent-frida/src/test/java/agent/frida/model/AbstractModelForFridaActivationTest.java b/Ghidra/Debug/Debugger-agent-frida/src/test/java/agent/frida/model/AbstractModelForFridaActivationTest.java
index 58580cc0f8..ea472fbefd 100644
--- a/Ghidra/Debug/Debugger-agent-frida/src/test/java/agent/frida/model/AbstractModelForFridaActivationTest.java
+++ b/Ghidra/Debug/Debugger-agent-frida/src/test/java/agent/frida/model/AbstractModelForFridaActivationTest.java
@@ -43,17 +43,19 @@ import ghidra.dbg.util.PathPattern;
* result in the containing thread or frame becoming active instead. Or, activating a thread may
* result in its innermost frame becoming active as well.
*/
-public abstract class AbstractModelForFridaActivationTest extends AbstractDebuggerModelActivationTest {
+public abstract class AbstractModelForFridaActivationTest
+ extends AbstractDebuggerModelActivationTest {
@Override
@Ignore
@Test
public void testDefaultFocusIsAsExpected() throws Throwable {
+ // Disabled as of 220609
List<String> expectedDefaultFocus = getExpectedDefaultActivePath();
assumeNotNull(expectedDefaultFocus);
m.build();
- PathPattern pathPattern = new PathPattern(expectedDefaultFocus);
+ PathPattern pathPattern = new PathPattern(expectedDefaultFocus);
Set<TargetObject> activatable = getActivatableThings();
// The default must be one of the activatable objects
TargetObject obj = Unique.assertOne(activatable.stream()
@@ -69,6 +71,7 @@ public abstract class AbstractModelForFridaActivationTest extends AbstractDebugg
@Ignore
@Test
public void testActivateEachOnce() throws Throwable {
+ // Disabled as of 220609
m.build();
TargetActiveScope activeScope = findActiveScope();
@@ -87,6 +90,7 @@ public abstract class AbstractModelForFridaActivationTest extends AbstractDebugg
@Ignore
@Test
public void testActivateEachTwice() throws Throwable {
+ // Disabled as of 220609
m.build();
TargetActiveScope activeScope = findActiveScope();
@@ -109,6 +113,7 @@ public abstract class AbstractModelForFridaActivationTest extends AbstractDebugg
@Ignore
@Test
public void testActivateEachViaInterpreter() throws Throwable {
+ // Disabled as of 220609
assumeTrue(m.hasInterpreter());
m.build();
diff --git a/Ghidra/Debug/Debugger-agent-frida/src/test/java/agent/frida/model/AbstractModelForFridaFactoryTest.java b/Ghidra/Debug/Debugger-agent-frida/src/test/java/agent/frida/model/AbstractModelForFridaFactoryTest.java
index 4ac0c52009..8ebd64ea87 100644
--- a/Ghidra/Debug/Debugger-agent-frida/src/test/java/agent/frida/model/AbstractModelForFridaFactoryTest.java
+++ b/Ghidra/Debug/Debugger-agent-frida/src/test/java/agent/frida/model/AbstractModelForFridaFactoryTest.java
@@ -17,6 +17,9 @@ package agent.frida.model;
import java.util.Map;
+import org.junit.Ignore;
+import org.junit.Test;
+
import ghidra.dbg.test.AbstractDebuggerModelFactoryTest;
public abstract class AbstractModelForFridaFactoryTest extends AbstractDebuggerModelFactoryTest {
@@ -24,4 +27,47 @@ public abstract class AbstractModelForFridaFactoryTest extends AbstractDebuggerM
protected Map<String, Object> getFailingFactoryOptions() {
return Map.ofEntries();
}
+
+ @Override
+ @Ignore
+ @Test
+ public void testBuildAndClose() throws Throwable {
+ // Disabled as of 220609
+ }
+
+ @Override
+ @Ignore
+ @Test
+ public void testBuildFailingOptionsErr() throws Throwable {
+ // Disabled as of 220609
+ }
+
+ @Override
+ @Ignore
+ @Test
+ public void testPing() throws Throwable {
+ // Disabled as of 220609
+ }
+
+ @Override
+ @Ignore
+ @Test
+ public void testWaitRootAccess() throws Throwable {
+ // Disabled as of 220609
+ }
+
+ @Override
+ @Ignore
+ @Test
+ public void testHasNonEnumerableRootSchema() throws Throwable {
+ // Disabled as of 220609
+ }
+
+ @Override
+ @Ignore
+ @Test
+ public void testNonExistentPathGivesNull() throws Throwable {
+ // Disabled as of 220609
+ }
+
}
diff --git a/Ghidra/Debug/Debugger-agent-frida/src/test/java/agent/frida/model/AbstractModelForFridaInterpreterTest.java b/Ghidra/Debug/Debugger-agent-frida/src/test/java/agent/frida/model/AbstractModelForFridaInterpreterTest.java
index ae3b286bff..bad76c2ab2 100644
--- a/Ghidra/Debug/Debugger-agent-frida/src/test/java/agent/frida/model/AbstractModelForFridaInterpreterTest.java
+++ b/Ghidra/Debug/Debugger-agent-frida/src/test/java/agent/frida/model/AbstractModelForFridaInterpreterTest.java
@@ -17,6 +17,9 @@ package agent.frida.model;
import java.util.List;
+import org.junit.Ignore;
+import org.junit.Test;
+
import ghidra.dbg.target.TargetProcess;
import ghidra.dbg.test.*;
import ghidra.dbg.util.PathUtils;
@@ -81,4 +84,18 @@ public abstract class AbstractModelForFridaInterpreterTest
return FridaLinuxSpecimen.PRINT;
}
+ @Override
+ @Ignore
+ @Test
+ public void testExecute() throws Throwable {
+ // Disabled as of 220609
+ }
+
+ @Override
+ @Ignore
+ @Test
+ public void testExecuteCapture() throws Throwable {
+ // Disabled as of 220609
+ }
+
}
diff --git a/Ghidra/Debug/Debugger-agent-frida/src/test/java/agent/frida/model/AbstractModelForFridaMethodsTest.java b/Ghidra/Debug/Debugger-agent-frida/src/test/java/agent/frida/model/AbstractModelForFridaMethodsTest.java
index 798367f849..b46371c964 100644
--- a/Ghidra/Debug/Debugger-agent-frida/src/test/java/agent/frida/model/AbstractModelForFridaMethodsTest.java
+++ b/Ghidra/Debug/Debugger-agent-frida/src/test/java/agent/frida/model/AbstractModelForFridaMethodsTest.java
@@ -97,6 +97,7 @@ public abstract class AbstractModelForFridaMethodsTest extends AbstractDebuggerM
List.of(AssertionError.class));
}
+ @Override
protected void runTestKill(DebuggerTestSpecimen specimen) throws Throwable {
TargetProcess process = retryForProcessRunning(specimen, this);
TargetKillable killable = m.suitable(TargetKillable.class, process.getPath());
@@ -110,8 +111,10 @@ public abstract class AbstractModelForFridaMethodsTest extends AbstractDebuggerM
runTestResumeTerminates(specimen);
}
+ @Ignore
@Test
public void testLaunchResumeKill() throws Throwable {
+ // Disabled as of 220609
assumeTrue(m.hasKillableProcesses());
m.build();
@@ -126,6 +129,7 @@ public abstract class AbstractModelForFridaMethodsTest extends AbstractDebuggerM
@Ignore
@Test
public void testScan() throws Throwable {
+ // Disabled as of 220609
assumeTrue(m.hasKillableProcesses());
m.build();
@@ -192,8 +196,10 @@ public abstract class AbstractModelForFridaMethodsTest extends AbstractDebuggerM
runTestKill(specimen);
}
+ @Ignore
@Test
public void testInterceptor() throws Throwable {
+ // Disabled as of 220609
assumeTrue(m.hasKillableProcesses());
m.build();
@@ -222,8 +228,10 @@ public abstract class AbstractModelForFridaMethodsTest extends AbstractDebuggerM
runTestKill(specimen);
}
+ @Ignore
@Test
public void testStalker() throws Throwable {
+ // Disabled as of 220609
assumeTrue(m.hasKillableProcesses());
m.build();
diff --git a/Ghidra/Debug/Debugger-agent-frida/src/test/java/agent/frida/model/AbstractModelForFridaRootAttacherTest.java b/Ghidra/Debug/Debugger-agent-frida/src/test/java/agent/frida/model/AbstractModelForFridaRootAttacherTest.java
index c2c48af353..253c4d260c 100644
--- a/Ghidra/Debug/Debugger-agent-frida/src/test/java/agent/frida/model/AbstractModelForFridaRootAttacherTest.java
+++ b/Ghidra/Debug/Debugger-agent-frida/src/test/java/agent/frida/model/AbstractModelForFridaRootAttacherTest.java
@@ -15,22 +15,18 @@
*/
package agent.frida.model;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.*;
import java.util.List;
import java.util.concurrent.TimeUnit;
-import org.junit.After;
-import org.junit.Ignore;
-import org.junit.Test;
+import org.junit.*;
import agent.frida.model.iface1.FridaModelTargetKillable;
import ghidra.dbg.DebugModelConventions;
-import ghidra.dbg.target.TargetEnvironment;
-import ghidra.dbg.target.TargetKillable;
+import ghidra.dbg.error.DebuggerIllegalArgumentException;
+import ghidra.dbg.target.*;
import ghidra.dbg.target.TargetMethod.TargetParameterMap;
-import ghidra.dbg.target.TargetProcess;
import ghidra.dbg.test.AbstractDebuggerModelAttacherTest;
import ghidra.dbg.util.PathUtils;
import ghidra.util.Msg;
@@ -68,6 +64,7 @@ public abstract class AbstractModelForFridaRootAttacherTest
@Ignore
@After
public void tearDownDebuggerModelTest() throws Throwable {
+ // Disabled as of 220609
/**
* NB. Model has to be closed before dummy. If dummy is suspended by a debugger, terminating
* it, even forcibly, may fail.
@@ -84,16 +81,18 @@ public abstract class AbstractModelForFridaRootAttacherTest
}
}
+ @Override
@Ignore
@Test
public void testAttachByPidThenResumeInterrupt() throws Throwable {
}
+ @Override
@Ignore
@Test
public void testAttachByPidThenKill() throws Throwable {
}
-
+
@Override
protected void runTestKill(DebuggerTestSpecimen specimen)
throws Throwable {
@@ -105,4 +104,61 @@ public abstract class AbstractModelForFridaRootAttacherTest
retryVoid(() -> assertFalse(DebugModelConventions.isProcessAlive(process)),
List.of(AssertionError.class));
}
+
+ @Override
+ @Ignore
+ @Test
+ public void testAttacherIsWhereExpected() throws Throwable {
+ // Disabled as of 220609
+ }
+
+ @Override
+ @Ignore
+ @Test
+ public void testAttachableContainerIsWhereExpected() throws Throwable {
+ // Disabled as of 220609
+ }
+
+ @Override
+ @Ignore
+ @Test
+ public void testListAttachable() throws Throwable {
+ // Disabled as of 220609
+ }
+
+ @Override
+ @Ignore
+ @Test
+ public void testAttachByPid() throws Throwable {
+ // Disabled as of 220609
+ }
+
+ @Override
+ @Ignore
+ @Test
+ public void testAttachByObj() throws Throwable {
+ // Disabled as of 220609
+ }
+
+ @Override
+ @Ignore
+ @Test(expected = DebuggerIllegalArgumentException.class)
+ public void testAttachByObjBogusThrowsException() throws Throwable {
+ // Disabled as of 220609
+ }
+
+ @Override
+ @Ignore
+ @Test
+ public void testAttachByPidThenDetach() throws Throwable {
+ // Disabled as of 220609
+ }
+
+ @Override
+ @Ignore
+ @Test
+ public void testAttachShowsInProcessContainer() throws Throwable {
+ // Disabled as of 220609
+ }
+
}
diff --git a/Ghidra/Debug/Debugger-agent-frida/src/test/java/agent/frida/model/AbstractModelForFridaRootLauncherTest.java b/Ghidra/Debug/Debugger-agent-frida/src/test/java/agent/frida/model/AbstractModelForFridaRootLauncherTest.java
index 207066aa65..e24606daa6 100644
--- a/Ghidra/Debug/Debugger-agent-frida/src/test/java/agent/frida/model/AbstractModelForFridaRootLauncherTest.java
+++ b/Ghidra/Debug/Debugger-agent-frida/src/test/java/agent/frida/model/AbstractModelForFridaRootLauncherTest.java
@@ -15,21 +15,19 @@
*/
package agent.frida.model;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.*;
import java.util.List;
import java.util.Map;
+import org.junit.Ignore;
+import org.junit.Test;
+
import ghidra.dbg.DebugModelConventions.AsyncState;
-import ghidra.dbg.target.TargetDetachable;
-import ghidra.dbg.target.TargetEnvironment;
-import ghidra.dbg.target.TargetExecutionStateful;
+import ghidra.dbg.target.*;
import ghidra.dbg.target.TargetExecutionStateful.TargetExecutionState;
import ghidra.dbg.target.TargetMethod.ParameterDescription;
import ghidra.dbg.target.TargetMethod.TargetParameterMap;
-import ghidra.dbg.target.TargetProcess;
-import ghidra.dbg.target.TargetResumable;
import ghidra.dbg.test.AbstractDebuggerModelLauncherTest;
import ghidra.dbg.util.PathUtils;
@@ -60,6 +58,7 @@ public abstract class AbstractModelForFridaRootLauncherTest
assertTrue(environment.getDebugger().toLowerCase().contains("frida"));
}
+ @Override
protected void runTestDetach(DebuggerTestSpecimen specimen)
throws Throwable {
TargetProcess process = retryForProcessRunning(specimen, this);
@@ -67,7 +66,8 @@ public abstract class AbstractModelForFridaRootLauncherTest
waitAcc(detachable);
waitOn(detachable.detach());
}
-
+
+ @Override
protected void runTestResumeTerminates(DebuggerTestSpecimen specimen) throws Throwable {
TargetProcess process = retryForProcessRunning(specimen, this);
TargetResumable resumable = m.suitable(TargetResumable.class, process.getPath());
@@ -78,4 +78,53 @@ public abstract class AbstractModelForFridaRootLauncherTest
waitOn(resumable.resume());
}
+ @Override
+ @Ignore
+ @Test
+ public void testLauncherIsWhereExpected() throws Throwable {
+ // Disabled as of 220609
+ }
+
+ @Override
+ @Ignore
+ @Test
+ public void testLaunchParameters() throws Throwable {
+ // Disabled as of 220609
+ }
+
+ @Override
+ @Ignore
+ @Test
+ public void testLaunch() throws Throwable {
+ // Disabled as of 220609
+ }
+
+ @Override
+ @Ignore
+ @Test
+ public void testLaunchThenDetach() throws Throwable {
+ // Disabled as of 220609
+ }
+
+ @Override
+ @Ignore
+ @Test
+ public void testLaunchThenKill() throws Throwable {
+ // Disabled as of 220609
+ }
+
+ @Override
+ @Ignore
+ @Test
+ public void testLaunchThenResume() throws Throwable {
+ // Disabled as of 220609
+ }
+
+ @Override
+ @Ignore
+ @Test
+ public void testLaunchShowsInProcessContainer() throws Throwable {
+ // Disabled as of 220609
+ }
+
}
diff --git a/Ghidra/Debug/Debugger-agent-frida/src/test/java/agent/frida/model/AbstractModelForFridaX64RegistersTest.java b/Ghidra/Debug/Debugger-agent-frida/src/test/java/agent/frida/model/AbstractModelForFridaX64RegistersTest.java
index d65418f0c9..0cf7af739e 100644
--- a/Ghidra/Debug/Debugger-agent-frida/src/test/java/agent/frida/model/AbstractModelForFridaX64RegistersTest.java
+++ b/Ghidra/Debug/Debugger-agent-frida/src/test/java/agent/frida/model/AbstractModelForFridaX64RegistersTest.java
@@ -61,22 +61,23 @@ public abstract class AbstractModelForFridaX64RegistersTest
public DebuggerTestSpecimen getLaunchSpecimen() {
return FridaLinuxSpecimen.SPIN_STRIPPED;
}
-
+
@Override
protected TargetObject maybeSubstituteThread(TargetObject target) throws Throwable {
FridaModelTargetProcess fproc = (FridaModelTargetProcess) target;
waitOn(fproc.resume());
- FridaModelTargetThreadContainerImpl threads = (FridaModelTargetThreadContainerImpl) fproc.getCachedAttribute("Threads");
+ FridaModelTargetThreadContainerImpl threads =
+ (FridaModelTargetThreadContainerImpl) fproc.getCachedAttribute("Threads");
waitOn(threads.fetchElements());
TargetThread thread = findAnyThread(target.getPath());
return thread == null ? target : thread;
}
-
@Override
@Ignore
@Test
public void testRegistersHaveExpectedSizes() throws Throwable {
+ // Disabled as of 220609
m.build();
TargetObject target = maybeSubstituteThread(obtainTarget());
@@ -98,6 +99,7 @@ public abstract class AbstractModelForFridaX64RegistersTest
@Ignore
@Test
public void testRegisterBankIsWhereExpected() throws Throwable {
+ // Disabled as of 220609
m.build();
TargetObject target = maybeSubstituteThread(obtainTarget());
@@ -116,6 +118,7 @@ public abstract class AbstractModelForFridaX64RegistersTest
@Ignore
@Test
public void testReadRegisters() throws Throwable {
+ // Disabled as of 220609
m.build();
TargetObject target = maybeSubstituteThread(obtainTarget());
@@ -172,5 +175,5 @@ public abstract class AbstractModelForFridaX64RegistersTest
assertEquals("Not all registers were read, or extras were read", write.keySet(),
read.keySet());
}
-
+
}