Java Code Examples for jdk.test.lib.process.OutputAnalyzer#shouldNotContain()

The following examples show how to use jdk.test.lib.process.OutputAnalyzer#shouldNotContain() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: GuardShrinkWarning.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
public static void main(String args[]) throws Exception {

    ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(
      "-showversion",
      "-XX:+UseConcMarkSweepGC",
      "-XX:+ExplicitGCInvokesConcurrent",
      "GuardShrinkWarning$SystemGCCaller"
      );

    OutputAnalyzer output = new OutputAnalyzer(pb.start());

    output.shouldNotContain("Shrinking of CMS not yet implemented");

    output.shouldNotContain("error");

    output.shouldHaveExitValue(0);
  }
 
Example 2
Source File: TestVerifySubSet.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
public static void main(String args[]) throws Exception {

        OutputAnalyzer output;

        output = runTest("heap, threads, codecache, metaspace");
        output.shouldContain("Heap");
        output.shouldContain("Threads");
        output.shouldContain("CodeCache");
        output.shouldContain("MetaspaceAux");
        output.shouldNotContain("SymbolTable");
        output.shouldNotContain("StringTable");
        output.shouldNotContain("SystemDictionary");
        output.shouldNotContain("CodeCache Oops");
        output.shouldHaveExitValue(0);

        output = runTest("hello, threads, codecache, metaspace");
        output.shouldContain("memory sub-system is unknown, please correct it");
        output.shouldNotContain("Threads");
        output.shouldNotContain("CodeCache");
        output.shouldNotContain("MetaspaceAux");
        output.shouldHaveExitValue(1);
    }
 
Example 3
Source File: TestNewSizeThreadIncrease.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
static void runNewSizeThreadIncreaseTest(String expectedValue, boolean isNewsizeChanged) throws Exception {
  ProcessBuilder pb = ProcessTools.createJavaProcessBuilder("-XX:+UseSerialGC",
                                                            "-Xms96M",
                                                            "-Xmx128M",
                                                            "-XX:NewRatio=2",
                                                            "-Xlog:gc+heap+ergo=debug",
                                                            "-XX:NewSizeThreadIncrease="+expectedValue,
                                                            GCTest.class.getName());
  OutputAnalyzer output = new OutputAnalyzer(pb.start());

  output.shouldHaveExitValue(0);

  if (isNewsizeChanged) {
    output.shouldContain(LOG_NEWSIZE_CHANGED);
  } else {
    output.shouldNotContain(LOG_NEWSIZE_CHANGED);
  }
}
 
Example 4
Source File: AssertSafepointCheckConsistency3.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
public static void main(String args[]) throws Exception {
    if (args.length > 0) {
        WhiteBox.getWhiteBox().assertMatchingSafepointCalls(false, true);
    }
    if (Platform.isDebugBuild()){
        ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(
              "-Xbootclasspath/a:.",
              "-XX:+UnlockDiagnosticVMOptions",
              "-XX:+WhiteBoxAPI",
              "-XX:-TransmitErrorReport",
              "-XX:-CreateCoredumpOnCrash",
              "-Xmx32m",
              "AssertSafepointCheckConsistency3",
              "test");

        OutputAnalyzer output = new OutputAnalyzer(pb.start());
        output.shouldNotContain("assert");
        output.shouldNotContain("never");
        output.shouldNotContain("always");
    }
}
 
Example 5
Source File: TransformTestCommon.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
private static void checkSharingByClass(TestEntry entry, OutputAnalyzer out,
                                        String parent, String child)
    throws Exception {

    String parentSharedMatch = parent + " source: shared objects file";
    String childSharedMatch =  child +  " source: shared objects file";

    if (entry.isParentExpectedShared)
        out.shouldContain(parentSharedMatch);
    else
        out.shouldNotContain(parentSharedMatch);

    if (entry.isChildExpectedShared)
        out.shouldContain(childSharedMatch);
    else
        out.shouldNotContain(childSharedMatch);
}
 
Example 6
Source File: AdaptiveGCBoundary.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
public static void main(String args[]) throws Exception {

    ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(
      "-showversion",
      "-XX:+UseParallelGC",
      "-XX:+UseAdaptiveGCBoundary",
      "-XX:+PrintCommandLineFlags",
      SystemGCCaller.class.getName()
      );

    OutputAnalyzer output = new OutputAnalyzer(pb.start());

    output.shouldContain("+UseAdaptiveGCBoundary");

    output.shouldNotContain("error");

    output.shouldHaveExitValue(0);
  }
 
Example 7
Source File: CommandLineDetail.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
public static void main(String args[]) throws Exception {

    ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(
      "-XX:NativeMemoryTracking=detail",
      "-version");
    OutputAnalyzer output = new OutputAnalyzer(pb.start());
    output.shouldNotContain("error");
    output.shouldHaveExitValue(0);
  }
 
Example 8
Source File: TestCMS.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
public static void runTest(String[] args) throws Exception {
  ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(args);
  OutputAnalyzer output = new OutputAnalyzer(pb.start());
  output.shouldContain("deprecated");
  output.shouldNotContain("error");
  output.shouldHaveExitValue(0);
}
 
Example 9
Source File: TestCpoolForInvokeDynamic.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
private static void createAnotherToAttach(
                        String[] instanceKlassNames,
                        long lingeredAppPid) throws Exception {

    String[] toolArgs = {
        "--add-modules=jdk.hotspot.agent",
        "--add-exports=jdk.hotspot.agent/sun.jvm.hotspot=ALL-UNNAMED",
        "--add-exports=jdk.hotspot.agent/sun.jvm.hotspot.utilities=ALL-UNNAMED",
        "--add-exports=jdk.hotspot.agent/sun.jvm.hotspot.oops=ALL-UNNAMED",
        "--add-exports=jdk.hotspot.agent/sun.jvm.hotspot.debugger=ALL-UNNAMED",
        "--add-exports=jdk.hotspot.agent/sun.jvm.hotspot.ui.classbrowser=ALL-UNNAMED",
        "TestCpoolForInvokeDynamic",
        Long.toString(lingeredAppPid)
    };

    // Start a new process to attach to the lingered app
    ProcessBuilder processBuilder = ProcessTools.createJavaProcessBuilder(toolArgs);
    OutputAnalyzer SAOutput = ProcessTools.executeProcess(processBuilder);
    SAOutput.shouldHaveExitValue(0);
    System.out.println(SAOutput.getOutput());

    SAOutput.shouldContain("invokedynamic");
    SAOutput.shouldContain("Name and Type");
    SAOutput.shouldContain("run:()Ljava.lang.Runnable");
    SAOutput.shouldContain("compare:()LTestComparator");
    SAOutput.shouldNotContain("Corrupted constant pool");
}
 
Example 10
Source File: TestG1.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
public static void main(String args[]) throws Exception {
  ProcessBuilder pb = ProcessTools.createJavaProcessBuilder("-XX:+UseG1GC", "-version");
  OutputAnalyzer output = new OutputAnalyzer(pb.start());
  output.shouldNotContain("deprecated");
  output.shouldNotContain("error");
  output.shouldHaveExitValue(0);
}
 
Example 11
Source File: ClassLoadUnloadTest.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
static void checkAbsent(String... outputStrings) throws Exception {
    out = new OutputAnalyzer(pb.start());
    for (String s: outputStrings) {
        out.shouldNotContain(s);
    }
    out.shouldHaveExitValue(0);
}
 
Example 12
Source File: TestCompressedClassFlags.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
public static void main(String[] args) throws Exception {
    if (Platform.is64bit()) {
        OutputAnalyzer output = runJava("-XX:CompressedClassSpaceSize=1g",
                                        "-XX:-UseCompressedClassPointers",
                                        "-version");
        output.shouldContain("warning");
        output.shouldNotContain("error");
        output.shouldHaveExitValue(0);
    }
}
 
Example 13
Source File: TestStringDeduplicationTools.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
public static void testFullGC() throws Exception {
    // Do full GC to age strings to provoke deduplication
    OutputAnalyzer output = DeduplicationTest.run(LargeNumberOfStrings,
                                                  DefaultAgeThreshold,
                                                  FullGC,
                                                  "-Xlog:gc,gc+stringdedup=trace");
    output.shouldNotContain("Pause Young (G1 Evacuation Pause)");
    output.shouldContain("Full GC");
    output.shouldContain("Concurrent String Deduplication");
    output.shouldContain("Deduplicated:");
    output.shouldHaveExitValue(0);
}
 
Example 14
Source File: TestStringDeduplicationTools.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
public static void testYoungGC() throws Exception {
    // Do young GC to age strings to provoke deduplication
    OutputAnalyzer output = DeduplicationTest.run(LargeNumberOfStrings,
                                                  DefaultAgeThreshold,
                                                  YoungGC,
                                                  "-Xlog:gc,gc+stringdedup=trace");
    output.shouldNotContain("Full GC");
    output.shouldContain("Pause Young (G1 Evacuation Pause)");
    output.shouldContain("Concurrent String Deduplication");
    output.shouldContain("Deduplicated:");
    output.shouldHaveExitValue(0);
}
 
Example 15
Source File: TestMaxHeapSizeTools.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
private static void shouldContainOrNot(OutputAnalyzer output, boolean contains, String message) throws Exception {
  if (contains) {
    output.shouldContain(message);
  } else {
    output.shouldNotContain(message);
  }
}
 
Example 16
Source File: CheckSegmentedCodeCache.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
private static void verifyCodeHeapNotExists(ProcessBuilder pb, String... heapNames) throws Exception {
    OutputAnalyzer out = new OutputAnalyzer(pb.start());
    out.shouldHaveExitValue(0);
    for (String name : heapNames) {
        out.shouldNotContain(name);
    }
}
 
Example 17
Source File: StartupTimeTest.java    From openjdk-jdk9 with GNU General Public License v2.0 4 votes vote down vote up
static void analyzeOutputOff(ProcessBuilder pb) throws Exception {
    OutputAnalyzer output = new OutputAnalyzer(pb.start());
    output.shouldNotContain("[startuptime]");
    output.shouldHaveExitValue(0);
}
 
Example 18
Source File: BiasedLockingTest.java    From openjdk-jdk9 with GNU General Public License v2.0 4 votes vote down vote up
static void analyzeOutputOff(ProcessBuilder pb) throws Exception {
    OutputAnalyzer output = new OutputAnalyzer(pb.start());
    output.shouldNotContain("[biasedlocking]");
    output.shouldHaveExitValue(0);
}
 
Example 19
Source File: MonitorInflationTest.java    From openjdk-jdk9 with GNU General Public License v2.0 4 votes vote down vote up
static void analyzeOutputOff(ProcessBuilder pb) throws Exception {
    OutputAnalyzer output = new OutputAnalyzer(pb.start());
    output.shouldNotContain("[monitorinflation]");
    output.shouldHaveExitValue(0);
}
 
Example 20
Source File: CompressedOopsTest.java    From openjdk-jdk9 with GNU General Public License v2.0 4 votes vote down vote up
static void analyzeOutputOff(ProcessBuilder pb) throws Exception {
    OutputAnalyzer output = new OutputAnalyzer(pb.start());
    output.shouldNotContain("[gc,heap,coops]");
    output.shouldHaveExitValue(0);
}