From 2430dfac310fb18f3079e493e8a279a2d3d98e34 Mon Sep 17 00:00:00 2001 From: Paul Sokolovsky Date: Wed, 14 Oct 2015 00:56:01 +0300 Subject: [PATCH] tests/jni: Start adding modjni tests. These are currently not intended to run with the rest of testsuite, as they require dependencies and special environment setup anyway (drafted in tests/jni/README). --- tests/jni/README | 12 ++++++++++++ tests/jni/system_out.py | 9 +++++++++ tests/jni/system_out.py.exp | 1 + 3 files changed, 22 insertions(+) create mode 100644 tests/jni/README create mode 100644 tests/jni/system_out.py create mode 100644 tests/jni/system_out.py.exp diff --git a/tests/jni/README b/tests/jni/README new file mode 100644 index 0000000000..8418bb84f4 --- /dev/null +++ b/tests/jni/README @@ -0,0 +1,12 @@ +Running "jni" module tests (as well as just using this module) requires +being able to load libjvm.so, which requires path to it set via +LD_LIBRARY_PATH environment variable. This path is not set automatically +and there is no easy way to guess it, because there can be installed +different implementations of JVM, for one implementation, there can be +different versions, and single version may include different variants +of JVM. + +For example, for OpenJDK 7 on x86_64, following may work: + +LD_LIBRARY_PATH=/usr/lib/jvm/java-7-openjdk-amd64/jre/lib/amd64/server ./run-tests jni/*.py + diff --git a/tests/jni/system_out.py b/tests/jni/system_out.py new file mode 100644 index 0000000000..7a1f180306 --- /dev/null +++ b/tests/jni/system_out.py @@ -0,0 +1,9 @@ +import sys +try: + import jni + System = jni.cls("java/lang/System") +except: + print("SKIP") + sys.exit() + +System.out.println("Hello, Java!") diff --git a/tests/jni/system_out.py.exp b/tests/jni/system_out.py.exp new file mode 100644 index 0000000000..01dd954f90 --- /dev/null +++ b/tests/jni/system_out.py.exp @@ -0,0 +1 @@ +Hello, Java!