On Tue, 5 Jan 2021 16:01:11 GMT, Uwe Schindler <uschind...@openjdk.org> wrote:

>> I am not sure if a test like this is really needed.
>> The alignment is pageSize on Linux and some arbitrary value (65536) on 
>> Windows. If you have some test file that writes like a few bytes (1, 2, 3, 
>> 4,...) To a file and then maps it with offsets other than zero, you just 
>> have to get the first byte and compare it to offset.
>
> In fact the new test only checks if everything is aligned like we expect, but 
> it does not test that our mapping returns a memory segment with expected 
> contents.

So I tend to make a simple test without reflection that writes a defined 
sequence of bytes to a file and then maps it with various offsets, checking 
that the first byte in the mapped segment is from that sequence.

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

PR: https://git.openjdk.java.net/jdk16/pull/84

Reply via email to