1 # Tests
for ClassLoader and native library loader code.
3 # Compute the correct
name for an object file.
4 # This is an awful hack.
5 proc gcj_object_file_name
{compiler base
} {
6 verbose
"OBJECT: compiler = $compiler"
7 if {[string match
*libtool
* $compiler
]} {
13 #
Do all the work
for a single JNI test.
Return 0 on failure.
14 proc gcj_loader_test_one
{srcfile
} {
15 global objdir srcdir subdir
17 set resfile $srcdir
/$subdir
/[file rootname
[file tail $srcfile
]].out
19 regsub
"^.*/(\[^/.\]+)\[.\]\[^/]*$" "$srcfile" "\\1" out
20 set executable
"${objdir}/$out.exe"
22 set errname
[file rootname
[file tail $srcfile
]]
23 set args [libjava_arguments link
]
24 lappend
args "additional_flags=--main=[file rootname [file tail $srcfile]] [gcj_object_file_name $args dummy]"
25 set x
[libjava_prune_warnings \
26 [libjava_tcompile $srcfile
"$executable" executable $args]]
29 verbose
"target_compile failed: $x" 2
31 fail
"$errname compilation from source"
32 untested
"$errname execution from source compiled test"
35 pass
"$errname compilation from source"
37 libjava_invoke $executable $executable
"" $executable "" $resfile ""
42 # Run the bytecode loader tests.
43 proc gcj_loader_run
{} {
44 global srcdir subdir objdir
45 global build_triplet host_triplet
48 #
set file
"${srcdir}/${subdir}/dummy.java"
49 #
if {! [bytecompile_file $file
[pwd
]]} {
50 # fail
"bytecompile $file"
51 # # FIXME
- should use `untested
' on all remaining tests.
55 # pass "bytecompile $file"
57 set args [libjava_arguments compile]
58 lappend args "additional_flags=--resource $srcdir/$subdir/dummy.class"
59 set x [libjava_prune_warnings \
60 [libjava_tcompile "$srcdir/$subdir/dummy.class" "$objdir/[gcj_object_file_name $args dummy]" object $args]]
63 verbose "resource compilation failed: $x" 2
65 fail "resource compilation dummy.class"
68 pass "resource compilation: dummy.class"
70 catch { lsort [glob -nocomplain ${srcdir}/${subdir}/Test*.jar] } srcfiles
73 gcj_loader_test_one $x