diff options
author | tromey <tromey@138bc75d-0d04-0410-961f-82ee72b054a4> | 2001-12-14 21:56:29 +0000 |
---|---|---|
committer | tromey <tromey@138bc75d-0d04-0410-961f-82ee72b054a4> | 2001-12-14 21:56:29 +0000 |
commit | f01c219e1de87e10a039da06d244189da2da3b6c (patch) | |
tree | 5a220d504853a608283a932d2ac9a64d8df7490e /libjava | |
parent | 4058d810c8c02296d2d5f31df3a2b9ffa7c60439 (diff) | |
download | gcc-f01c219e1de87e10a039da06d244189da2da3b6c.tar.gz |
For PR libgcj/5103:
* libjava.jni/cxxtest.out: New file.
* libjava.jni/cxxtest.cc: New file.
* libjava.jni/cxxtest.java: New file.
* libjava.jni/jni.exp (gcj_jni_test_one): If there is no .c file,
assume there is a .cc file.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@48012 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libjava')
-rw-r--r-- | libjava/testsuite/ChangeLog | 9 | ||||
-rw-r--r-- | libjava/testsuite/libjava.jni/cxxtest.cc | 24 | ||||
-rw-r--r-- | libjava/testsuite/libjava.jni/cxxtest.java | 25 | ||||
-rw-r--r-- | libjava/testsuite/libjava.jni/cxxtest.out | 1 | ||||
-rw-r--r-- | libjava/testsuite/libjava.jni/jni.exp | 9 |
5 files changed, 67 insertions, 1 deletions
diff --git a/libjava/testsuite/ChangeLog b/libjava/testsuite/ChangeLog index 70777e81087..de7df24277f 100644 --- a/libjava/testsuite/ChangeLog +++ b/libjava/testsuite/ChangeLog @@ -1,3 +1,12 @@ +2001-12-13 Tom Tromey <tromey@redhat.com> + + For PR libgcj/5103: + * libjava.jni/cxxtest.out: New file. + * libjava.jni/cxxtest.cc: New file. + * libjava.jni/cxxtest.java: New file. + * libjava.jni/jni.exp (gcj_jni_test_one): If there is no .c file, + assume there is a .cc file. + 2001-12-09 Bryce McKinlay <bryce@waitaki.otago.ac.nz> * libjava.lang/PR3731.out: Adjust output to reflect that "instanceof" diff --git a/libjava/testsuite/libjava.jni/cxxtest.cc b/libjava/testsuite/libjava.jni/cxxtest.cc new file mode 100644 index 00000000000..577273bb5a2 --- /dev/null +++ b/libjava/testsuite/libjava.jni/cxxtest.cc @@ -0,0 +1,24 @@ +#include <jni.h> +#include <cxxtest.h> + +jobjectArray +Java_cxxtest_fetch (JNIEnv *env, jobject _this) +{ + jclass cls; + jfieldID fid; + jobjectArray obj; + + cls = env->GetObjectClass (_this); + if (! cls) + return 0; + + fid = env->GetFieldID (cls, "F", "[Ljava/lang/Object;"); + if (! fid) + return 0; + + obj = reinterpret_cast<jobjectArray> (env->GetObjectField (_this, fid)); + + return obj; +} + + diff --git a/libjava/testsuite/libjava.jni/cxxtest.java b/libjava/testsuite/libjava.jni/cxxtest.java new file mode 100644 index 00000000000..b1c3bb945fa --- /dev/null +++ b/libjava/testsuite/libjava.jni/cxxtest.java @@ -0,0 +1,25 @@ +// Test for array field lookup. + +public class cxxtest +{ + // A field for us to look up. + public Object[] F = new Object[7]; + + public native Object[] fetch (); + + public void doit () + { + System.out.println (F == fetch ()); + } + + public static void main (String[] args) + { + cxxtest q = new cxxtest (); + q.doit (); + } + + static + { + System.loadLibrary ("cxxtest"); + } +} diff --git a/libjava/testsuite/libjava.jni/cxxtest.out b/libjava/testsuite/libjava.jni/cxxtest.out new file mode 100644 index 00000000000..27ba77ddaf6 --- /dev/null +++ b/libjava/testsuite/libjava.jni/cxxtest.out @@ -0,0 +1 @@ +true diff --git a/libjava/testsuite/libjava.jni/jni.exp b/libjava/testsuite/libjava.jni/jni.exp index 583462bb07d..ec599457ee5 100644 --- a/libjava/testsuite/libjava.jni/jni.exp +++ b/libjava/testsuite/libjava.jni/jni.exp @@ -106,6 +106,13 @@ proc gcj_jni_test_one {file} { } set cfile [file rootname $file].c + set cxxflags "" + # If there is no `.c' file, assume there is a `.cc' file. + if {! [file exists $cfile]} { + set cfile [file rootname $file].cc + set cxxflags "-lstdc++" + } + if {! [gcj_jni_compile_c_to_so $cfile]} { # FIXME return 0 @@ -113,7 +120,7 @@ proc gcj_jni_test_one {file} { # We use -l$main because the .so is named the same as the main # program. - set args [list "additional_flags=-fjni -L. -l$main"] + set args [list "additional_flags=-fjni -L. -l$main $cxxflags"] if {! [gcj_link $main $main $file $args]} { # FIXME return 0 |