This commit is contained in:
Alejandro Murillo 2016-08-12 13:58:18 -07:00
commit b5eefa753f
2 changed files with 23 additions and 11 deletions

View File

@ -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 @@ BUNDLE_UP_AND_EXIT = \
( \
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 \

View File

@ -40,6 +40,7 @@ import java.io.File;
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 @@ public class BasicLauncherTest {
* @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 @@ public class BasicLauncherTest {
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 class BasicLauncherTest {
}
}
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 @@ public class BasicLauncherTest {
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 @@ public class BasicLauncherTest {
}
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 @@ public class BasicLauncherTest {
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();