RFR (M) 8179249 Improve process output analysis in CDS tests

Ioi Lam ioi.lam at oracle.com
Thu Jan 25 21:16:46 UTC 2018


Hi,

This is a preliminary RFR. I still need to do some cleanup and add more 
JavaDocs. However, I just wanted to show the design and see if people 
are OK with it:

https://bugs.openjdk.java.net/browse/JDK-8179249
http://cr.openjdk.java.net/~iklam/jdk11/8179249-improve-cds-tests-process-output-analysis.v01/

The goal of this RFE is to make the CDS tests more maintainable. You can 
read the background in the RFE description. Here are some examples of 
the new style:

      * 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");

More detailed description can be found in CDSTestUtils.java

In this push, I am limiting the changes only to those tests that called 
TestCommon.execCommon(), which had the more unreadable and error-prone 
code. I may clean up the other tests in a future RFE.

I removed the TestCommon.execCommon calls from all the appcds test 
cases, except for the following tests

runtime/appcds/ClassLoaderTest.java

     This test has a bug (JDK-8196121), so it should be fixed separately.

runtime/appcds/jigsaw/classpathtests/DummyClassesInBootClassPath.java

     This test has a bug (JDK-8196124), so it should be fixed separately.

runtime/appcds/jvmti/transformRelatedClasses/TransformRelatedClassesAppCDS.java

      This test is related to 
runtime/SharedArchiveFile/serviceability/transformRelatedClasses I plan 
to fix all the tests in runtime/SharedArchiveFile in a separate RFE.

Thanks
- Ioi



More information about the hotspot-runtime-dev mailing list