< prev index next >
test/hotspot/jtreg/testlibrary/ctw/src/sun/hotspot/tools/ctw/CtwRunner.java
Print this page
rev 47464 : 8186618: [TESTBUG] Test applications/ctw/Modules.java doesn't have timeout and hang on windows
Reviewed-by: duke
@@ -33,12 +33,10 @@
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.ArrayList;
import java.util.List;
-import java.util.concurrent.Executor;
-import java.util.concurrent.ExecutorService;
import java.util.concurrent.TimeUnit;
import java.util.function.Predicate;
import java.util.regex.Pattern;
import java.util.stream.Collectors;
@@ -60,23 +58,31 @@
}
new CtwRunner(args[0]).run();
}
private final List<Throwable> errors;
+ private final String target;
private final Path targetPath;
private final String targetName;
private CtwRunner(String target) {
- if (target.equals("modules")) {
+ if (target.startsWith("modules")) {
targetPath = Paths
.get(Utils.TEST_JDK)
.resolve("lib")
- .resolve(target);
+ .resolve("modules");
+ if (target.equals("modules")){
+ target = targetPath.toString();
+ }
+ targetName = target.replace(':', '_')
+ .replace('.', '_')
+ .replace(',', '_');
} else {
targetPath = Paths.get(target).toAbsolutePath();
- }
targetName = targetPath.getFileName().toString();
+ }
+ this.target = target;
errors = new ArrayList<>();
}
private void run() {
@@ -102,11 +108,11 @@
private void startCtwforAllClasses() {
long classStart = 0L;
long classCount = classCount();
Asserts.assertGreaterThan(classCount, 0L,
- targetPath + " does not have any classes");
+ target + "(at " + targetPath + ") does not have any classes");
boolean done = false;
while (!done) {
String[] cmd = cmd(classStart);
try {
ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(
@@ -136,11 +142,11 @@
+ "before finishing all compilations."
+ " lastClass[" + lastIndex
+ "] != classCount[" + classCount + "]"));
} else {
System.out.println("Executed CTW for all " + classCount
- + " classes in " + targetPath);
+ + " classes in " + target + "(at " + targetPath + ")");
}
done = true;
} else {
if (lastClass == null) {
errors.add(new Error(phase + ": failed during preload"
@@ -160,11 +166,11 @@
}
}
}
private long classCount() {
- List<PathHandler> phs = PathHandler.create(targetPath.toString());
+ List<PathHandler> phs = PathHandler.create(target);
long result = phs.stream()
.mapToLong(PathHandler::classCount)
.sum();
phs.forEach(PathHandler::close);
return result;
@@ -213,11 +219,11 @@
String.format("-XX:ReplayDataFile=replay_%s_%%p.log", phase),
// MethodHandle MUST NOT be compiled
"-XX:CompileCommand=exclude,java/lang/invoke/MethodHandle.*",
// CTW entry point
CompileTheWorld.class.getName(),
- targetPath.toString(),
+ target,
};
}
private String phaseName(long classStart) {
return String.format("%s_%d", targetName, classStart);
< prev index next >