Merge
authoramurillo
Fri, 12 Aug 2016 13:58:18 -0700
changeset 40398 2be90ca0e54e
parent 40274 28c4614722f2 (current diff)
parent 40397 67060ef26d11 (diff)
child 40399 09495c7e0ec8
child 40466 4abc0b9bd305
Merge
--- a/jdk/test/Makefile	Fri Aug 12 20:14:25 2016 +0300
+++ b/jdk/test/Makefile	Fri Aug 12 13:58:18 2016 -0700
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 1995, 2015, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 1995, 2016, Oracle and/or its affiliates. All rights reserved.
 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 #
 # This code is free software; you can redistribute it and/or modify it
@@ -185,6 +185,9 @@
 ( \
   jtregExitCode=$$? && \
   _summary="$(SUMMARY_TXT)"; \
+  if [ $${jtregExitCode} = 1 ] ; then \
+    jtregExitCode=0; \
+  fi; \
   $(RM) -f $(STATS_TXT) $(RUNLIST) $(PASSLIST) $(FAILLIST) $(EXITCODE); \
   $(ECHO) "$${jtregExitCode}" > $(EXITCODE); \
   if [ -r "$${_summary}" ] ; then \
--- a/jdk/test/sun/tools/jhsdb/BasicLauncherTest.java	Fri Aug 12 20:14:25 2016 +0300
+++ b/jdk/test/sun/tools/jhsdb/BasicLauncherTest.java	Fri Aug 12 13:58:18 2016 -0700
@@ -40,6 +40,7 @@
 import java.util.ArrayList;
 import java.util.List;
 import java.util.Arrays;
+import java.util.Optional;
 import jdk.testlibrary.JDKToolLauncher;
 import jdk.testlibrary.Utils;
 import jdk.testlibrary.OutputAnalyzer;
@@ -111,7 +112,8 @@
      * @param vmArgs  - vm and java arguments to launch test app
      * @return exit code of tool
      */
-    public static void launch(String expectedMessage, List<String> toolArgs)
+    public static void launch(String expectedMessage,
+                 Optional<String> unexpectedMessage, List<String> toolArgs)
         throws IOException {
 
         System.out.println("Starting LingeredApp");
@@ -131,6 +133,7 @@
             processBuilder.redirectError(ProcessBuilder.Redirect.INHERIT);
             OutputAnalyzer output = ProcessTools.executeProcess(processBuilder);;
             output.shouldContain(expectedMessage);
+            unexpectedMessage.ifPresent(output::shouldNotContain);
             output.shouldHaveExitValue(0);
 
         } catch (Exception ex) {
@@ -140,13 +143,16 @@
         }
     }
 
-    public static void launch(String expectedMessage, String... toolArgs)
+    public static void launch(String expectedMessage,
+                              String unexpectedMessage, String... toolArgs)
         throws IOException {
 
-        launch(expectedMessage, Arrays.asList(toolArgs));
+        launch(expectedMessage, Optional.ofNullable(unexpectedMessage),
+                                                       Arrays.asList(toolArgs));
     }
 
-    public static void launchNotOSX(String expectedMessage, String... toolArgs)
+    public static void launchNotOSX(String expectedMessage,
+                              String unexpectedMessage, String... toolArgs)
         throws IOException {
 
         if (Platform.isOSX()) {
@@ -154,6 +160,8 @@
             System.out.println("This test is not expected to work on OS X. Skipping");
             return;
         }
+
+        launch(expectedMessage, unexpectedMessage, toolArgs);
     }
 
     public static void testHeapDump() throws IOException {
@@ -164,7 +172,7 @@
         }
         dump.deleteOnExit();
 
-        launch("heap written to", "jmap",
+        launch("heap written to", null, "jmap",
                "--binaryheap", "--dumpfile=" + dump.getAbsolutePath());
 
         assertTrue(dump.exists() && dump.isFile(),
@@ -182,11 +190,12 @@
 
         launchCLHSDB();
 
-        launch("compiler detected", "jmap", "--clstats");
-        launchNotOSX("No deadlocks found", "jstack");
-        launch("compiler detected", "jmap");
-        launch("Java System Properties", "jinfo");
-        launch("java.threads", "jsnap");
+        launch("compiler detected", null, "jmap", "--clstats");
+        launchNotOSX("No deadlocks found", null, "jstack");
+        launch("compiler detected", null, "jmap");
+        launch("Java System Properties",
+               "System Properties info not available", "jinfo");
+        launch("java.threads", null, "jsnap");
 
         testHeapDump();