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

Yumin Qi minqi at openjdk.java.net
Fri Jul 30 22:24:28 UTC 2021


On Fri, 30 Jul 2021 18:47:33 GMT, Ioi Lam <iklam 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
>
> 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.

Let me double check this part.

> 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.

This is same as original code, I will investigate more of this part. Thanks.

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

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


More information about the hotspot-runtime-dev mailing list