RFR: 8271419: Refactor test code for modifying CDS archive contents [v2]
Yumin Qi
minqi at openjdk.java.net
Mon Aug 2 18:29:34 UTC 2021
On Mon, 2 Aug 2021 06:46:00 GMT, Ioi Lam <iklam at openjdk.org> wrote:
>> Yumin Qi has updated the pull request incrementally with one additional commit since the last revision:
>>
>> Move more function to CDSArchiveUtils, fixed review comments
>
> test/hotspot/jtreg/runtime/cds/appcds/SharedArchiveConsistency.java line 66:
>
>> 64: "Unable to use shared archive",
>> 65: "The shared archive file has a bad magic number",
>> 66: "Unable to map shared spaces",
>
> Why are these new errors needed? Did you change any behavior of the tests?
Thanks for mentioning this. There is an issue to use FileChannel:
outputChannel.transferFrom(inputChannel, 0, offset);
+ outputChannel.position(offset); // <---- need explicitly positioned or the following write to overwrite from offset 0.
outputChannel.write(ByteBuffer.wrap(bytes));
outputChannel.transferFrom(inputChannel, offset + bytes.length, orgSize - bytes.length);
The added lines should be removed.
> test/lib/jdk/test/lib/cds/CDSArchiveUtils.java line 73:
>
>> 71:
>> 72: public static void initialize() throws Exception {
>> 73: WhiteBox wb = WhiteBox.getWhiteBox();
>
> This method can be changed to a `static { ....}` block, so that you don't need to explicitly call `CDSArchiveUtils.initialize()`.
Will move to static block.
-------------
PR: https://git.openjdk.java.net/jdk/pull/4945
More information about the hotspot-runtime-dev
mailing list