Merge remote-tracking branch 'origin/GP-0-dragonmacher-test-cleanup-update'

This commit is contained in:
ghidra1
2022-04-19 18:12:36 -04:00
2 changed files with 17 additions and 0 deletions

View File

@@ -21,6 +21,8 @@ import java.io.File;
import java.io.IOException;
import java.util.*;
import org.junit.BeforeClass;
import docking.test.AbstractDockingTest;
import ghidra.GhidraTestApplicationLayout;
import ghidra.app.events.ProgramLocationPluginEvent;
@@ -96,6 +98,15 @@ public abstract class AbstractGhidraHeadlessIntegrationTest extends AbstractDock
System.setProperty(GhidraScriptConstants.USER_SCRIPTS_DIR_PROPERTY, getTestDirectoryPath());
}
@BeforeClass
public static void cleanDbTestDir() {
// keep files around in batch mode to allow tests to run faster; assume batch mode performs
// its own cleanup; only run once per class to allow subsequent tests to be faster
if (!BATCH_MODE) {
TestProgramManager.cleanDbTestDir();
}
}
public static boolean deleteProject(String directory, String name) {
return ProjectTestUtils.deleteProject(directory, name);
}

View File

@@ -431,6 +431,12 @@ public class TestProgramManager {
return dbTestDir;
}
public static void cleanDbTestDir() {
File dir = getDbTestDir();
Msg.debug(TestProgramManager.class, "Deleting test db cache dir: " + dir);
FileUtilities.deleteDir(dir);
}
private static File getTestDBDirectory() {
String testDirPath = AbstractGTest.getTestDirectoryPath();
File dir = new File(testDirPath, DB_DIR_NAME);