aboutsummaryrefslogtreecommitdiff
path: root/libjava/testsuite/libjava.loader/loader.exp
diff options
context:
space:
mode:
authorAnthony Green <green@redhat.com>2002-11-04 01:31:12 +0000
committerAnthony Green <green@gcc.gnu.org>2002-11-04 01:31:12 +0000
commit55376e412851fb852f4b5c72d1da5e12aec0a459 (patch)
tree50932c23d528ff479cc42e794aaeb5732fb4f309 /libjava/testsuite/libjava.loader/loader.exp
parentc9fe6f9f39ac5003dd6642d3d708c6818e99223e (diff)
downloadgcc-55376e412851fb852f4b5c72d1da5e12aec0a459.zip
gcc-55376e412851fb852f4b5c72d1da5e12aec0a459.tar.gz
gcc-55376e412851fb852f4b5c72d1da5e12aec0a459.tar.bz2
New files.
From-SVN: r58778
Diffstat (limited to 'libjava/testsuite/libjava.loader/loader.exp')
-rw-r--r--libjava/testsuite/libjava.loader/loader.exp64
1 files changed, 64 insertions, 0 deletions
diff --git a/libjava/testsuite/libjava.loader/loader.exp b/libjava/testsuite/libjava.loader/loader.exp
new file mode 100644
index 0000000..6da7016
--- /dev/null
+++ b/libjava/testsuite/libjava.loader/loader.exp
@@ -0,0 +1,64 @@
+# Tests for ClassLoader and native library loader code.
+
+# Do all the work for a single JNI test. Return 0 on failure.
+proc gcj_loader_test_one {srcfile} {
+ global objdir srcdir subdir
+
+ set resfile $srcdir/$subdir/[file rootname [file tail $srcfile]].out
+
+ regsub "^.*/(\[^/.\]+)\[.\]\[^/]*$" "$srcfile" "\\1" out
+ set executable "${objdir}/$out.exe"
+
+ set errname [file rootname [file tail $srcfile]]
+ set args [libjava_arguments link]
+ lappend args "additional_flags=--main=[file rootname [file tail $srcfile]] $srcdir/$subdir/MyLoader.java $objdir/dummy.o"
+ set x [prune_warnings \
+ [libjava_tcompile $srcfile "$executable" "$executable" $args]]
+
+ if { $x != "" } {
+ verbose "target_compile failed: $x" 2
+
+ fail "$errname compilation from source"
+ untested "$errname execution from source compiled test"
+ return
+ }
+ pass "$errname compilation from source"
+
+ libjava_invoke $executable $executable "" $executable "" $resfile ""
+
+ return 1
+}
+
+# Run the bytecode loader tests.
+proc gcj_loader_run {} {
+ global srcdir subdir objdir
+ global build_triplet host_triplet
+ global GCJ_UNDER_TEST
+
+ set file "${srcdir}/${subdir}/dummy.java"
+ if {! [bytecompile_file $file [pwd]]} {
+ fail "bytecompile $file"
+ # FIXME - should use `untested' on all remaining tests.
+ # But that is hard.
+ return 0
+ }
+ pass "bytecompile $file"
+
+ set x [prune_warnings \
+ [eval exec "$GCJ_UNDER_TEST --resource $objdir/dummy.class -c $objdir/dummy.class -o $objdir/dummy.o"]]
+ if { $x != "" } {
+ verbose "resource compilation failed: $x" 2
+
+ fail "resource compilation dummy.class"
+ return 0;
+ }
+ pass "resource compilation: dummy.class"
+
+ catch { lsort [glob -nocomplain ${srcdir}/${subdir}/Test*.java] } srcfiles
+
+ foreach x $srcfiles {
+ gcj_loader_test_one $x
+ }
+}
+
+gcj_loader_run