diff options
Diffstat (limited to 'meson/test cases/java/9 jdk')
-rw-r--r-- | meson/test cases/java/9 jdk/lib/com_mesonbuild_JdkTest.c | 9 | ||||
-rw-r--r-- | meson/test cases/java/9 jdk/lib/com_mesonbuild_JdkTest.h | 21 | ||||
-rw-r--r-- | meson/test cases/java/9 jdk/lib/meson.build | 14 | ||||
-rw-r--r-- | meson/test cases/java/9 jdk/lib/native.c | 11 | ||||
-rw-r--r-- | meson/test cases/java/9 jdk/meson.build | 18 | ||||
-rw-r--r-- | meson/test cases/java/9 jdk/src/com/mesonbuild/JdkTest.java | 15 | ||||
-rw-r--r-- | meson/test cases/java/9 jdk/src/meson.build | 17 |
7 files changed, 105 insertions, 0 deletions
diff --git a/meson/test cases/java/9 jdk/lib/com_mesonbuild_JdkTest.c b/meson/test cases/java/9 jdk/lib/com_mesonbuild_JdkTest.c new file mode 100644 index 000000000..075e37b2b --- /dev/null +++ b/meson/test cases/java/9 jdk/lib/com_mesonbuild_JdkTest.c @@ -0,0 +1,9 @@ +#include <jni.h> + +#include "com_mesonbuild_JdkTest.h" + +JNIEXPORT jint JNICALL Java_com_mesonbuild_JdkTest_jdk_1test + (JNIEnv *env, jclass clazz) +{ + return (jint)0xdeadbeef; +} diff --git a/meson/test cases/java/9 jdk/lib/com_mesonbuild_JdkTest.h b/meson/test cases/java/9 jdk/lib/com_mesonbuild_JdkTest.h new file mode 100644 index 000000000..40083ac9b --- /dev/null +++ b/meson/test cases/java/9 jdk/lib/com_mesonbuild_JdkTest.h @@ -0,0 +1,21 @@ +/* DO NOT EDIT THIS FILE - it is machine generated */ +#include <jni.h> +/* Header for class com_mesonbuild_JdkTest */ + +#ifndef _Included_com_mesonbuild_JdkTest +#define _Included_com_mesonbuild_JdkTest +#ifdef __cplusplus +extern "C" { +#endif +/* + * Class: com_mesonbuild_JdkTest + * Method: jdk_test + * Signature: ()I + */ +JNIEXPORT jint JNICALL Java_com_mesonbuild_JdkTest_jdk_1test + (JNIEnv *, jclass); + +#ifdef __cplusplus +} +#endif +#endif diff --git a/meson/test cases/java/9 jdk/lib/meson.build b/meson/test cases/java/9 jdk/lib/meson.build new file mode 100644 index 000000000..a94776972 --- /dev/null +++ b/meson/test cases/java/9 jdk/lib/meson.build @@ -0,0 +1,14 @@ +sources = files( + 'native.c', + 'com_mesonbuild_JdkTest.c', +) + +jdkjava = shared_module( + 'jdkjava', + sources, + dependencies : [jdk], +) + +jdkjava_dep = declare_dependency( + link_with : jdkjava, +) diff --git a/meson/test cases/java/9 jdk/lib/native.c b/meson/test cases/java/9 jdk/lib/native.c new file mode 100644 index 000000000..0b5e71890 --- /dev/null +++ b/meson/test cases/java/9 jdk/lib/native.c @@ -0,0 +1,11 @@ +#include <jni.h> + +JNIEXPORT jint JNICALL +JNI_OnLoad(JavaVM *vm, void *reserved) +{ + return JNI_VERSION_1_8; +} + +JNIEXPORT void JNICALL +JNI_OnUnload(JavaVM *vm, void *reserved) +{} diff --git a/meson/test cases/java/9 jdk/meson.build b/meson/test cases/java/9 jdk/meson.build new file mode 100644 index 000000000..310ba5e2a --- /dev/null +++ b/meson/test cases/java/9 jdk/meson.build @@ -0,0 +1,18 @@ +project('jdkjava', ['c', 'java']) + +if build_machine.system() == 'cygwin' + error('MESON_SKIP_TEST: cygwin test failures') +endif + +if build_machine.system() == 'windows' and build_machine.cpu_family() == 'x86' + error('MESON_SKIP_TEST: failing builds on 32bit Windows because a 32bit JDK isn not available in the Azure Pipelines Windows images') +endif + +fs = import('fs') + +java = find_program('java') + +jdk = dependency('jdk', version : '>=1.8') + +subdir('lib') +subdir('src') diff --git a/meson/test cases/java/9 jdk/src/com/mesonbuild/JdkTest.java b/meson/test cases/java/9 jdk/src/com/mesonbuild/JdkTest.java new file mode 100644 index 000000000..35c47cef8 --- /dev/null +++ b/meson/test cases/java/9 jdk/src/com/mesonbuild/JdkTest.java @@ -0,0 +1,15 @@ +package com.mesonbuild; + +public final class JdkTest { + private static native int jdk_test(); + + public static void main(String[] args) { + if (jdk_test() != 0xdeadbeef) { + throw new RuntimeException("jdk_test() did not return 0"); + } + } + + static { + System.loadLibrary("jdkjava"); + } +} diff --git a/meson/test cases/java/9 jdk/src/meson.build b/meson/test cases/java/9 jdk/src/meson.build new file mode 100644 index 000000000..d1b9ee31c --- /dev/null +++ b/meson/test cases/java/9 jdk/src/meson.build @@ -0,0 +1,17 @@ +jdkjar = jar( + 'jdkjar', + 'com' / 'mesonbuild' / 'JdkTest.java', + main_class : 'com.mesonbuild.JdkTest', +) + +test( + 'jdktest', + java, + args: [ + '-Djava.library.path=@0@'.format(fs.parent(jdkjava.full_path())), + '-jar', + jdkjar, + ], + protocol : 'exitcode', + depends : [jdkjava], +) |