2002-11-04 02:31:12 +01:00
|
|
|
# Tests for ClassLoader and native library loader code.
|
|
|
|
|
2004-11-25 04:47:08 +01:00
|
|
|
# Compute the correct name for an object file.
|
|
|
|
# This is an awful hack.
|
|
|
|
proc gcj_object_file_name {compiler base} {
|
|
|
|
verbose "OBJECT: compiler = $compiler"
|
|
|
|
if {[string match *libtool* $compiler]} {
|
|
|
|
return $base.lo
|
|
|
|
}
|
|
|
|
return $base.o
|
|
|
|
}
|
|
|
|
|
2002-11-04 02:31:12 +01:00
|
|
|
# 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"
|
|
|
|
|
2004-11-25 04:47:08 +01:00
|
|
|
set errname [file rootname [file tail $srcfile]]
|
|
|
|
set args [libjava_arguments link]
|
2007-01-09 20:58:05 +01:00
|
|
|
lappend args "additional_flags=--main=[file rootname [file tail $srcfile]] [gcj_object_file_name $args dummy]"
|
2002-12-13 06:00:15 +01:00
|
|
|
set x [libjava_prune_warnings \
|
2002-11-21 19:14:47 +01:00
|
|
|
[libjava_tcompile $srcfile "$executable" executable $args]]
|
2002-11-04 02:31:12 +01:00
|
|
|
|
|
|
|
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
|
|
|
|
|
2007-01-09 20:58:05 +01:00
|
|
|
# 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"
|
2002-11-04 02:31:12 +01:00
|
|
|
|
2002-11-21 19:14:47 +01:00
|
|
|
set args [libjava_arguments compile]
|
2007-01-09 20:58:05 +01:00
|
|
|
lappend args "additional_flags=--resource $srcdir/$subdir/dummy.class"
|
2002-12-13 06:00:15 +01:00
|
|
|
set x [libjava_prune_warnings \
|
2007-01-09 20:58:05 +01:00
|
|
|
[libjava_tcompile "$srcdir/$subdir/dummy.class" "$objdir/[gcj_object_file_name $args dummy]" object $args]]
|
2002-11-21 19:14:47 +01:00
|
|
|
|
2002-11-04 02:31:12 +01:00
|
|
|
if { $x != "" } {
|
|
|
|
verbose "resource compilation failed: $x" 2
|
|
|
|
|
|
|
|
fail "resource compilation dummy.class"
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
pass "resource compilation: dummy.class"
|
|
|
|
|
2007-01-09 20:58:05 +01:00
|
|
|
catch { lsort [glob -nocomplain ${srcdir}/${subdir}/Test*.jar] } srcfiles
|
2002-11-04 02:31:12 +01:00
|
|
|
|
|
|
|
foreach x $srcfiles {
|
|
|
|
gcj_loader_test_one $x
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
gcj_loader_run
|