8161138: testlibrary_tests/ctw/* failed with "Failed. Unexpected exit from test [exit code: 0]"

Reviewed-by: kvn
This commit is contained in:
Tatiana Pivovarova 2016-07-29 17:41:14 +03:00
parent 757db81501
commit a4383337fe
2 changed files with 10 additions and 11 deletions

View File

@ -35,8 +35,8 @@ import java.util.concurrent.*;
public class CompileTheWorld {
// in case when a static constructor changes System::out and System::err
// we hold these values of output streams
public static final PrintStream OUT = System.out;
public static final PrintStream ERR = System.err;
static PrintStream OUT = System.out;
static final PrintStream ERR = System.err;
/**
* Entry point. Compiles classes in {@code paths}
*
@ -56,7 +56,7 @@ public class CompileTheWorld {
}
}
if (os != null) {
System.setOut(os);
OUT = os;
}
try {
@ -89,9 +89,6 @@ public class CompileTheWorld {
os.close();
}
}
// in case when a static constructor creates and runs a new thread
// we force it to exit
System.exit(0);
}
private static ExecutorService createExecutor() {

View File

@ -28,12 +28,11 @@ import jdk.internal.misc.Unsafe;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.Objects;
import java.util.concurrent.atomic.AtomicLong;
import java.util.regex.Pattern;
import java.util.regex.Matcher;
import java.util.concurrent.Executor;
import java.util.concurrent.atomic.AtomicLong;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
/**
* Abstract handler for path.
@ -152,7 +151,10 @@ public abstract class PathHandler {
if (id >= Utils.COMPILE_THE_WORLD_START_AT) {
try {
Class<?> aClass = loader.loadClass(name);
UNSAFE.ensureClassInitialized(aClass);
if (name != "sun.reflect.misc.Trampoline"
&& name != "sun.tools.jconsole.OutputViewer") { // workaround for JDK-8159155
UNSAFE.ensureClassInitialized(aClass);
}
CompileTheWorld.OUT.printf("[%d]\t%s%n", id, name);
Compiler.compileClass(aClass, id, executor);
} catch (ClassNotFoundException e) {