< prev index next >

test/lib/jdk/test/lib/cds/CDSTestUtils.java

Print this page

*** 80,118 **** * However, if the JVM process fails with mapping failure, the string "Hi" will not be in the output, * and your test case will fail intermittently. * * Instead, the test case should be written as * ! * CCDSTestUtils.run(args).assertNormalExit("Hi"); * * EXAMPLES/HOWTO * * 1. For simple substring matching: * ! * CCDSTestUtils.run(args).assertNormalExit("Hi"); ! * CCDSTestUtils.run(args).assertNormalExit("a", "b", "x"); ! * CCDSTestUtils.run(args).assertAbnormalExit("failure 1", "failure2"); * * 2. For more complex output matching: using Lambda expressions * ! * CCDSTestUtils.run(args) * .assertNormalExit(output -> output.shouldNotContain("this should not be printed"); ! * CCDSTestUtils.run(args) * .assertAbnormalExit(output -> { * output.shouldNotContain("this should not be printed"); * output.shouldHaveExitValue(123); * }); * * 3. Chaining several checks: * ! * CCDSTestUtils.run(args) * .assertNormalExit(output -> output.shouldNotContain("this should not be printed") * .assertNormalExit("should have this", "should have that"); * * 4. [Rare use case] if a test sometimes exit normally, and sometimes abnormally: * ! * CCDSTestUtils.run(args) * .ifNormalExit("ths string is printed when exiting with 0") * .ifAbNormalExit("ths string is printed when exiting with 1"); * * NOTE: you usually don't want to write your test case like this -- it should always * exit with the same exit code. (But I kept this API because some existing test cases --- 80,118 ---- * However, if the JVM process fails with mapping failure, the string "Hi" will not be in the output, * and your test case will fail intermittently. * * Instead, the test case should be written as * ! * CDSTestUtils.run(args).assertNormalExit("Hi"); * * EXAMPLES/HOWTO * * 1. For simple substring matching: * ! * CDSTestUtils.run(args).assertNormalExit("Hi"); ! * CDSTestUtils.run(args).assertNormalExit("a", "b", "x"); ! * CDSTestUtils.run(args).assertAbnormalExit("failure 1", "failure2"); * * 2. For more complex output matching: using Lambda expressions * ! * CDSTestUtils.run(args) * .assertNormalExit(output -> output.shouldNotContain("this should not be printed"); ! * CDSTestUtils.run(args) * .assertAbnormalExit(output -> { * output.shouldNotContain("this should not be printed"); * output.shouldHaveExitValue(123); * }); * * 3. Chaining several checks: * ! * CDSTestUtils.run(args) * .assertNormalExit(output -> output.shouldNotContain("this should not be printed") * .assertNormalExit("should have this", "should have that"); * * 4. [Rare use case] if a test sometimes exit normally, and sometimes abnormally: * ! * CDSTestUtils.run(args) * .ifNormalExit("ths string is printed when exiting with 0") * .ifAbNormalExit("ths string is printed when exiting with 1"); * * NOTE: you usually don't want to write your test case like this -- it should always * exit with the same exit code. (But I kept this API because some existing test cases
*** 386,398 **** --- 386,400 ---- for (String p : opts.prefix) cmd.add(p); cmd.add("-Xshare:" + opts.xShareMode); cmd.add("-Dtest.timeout.factor=" + TestTimeoutFactor); + if (!opts.useSystemArchive) { if (opts.archiveName == null) opts.archiveName = getDefaultArchiveName(); cmd.add("-XX:SharedArchiveFile=" + opts.archiveName); + } if (opts.useVersion) cmd.add("-version"); for (String s : opts.suffix) cmd.add(s);
< prev index next >