Ghidra is a software reverse engineering (SRE) framework
script tests should wipe the directory after each test
Jason P. Leasureb569c79baf71
diff --git a/Ghidra/Features/Base/src/test.slow/java/ghidra/app/plugin/core/script/AbstractGhidraScriptMgrPluginTest.java b/Ghidra/Features/Base/src/test.slow/java/ghidra/app/plugin/core/script/AbstractGhidraScriptMgrPluginTest.javaindex 73872efc9b..73b1918169 100644--- a/Ghidra/Features/Base/src/test.slow/java/ghidra/app/plugin/core/script/AbstractGhidraScriptMgrPluginTest.java+++ b/Ghidra/Features/Base/src/test.slow/java/ghidra/app/plugin/core/script/AbstractGhidraScriptMgrPluginTest.java@@ -20,6 +20,7 @@ import static org.junit.Assert.*;import java.awt.Window;import java.io.*;import java.lang.reflect.InvocationTargetException;+import java.nio.file.Files;import java.util.*;import java.util.concurrent.CountDownLatch;import java.util.concurrent.TimeUnit;@@ -165,9 +166,21 @@ public abstract class AbstractGhidraScriptMgrPluginTesttestScriptFile.delete();}+ wipeUserScripts();+env.dispose();}+ protected void wipeUserScripts() throws IOException {+ java.nio.file.Path userScriptDir =+ java.nio.file.Paths.get(GhidraScriptUtil.USER_SCRIPTS_DIR);+ Iterator<java.nio.file.Path> it = Files.list(userScriptDir).iterator();+ while (it.hasNext()) {+ Files.walk(it.next()).sorted(Comparator.reverseOrder()).map(+ java.nio.file.Path::toFile).forEach(File::delete);+ }+ }+//==================================================================================================// Private Methods//==================================================================================================