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 { public class CompileTheWorld {
// in case when a static constructor changes System::out and System::err // in case when a static constructor changes System::out and System::err
// we hold these values of output streams // we hold these values of output streams
public static final PrintStream OUT = System.out; static PrintStream OUT = System.out;
public static final PrintStream ERR = System.err; static final PrintStream ERR = System.err;
/** /**
* Entry point. Compiles classes in {@code paths} * Entry point. Compiles classes in {@code paths}
* *
@ -56,7 +56,7 @@ public class CompileTheWorld {
} }
} }
if (os != null) { if (os != null) {
System.setOut(os); OUT = os;
} }
try { try {
@ -89,9 +89,6 @@ public class CompileTheWorld {
os.close(); 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() { private static ExecutorService createExecutor() {

View file

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