| 1 | # Tests for ClassLoader and native library loader code.
|
|---|
| 2 |
|
|---|
| 3 | # Do all the work for a single JNI test. Return 0 on failure.
|
|---|
| 4 | proc gcj_loader_test_one {srcfile} {
|
|---|
| 5 | global objdir srcdir subdir
|
|---|
| 6 |
|
|---|
| 7 | set resfile $srcdir/$subdir/[file rootname [file tail $srcfile]].out
|
|---|
| 8 |
|
|---|
| 9 | regsub "^.*/(\[^/.\]+)\[.\]\[^/]*$" "$srcfile" "\\1" out
|
|---|
| 10 | set executable "${objdir}/$out.exe"
|
|---|
| 11 |
|
|---|
| 12 | set errname [file rootname [file tail $srcfile]]
|
|---|
| 13 | set args [libjava_arguments link]
|
|---|
| 14 | lappend args "additional_flags=--main=[file rootname [file tail $srcfile]] $srcdir/$subdir/MyLoader.java $objdir/dummy.o"
|
|---|
| 15 | set x [libjava_prune_warnings \
|
|---|
| 16 | [libjava_tcompile $srcfile "$executable" executable $args]]
|
|---|
| 17 |
|
|---|
| 18 | if { $x != "" } {
|
|---|
| 19 | verbose "target_compile failed: $x" 2
|
|---|
| 20 |
|
|---|
| 21 | fail "$errname compilation from source"
|
|---|
| 22 | untested "$errname execution from source compiled test"
|
|---|
| 23 | return
|
|---|
| 24 | }
|
|---|
| 25 | pass "$errname compilation from source"
|
|---|
| 26 |
|
|---|
| 27 | libjava_invoke $executable $executable "" $executable "" $resfile ""
|
|---|
| 28 |
|
|---|
| 29 | return 1
|
|---|
| 30 | }
|
|---|
| 31 |
|
|---|
| 32 | # Run the bytecode loader tests.
|
|---|
| 33 | proc gcj_loader_run {} {
|
|---|
| 34 | global srcdir subdir objdir
|
|---|
| 35 | global build_triplet host_triplet
|
|---|
| 36 | global GCJ_UNDER_TEST
|
|---|
| 37 |
|
|---|
| 38 | set file "${srcdir}/${subdir}/dummy.java"
|
|---|
| 39 | if {! [bytecompile_file $file [pwd]]} {
|
|---|
| 40 | fail "bytecompile $file"
|
|---|
| 41 | # FIXME - should use `untested' on all remaining tests.
|
|---|
| 42 | # But that is hard.
|
|---|
| 43 | return 0
|
|---|
| 44 | }
|
|---|
| 45 | pass "bytecompile $file"
|
|---|
| 46 |
|
|---|
| 47 | set args [libjava_arguments compile]
|
|---|
| 48 | lappend args "additional_flags=--resource $objdir/dummy.class"
|
|---|
| 49 | set x [libjava_prune_warnings \
|
|---|
| 50 | [libjava_tcompile "$objdir/dummy.class" "$objdir/dummy.o" object $args]]
|
|---|
| 51 |
|
|---|
| 52 | if { $x != "" } {
|
|---|
| 53 | verbose "resource compilation failed: $x" 2
|
|---|
| 54 |
|
|---|
| 55 | fail "resource compilation dummy.class"
|
|---|
| 56 | return 0;
|
|---|
| 57 | }
|
|---|
| 58 | pass "resource compilation: dummy.class"
|
|---|
| 59 |
|
|---|
| 60 | catch { lsort [glob -nocomplain ${srcdir}/${subdir}/Test*.java] } srcfiles
|
|---|
| 61 |
|
|---|
| 62 | foreach x $srcfiles {
|
|---|
| 63 | gcj_loader_test_one $x
|
|---|
| 64 | }
|
|---|
| 65 | }
|
|---|
| 66 |
|
|---|
| 67 | gcj_loader_run
|
|---|