< prev index next >
test/jdk/sun/tools/jcmd/TestJcmdSanity.java
Print this page
rev 51638 : [mq]: 8210112
rev 51639 : [mq]: 8210112-1
*** 28,48 ****
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.List;
! import jdk.testlibrary.OutputAnalyzer;
! import jdk.testlibrary.ProcessTools;
import jdk.testlibrary.Utils;
/*
* @test
* @bug 7104647 7154822
* @summary Unit test for jcmd utility. The test will send different diagnostic
* command requests to the current java process.
*
* @library /lib/testlibrary
*
* @build jdk.testlibrary.*
* @run main/othervm -XX:+UsePerfData TestJcmdSanity
*/
public class TestJcmdSanity {
--- 28,49 ----
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.List;
! import jdk.test.lib.process.OutputAnalyzer;
! import jdk.test.lib.process.ProcessTools;
import jdk.testlibrary.Utils;
/*
* @test
* @bug 7104647 7154822
* @summary Unit test for jcmd utility. The test will send different diagnostic
* command requests to the current java process.
*
* @library /lib/testlibrary
+ * @library /test/lib
*
* @build jdk.testlibrary.*
* @run main/othervm -XX:+UsePerfData TestJcmdSanity
*/
public class TestJcmdSanity {
*** 132,147 ****
* VM.system_properties
*
* @param output The generated output from the jcmd.
* @throws Exception
*/
! private static void matchJcmdCommands(OutputAnalyzer output) throws Exception {
! int matchedCount = output.shouldMatchByLine(JCMD_COMMAND_REGEX,
"help",
JCMD_COMMAND_REGEX);
- assertGreaterThan(matchedCount , 0,
- "Found no lines matching pattern: " + JCMD_COMMAND_REGEX);
}
/**
* Verifies the generated output from the PerfCounter.print command
* matches a certain pattern.
--- 133,146 ----
* VM.system_properties
*
* @param output The generated output from the jcmd.
* @throws Exception
*/
! private static void matchJcmdCommands(OutputAnalyzer output) {
! output.shouldMatchByLine(JCMD_COMMAND_REGEX,
"help",
JCMD_COMMAND_REGEX);
}
/**
* Verifies the generated output from the PerfCounter.print command
* matches a certain pattern.
*** 152,166 ****
* sun.rt.javaCommand="com.sun.javatest.regtest.MainWrapper /tmp/jtreg/jtreg-workdir/classes/sun/tools/jcmd/TestJcmdSanity.jta"
*
* @param output The generated output from the PerfCounter.print command.
* @throws Exception
*/
! private static void matchPerfCounters(OutputAnalyzer output) throws Exception {
! int matchedCount = output.shouldMatchByLineFrom(PERF_COUNTER_REGEX,
PERF_COUNTER_REGEX);
- assertGreaterThan(matchedCount , 0,
- "Found no lines matching pattern: " + PERF_COUNTER_REGEX);
}
private static void verifyOutputAgainstFile(OutputAnalyzer output) throws IOException {
Path path = Paths.get(TEST_SRC, "help_help.out");
List<String> fileOutput = Files.readAllLines(path);
--- 151,163 ----
* sun.rt.javaCommand="com.sun.javatest.regtest.MainWrapper /tmp/jtreg/jtreg-workdir/classes/sun/tools/jcmd/TestJcmdSanity.jta"
*
* @param output The generated output from the PerfCounter.print command.
* @throws Exception
*/
! private static void matchPerfCounters(OutputAnalyzer output) {
! output.shouldMatchByLineFrom(PERF_COUNTER_REGEX,
PERF_COUNTER_REGEX);
}
private static void verifyOutputAgainstFile(OutputAnalyzer output) throws IOException {
Path path = Paths.get(TEST_SRC, "help_help.out");
List<String> fileOutput = Files.readAllLines(path);
< prev index next >