This commit is contained in:
Jesper Wilhelmsson 2016-11-09 15:32:39 +01:00
commit 61440b5478
8 changed files with 99 additions and 83 deletions

View File

@ -334,11 +334,7 @@ my.test.targets.hotspot.solaris.sparcv9= \
solaris_sparcv9_5.11-{product|fastdebug}-c2-jvm98, \
solaris_sparcv9_5.11-{product|fastdebug}-c2-jvm98_nontiered, \
solaris_sparcv9_5.11-{product|fastdebug}-c2-scimark, \
solaris_sparcv9_5.11-product-c2-runThese8, \
solaris_sparcv9_5.11-{product|fastdebug}-c2-GCBasher_SerialGC, \
solaris_sparcv9_5.11-{product|fastdebug}-c2-GCBasher_ParallelGC, \
solaris_sparcv9_5.11-{product|fastdebug}-c2-GCBasher_CMS, \
solaris_sparcv9_5.11-{product|fastdebug}-c2-GCBasher_G1
solaris_sparcv9_5.11-product-c2-runThese8,
my.test.targets.hotspot.solaris.x64= \
solaris_x64_5.11-{product|fastdebug}-c2-jvm98, \
@ -346,40 +342,24 @@ my.test.targets.hotspot.solaris.x64= \
solaris_x64_5.11-{product|fastdebug}-c2-scimark, \
solaris_x64_5.11-product-c2-runThese8, \
solaris_x64_5.11-product-c2-runThese8_Xcomp_lang, \
solaris_x64_5.11-product-c2-runThese8_Xcomp_vm, \
solaris_x64_5.11-{product|fastdebug}-c2-GCBasher_SerialGC, \
solaris_x64_5.11-{product|fastdebug}-c2-GCBasher_ParallelGC, \
solaris_x64_5.11-{product|fastdebug}-c2-GCBasher_CMS, \
solaris_x64_5.11-{product|fastdebug}-c2-GCBasher_G1
solaris_x64_5.11-product-c2-runThese8_Xcomp_vm,
my.test.targets.hotspot.linux.i586= \
linux_i586_3.8-{product|fastdebug}-c2-jvm98, \
linux_i586_3.8-{product|fastdebug}-c2-jvm98_nontiered, \
linux_i586_3.8-{product|fastdebug}-c2-scimark, \
linux_i586_3.8-fastdebug-c2-runThese8_Xcomp_lang, \
linux_i586_3.8-fastdebug-c2-runThese8_Xcomp_vm, \
linux_i586_3.8-{product|fastdebug}-c2-GCBasher_SerialGC, \
linux_i586_3.8-{product|fastdebug}-c2-GCBasher_ParallelGC, \
linux_i586_3.8-{product|fastdebug}-c2-GCBasher_CMS, \
linux_i586_3.8-{product|fastdebug}-c2-GCBasher_G1
linux_i586_3.8-fastdebug-c2-runThese8_Xcomp_vm
my.test.targets.hotspot.linux.x64= \
linux_x64_3.8-{product|fastdebug}-c2-jvm98, \
linux_x64_3.8-{product|fastdebug}-c2-jvm98_nontiered, \
linux_x64_3.8-{product|fastdebug}-c2-scimark, \
linux_x64_3.8-{product|fastdebug}-c2-GCBasher_SerialGC, \
linux_x64_3.8-{product|fastdebug}-c2-GCBasher_ParallelGC, \
linux_x64_3.8-{product|fastdebug}-c2-GCBasher_CMS, \
linux_x64_3.8-{product|fastdebug}-c2-GCBasher_G1
linux_x64_3.8-{product|fastdebug}-c2-scimark
my.test.targets.hotspot.macosx.x64= \
macosx_x64_10.9-{product|fastdebug}-c2-jvm98, \
macosx_x64_10.9-{product|fastdebug}-c2-jvm98_nontiered, \
macosx_x64_10.9-{product|fastdebug}-c2-scimark, \
macosx_x64_10.9-{product|fastdebug}-c2-GCBasher_SerialGC, \
macosx_x64_10.9-{product|fastdebug}-c2-GCBasher_ParallelGC, \
macosx_x64_10.9-{product|fastdebug}-c2-GCBasher_CMS, \
macosx_x64_10.9-{product|fastdebug}-c2-GCBasher_G1
macosx_x64_10.9-{product|fastdebug}-c2-scimark
my.test.targets.hotspot.windows.i586= \
windows_i586_6.3-{product|fastdebug}-c2-jvm98, \
@ -387,11 +367,7 @@ my.test.targets.hotspot.windows.i586= \
windows_i586_6.3-{product|fastdebug}-c2-scimark, \
windows_i586_6.3-product-c2-runThese8, \
windows_i586_6.3-product-c2-runThese8_Xcomp_lang, \
windows_i586_6.3-product-c2-runThese8_Xcomp_vm, \
windows_i586_6.3-{product|fastdebug}-c2-GCBasher_SerialGC, \
windows_i586_6.3-{product|fastdebug}-c2-GCBasher_ParallelGC, \
windows_i586_6.3-{product|fastdebug}-c2-GCBasher_CMS, \
windows_i586_6.3-{product|fastdebug}-c2-GCBasher_G1
windows_i586_6.3-product-c2-runThese8_Xcomp_vm,
my.test.targets.hotspot.windows.x64= \
windows_x64_6.3-{product|fastdebug}-c2-jvm98, \
@ -399,11 +375,7 @@ my.test.targets.hotspot.windows.x64= \
windows_x64_6.3-{product|fastdebug}-c2-scimark, \
windows_x64_6.3-product-c2-runThese8, \
windows_x64_6.3-product-c2-runThese8_Xcomp_lang, \
windows_x64_6.3-product-c2-runThese8_Xcomp_vm, \
windows_x64_6.3-{product|fastdebug}-c2-GCBasher_SerialGC, \
windows_x64_6.3-{product|fastdebug}-c2-GCBasher_ParallelGC, \
windows_x64_6.3-{product|fastdebug}-c2-GCBasher_CMS, \
windows_x64_6.3-{product|fastdebug}-c2-GCBasher_G1
windows_x64_6.3-product-c2-runThese8_Xcomp_vm,
# Some basic "smoke" tests for OpenJDK builds
my.test.targets.hotspot.open= \
@ -468,9 +440,17 @@ my.make.rule.test.targets.hotspot.reg= \
${my.make.rule.test.targets.hotspot.reg.group:GROUP=hotspot_fast_gc_2}, \
${my.make.rule.test.targets.hotspot.reg.group:GROUP=hotspot_fast_gc_closed}, \
${my.make.rule.test.targets.hotspot.reg.group:GROUP=hotspot_fast_gc_gcold}, \
${my.make.rule.test.targets.hotspot.reg.group:GROUP=hotspot_fast_gc_gcbasher}, \
${my.make.rule.test.targets.hotspot.reg.group:GROUP=hotspot_fast_runtime}, \
${my.make.rule.test.targets.hotspot.reg.group:GROUP=hotspot_fast_serviceability}, \
${my.make.rule.test.targets.hotspot.reg.group:GROUP=jdk_svc_sanity}, \
solaris_sparcv9_5.11-product-c2-hotspot_fast_gc_gcbasher, \
solaris_x64_5.11-product-c2-hotspot_fast_gc_gcbasher, \
linux_i586_3.8-product-c2-hotspot_fast_gc_gcbasher, \
linux_x64_3.8-product-c2-hotspot_fast_gc_gcbasher, \
macosx_x64_10.9-product-c2-hotspot_fast_gc_gcbasher, \
windows_i586_6.3-product-c2-hotspot_fast_gc_gcbasher, \
windows_x64_6.3-product-c2-hotspot_fast_gc_gcbasher, \
${my.additional.make.rule.test.targets.hotspot.reg}
# Other Makefile based Hotspot tests

View File

@ -86,7 +86,7 @@ classes: require_env
test: require_env build
rm -rf "${RUN_DIR}"
mkdir -p "${RUN_DIR}"
"${JTREG_HOME}"/bin/jtreg \
"${JTREG_HOME}"/bin/jtreg \
-jdk:"${JAVA_HOME}" \
${JTREG_TEST_OPTS} \
-timeout:0.1 -va -retain:all \
@ -94,6 +94,7 @@ test: require_env build
-agentvm \
-thd:"${TARGET_JAR}" \
-th:jdk.test.failurehandler.jtreg.GatherProcessInfoTimeoutHandler \
-thtimeout:0 \
-od:"${TARGET_JAR}" \
-o:jdk.test.failurehandler.jtreg.GatherDiagnosticInfoObserver \
-w:"${RUN_DIR}/JTwork" \

View File

@ -49,7 +49,7 @@ public class HtmlSection {
private HtmlSection(PrintWriter pw, String id, String name, HtmlSection rootSection) {
this.pw = pw;
textWriter = new PrintWriter(new HtmlFilterWriter(pw));
textWriter = new PrintWriter(new HtmlFilterWriter(pw), true);
this.id = id;
this.name = name;
child = null;

View File

@ -164,7 +164,8 @@ public class ActionHelper {
Stopwatch stopwatch = new Stopwatch();
stopwatch.start();
log.printf("%s%n[%tF %<tT] %s%n%1$s%n", line, new Date(), pb.command());
log.printf("%s%n[%tF %<tT] %s timeout=%s%n%1$s%n", line, new Date(), pb.command(), params.timeout);
Process process;
KillerTask killer;
@ -178,30 +179,28 @@ public class ActionHelper {
out);
try {
result = new ExitCode(process.waitFor());
killer.cancel();
} catch (InterruptedException e) {
Thread.currentThread().interrupt();
if (!killer.cancel()) {
log.println(
"WARNING: interrupted when waiting for the tool:");
e.printStackTrace(log);
}
log.println("WARNING: interrupted when waiting for the tool:%n");
e.printStackTrace(log);
} finally {
killer.cancel();
}
if (killer.hasTimedOut()) {
log.printf(
"WARNING: tool timed out: killed process after %d ms%n",
TimeUnit.MILLISECONDS.toMicros(params.timeout));
params.timeout);
result = ExitCode.TIMED_OUT;
}
} catch (IOException e) {
log.printf("WARNING: caught IOException while running tool%n");
e.printStackTrace(log);
result = ExitCode.LAUNCH_ERROR;
}
stopwatch.stop();
log.printf("%s%n[%tF %<tT] exit code : %d time : %d ms%n%1$s%n",
log.printf("%s%n[%tF %<tT] exit code: %d time: %d ms%n%1$s%n",
line, new Date(), result.value,
TimeUnit.MILLISECONDS.toSeconds(stopwatch.getElapsedTimeNs()));
TimeUnit.NANOSECONDS.toMillis(stopwatch.getElapsedTimeNs()));
return result;
}
@ -247,7 +246,7 @@ public class ActionHelper {
log.printf("WARNING: can't run jps : %s%n", e.getMessage());
e.printStackTrace(log);
} catch (InterruptedException e) {
Thread.currentThread().interrupt();
log.printf("WARNING: interrupted%n");
e.printStackTrace(log);
}
return result;
@ -266,8 +265,7 @@ public class ActionHelper {
try {
process.exitValue();
} catch (IllegalThreadStateException e) {
// !prepareProcess.isAlive()
process.destroy();
process.destroyForcibly();
timedOut = true;
}
}
@ -301,11 +299,15 @@ public class ActionHelper {
exitCode.value);
break;
}
try {
Thread.sleep(params.pause);
} catch (InterruptedException e) {
Thread.currentThread().interrupt();
e.printStackTrace(sectionWriter);
// sleep, if this is not the last iteration
if (i < n - 1) {
try {
Thread.sleep(params.pause);
} catch (InterruptedException e) {
sectionWriter.printf(
"WARNING: interrupted while sleeping between invocations");
e.printStackTrace(sectionWriter);
}
}
}
} else {

View File

@ -68,7 +68,7 @@ public class GatherDiagnosticInfoObserver implements Harness.Observer {
boolean needClose = false;
try {
log = new PrintWriter(new FileWriter(
workDir.resolve(LOG_FILENAME).toFile(), true));
workDir.resolve(LOG_FILENAME).toFile(), true), true);
needClose = true;
} catch (IOException e) {
log = new PrintWriter(System.out);
@ -100,7 +100,7 @@ public class GatherDiagnosticInfoObserver implements Harness.Observer {
EnvironmentInfoGatherer gatherer) {
File output = workDir.resolve(ENVIRONMENT_OUTPUT).toFile();
try (HtmlPage html = new HtmlPage(new PrintWriter(
new FileWriter(output, true)))) {
new FileWriter(output, true), true))) {
try (ElapsedTimePrinter timePrinter
= new ElapsedTimePrinter(new Stopwatch(), name, log)) {
gatherer.gatherEnvironmentInfo(html.getRootSection());

View File

@ -70,9 +70,9 @@ public class GatherProcessInfoTimeoutHandler extends TimeoutHandler {
String name = getClass().getName();
PrintWriter actionsLog;
try {
// try to open a separate file for aciton log
// try to open a separate file for action log
actionsLog = new PrintWriter(new FileWriter(
workDir.resolve(LOG_FILENAME).toFile(), true));
workDir.resolve(LOG_FILENAME).toFile(), true), true);
} catch (IOException e) {
// use jtreg log as a fallback
actionsLog = log;
@ -84,7 +84,7 @@ public class GatherProcessInfoTimeoutHandler extends TimeoutHandler {
File output = workDir.resolve(OUTPUT_FILENAME).toFile();
try {
PrintWriter pw = new PrintWriter(new FileWriter(output, true));
PrintWriter pw = new PrintWriter(new FileWriter(output, true), true);
runGatherer(name, workDir, actionsLog, pw, pid);
} catch (IOException e) {
actionsLog.printf("IOException: cannot open output file[%s] : %s",

View File

@ -59,6 +59,7 @@ public class VMProps implements Callable<Map<String, String>> {
map.put("vm.bits", vmBits());
map.put("vm.flightRecorder", vmFlightRecorder());
map.put("vm.simpleArch", vmArch());
map.put("vm.debug", vmDebug());
vmGC(map); // vm.gc.X = true/false
dump(map);
@ -147,6 +148,13 @@ public class VMProps implements Callable<Map<String, String>> {
return "false";
}
/**
* @return debug level value extracted from the "jdk.debug" property.
*/
protected String vmDebug() {
return "" + System.getProperty("jdk.debug").contains("debug");
}
/**
* For all existing GC sets vm.gc.X property.
* Example vm.gc.G1=true means:

View File

@ -67,13 +67,14 @@ import java.util.UUID;
public class LingeredApp {
private static final long spinDelay = 1000;
private static final int appWaitTime = 100;
private final String lockFileName;
private long lockCreationTime;
private Process appProcess;
private final ArrayList<String> storedAppOutput;
protected Process appProcess;
protected static final int appWaitTime = 100;
protected final String lockFileName;
/*
* Drain child process output, store it into string array
*/
@ -255,14 +256,10 @@ public class LingeredApp {
}
/**
* Run the app
*
* @param vmArguments
* @throws IOException
* Analyze an environment and prepare a command line to
* run the app, app name should be added explicitly
*/
public void runApp(List<String> vmArguments)
throws IOException {
public List<String> runAppPrepare(List<String> vmArguments) {
// We should always use testjava or throw an exception,
// so we can't use JDKToolFinder.getJDKTool("java");
// that falls back to compile java on error
@ -303,28 +300,52 @@ public class LingeredApp {
String classpath = System.getProperty("test.class.path");
cmd.add((classpath == null) ? "." : classpath);
cmd.add(this.getAppName());
cmd.add(lockFileName);
return cmd;
}
// Reporting
/**
* Assemble command line to a printable string
*/
public void printCommandLine(List<String> cmd) {
// A bit of verbosity
StringBuilder cmdLine = new StringBuilder();
for (String strCmd : cmd) {
cmdLine.append("'").append(strCmd).append("' ");
}
// A bit of verbosity
System.out.println("Command line: [" + cmdLine.toString() + "]");
}
public void startGobblerPipe() {
// Create pipe reader for process, and read stdin and stderr to array of strings
InputGobbler gb = new InputGobbler(appProcess.getInputStream(), storedAppOutput);
gb.start();
}
/**
* Run the app.
*
* @param vmArguments
* @throws IOException
*/
public void runApp(List<String> vmArguments)
throws IOException {
List<String> cmd = runAppPrepare(vmArguments);
cmd.add(this.getAppName());
cmd.add(lockFileName);
printCommandLine(cmd);
ProcessBuilder pb = new ProcessBuilder(cmd);
// we don't expect any error output but make sure we are not stuck on pipe
// pb.redirectErrorStream(false);
// ProcessBuilder.start can throw IOException
pb.redirectError(ProcessBuilder.Redirect.INHERIT);
appProcess = pb.start();
// Create pipe reader for process, and read stdin and stderr to array of strings
InputGobbler gb = new InputGobbler(appProcess.getInputStream(), storedAppOutput);
gb.start();
startGobblerPipe();
}
/**
@ -334,10 +355,14 @@ public class LingeredApp {
*/
public void stopApp() throws IOException {
deleteLock();
waitAppTerminate();
int exitcode = appProcess.exitValue();
if (exitcode != 0) {
throw new IOException("LingeredApp terminated with non-zero exit code " + exitcode);
// The startApp() of the derived app can throw
// an exception before the LA actually starts
if (appProcess != null) {
waitAppTerminate();
int exitcode = appProcess.exitValue();
if (exitcode != 0) {
throw new IOException("LingeredApp terminated with non-zero exit code " + exitcode);
}
}
}