[foreign-memaccess+abi] RFR: 8303831: TestSegmentCopy times out
Jorn Vernee
jvernee at openjdk.org
Thu Apr 13 16:31:39 UTC 2023
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.
-------------
Commit messages:
- polish
- fix running time of TestSegmentCopy
Changes: https://git.openjdk.org/panama-foreign/pull/827/files
Webrev: https://webrevs.openjdk.org/?repo=panama-foreign&pr=827&range=00
Issue: https://bugs.openjdk.org/browse/JDK-8303831
Stats: 141 lines in 1 file changed: 28 ins; 42 del; 71 mod
Patch: https://git.openjdk.org/panama-foreign/pull/827.diff
Fetch: git fetch https://git.openjdk.org/panama-foreign.git pull/827/head:pull/827
PR: https://git.openjdk.org/panama-foreign/pull/827
More information about the panama-dev
mailing list