Skip to content

Commit 2430dfa

Browse files
committed
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).
1 parent fe29cc1 commit 2430dfa

File tree

3 files changed

+22
-0
lines changed

3 files changed

+22
-0
lines changed

tests/jni/README

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
Running "jni" module tests (as well as just using this module) requires
2+
being able to load libjvm.so, which requires path to it set via
3+
LD_LIBRARY_PATH environment variable. This path is not set automatically
4+
and there is no easy way to guess it, because there can be installed
5+
different implementations of JVM, for one implementation, there can be
6+
different versions, and single version may include different variants
7+
of JVM.
8+
9+
For example, for OpenJDK 7 on x86_64, following may work:
10+
11+
LD_LIBRARY_PATH=/usr/lib/jvm/java-7-openjdk-amd64/jre/lib/amd64/server ./run-tests jni/*.py
12+

tests/jni/system_out.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
import sys
2+
try:
3+
import jni
4+
System = jni.cls("java/lang/System")
5+
except:
6+
print("SKIP")
7+
sys.exit()
8+
9+
System.out.println("Hello, Java!")

tests/jni/system_out.py.exp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Hello, Java!

0 commit comments

Comments
 (0)