RFR: 8213226: [TESTBUG] Reduce the usage of CDSTestUtils.executeAndLog()

Ioi Lam iklam at openjdk.java.net
Fri Jan 29 22:53:46 UTC 2021


On Thu, 28 Jan 2021 18:44:45 GMT, Calvin Cheung <ccheung at openjdk.org> wrote:

> Please review this CDS tests cleanup for reducing the usage of `CDSTestUtils.executeAndLog()` by making use of `CDSTestUtils.run()`, `CDSTestUtils.createArchiveAndCheck()`, etc.
> 
> Testing: tiers 1 - 4.

Changes requested by iklam (Reviewer).

test/hotspot/jtreg/runtime/cds/DeterministicDump.java line 86:

> 84:             .setArchiveName(archiveName)
> 85:             .addSuffix(more);
> 86:         OutputAnalyzer out = CDSTestUtils.createArchive(opts);

Use `createArchiveAndCheck` instead?

test/hotspot/jtreg/runtime/cds/appcds/DumpClassList.java line 105:

> 103:         CDSTestUtils.checkDump(out, "[info][class,load] boot.append.Foo")
> 104:             .shouldNotContain("Preload Warning: Cannot find java/lang/invoke/LambdaForm")
> 105:             .shouldNotContain("Preload Warning: Cannot find boot/append/Foo");

I think can be further simplified as

CDSTestUtils.createArchiveAndCheck(opts)
   .shouldNotContain("Preload Warning: Cannot find java/lang/invoke/LambdaForm")
   .shouldNotContain("Preload Warning: Cannot find boot/append/Foo")
   .shouldContain("[info][class,load] boot.append.Foo");

Probably most `createArchive()` calls can be replaced `with createArchiveAndCheck()`

test/hotspot/jtreg/runtime/cds/appcds/StaticArchiveWithLambda.java line 54:

> 52:                        appClass);
> 53:         CDSTestUtils.run(dumpOpts)
> 54:                     .assertNormalExit();

I see several places with similar code. Maybe the above can be moved into a common method like

CDSTestUtils.dumpClassList(classlist, "-cp", appJar,  appClass);

`CDSTestUtils.dumpClassList` can internally call `assertNormaExit`, and return the `Result` so the test case can perform more tests if necessary.

-------------

PR: https://git.openjdk.java.net/jdk/pull/2297


More information about the hotspot-runtime-dev mailing list