From 61c8e5e6b2a2253b74aee6d69c51ea299ab9cc74 Mon Sep 17 00:00:00 2001 From: ChengJin01 Date: Thu, 25 Apr 2024 09:24:45 -0400 Subject: [PATCH] [FFI_JDK21/Test] Enable the downcall tests for primitives on z/OS The changes only enable the downcall specific tests for primitives on z/OS to ensure FFI functionally works as expected given the related code issues with the remaining test cases have not yet been resolved on z/OS. Signed-off-by: ChengJin01 --- .../jdk/internal/foreign/abi/UpcallLinker.java | 4 ++++ .../resources/excludes/latest_exclude_21.txt | 12 ++++++++++++ test/functional/Java21Only/build.xml | 4 +++- test/functional/Java21Only/playlist.xml | 3 ++- .../test/jep442/downcall/InvalidDownCallTests.java | 2 ++ .../test/jep442/downcall/MultiThreadingTests2.java | 2 +- .../openj9/test/jep442/downcall/StructTests1.java | 2 +- .../openj9/test/jep442/downcall/StructTests2.java | 2 +- .../test/jep442/downcall/UnionStructTests.java | 2 +- .../org/openj9/test/jep442/downcall/UnionTests.java | 2 +- test/functional/Java21Only/testng_210.xml | 3 +++ 11 files changed, 31 insertions(+), 7 deletions(-) diff --git a/jcl/src/java.base/share/classes/jdk/internal/foreign/abi/UpcallLinker.java b/jcl/src/java.base/share/classes/jdk/internal/foreign/abi/UpcallLinker.java index aa03582fcb9..6d7fa7b419a 100644 --- a/jcl/src/java.base/share/classes/jdk/internal/foreign/abi/UpcallLinker.java +++ b/jcl/src/java.base/share/classes/jdk/internal/foreign/abi/UpcallLinker.java @@ -144,9 +144,13 @@ public static UpcallStubFactory makeFactory(MethodType methodType, ABIDescriptor * @return a factory instance that wraps up the upcall specific code */ public static UpcallStubFactory makeFactory(MethodType methodType, FunctionDescriptor descriptor, LinkerOptions options) { + /*[IF PLATFORM-mz31 | PLATFORM-mz64]*/ + throw new InternalError("Upcall is not yet implemented"); //$NON-NLS-1$ + /*[ELSE] PLATFORM-mz31 | PLATFORM-mz64 */ return (target, arena) -> { return UpcallLinker.make(target, methodType, descriptor, arena, options); }; + /*[ENDIF] PLATFORM-mz31 | PLATFORM-mz64 */ } /*[ENDIF] JAVA_SPEC_VERSION >= 21 */ } diff --git a/test/TestConfig/resources/excludes/latest_exclude_21.txt b/test/TestConfig/resources/excludes/latest_exclude_21.txt index 8d3b462d32e..251d48fbe1b 100644 --- a/test/TestConfig/resources/excludes/latest_exclude_21.txt +++ b/test/TestConfig/resources/excludes/latest_exclude_21.txt @@ -31,6 +31,18 @@ org.openj9.test.nestmates.NestAttributeTest:testGetNestMembersAPINestMemberWrong org.openj9.test.nestmates.NestAttributeTest:testGetNestMembersAPINestMemberWrongNestHost NA generic-all org.openj9.test.nestmates.NestAttributeTest:testGetNestMembersAPINestMemberWrongNestHost2 NA generic-all +org.openj9.test.jep442.downcall.InvalidDownCallTests:test_heapSegmentForStructArgument javanext/issues/441 zos_390-64 +org.openj9.test.jep442.downcall.InvalidDownCallTests:test_invalidMemoryLayoutForMemAddr javanext/issues/441 zos_390-64 +org.openj9.test.jep442.downcall.InvalidDownCallTests:test_invalidMemoryLayoutForReturnType javanext/issues/441 zos_390-64 +org.openj9.test.jep442.downcall.PrimitiveTypeTests1:test_memoryAllocFreeFromDefaultLib_1 javanext/issues/441 zos_390-64 +org.openj9.test.jep442.downcall.PrimitiveTypeTests1:test_printfFromDefaultLibWithMemAddr_1 javanext/issues/441 zos_390-64 +org.openj9.test.jep442.downcall.PrimitiveTypeTests1:test_printfFromDefaultLibWithMemAddr_LinkerOption_1 javanext/issues/441 zos_390-64 +org.openj9.test.jep442.downcall.PrimitiveTypeTests1:test_strlenFromDefaultLibWithMemAddr_1 javanext/issues/441 zos_390-64 +org.openj9.test.jep442.downcall.PrimitiveTypeTests2:test_memoryAllocFreeFromDefaultLib_2 javanext/issues/441 zos_390-64 +org.openj9.test.jep442.downcall.PrimitiveTypeTests2:test_printfFromDefaultLibWithMemAddr_2 javanext/issues/441 zos_390-64 +org.openj9.test.jep442.downcall.PrimitiveTypeTests2:test_printfFromDefaultLibWithMemAddr_LinkerOption_2 javanext/issues/441 zos_390-64 +org.openj9.test.jep442.downcall.PrimitiveTypeTests2:test_strlenFromDefaultLibWithMemAddr_2 javanext/issues/441 zos_390-64 + # Exclude Java 19 Thread related failures org.openj9.test.java.lang.Test_ThreadGroup:test_activeCount NA generic-all diff --git a/test/functional/Java21Only/build.xml b/test/functional/Java21Only/build.xml index 138cd920a3e..c806a53fa40 100644 --- a/test/functional/Java21Only/build.xml +++ b/test/functional/Java21Only/build.xml @@ -34,7 +34,8 @@ SPDX-License-Identifier: EPL-2.0 OR Apache-2.0 OR GPL-2.0-only WITH Classpath-ex - + + @@ -52,6 +53,7 @@ SPDX-License-Identifier: EPL-2.0 OR Apache-2.0 OR GPL-2.0-only WITH Classpath-ex + diff --git a/test/functional/Java21Only/playlist.xml b/test/functional/Java21Only/playlist.xml index 0137ed92b7a..4fcd58422de 100644 --- a/test/functional/Java21Only/playlist.xml +++ b/test/functional/Java21Only/playlist.xml @@ -35,7 +35,7 @@ SPDX-License-Identifier: EPL-2.0 OR Apache-2.0 OR GPL-2.0-only WITH Classpath-ex -excludegroups $(DEFAULT_EXCLUDE); \ $(TEST_STATUS) - bits.64,^arch.arm,^arch.riscv,^os.zos,^os.sunos + bits.64,^arch.arm,^arch.riscv,^os.sunos sanity @@ -44,6 +44,7 @@ SPDX-License-Identifier: EPL-2.0 OR Apache-2.0 OR GPL-2.0-only WITH Classpath-ex openj9 + ibm 21 diff --git a/test/functional/Java21Only/src/org/openj9/test/jep442/downcall/InvalidDownCallTests.java b/test/functional/Java21Only/src/org/openj9/test/jep442/downcall/InvalidDownCallTests.java index 9b3a5fc7a98..55c6295c8ff 100644 --- a/test/functional/Java21Only/src/org/openj9/test/jep442/downcall/InvalidDownCallTests.java +++ b/test/functional/Java21Only/src/org/openj9/test/jep442/downcall/InvalidDownCallTests.java @@ -114,6 +114,7 @@ public void test_nullValueForStructArgument() throws Throwable { } } + @Test public void test_nullSegmentForPtrArgument() throws Throwable { FunctionDescriptor fd = FunctionDescriptor.of(JAVA_INT, JAVA_INT, ADDRESS); MemorySegment functionSymbol = nativeLibLookup.find("validateNullAddrArgument").get(); @@ -154,6 +155,7 @@ public void test_heapSegmentForPtrArgument() throws Throwable { fail("Failed to throw out IllegalArgumentException in the case of the heap segment"); } + @Test public void test_heapSegmentForStructArgument() throws Throwable { GroupLayout structLayout = MemoryLayout.structLayout(JAVA_INT.withName("elem1"), JAVA_INT.withName("elem2")); VarHandle intHandle1 = structLayout.varHandle(PathElement.groupElement("elem1")); diff --git a/test/functional/Java21Only/src/org/openj9/test/jep442/downcall/MultiThreadingTests2.java b/test/functional/Java21Only/src/org/openj9/test/jep442/downcall/MultiThreadingTests2.java index 44773752926..34e130ac957 100644 --- a/test/functional/Java21Only/src/org/openj9/test/jep442/downcall/MultiThreadingTests2.java +++ b/test/functional/Java21Only/src/org/openj9/test/jep442/downcall/MultiThreadingTests2.java @@ -44,7 +44,7 @@ * verifies the downcalls with the shared downcall handlder (cached as soft reference in OpenJDK) * in multithreading. */ -@Test(groups = { "level.sanity" }) +@Test(groups = { "level.sanity", "disabled.os.zos" }) public class MultiThreadingTests2 implements Thread.UncaughtExceptionHandler { private volatile Throwable initException; diff --git a/test/functional/Java21Only/src/org/openj9/test/jep442/downcall/StructTests1.java b/test/functional/Java21Only/src/org/openj9/test/jep442/downcall/StructTests1.java index 05f9a7ea123..61515276ba9 100644 --- a/test/functional/Java21Only/src/org/openj9/test/jep442/downcall/StructTests1.java +++ b/test/functional/Java21Only/src/org/openj9/test/jep442/downcall/StructTests1.java @@ -52,7 +52,7 @@ * [2] the test suite is mainly intended for the following Clinker API: * MethodHandle downcallHandle(MemorySegment symbol, FunctionDescriptor function) */ -@Test(groups = { "level.sanity" }) +@Test(groups = { "level.sanity", "disabled.os.zos" }) public class StructTests1 { private static boolean isAixOS = System.getProperty("os.name").toLowerCase().contains("aix"); private static Linker linker = Linker.nativeLinker(); diff --git a/test/functional/Java21Only/src/org/openj9/test/jep442/downcall/StructTests2.java b/test/functional/Java21Only/src/org/openj9/test/jep442/downcall/StructTests2.java index cc372be089f..1e680436dab 100644 --- a/test/functional/Java21Only/src/org/openj9/test/jep442/downcall/StructTests2.java +++ b/test/functional/Java21Only/src/org/openj9/test/jep442/downcall/StructTests2.java @@ -52,7 +52,7 @@ * [2] the test suite is mainly intended for the following Clinker API: * MethodHandle downcallHandle(FunctionDescriptor function) */ -@Test(groups = { "level.sanity" }) +@Test(groups = { "level.sanity", "disabled.os.zos" }) public class StructTests2 { private static boolean isAixOS = System.getProperty("os.name").toLowerCase().contains("aix"); private static Linker linker = Linker.nativeLinker(); diff --git a/test/functional/Java21Only/src/org/openj9/test/jep442/downcall/UnionStructTests.java b/test/functional/Java21Only/src/org/openj9/test/jep442/downcall/UnionStructTests.java index e9a627537ea..a15f40567a0 100644 --- a/test/functional/Java21Only/src/org/openj9/test/jep442/downcall/UnionStructTests.java +++ b/test/functional/Java21Only/src/org/openj9/test/jep442/downcall/UnionStructTests.java @@ -49,7 +49,7 @@ * The test suite is mainly intended for the following Linker API: * MethodHandle downcallHandle(MemorySegment symbol, FunctionDescriptor function) */ -@Test(groups = { "level.sanity" }) +@Test(groups = { "level.sanity", "disabled.os.zos" }) public class UnionStructTests { private static Linker linker = Linker.nativeLinker(); diff --git a/test/functional/Java21Only/src/org/openj9/test/jep442/downcall/UnionTests.java b/test/functional/Java21Only/src/org/openj9/test/jep442/downcall/UnionTests.java index 05f7ce21b43..446f7c3497c 100644 --- a/test/functional/Java21Only/src/org/openj9/test/jep442/downcall/UnionTests.java +++ b/test/functional/Java21Only/src/org/openj9/test/jep442/downcall/UnionTests.java @@ -48,7 +48,7 @@ * The test suite is mainly intended for the following Linker API: * MethodHandle downcallHandle(MemorySegment symbol, FunctionDescriptor function) */ -@Test(groups = { "level.sanity" }) +@Test(groups = { "level.sanity", "disabled.os.zos" }) public class UnionTests { private static Linker linker = Linker.nativeLinker(); diff --git a/test/functional/Java21Only/testng_210.xml b/test/functional/Java21Only/testng_210.xml index cf9236a1579..d114bc18146 100644 --- a/test/functional/Java21Only/testng_210.xml +++ b/test/functional/Java21Only/testng_210.xml @@ -24,6 +24,9 @@ + + +