diff options
7 files changed, 85 insertions, 14 deletions
diff --git a/testing/newsrc/org/aspectj/testing/CompileSpec.java b/testing/newsrc/org/aspectj/testing/CompileSpec.java index 714158a11..22570e3d1 100644 --- a/testing/newsrc/org/aspectj/testing/CompileSpec.java +++ b/testing/newsrc/org/aspectj/testing/CompileSpec.java @@ -16,6 +16,7 @@ import java.util.ArrayList; import java.util.List; import java.util.StringTokenizer; +import org.aspectj.testing.util.TestUtil; import org.aspectj.tools.ajc.AjcTestCase; import org.aspectj.tools.ajc.CompilationResult; @@ -31,6 +32,7 @@ public class CompileSpec implements ITestStep { private boolean includeClassesDir; private String aspectpath; private String classpath; + private String modulepath; private String inpath; private String sourceroots; private String outjar; @@ -97,6 +99,14 @@ public class CompileSpec implements ITestStep { public void setClasspath(String classpath) { this.classpath = classpath.replace(',',File.pathSeparatorChar); } + + public String getModulepath() { + return this.modulepath; + } + + public void setModulepath(String modulepath) { + this.modulepath = modulepath.replace(',', File.pathSeparatorChar); + } /** * @return Returns the files. */ @@ -241,6 +251,11 @@ public class CompileSpec implements ITestStep { args.append(getClasspath()); args.append(" "); } + if (getModulepath() != null) { + args.append("-p "); + args.append(rewrite(getModulepath())); + args.append(" "); + } if (getXlintfile() != null) { args.append("-Xlintfile "); args.append(getXlintfile()); @@ -287,6 +302,11 @@ public class CompileSpec implements ITestStep { return ret; } + private String rewrite(String path) { + path = path.replace("$runtime", TestUtil.aspectjrtPath().toString()); + return path; + } + protected AjcTestCase.MessageSpec buildMessageSpec() { List<AjcTestCase.Message> infos = null; List<AjcTestCase.Message> warnings = new ArrayList<AjcTestCase.Message>(); diff --git a/testing/newsrc/org/aspectj/testing/FileSpec.java b/testing/newsrc/org/aspectj/testing/FileSpec.java index 448e5e34e..f9876928b 100644 --- a/testing/newsrc/org/aspectj/testing/FileSpec.java +++ b/testing/newsrc/org/aspectj/testing/FileSpec.java @@ -40,10 +40,25 @@ public class FileSpec implements ITestStep { public void execute(AjcTestCase inTestCase) { File sandbox = inTestCase.getSandboxDirectory(); if (toDelete != null) { - new File(sandbox, toDelete).delete(); + File targetForDeletion = new File(sandbox, toDelete); + if (targetForDeletion.isFile()) { + targetForDeletion.delete(); + } else { + recursiveDelete(targetForDeletion); + } } } + private void recursiveDelete(File toDelete) { + if (toDelete.isDirectory()) { + File[] files = toDelete.listFiles(); + for (File f: files) { + recursiveDelete(f); + } + } + toDelete.delete(); + } + public void setBaseDir(String dir) { // this.dir = dir; } diff --git a/testing/newsrc/org/aspectj/testing/RunSpec.java b/testing/newsrc/org/aspectj/testing/RunSpec.java index 2309788bc..9d21b599c 100644 --- a/testing/newsrc/org/aspectj/testing/RunSpec.java +++ b/testing/newsrc/org/aspectj/testing/RunSpec.java @@ -21,6 +21,9 @@ import java.util.StringTokenizer; import org.aspectj.tools.ajc.AjcTestCase; import org.aspectj.util.FileUtil; +import org.aspectj.util.LangUtil; +import org.aspectj.weaver.Utils; +import org.aspectj.weaver.bcel.Utility; /** * @author Adrian Colyer @@ -29,9 +32,11 @@ public class RunSpec implements ITestStep { private List<ExpectedMessageSpec> expected = new ArrayList<ExpectedMessageSpec>(); private String classToRun; + private String moduleToRun; // alternative to classToRun on JDK9+ private String baseDir; private String options; private String cpath; + private String mpath; private String orderedStderr; private AjcTest myTest; private OutputSpec stdErrSpec; @@ -59,9 +64,9 @@ public class RunSpec implements ITestStep { try { setSystemProperty("test.base.dir", inTestCase.getSandboxDirectory().getAbsolutePath()); - AjcTestCase.RunResult rr = inTestCase.run(getClassToRun(), args, vmargs, getClasspath(), useLtw, "true".equalsIgnoreCase(usefullltw)); + AjcTestCase.RunResult rr = inTestCase.run(getClassToRun(), getModuleToRun(), args, vmargs, getClasspath(), getModulepath(), useLtw, "true".equalsIgnoreCase(usefullltw)); - if (stdErrSpec != null) { + if (stdErrSpec != null) { stdErrSpec.matchAgainst(rr.getStdErr(), orderedStderr); } if (stdOutSpec != null) { @@ -129,6 +134,16 @@ public class RunSpec implements ITestStep { return this.cpath.replace('/', File.separatorChar).replace(',', File.pathSeparatorChar); } + public String getModulepath() { + if (mpath == null) + return null; + return this.mpath.replace('/', File.separatorChar).replace(',', File.pathSeparatorChar); + } + + public void setModulepath(String mpath) { + this.mpath = mpath; + } + public void setClasspath(String cpath) { this.cpath = cpath; } @@ -144,20 +159,22 @@ public class RunSpec implements ITestStep { public void setOrderedStderr(String orderedStderr) { this.orderedStderr = orderedStderr; } - - /** - * @return Returns the classToRun. - */ + public String getClassToRun() { return classToRun; } - - /** - * @param classToRun The classToRun to set. - */ + public void setClassToRun(String classToRun) { this.classToRun = classToRun; } + + public void setModuleToRun(String moduleToRun) { + this.moduleToRun = moduleToRun; + } + + public String getModuleToRun() { + return this.moduleToRun; + } public String getLtwFile() { return ltwFile; diff --git a/testing/newsrc/org/aspectj/testing/XMLBasedAjcTestCase.java b/testing/newsrc/org/aspectj/testing/XMLBasedAjcTestCase.java index 18b9233dc..fa47c98c4 100644 --- a/testing/newsrc/org/aspectj/testing/XMLBasedAjcTestCase.java +++ b/testing/newsrc/org/aspectj/testing/XMLBasedAjcTestCase.java @@ -202,6 +202,7 @@ public abstract class XMLBasedAjcTestCase extends AjcTestCase { digester.addSetNext("suite/ajc-test/file", "addTestStep", "org.aspectj.testing.ITestStep"); digester.addObjectCreate("suite/ajc-test/run", RunSpec.class); digester.addSetProperties("suite/ajc-test/run", "class", "classToRun"); + digester.addSetProperties("suite/ajc-test/run", "module", "moduleToRun"); digester.addSetProperties("suite/ajc-test/run", "ltw", "ltwFile"); digester.addSetProperties("suite/ajc-test/run", "xlintfile", "xlintFile"); digester.addSetProperties("suite/ajc-test/run/stderr", "ordered", "orderedStderr"); diff --git a/testing/src/org/aspectj/testing/ajde/CompileCommand.java b/testing/src/org/aspectj/testing/ajde/CompileCommand.java index 2fd748ff2..86c5fbaf7 100644 --- a/testing/src/org/aspectj/testing/ajde/CompileCommand.java +++ b/testing/src/org/aspectj/testing/ajde/CompileCommand.java @@ -378,6 +378,18 @@ class MyCompilerConfig implements ICompilerConfiguration { return null; } + @Override + public String getModulepath() { + // TODO Auto-generated method stub + return null; + } + + @Override + public String getModuleSourcepath() { + // TODO Auto-generated method stub + return null; + } + } class MyOutputLocationManager implements IOutputLocationManager { @@ -417,7 +429,6 @@ class MyOutputLocationManager implements IOutputLocationManager { } public int discoverChangesSince(File dir, long buildtime) { - // TODO Auto-generated method stub return 0; } diff --git a/testing/src/org/aspectj/testing/harness/bridge/JavaRun.java b/testing/src/org/aspectj/testing/harness/bridge/JavaRun.java index 8efad22de..aade35f48 100644 --- a/testing/src/org/aspectj/testing/harness/bridge/JavaRun.java +++ b/testing/src/org/aspectj/testing/harness/bridge/JavaRun.java @@ -610,6 +610,9 @@ public class JavaRun implements IAjcRun { /** fully-qualified name of the class to run */ protected String className; + /** Alternative to classname for specifying what to run modulename/type */ + protected String module; + /** minimum required version of Java, if any */ protected String javaVersion; @@ -669,6 +672,10 @@ public class JavaRun implements IAjcRun { this.className = className; } + public void setModule(String module) { + this.module = module; + } + public void setLTW(String ltw) { useLTW = TestUtil.parseBoolean(ltw); } diff --git a/testing/src/org/aspectj/testing/xml/AjcSpecXmlReader.java b/testing/src/org/aspectj/testing/xml/AjcSpecXmlReader.java index 1c295d795..370a9ac91 100644 --- a/testing/src/org/aspectj/testing/xml/AjcSpecXmlReader.java +++ b/testing/src/org/aspectj/testing/xml/AjcSpecXmlReader.java @@ -251,8 +251,8 @@ public class AjcSpecXmlReader { digester.addSetProperties(compileX + "/file"); digester.addSetProperties(inccompileX, "classes", "paths"); digester.addSetProperties(runX, - new String[] { "class", "vm", "skipTester", "fork", "vmargs", "aspectpath"}, - new String[] { "className", "javaVersion", "skipTester", "fork", "vmArgs", "aspectpath"}); + new String[] { "class", "vm", "skipTester", "fork", "vmargs", "aspectpath", "module"}, + new String[] { "className", "javaVersion", "skipTester", "fork", "vmArgs", "aspectpath", "module"}); digester.addSetProperties(dirchangesX); digester.addSetProperties(messageX); digester.addSetProperties(messageSrcLocX, "line", "lineAsString"); |