Skip to content

Commit ebf443a

Browse files
committedSep 29, 2020
8253590: java/foreign tests are still failing on x86_32 after foreign-memaccess integration
Reviewed-by: psandoz
1 parent 431338b commit ebf443a

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed
 

‎test/jdk/java/foreign/TestArrays.java

+5-4
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424

2525
/*
2626
* @test
27-
* @run testng TestArrays
27+
* @run testng/othervm -Dforeign.restricted=permit TestArrays
2828
*/
2929

3030
import jdk.incubator.foreign.MemoryAddress;
@@ -105,10 +105,11 @@ public void testArrays(Consumer<MemoryAddress> init, SequenceLayout layout) {
105105
}
106106
}
107107

108-
@Test(expectedExceptions = { UnsupportedOperationException.class,
109-
IllegalArgumentException.class })
108+
@Test(expectedExceptions = UnsupportedOperationException.class)
110109
public void testTooBigForArray() {
111-
MemorySegment.allocateNative((long) Integer.MAX_VALUE * 2).toByteArray();
110+
try (MemorySegment segment = MemorySegment.ofNativeRestricted(MemoryAddress.NULL, (long)Integer.MAX_VALUE + 10L, null, null, null)) {
111+
segment.toByteArray();
112+
}
112113
}
113114

114115
@Test(expectedExceptions = IllegalStateException.class)

‎test/jdk/java/foreign/TestByteBuffer.java

+3-4
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
* @test
2828
* @modules java.base/sun.nio.ch
2929
* jdk.incubator.foreign/jdk.internal.foreign
30-
* @run testng TestByteBuffer
30+
* @run testng/othervm -Dforeign.restricted=permit TestByteBuffer
3131
*/
3232

3333

@@ -458,10 +458,9 @@ public void testBufferOnClosedScope() {
458458
byteBuffer.get(); // should throw
459459
}
460460

461-
@Test(expectedExceptions = { UnsupportedOperationException.class,
462-
IllegalArgumentException.class })
461+
@Test(expectedExceptions = UnsupportedOperationException.class)
463462
public void testTooBigForByteBuffer() {
464-
try (MemorySegment segment = MemorySegment.allocateNative((long)Integer.MAX_VALUE + 10L)) {
463+
try (MemorySegment segment = MemorySegment.ofNativeRestricted(MemoryAddress.NULL, (long)Integer.MAX_VALUE + 10L, null, null, null)) {
465464
segment.asByteBuffer();
466465
}
467466
}

0 commit comments

Comments
 (0)
Please sign in to comment.