< prev index next >

test/hotspot/jtreg/applications/jcstress/JcstressRunner.java

Print this page

 25 
 26 import jdk.test.lib.Utils;
 27 import jdk.test.lib.artifacts.Artifact;
 28 import jdk.test.lib.artifacts.ArtifactResolver;
 29 import jdk.test.lib.artifacts.ArtifactResolverException;
 30 import jdk.test.lib.process.OutputAnalyzer;
 31 import jdk.test.lib.process.ProcessTools;
 32 
 33 import java.io.File;
 34 import java.nio.file.Files;
 35 import java.nio.file.Path;
 36 import java.nio.file.Paths;
 37 import java.util.ArrayList;
 38 import java.util.Map;
 39 import java.util.List;
 40 
 41 /**
 42  * jcstress tests wrapper
 43  */
 44 @Artifact(organization = "org.openjdk.jcstress", name = "jcstress-tests-all",
 45         revision = "0.5", extension = "jar", unpack = false)
 46 public class JcstressRunner {
 47 
 48     public static final String MAIN_CLASS = "org.openjdk.jcstress.Main";
 49 
 50     public static Path pathToArtifact() {
 51         Map<String, Path> artifacts;
 52         try {
 53             artifacts = ArtifactResolver.resolve(JcstressRunner.class);
 54         } catch (ArtifactResolverException e) {
 55             throw new Error("TESTBUG: Can not resolve artifacts for "
 56                             + JcstressRunner.class.getName(), e);
 57         }
 58         return artifacts.get("org.openjdk.jcstress.jcstress-tests-all-0.5")
 59                         .toAbsolutePath();
 60     }
 61 
 62     public static void main(String[] args) throws Throwable {
 63         if (args.length < 1) {
 64             throw new Error("Usage: [jcstress flag]*");
 65         }
 66         Path out = Paths.get("jcstress.out").toAbsolutePath();
 67 
 68         ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(getCmd(args))
 69                                         .redirectErrorStream(true)
 70                                         .redirectOutput(out.toFile());
 71         OutputAnalyzer oa = ProcessTools.executeProcess(pb);
 72         if (0 != oa.getExitValue()) {
 73             String message = "jctress test finished with nonzero exitcode "
 74                               + oa.getExitValue();
 75             System.err.println(message);
 76 
 77             System.err.print("cmd = ");
 78             System.err.println(pb.command());

 25 
 26 import jdk.test.lib.Utils;
 27 import jdk.test.lib.artifacts.Artifact;
 28 import jdk.test.lib.artifacts.ArtifactResolver;
 29 import jdk.test.lib.artifacts.ArtifactResolverException;
 30 import jdk.test.lib.process.OutputAnalyzer;
 31 import jdk.test.lib.process.ProcessTools;
 32 
 33 import java.io.File;
 34 import java.nio.file.Files;
 35 import java.nio.file.Path;
 36 import java.nio.file.Paths;
 37 import java.util.ArrayList;
 38 import java.util.Map;
 39 import java.util.List;
 40 
 41 /**
 42  * jcstress tests wrapper
 43  */
 44 @Artifact(organization = "org.openjdk.jcstress", name = "jcstress-tests-all",
 45         revision = "0.6-virtual-1", extension = "jar", unpack = false)
 46 public class JcstressRunner {
 47 
 48     public static final String MAIN_CLASS = "org.openjdk.jcstress.Main";
 49 
 50     public static Path pathToArtifact() {
 51         Map<String, Path> artifacts;
 52         try {
 53             artifacts = ArtifactResolver.resolve(JcstressRunner.class);
 54         } catch (ArtifactResolverException e) {
 55             throw new Error("TESTBUG: Can not resolve artifacts for "
 56                             + JcstressRunner.class.getName(), e);
 57         }
 58         return artifacts.get("org.openjdk.jcstress.jcstress-tests-all-0.6-virtual-1")
 59                         .toAbsolutePath();
 60     }
 61 
 62     public static void main(String[] args) throws Throwable {
 63         if (args.length < 1) {
 64             throw new Error("Usage: [jcstress flag]*");
 65         }
 66         Path out = Paths.get("jcstress.out").toAbsolutePath();
 67 
 68         ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(getCmd(args))
 69                                         .redirectErrorStream(true)
 70                                         .redirectOutput(out.toFile());
 71         OutputAnalyzer oa = ProcessTools.executeProcess(pb);
 72         if (0 != oa.getExitValue()) {
 73             String message = "jctress test finished with nonzero exitcode "
 74                               + oa.getExitValue();
 75             System.err.println(message);
 76 
 77             System.err.print("cmd = ");
 78             System.err.println(pb.command());
< prev index next >