GP-2677: Fix and enable tests

This commit is contained in:
Dan
2023-08-04 14:29:45 -04:00
committed by Ryan Kurtz
parent 689064b590
commit 75677b729f
31 changed files with 236 additions and 274 deletions

View File

@@ -20,7 +20,9 @@ import java.util.List;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.TimeoutException;
import generic.jar.ResourceFile;
import ghidra.framework.Application;
import ghidra.framework.Platform;
import ghidra.util.Msg;
public class DummyProc implements AutoCloseable {
@@ -28,15 +30,34 @@ public class DummyProc implements AutoCloseable {
public final long pid;
public static String which(String cmd) {
// Try the os/<platform>/ directory
try {
return Application.getOSFile(cmd).getAbsolutePath();
}
catch (Exception e) {
// fallback to system
// just try next strategy
}
// Try the build/exe/<cmd>/ and build/exe/<cmd>/<platform>/ directory
for (ResourceFile modRoot : Application.getModuleRootDirectories()) {
ResourceFile exe = new ResourceFile(modRoot, "build/exe/" + cmd + "/" + cmd);
if (exe.exists() && exe.getFile(false).canExecute()) {
return exe.getAbsolutePath();
}
ResourceFile platformExe = new ResourceFile(modRoot,
"build/exe/" + cmd + "/" + Platform.CURRENT_PLATFORM.getDirectoryName() + "/" +
cmd);
if (platformExe.exists() && platformExe.getFile(false).canExecute()) {
return platformExe.getAbsolutePath();
}
}
// Try the current directory
if (new File(cmd).canExecute()) {
return cmd;
}
// Try the system PATH
String line;
try {
boolean isWindows = System.getProperty("os.name").toLowerCase().contains("windows");