[foreign-memaccess+abi] RFR: 8303831: TestSegmentCopy times out

Maurizio Cimadamore mcimadamore at openjdk.org
Fri Apr 14 11:18:13 UTC 2023


On Thu, 13 Apr 2023 16:23:37 GMT, Jorn Vernee <jvernee at openjdk.org> wrote:

> The underlying issue turned out to be that this test generates a lot of test cases, 165890, which TestNG then spends forever generating an XML report for.
> 
> This patch refactors the test to generate less test cases. Instead of generating all the combinations of slices up front in the data provider, it is done on the fly in the test methods themselves.
> 
> Additionally, this patch improves the space that is covered. The current code tests copies between disjoint slices of the same segment. The new code uses two separate segments, which also allows testing mixes of segment types (heap/off-heap).
> 
> The current code also uses `asSlice` to generate the slices, but it seems more interesting to pass the offset of a slice directly to MemorySegment::copy, so that we test with different offsets as well (currently only offset 0 is used). I think we already have enough coverage of `asSlice` in other tests, such as TestSlices.
> 
> Lastly, I've removed the zeroing of the target area/slice. If there's garbage in target slice, we can test that the copy properly overwrites the garbage as well.

Looks great!

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

Marked as reviewed by mcimadamore (Committer).

PR Review: https://git.openjdk.org/panama-foreign/pull/827#pullrequestreview-1385264864


More information about the panama-dev mailing list