diff options
author | Alexander Kriegisch <Alexander@Kriegisch.name> | 2022-03-31 11:18:47 +0700 |
---|---|---|
committer | Alexander Kriegisch <Alexander@Kriegisch.name> | 2022-03-31 11:18:47 +0700 |
commit | dbb6a9e1496cce5d9dace197f96cd13de047e2dc (patch) | |
tree | dd1e46fb6b850a16cb9156f216840e3909bc90df | |
parent | 33bd2b4a2e30de544ec2bb8a90997e8b6595b13c (diff) | |
download | aspectj-dbb6a9e1496cce5d9dace197f96cd13de047e2dc.tar.gz aspectj-dbb6a9e1496cce5d9dace197f96cd13de047e2dc.zip |
Make sure to always print commands when running Java test classes
In some cases, the 'java ...' command was not printed, which is
especially unhelpful when tests fail.
Signed-off-by: Alexander Kriegisch <Alexander@Kriegisch.name>
-rw-r--r-- | org.aspectj.ajdt.core/src/test/java/org/aspectj/tools/ajc/AjcTestCase.java | 16 | ||||
-rw-r--r-- | org.aspectj.ajdt.core/src/test/java/org/aspectj/tools/ajc/CompilationResult.java | 2 |
2 files changed, 10 insertions, 8 deletions
diff --git a/org.aspectj.ajdt.core/src/test/java/org/aspectj/tools/ajc/AjcTestCase.java b/org.aspectj.ajdt.core/src/test/java/org/aspectj/tools/ajc/AjcTestCase.java index 0aa9a81db..f812f8f85 100644 --- a/org.aspectj.ajdt.core/src/test/java/org/aspectj/tools/ajc/AjcTestCase.java +++ b/org.aspectj.ajdt.core/src/test/java/org/aspectj/tools/ajc/AjcTestCase.java @@ -483,7 +483,7 @@ public abstract class AjcTestCase extends TestCase { addExtra(failureReport, "error", extraErrors); addExtra(failureReport, "fail", extraFails); addExtra(failureReport, "weaveInfo", extraWeaves); - failureReport.append("\ncommand was: 'ajc"); + failureReport.append("\nCommand: 'ajc"); String[] args = result.getArgs(); for (String arg : args) { failureReport.append(" "); @@ -654,6 +654,8 @@ public abstract class AjcTestCase extends TestCase { " -classpath " + cp + pathSeparator + defaultCpAbsolute + " -javaagent:" + javaagent + " " + className + " " + String.join(" ", args); + if (Ajc.verbose) + System.out.println("\nCommand: '" + command + "'\n"); // Command is executed using ProcessBuilder to allow setting CWD for ajc sandbox compliance ProcessBuilder pb = new ProcessBuilder(tokenizeCommand(command)); pb.directory( new File(ajc.getSandboxDirectory().getAbsolutePath())); @@ -683,9 +685,8 @@ public abstract class AjcTestCase extends TestCase { cp.append(TestUtil.aspectjrtPath().getPath()).append(pathSeparator); } String command = LangUtil.getJavaExecutable().getAbsolutePath() + " " +vmargs+ (cp.length()==0?"":" -classpath " + cp) + " -p "+mp+" --module "+moduleName ; - if (Ajc.verbose) { - System.out.println("Command is "+command); - } + if (Ajc.verbose) + System.out.println("\nCommand: '" + command + "'\n"); // Command is executed using ProcessBuilder to allow setting CWD for ajc sandbox compliance ProcessBuilder pb = new ProcessBuilder(tokenizeCommand(command)); pb.directory( new File(ajc.getSandboxDirectory().getAbsolutePath())); @@ -717,9 +718,8 @@ public abstract class AjcTestCase extends TestCase { cp.append(pathSeparator).append(TestUtil.aspectjrtPath().getPath()); } String command = LangUtil.getJavaExecutable().getAbsolutePath() + " " +vmargs+ (cp.length()==0?"":" -classpath " + cp) + " " + className ; - if (Ajc.verbose) { - System.out.println("\nCommand is "+command); - } + if (Ajc.verbose) + System.out.println("\nCommand: '" + command + "'\n"); // Command is executed using ProcessBuilder to allow setting CWD for ajc sandbox compliance ProcessBuilder pb = new ProcessBuilder(tokenizeCommand(command)); pb.directory( new File(ajc.getSandboxDirectory().getAbsolutePath())); @@ -751,6 +751,8 @@ public abstract class AjcTestCase extends TestCase { command.append(" "); command.append(arg); } + if (Ajc.verbose) + System.out.println("\nCommand: '" + command + "'\n"); // try { // // Enable the security manager // Policy.setPolicy(new MyPolicy()); diff --git a/org.aspectj.ajdt.core/src/test/java/org/aspectj/tools/ajc/CompilationResult.java b/org.aspectj.ajdt.core/src/test/java/org/aspectj/tools/ajc/CompilationResult.java index 612f16539..f2757bdaa 100644 --- a/org.aspectj.ajdt.core/src/test/java/org/aspectj/tools/ajc/CompilationResult.java +++ b/org.aspectj.ajdt.core/src/test/java/org/aspectj/tools/ajc/CompilationResult.java @@ -212,7 +212,7 @@ public class CompilationResult { buff.append(weaveMessage.toString()); buff.append("\n"); } - buff.append("\ncommand was: 'ajc"); + buff.append("\nCommand: 'ajc"); for (String arg : args) { buff.append(' '); buff.append(arg); |