RFR: 8271419: Refactor test code for modifying CDS archive contents

Ioi Lam iklam at openjdk.java.net
Fri Jul 30 18:57:07 UTC 2021


On Fri, 30 Jul 2021 15:33:14 GMT, Yumin Qi <minqi at openjdk.org> wrote:

> The code for modifying CDS archive content could be used by other tests so the common code is refactored into a util class CDSArchiveUtils.
> 
> Tests: tier1,tier4
> 
> Thanks
> Yumin

Changes requested by iklam (Reviewer).

test/hotspot/jtreg/runtime/cds/appcds/SharedArchiveConsistency.java line 152:

> 150: 
> 151:     public static void modifyJvmIdent(File jsaFile) throws Exception {
> 152:         System.out.println("    offset_jvm_ident " + CDSArchiveUtils.offsetJvmIdent);

I think the modifyXXX functions should also be moved to CDSArchiveUtils so that they can be called by other test cases.

test/lib/jdk/test/lib/cds/CDSArchiveUtils.java line 85:

> 83:         // fileHeaderSize may not be available
> 84:         // fileHeaderSize = (int)alignUpWithPageSize(wb.getOffsetForName("file_header_size"));
> 85:     }

This should always be available. `file_header_size` is a constant value (`sizeof(FileMapHeader)`) stored inside cdsoffsets.cpp. It doesn't depend on the contents of the archive file.

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

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


More information about the hotspot-runtime-dev mailing list