Skip to content

Commit

Permalink
Merge pull request #19384 from ChengJin01/ffi_enable_prim_tests_jdk21…
Browse files Browse the repository at this point in the history
…_zos

[FFI_JDK21/Test] Enable the downcall tests for primitives on z/OS
  • Loading branch information
keithc-ca authored May 1, 2024
2 parents a0d1695 + 61c8e5e commit 0a576e3
Show file tree
Hide file tree
Showing 11 changed files with 31 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
}
12 changes: 12 additions & 0 deletions test/TestConfig/resources/excludes/latest_exclude_21.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 3 additions & 1 deletion test/functional/Java21Only/build.xml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,8 @@ SPDX-License-Identifier: EPL-2.0 OR Apache-2.0 OR GPL-2.0-only WITH Classpath-ex
<property name="build" location="bin" />
<property name="LIB" value="asm,testng,jcommander" />
<import file="${TEST_ROOT}/TKG/scripts/getDependencies.xml" />
<property name="TestUtilities" location="../TestUtilities/src"/>
<property name="TestUtilities" location="../TestUtilities/src" />
<property name="transformerListener" location="${TEST_ROOT}/Utils/src" />

<target name="init">
<mkdir dir="${DEST}" />
Expand All @@ -52,6 +53,7 @@ SPDX-License-Identifier: EPL-2.0 OR Apache-2.0 OR GPL-2.0-only WITH Classpath-ex
<javac srcdir="${src}" destdir="${build}" debug="true" fork="true" executable="${compiler.javac}" includeAntRuntime="false" encoding="ISO-8859-1">
<src path="${src}" />
<src path="${TestUtilities}" />
<src path="${transformerListener}" />
<compilerarg line='--enable-preview --source ${JDK_VERSION}' />
<classpath>
<pathelement location="${LIB_DIR}/testng.jar" />
Expand Down
3 changes: 2 additions & 1 deletion test/functional/Java21Only/playlist.xml
Original file line number Diff line number Diff line change
Expand Up @@ -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)
</command>
<platformRequirements>bits.64,^arch.arm,^arch.riscv,^os.zos,^os.sunos</platformRequirements>
<platformRequirements>bits.64,^arch.arm,^arch.riscv,^os.sunos</platformRequirements>
<levels>
<level>sanity</level>
</levels>
Expand All @@ -44,6 +44,7 @@ SPDX-License-Identifier: EPL-2.0 OR Apache-2.0 OR GPL-2.0-only WITH Classpath-ex
</groups>
<impls>
<impl>openj9</impl>
<impl>ibm</impl>
</impls>
<versions>
<version>21</version>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down Expand Up @@ -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"));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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();

Expand Down
3 changes: 3 additions & 0 deletions test/functional/Java21Only/testng_210.xml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@

<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd">
<suite name="Java21 only test suite" parallel="none" verbose="2">
<listeners>
<listener class-name="org.openj9.test.util.IncludeExcludeTestAnnotationTransformer" />
</listeners>
<test name="Jep442Tests_testLinkerFfi_DownCall">
<classes>
<class name="org.openj9.test.jep442.downcall.InvalidDownCallTests"/>
Expand Down

0 comments on commit 0a576e3

Please sign in to comment.