Merge
authorduke
Wed, 05 Jul 2017 22:28:01 +0200
changeset 42092 40ad5a030c2f
parent 42091 296b6f1ad81e (current diff)
parent 42012 89406c257bc9 (diff)
child 42110 fc49ec5a8314
Merge
--- a/.hgtags-top-repo	Mon Nov 21 18:47:57 2016 +0000
+++ b/.hgtags-top-repo	Wed Jul 05 22:28:01 2017 +0200
@@ -387,3 +387,4 @@
 2b3e5caafe3594ea507c37675c4d3086f415dc64 jdk-9+142
 1fc62b1c629fb80fdaa639d3b59452a184f0d705 jdk-9+143
 8d337fd6333e28c48aa87880144b840aad82baaf jdk-9+144
+ff98aa9ec9fae991e426ce5926fc9036d25f5562 jdk-9+145
--- a/make/jprt.properties	Mon Nov 21 18:47:57 2016 +0000
+++ b/make/jprt.properties	Wed Jul 05 22:28:01 2017 +0200
@@ -334,11 +334,7 @@
     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 @@
     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 @@
     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 @@
     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.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
--- a/test/failure_handler/Makefile	Mon Nov 21 18:47:57 2016 +0000
+++ b/test/failure_handler/Makefile	Wed Jul 05 22:28:01 2017 +0200
@@ -86,7 +86,7 @@
 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 @@
         -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"                                              \
--- a/test/failure_handler/src/share/classes/jdk/test/failurehandler/HtmlSection.java	Mon Nov 21 18:47:57 2016 +0000
+++ b/test/failure_handler/src/share/classes/jdk/test/failurehandler/HtmlSection.java	Wed Jul 05 22:28:01 2017 +0200
@@ -49,7 +49,7 @@
 
     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;
--- a/test/failure_handler/src/share/classes/jdk/test/failurehandler/action/ActionHelper.java	Mon Nov 21 18:47:57 2016 +0000
+++ b/test/failure_handler/src/share/classes/jdk/test/failurehandler/action/ActionHelper.java	Wed Jul 05 22:28:01 2017 +0200
@@ -164,7 +164,8 @@
         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 @@
                     out);
             try {
                 result = new ExitCode(process.waitFor());
+            } catch (InterruptedException e) {
+                log.println("WARNING: interrupted when waiting for the tool:%n");
+                e.printStackTrace(log);
+            } finally {
                 killer.cancel();
-            } catch (InterruptedException e) {
-                Thread.currentThread().interrupt();
-                if (!killer.cancel()) {
-                    log.println(
-                            "WARNING: interrupted when waiting for the tool:");
-                    e.printStackTrace(log);
-                }
             }
             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 @@
             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 @@
             try {
                 process.exitValue();
             } catch (IllegalThreadStateException e) {
-                // !prepareProcess.isAlive()
-                process.destroy();
+                process.destroyForcibly();
                 timedOut = true;
             }
         }
@@ -301,11 +299,15 @@
                             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 {
--- a/test/failure_handler/src/share/classes/jdk/test/failurehandler/jtreg/GatherDiagnosticInfoObserver.java	Mon Nov 21 18:47:57 2016 +0000
+++ b/test/failure_handler/src/share/classes/jdk/test/failurehandler/jtreg/GatherDiagnosticInfoObserver.java	Wed Jul 05 22:28:01 2017 +0200
@@ -68,7 +68,7 @@
         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 @@
                                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());
--- a/test/failure_handler/src/share/classes/jdk/test/failurehandler/jtreg/GatherProcessInfoTimeoutHandler.java	Mon Nov 21 18:47:57 2016 +0000
+++ b/test/failure_handler/src/share/classes/jdk/test/failurehandler/jtreg/GatherProcessInfoTimeoutHandler.java	Wed Jul 05 22:28:01 2017 +0200
@@ -70,9 +70,9 @@
         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 @@
 
             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",
--- a/test/jtreg-ext/requires/VMProps.java	Mon Nov 21 18:47:57 2016 +0000
+++ b/test/jtreg-ext/requires/VMProps.java	Wed Jul 05 22:28:01 2017 +0200
@@ -59,6 +59,7 @@
         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);
@@ -148,6 +149,13 @@
     }
 
     /**
+     * @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:
      *    VM supports G1
--- a/test/lib/jdk/test/lib/apps/LingeredApp.java	Mon Nov 21 18:47:57 2016 +0000
+++ b/test/lib/jdk/test/lib/apps/LingeredApp.java	Wed Jul 05 22:28:01 2017 +0200
@@ -67,12 +67,13 @@
 public class LingeredApp {
 
     private static final long spinDelay = 1000;
-    private static final int appWaitTime = 100;
+
+    private long lockCreationTime;
+    private final ArrayList<String> storedAppOutput;
 
-    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 @@
     }
 
     /**
-     * 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 @@
         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 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);
+            }
         }
     }