2003-01-13 01:22:20 +01:00
|
|
|
# Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003 Free Software Foundation
|
1999-04-07 16:42:40 +02:00
|
|
|
|
|
|
|
load_lib "libgloss.exp"
|
|
|
|
|
|
|
|
# GCJ_UNDER_TEST is the compiler under test.
|
|
|
|
|
|
|
|
global tmpdir
|
|
|
|
|
|
|
|
if ![info exists tmpdir] {
|
|
|
|
set tmpdir "/tmp"
|
|
|
|
}
|
|
|
|
|
2002-12-13 06:00:15 +01:00
|
|
|
# This is like `prune_warnings', but it also prunes away a warning
|
|
|
|
# from the bytecode front end that we don't care about.
|
|
|
|
proc libjava_prune_warnings {text} {
|
|
|
|
set text [prune_warnings $text]
|
|
|
|
set tlist [split $text \n]
|
|
|
|
set len [llength $tlist]
|
|
|
|
for {set i [expr {$len - 1}]} {$i >= 2} {incr i -1} {
|
|
|
|
if {[string match "*unreachable bytecode*" [lindex $tlist $i]]} {
|
2003-01-31 19:09:04 +01:00
|
|
|
# Delete this line, all other unreachable warnings and the previous
|
|
|
|
# two lines containing the method and class.
|
|
|
|
set j [expr {$i - 1}]
|
|
|
|
while {[string match "*unreachable bytecode*" [lindex $tlist $j]]} {
|
|
|
|
incr j -1
|
|
|
|
}
|
|
|
|
incr j -1
|
|
|
|
set tlist [lreplace $tlist $j $i]
|
|
|
|
set i $j
|
2002-12-13 06:00:15 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
return [join $tlist \n]
|
|
|
|
}
|
|
|
|
|
2000-12-16 03:06:29 +01:00
|
|
|
# This is like `target_compile' but it does some surgery to work
|
|
|
|
# around stupid DejaGNU bugs. In particular DejaGNU has very poor
|
|
|
|
# quoting, so for instance a `$' will be re-evaluated at spawn time.
|
|
|
|
# We don't want that.
|
|
|
|
proc libjava_tcompile {source destfile type options} {
|
|
|
|
# This strange-looking expression really does quote the `$'.
|
|
|
|
regsub -all -- {\$} $source {\$} source
|
|
|
|
regsub -all -- {\$} $destfile {\$} destfile
|
|
|
|
return [target_compile $source $destfile $type $options]
|
|
|
|
}
|
|
|
|
|
1999-07-06 17:38:09 +02:00
|
|
|
# Read an `xfail' file if it exists. Returns a list of xfail tokens.
|
|
|
|
proc libjava_read_xfail {file} {
|
|
|
|
if {! [file exists $file]} {
|
|
|
|
return ""
|
|
|
|
}
|
|
|
|
set fd [open $file r]
|
|
|
|
set tokens [string trim [read $fd]]
|
|
|
|
close $fd
|
|
|
|
return $tokens
|
|
|
|
}
|
|
|
|
|
2000-05-17 17:48:44 +02:00
|
|
|
# Find a particular executable. FIXME: this relies on DejaGnu
|
|
|
|
# internals. These should probably be exposed in a better way.
|
|
|
|
proc libjava_find_program {prog} {
|
1999-04-07 16:42:40 +02:00
|
|
|
global tool_root_dir
|
|
|
|
|
2000-05-17 17:48:44 +02:00
|
|
|
set file [lookfor_file $tool_root_dir $prog]
|
1999-04-07 16:42:40 +02:00
|
|
|
if { $file == "" } {
|
2000-05-17 17:48:44 +02:00
|
|
|
set file [lookfor_file $tool_root_dir gcc/$prog];
|
1999-04-07 16:42:40 +02:00
|
|
|
}
|
|
|
|
if {$file == ""} {
|
2000-05-17 17:48:44 +02:00
|
|
|
set file $prog
|
1999-04-07 16:42:40 +02:00
|
|
|
}
|
|
|
|
return $file
|
|
|
|
}
|
|
|
|
|
2000-05-17 17:48:44 +02:00
|
|
|
# Find `jv-scan'.
|
|
|
|
proc find_jvscan {} {
|
|
|
|
return [libjava_find_program jv-scan]
|
|
|
|
}
|
|
|
|
|
|
|
|
# Find `gcjh'.
|
|
|
|
proc find_gcjh {} {
|
|
|
|
return [libjava_find_program gcjh]
|
|
|
|
}
|
|
|
|
|
2000-12-16 03:06:29 +01:00
|
|
|
proc find_javac {} {
|
2003-01-13 01:22:20 +01:00
|
|
|
global SUN_JAVAC GCJ_UNDER_TEST env libgcj_jar
|
1999-08-01 01:52:52 +02:00
|
|
|
# If JDK doesn't run on your platform but some other
|
|
|
|
# JDK-compatible javac does, you may set SUN_JAVAC to point to it.
|
|
|
|
# One of the most important properties of a SUN_JAVAC is that it
|
|
|
|
# must create class-files even for classes that have not been
|
|
|
|
# specified in the command line, but that were needed to compile
|
|
|
|
# those that have. For example, Pizza won't do it, but you can
|
|
|
|
# use `kaffe sun.tools.javac.Main', if you have Sun's classes.zip
|
|
|
|
# in the kaffe's default search path.
|
2000-12-16 03:06:29 +01:00
|
|
|
if {![info exists SUN_JAVAC]} {
|
|
|
|
if {[info exists env(SUN_JAVAC)]} {
|
1999-08-01 01:52:52 +02:00
|
|
|
set SUN_JAVAC $env(SUN_JAVAC)
|
|
|
|
} else {
|
2003-01-13 01:22:20 +01:00
|
|
|
set SUN_JAVAC "$GCJ_UNDER_TEST -C -I$libgcj_jar"
|
1999-08-01 01:52:52 +02:00
|
|
|
}
|
|
|
|
}
|
2000-12-16 03:06:29 +01:00
|
|
|
return $SUN_JAVAC
|
|
|
|
}
|
|
|
|
|
|
|
|
proc bytecompile_file { file objdir {classpath {}} } {
|
|
|
|
global env
|
|
|
|
set dirname [file dirname $file]
|
1999-08-01 01:52:52 +02:00
|
|
|
|
2000-12-16 03:06:29 +01:00
|
|
|
set javac [find_javac]
|
1999-04-07 16:42:40 +02:00
|
|
|
if {$classpath != ""} then {
|
|
|
|
set env(CLASSPATH) $classpath
|
|
|
|
}
|
2000-12-16 20:02:54 +01:00
|
|
|
set here [pwd]
|
|
|
|
cd $dirname
|
2000-05-17 17:48:44 +02:00
|
|
|
if {[catch {
|
2000-12-16 03:06:29 +01:00
|
|
|
set q [eval exec "$javac [list $file] -d $objdir 2>@ stdout"]
|
2000-05-17 17:48:44 +02:00
|
|
|
} msg]} then {
|
1999-04-07 16:42:40 +02:00
|
|
|
verbose "couldn't compile $file: $msg"
|
|
|
|
set r 0
|
|
|
|
} else {
|
|
|
|
set r 1
|
|
|
|
}
|
2000-12-16 20:02:54 +01:00
|
|
|
cd $here
|
1999-04-07 16:42:40 +02:00
|
|
|
return $r
|
|
|
|
}
|
|
|
|
|
|
|
|
set libjava_initialized 0
|
|
|
|
|
|
|
|
#
|
|
|
|
# Build the status wrapper library as needed.
|
|
|
|
#
|
|
|
|
proc libjava_init { args } {
|
|
|
|
global wrapper_file;
|
|
|
|
global wrap_compile_flags;
|
2001-05-04 21:33:10 +02:00
|
|
|
global libjava_initialized libjava_uses_threads
|
1999-04-07 16:42:40 +02:00
|
|
|
global GCJ_UNDER_TEST
|
|
|
|
global TOOL_EXECUTABLE
|
1999-08-01 01:52:52 +02:00
|
|
|
global original_ld_library_path
|
2001-05-04 21:33:10 +02:00
|
|
|
global env objdir
|
2002-08-16 20:19:00 +02:00
|
|
|
global env libgcj_jar
|
2002-05-09 23:01:55 +02:00
|
|
|
global tool_root_dir
|
|
|
|
global libjava_libgcc_s_path
|
1999-04-07 16:42:40 +02:00
|
|
|
|
|
|
|
if { $libjava_initialized == 1 } { return; }
|
|
|
|
|
|
|
|
if ![info exists GCJ_UNDER_TEST] {
|
|
|
|
if [info exists TOOL_EXECUTABLE] {
|
|
|
|
set GCJ_UNDER_TEST $TOOL_EXECUTABLE;
|
|
|
|
} else {
|
1999-08-01 01:52:52 +02:00
|
|
|
if [info exists env(GCJ)] {
|
|
|
|
set GCJ_UNDER_TEST $env(GCJ)
|
|
|
|
} else {
|
|
|
|
set GCJ_UNDER_TEST "[find_gcj]"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2002-08-16 20:19:00 +02:00
|
|
|
# Find the libgcj jar file.
|
|
|
|
set libgcj_jar [glob $objdir/../libgcj-*.jar]
|
|
|
|
verbose "jar file is $libgcj_jar"
|
2002-04-12 16:28:10 +02:00
|
|
|
|
2002-05-02 21:12:37 +02:00
|
|
|
# FIXME: This finds libgcj.spec for the default multilib.
|
|
|
|
# If thread models differ between multilibs, this has to be moved
|
|
|
|
# to libjava_arguments
|
|
|
|
set specdir [libjava_find_spec]
|
|
|
|
|
2001-05-04 21:33:10 +02:00
|
|
|
# The -B is so we find libgcj.spec.
|
2002-05-02 21:12:37 +02:00
|
|
|
set text [eval exec "$GCJ_UNDER_TEST -B$specdir -v 2>@ stdout"]
|
2001-05-04 21:33:10 +02:00
|
|
|
regexp -- "Thread model: (\[^\n\]+)\n" $text ignore model
|
|
|
|
set libjava_uses_threads [expr {! ($model == "no"
|
|
|
|
|| $model == "none"
|
|
|
|
|| $model == "single")}]
|
|
|
|
|
2001-04-27 02:56:16 +02:00
|
|
|
# Always set encoding used by gcj.
|
|
|
|
append GCJ_UNDER_TEST " --encoding=UTF-8"
|
|
|
|
|
1999-08-01 01:52:52 +02:00
|
|
|
if [info exists env(LD_LIBRARY_PATH)] {
|
|
|
|
set original_ld_library_path $env(LD_LIBRARY_PATH)
|
|
|
|
} else {
|
|
|
|
if [info exists env(SHLIB_PATH)] {
|
|
|
|
set original_ld_library_path $env(SHLIB_PATH)
|
|
|
|
} else {
|
|
|
|
set original_ld_library_path ""
|
1999-04-07 16:42:40 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
set wrapper_file "";
|
|
|
|
set wrap_compile_flags "";
|
|
|
|
if [target_info exists needs_status_wrapper] {
|
|
|
|
set result [build_wrapper "testglue.o"];
|
|
|
|
if { $result != "" } {
|
|
|
|
set wrapper_file [lindex $result 0];
|
|
|
|
set wrap_compile_flags [lindex $result 1];
|
|
|
|
} else {
|
|
|
|
warning "Status wrapper failed to build."
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2002-05-09 23:01:55 +02:00
|
|
|
# Finally, add the gcc build directory so that we can find the
|
|
|
|
# shared libgcc. This, like much of dejagnu, is hideous.
|
|
|
|
set libjava_libgcc_s_path {}
|
|
|
|
set gccdir [lookfor_file $tool_root_dir gcc/libgcc_s.so]
|
|
|
|
if {$gccdir != ""} {
|
|
|
|
set gccdir [file dirname $gccdir]
|
|
|
|
lappend libjava_libgcc_s_path $gccdir
|
|
|
|
set compiler ${gccdir}/xgcc
|
|
|
|
if { [is_remote host] == 0 && [which $compiler] != 0 } {
|
|
|
|
foreach i "[exec $compiler --print-multi-lib]" {
|
|
|
|
set mldir ""
|
|
|
|
regexp -- "\[a-z0-9=/\.-\]*;" $i mldir
|
|
|
|
set mldir [string trimright $mldir "\;@"]
|
|
|
|
if { "$mldir" == "." } {
|
|
|
|
continue
|
|
|
|
}
|
|
|
|
if { [llength [glob -nocomplain ${gccdir}/${mldir}/libgcc_s*.so.*]] == 1 } {
|
|
|
|
lappend libjava_libgcc_s_path "${gccdir}/${mldir}"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
1999-04-07 16:42:40 +02:00
|
|
|
set libjava_initialized 1
|
|
|
|
}
|
|
|
|
|
1999-04-26 16:28:20 +02:00
|
|
|
# Find a library. We know where libtool puts the actual libraries,
|
1999-05-05 13:56:28 +02:00
|
|
|
# and we look there. The implementation is fairly hacky. We can't
|
|
|
|
# compile with -nodefaultlibs, because that will also eliminate the
|
|
|
|
# system libraries we need. In order to have gcj still work, it must
|
|
|
|
# find the appropriate libraries so we must add -L options for their
|
|
|
|
# paths. However we can't simply use those libraries; we still need
|
|
|
|
# libtool for linking.
|
2002-05-02 21:12:37 +02:00
|
|
|
# Don't return the the lib${name}.la files here, since this causes the
|
|
|
|
# libraries to be linked twice: once as lib${name}.so and another time
|
|
|
|
# via gcj's implicit -l${name}. This is both unnecessary and causes the
|
|
|
|
# Solaris ld to warn: attempted multiple inclusion of file. This warning
|
|
|
|
# is not ignored by the dejagnu framework and cannot be disabled.
|
1999-04-26 16:28:20 +02:00
|
|
|
proc libjava_find_lib {dir name} {
|
|
|
|
global base_dir
|
|
|
|
set gp [get_multilibs]
|
|
|
|
foreach sub {.libs _libs} {
|
|
|
|
if {$gp != ""} {
|
|
|
|
if {[file exists $gp/$dir/$sub/lib${name}.a]} then {
|
2002-02-11 01:01:11 +01:00
|
|
|
# Just return the `-L' option. The library itself
|
|
|
|
# will be picked up via the spec file.
|
|
|
|
return "-L$gp/$dir/$sub"
|
1999-04-26 16:28:20 +02:00
|
|
|
}
|
|
|
|
}
|
2002-02-11 01:01:11 +01:00
|
|
|
# Just return the `-L' option. The library itself will be
|
|
|
|
# picked up via the spec file.
|
1999-04-26 16:28:20 +02:00
|
|
|
set lib [findfile $base_dir/../../$dir/$sub/lib${name}.a \
|
2002-02-11 01:01:11 +01:00
|
|
|
"-L$base_dir/../../$dir/$sub" \
|
1999-05-05 13:56:28 +02:00
|
|
|
""]
|
1999-04-26 16:28:20 +02:00
|
|
|
if {$lib != ""} {
|
|
|
|
return $lib
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return ""
|
|
|
|
}
|
|
|
|
|
2002-05-02 21:12:37 +02:00
|
|
|
# Find libgcj.spec. We need to use the file corresponding to the multilib
|
|
|
|
# under test since they might differ. Append a trailing slash since this
|
|
|
|
# is used with -B.
|
|
|
|
proc libjava_find_spec {} {
|
|
|
|
global objdir
|
|
|
|
set gp [get_multilibs]
|
|
|
|
|
|
|
|
if {[file exists $gp/libjava/libgcj.spec]} then {
|
|
|
|
return "$gp/libjava/"
|
|
|
|
}
|
|
|
|
return "$objdir/../"
|
|
|
|
}
|
|
|
|
|
2002-06-24 06:44:53 +02:00
|
|
|
# Find `gij'.
|
|
|
|
proc libjava_find_gij {} {
|
|
|
|
global base_dir
|
|
|
|
set gp [get_multilibs]
|
|
|
|
if {$gp != ""} {
|
|
|
|
set file $gp/libjava/gij
|
|
|
|
} else {
|
|
|
|
set file $base_dir/../gij
|
|
|
|
}
|
|
|
|
|
|
|
|
if {[file exists $file]} {
|
|
|
|
return $file
|
|
|
|
}
|
|
|
|
return gij
|
|
|
|
}
|
|
|
|
|
2001-06-09 00:12:28 +02:00
|
|
|
# Remove a bunch of files.
|
|
|
|
proc gcj_cleanup {args} {
|
|
|
|
foreach file $args {
|
|
|
|
if {[string match *.o $file]} {
|
|
|
|
verbose "removing [file rootname $file].lo"
|
|
|
|
file delete -force [file rootname $file].lo
|
|
|
|
}
|
|
|
|
file delete -force -- $file
|
|
|
|
verbose "removing $file"
|
|
|
|
}
|
|
|
|
# It is simplest to do this instead of trying to figure out what
|
|
|
|
# bits in .libs ought to be removed.
|
|
|
|
catch {system "rm -rf .libs"}
|
|
|
|
}
|
|
|
|
|
1999-05-03 14:48:34 +02:00
|
|
|
# Compute arguments needed for compiler. MODE is a libtool mode:
|
|
|
|
# either compile or link.
|
|
|
|
proc libjava_arguments {{mode compile}} {
|
1999-04-07 16:42:40 +02:00
|
|
|
global base_dir
|
|
|
|
global LIBJAVA
|
|
|
|
global LIBGC
|
1999-06-23 17:14:36 +02:00
|
|
|
global LIBQTHREADS
|
|
|
|
global LIBZ
|
1999-04-07 16:42:40 +02:00
|
|
|
global srcdir subdir objdir
|
|
|
|
global TOOL_OPTIONS
|
|
|
|
global GCJ_UNDER_TEST
|
|
|
|
global tmpdir
|
|
|
|
global runtests
|
1999-08-01 01:52:52 +02:00
|
|
|
global env
|
2001-03-16 21:54:45 +01:00
|
|
|
global tool_root_dir
|
2002-08-16 20:19:00 +02:00
|
|
|
global libgcj_jar
|
2002-05-09 23:01:55 +02:00
|
|
|
global libjava_libgcc_s_path
|
1999-04-07 16:42:40 +02:00
|
|
|
|
|
|
|
if [info exists LIBJAVA] {
|
|
|
|
set libjava $LIBJAVA;
|
|
|
|
} else {
|
1999-04-26 16:28:20 +02:00
|
|
|
set libjava [libjava_find_lib libjava gcj]
|
1999-04-07 16:42:40 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
if [info exists LIBGC] {
|
|
|
|
set libgc $LIBGC;
|
|
|
|
} else {
|
1999-04-26 16:28:20 +02:00
|
|
|
set libgc [libjava_find_lib boehm-gc gcjgc]
|
1999-04-07 16:42:40 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
if [info exists LIBQTHREADS] {
|
|
|
|
set libqthreads $LIBQTHREADS
|
|
|
|
} else {
|
1999-04-26 16:28:20 +02:00
|
|
|
set libqthreads [libjava_find_lib qthreads gcjcoop]
|
1999-04-07 16:42:40 +02:00
|
|
|
}
|
|
|
|
|
1999-06-23 17:14:36 +02:00
|
|
|
if [info exists LIBZ] {
|
|
|
|
set libz $LIBZ
|
|
|
|
} else {
|
|
|
|
set libz [libjava_find_lib zlib zgcj]
|
|
|
|
}
|
|
|
|
|
1999-04-07 16:42:40 +02:00
|
|
|
# FIXME: there's no way to determine whether -lpthread is
|
|
|
|
# required. We should get this info from configure, or it should
|
|
|
|
# just be in the compiler driver.
|
|
|
|
|
|
|
|
verbose "using LIBJAVA = $libjava" 2
|
|
|
|
verbose "using LIBGC = $libgc" 2
|
|
|
|
verbose "using LIBQTHREADS = $libqthreads" 2
|
1999-06-23 17:14:36 +02:00
|
|
|
verbose "using LIBZ = $libz" 2
|
1999-04-07 16:42:40 +02:00
|
|
|
set args ""
|
|
|
|
|
|
|
|
# Basically we want to build up a colon separated path list from
|
|
|
|
# the value of $libjava.
|
|
|
|
|
2001-03-16 21:54:45 +01:00
|
|
|
set lpath {}
|
|
|
|
foreach dir [list $libjava $libgc $libz] {
|
|
|
|
foreach item [split $dir " "] {
|
|
|
|
switch -glob -- $item {
|
|
|
|
"-L*" {
|
|
|
|
lappend lpath [string range $item 2 end]
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
1999-04-07 16:42:40 +02:00
|
|
|
|
2002-05-09 23:01:55 +02:00
|
|
|
set lpath [concat $lpath $libjava_libgcc_s_path]
|
2001-03-16 21:54:45 +01:00
|
|
|
set ld_library_path [join $lpath :]
|
1999-04-07 16:42:40 +02:00
|
|
|
|
|
|
|
# That's enough to make things work for the normal case.
|
|
|
|
# If we wanted to handle an arbitrary value of libjava,
|
|
|
|
# then we'd have to do a lot more work.
|
|
|
|
|
|
|
|
# Set variables the dynamic linker looks at.
|
1999-08-01 01:52:52 +02:00
|
|
|
global original_ld_library_path
|
|
|
|
setenv LD_LIBRARY_PATH "$ld_library_path:$original_ld_library_path"
|
|
|
|
setenv SHLIB_PATH "$ld_library_path:$original_ld_library_path"
|
1999-04-07 16:42:40 +02:00
|
|
|
|
2001-03-16 21:54:45 +01:00
|
|
|
verbose "LD_LIBRARY_PATH = $env(LD_LIBRARY_PATH)"
|
|
|
|
|
1999-04-07 16:42:40 +02:00
|
|
|
# Set the CLASSPATH environment variable
|
2002-08-16 20:19:00 +02:00
|
|
|
verbose "CLASSPATH is .:$srcdir/$subdir:$objdir:$libgcj_jar"
|
1999-04-07 16:42:40 +02:00
|
|
|
global env
|
2002-08-16 20:19:00 +02:00
|
|
|
set env(CLASSPATH) ".:$srcdir/$subdir:$objdir:$libgcj_jar"
|
1999-04-07 16:42:40 +02:00
|
|
|
|
2002-03-27 17:27:06 +01:00
|
|
|
if {$mode == "link"} {
|
|
|
|
global wrapper_file wrap_compile_flags;
|
|
|
|
lappend args "additional_flags=$wrap_compile_flags";
|
|
|
|
lappend args "libs=$wrapper_file";
|
|
|
|
lappend args "libs=$libjava";
|
|
|
|
lappend args "libs=$libgc";
|
|
|
|
lappend args "libs=$libqthreads"
|
|
|
|
lappend args "libs=$libz"
|
|
|
|
lappend args debug
|
|
|
|
}
|
1999-04-07 16:42:40 +02:00
|
|
|
|
|
|
|
if { [target_info needs_status_wrapper]!="" && [info exists gluefile] } {
|
|
|
|
lappend args "libs=${gluefile}"
|
|
|
|
lappend args "ldflags=$wrap_flags"
|
|
|
|
}
|
|
|
|
|
|
|
|
if [info exists TOOL_OPTIONS] {
|
|
|
|
lappend args "additional_flags=$TOOL_OPTIONS"
|
|
|
|
}
|
1999-05-03 14:48:34 +02:00
|
|
|
|
2002-05-02 21:12:37 +02:00
|
|
|
# Determine libgcj.spec corresponding to multilib under test.
|
|
|
|
set specdir [libjava_find_spec]
|
|
|
|
|
1999-05-03 14:48:34 +02:00
|
|
|
# Search for libtool. We need it to link.
|
1999-06-24 21:06:28 +02:00
|
|
|
set found_compiler 0
|
1999-05-03 14:48:34 +02:00
|
|
|
set d [absolute $objdir]
|
|
|
|
foreach x {. .. ../.. ../../..} {
|
|
|
|
if {[file exists $d/$x/libtool]} then {
|
|
|
|
# We have to run silently to avoid DejaGNU lossage.
|
|
|
|
lappend args \
|
2002-05-02 21:12:37 +02:00
|
|
|
"compiler=$d/$x/libtool --silent --tag=GCJ --mode=$mode $GCJ_UNDER_TEST -B$specdir"
|
1999-06-24 21:06:28 +02:00
|
|
|
set found_compiler 1
|
1999-05-03 14:48:34 +02:00
|
|
|
break
|
|
|
|
}
|
|
|
|
}
|
1999-06-24 21:06:28 +02:00
|
|
|
if {! $found_compiler} {
|
2002-05-02 21:12:37 +02:00
|
|
|
# Append -B$specdir so that we find libgcj.spec before it
|
1999-08-01 01:52:52 +02:00
|
|
|
# is installed.
|
2002-05-02 21:12:37 +02:00
|
|
|
lappend args "compiler=$GCJ_UNDER_TEST -B$specdir"
|
1999-06-24 21:06:28 +02:00
|
|
|
}
|
1999-05-03 14:48:34 +02:00
|
|
|
|
2001-06-06 04:53:52 +02:00
|
|
|
# Avoid libtool wrapper scripts when possible.
|
2002-05-06 13:37:34 +02:00
|
|
|
# but not if libtool warnings results in FAILs
|
2001-06-06 04:53:52 +02:00
|
|
|
if {$mode == "link"} {
|
2002-08-26 07:26:32 +02:00
|
|
|
if {! [istarget "*-*-cygwin*"] && ! [istarget "*-*-mingw*"] } {
|
2002-05-06 13:37:34 +02:00
|
|
|
lappend args "additional_flags=-no-install"
|
|
|
|
}
|
2001-06-06 04:53:52 +02:00
|
|
|
}
|
|
|
|
|
1999-04-07 16:42:40 +02:00
|
|
|
return $args
|
|
|
|
}
|
|
|
|
|
2001-06-14 19:46:53 +02:00
|
|
|
# Link a bunch of objects into a program. MAIN is the name of the
|
|
|
|
# class holding `main'. Return 0 on failure.
|
|
|
|
proc gcj_link {program main files {options {}}} {
|
|
|
|
set arguments [libjava_arguments link]
|
|
|
|
if {[llength $options]} {
|
|
|
|
eval lappend arguments $options
|
|
|
|
}
|
|
|
|
lappend arguments "additional_flags=--main=$main"
|
2002-12-13 06:00:15 +01:00
|
|
|
set x [libjava_prune_warnings \
|
|
|
|
[libjava_tcompile $files $program executable $arguments]]
|
2001-06-14 19:46:53 +02:00
|
|
|
if {$x != ""} {
|
|
|
|
verbose "link failure: $x" 2
|
|
|
|
fail "linking $program"
|
|
|
|
setup_xfail "*-*-*"
|
|
|
|
fail "running $program"
|
|
|
|
return 0
|
|
|
|
}
|
|
|
|
|
|
|
|
pass "linking $program"
|
|
|
|
return 1
|
|
|
|
}
|
1999-04-07 16:42:40 +02:00
|
|
|
|
2003-03-22 08:14:53 +01:00
|
|
|
# Invoke the program and see what happens. Return 0 on failure.
|
|
|
|
proc gcj_invoke {program expectFile ld_library_additions} {
|
|
|
|
global env
|
|
|
|
set lib_path $env(LD_LIBRARY_PATH)
|
|
|
|
|
|
|
|
set newval .
|
|
|
|
if {[llength $ld_library_additions] > 0} {
|
|
|
|
append newval :[join $ld_library_additions :]
|
|
|
|
}
|
|
|
|
append newval :$lib_path
|
|
|
|
|
|
|
|
setenv LD_LIBRARY_PATH $newval
|
|
|
|
setenv SHLIB_PATH $newval
|
|
|
|
|
|
|
|
verbose "LD_LIBRARY_PATH=$env(LD_LIBRARY_PATH)"
|
|
|
|
|
|
|
|
set result [libjava_load ./$program]
|
|
|
|
set status [lindex $result 0]
|
|
|
|
set output [lindex $result 1]
|
|
|
|
|
|
|
|
# Restore setting
|
|
|
|
setenv LD_LIBRARY_PATH $lib_path
|
|
|
|
setenv SHLIB_PATH $lib_path
|
|
|
|
|
|
|
|
if {$status != "pass"} {
|
|
|
|
verbose "got $output"
|
|
|
|
fail "$program run"
|
|
|
|
untested "$program output"
|
|
|
|
return 0
|
|
|
|
}
|
|
|
|
|
|
|
|
set id [open $expectFile r]
|
|
|
|
set expected [read $id]
|
|
|
|
close $id
|
|
|
|
|
|
|
|
if {! [string compare $output $expected]} {
|
|
|
|
pass "$program output"
|
|
|
|
return 1
|
|
|
|
} else {
|
|
|
|
fail "$program output"
|
|
|
|
return 0
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2002-06-24 06:44:53 +02:00
|
|
|
# Invoke a program and check its output. EXECUTABLE is the program;
|
|
|
|
# ARGS are the arguments to the program. Returns 1 if tests passed
|
|
|
|
# (or things were left untested), 0 otherwise.
|
|
|
|
proc libjava_invoke {errname testName optName executable inpfile resultfile args} {
|
|
|
|
upvar $optName opts
|
|
|
|
|
|
|
|
if {[info exists opts(no-exec)]} {
|
|
|
|
if {[info exists opts(need-threads)]} {
|
|
|
|
# This means we wanted to try to run it but we couldn't
|
|
|
|
# because threads aren't supported. So we have to
|
|
|
|
# generate an `untested'.
|
|
|
|
untested "$errname execution - $testName"
|
|
|
|
untested "$errname output - $testName"
|
|
|
|
}
|
|
|
|
return 1
|
|
|
|
}
|
|
|
|
|
|
|
|
set result [libjava_load $executable $args "$inpfile"]
|
|
|
|
set status [lindex $result 0]
|
|
|
|
set output [lindex $result 1]
|
|
|
|
if {[info exists opts(xfail-exec)]} then {
|
|
|
|
setup_xfail *-*-*
|
|
|
|
}
|
|
|
|
$status "$errname execution - $testName"
|
|
|
|
if { $status != "pass" } {
|
|
|
|
untested "$errname output - $testName"
|
|
|
|
return 0
|
|
|
|
}
|
|
|
|
|
|
|
|
verbose "resultfile is $resultfile"
|
|
|
|
set id [open $resultfile r]
|
|
|
|
set expected ""
|
|
|
|
append expected [read $id]
|
|
|
|
regsub -all "\r" "$output" "" output
|
|
|
|
regsub "\n*$" $expected "" expected
|
|
|
|
regsub "\n*$" $output "" output
|
|
|
|
regsub "^\n*" $expected "" expected
|
|
|
|
regsub "^\n*" $output "" output
|
|
|
|
regsub -all "\[ \t\]\[ \t\]*" $expected " " expected
|
|
|
|
regsub -all "\[ \t\]*\n\n*" $expected "\n" expected
|
|
|
|
regsub -all "\[ \t\]\[ \t\]*" $output " " output
|
|
|
|
regsub -all "\[ \t\]*\n\n*" $output "\n" output
|
|
|
|
verbose "expected is $expected"
|
|
|
|
verbose "actual is $output"
|
|
|
|
set passed 0
|
|
|
|
if {[info exists opts(regexp_match)]} {
|
|
|
|
if [regexp $expected $output] {
|
|
|
|
set passed 1
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
if { $expected == $output } {
|
|
|
|
set passed 1
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if {[info exists opts(xfail-output)]} {
|
|
|
|
setup_xfail *-*-*
|
|
|
|
}
|
|
|
|
if { $passed == 1 } {
|
|
|
|
pass "$errname output - $testName"
|
|
|
|
} else {
|
|
|
|
fail "$errname output - $testName"
|
|
|
|
}
|
|
|
|
close $id
|
|
|
|
|
|
|
|
return $passed
|
|
|
|
}
|
|
|
|
|
1999-04-07 16:42:40 +02:00
|
|
|
#
|
|
|
|
# Run the test specified by srcfile and resultfile. compile_args and
|
1999-07-06 17:38:09 +02:00
|
|
|
# exec_args are options telling this proc how to work.
|
1999-04-07 16:42:40 +02:00
|
|
|
#
|
|
|
|
proc test_libjava_from_source { options srcfile compile_args inpfile resultfile exec_args } {
|
|
|
|
global base_dir
|
|
|
|
global LIBJAVA
|
|
|
|
global LIBGC
|
|
|
|
global srcdir subdir objdir
|
|
|
|
global TOOL_OPTIONS
|
|
|
|
global GCJ_UNDER_TEST
|
|
|
|
global tmpdir
|
|
|
|
global runtests
|
|
|
|
|
1999-07-06 17:38:09 +02:00
|
|
|
# Make opts into an array.
|
|
|
|
set opts(_) x
|
|
|
|
unset opts(_)
|
|
|
|
foreach item $exec_args {
|
|
|
|
set opts($item) x
|
|
|
|
}
|
|
|
|
|
2001-05-04 21:33:10 +02:00
|
|
|
# If we need threads and we don't have them then set the `no-exec'
|
|
|
|
# flag. This is case is also handled specially later.
|
|
|
|
if {[info exists opts(need-threads)]} {
|
|
|
|
global libjava_uses_threads
|
|
|
|
if {! $libjava_uses_threads} {
|
|
|
|
set opts(no-exec) x
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
1999-04-07 16:42:40 +02:00
|
|
|
set errname [file rootname [file tail $srcfile]]
|
|
|
|
if {! [runtest_file_p $runtests $errname]} {
|
|
|
|
return
|
|
|
|
}
|
|
|
|
|
1999-07-15 11:15:26 +02:00
|
|
|
if {[info exists opts(no-link)]} {
|
|
|
|
set mode compile
|
|
|
|
} else {
|
|
|
|
set mode link
|
|
|
|
}
|
|
|
|
set args [libjava_arguments $mode]
|
|
|
|
if {! [info exists opts(no-link)]} {
|
|
|
|
# Add the --main flag
|
|
|
|
lappend args "additional_flags=--main=[file rootname [file tail $srcfile]]"
|
|
|
|
if { $compile_args != "" } {
|
|
|
|
lappend args "additional_flags=$compile_args"
|
|
|
|
}
|
1999-04-07 16:42:40 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
regsub "^.*/(\[^/.\]+)\[.\]\[^/]*$" "$srcfile" "\\1" out
|
|
|
|
set executable "${objdir}/$out"
|
1999-07-15 11:15:26 +02:00
|
|
|
if {[info exists opts(no-link)]} {
|
|
|
|
append executable ".o"
|
|
|
|
set target object
|
|
|
|
} else {
|
2002-05-06 01:19:06 +02:00
|
|
|
# DOS/win32 targets default to .exe if no suffix is given
|
|
|
|
# We then try to delete a file that doesn't exist. It is
|
|
|
|
# simpler to add the suffix everywhere.
|
2002-05-04 05:38:14 +02:00
|
|
|
append executable ".exe"
|
1999-07-15 11:15:26 +02:00
|
|
|
set target executable
|
|
|
|
}
|
1999-04-07 16:42:40 +02:00
|
|
|
if { $compile_args != "" } {
|
|
|
|
set errname "$errname $compile_args"
|
|
|
|
}
|
|
|
|
|
2001-06-09 00:12:28 +02:00
|
|
|
set removeList [list $executable]
|
|
|
|
|
2002-12-13 06:00:15 +01:00
|
|
|
set x [libjava_prune_warnings \
|
2000-12-16 03:06:29 +01:00
|
|
|
[libjava_tcompile $srcfile "$executable" $target $args]]
|
1999-07-06 17:38:09 +02:00
|
|
|
if {[info exists opts(xfail-gcj)]} {
|
|
|
|
setup_xfail *-*-*
|
|
|
|
}
|
1999-05-03 14:48:34 +02:00
|
|
|
if { $x != "" } {
|
|
|
|
verbose "target_compile failed: $x" 2
|
2000-03-06 07:05:02 +01:00
|
|
|
|
|
|
|
if {[info exists opts(shouldfail)]} {
|
|
|
|
pass "$errname compilation from source"
|
2001-06-09 00:12:28 +02:00
|
|
|
eval gcj_cleanup $removeList
|
2000-03-06 07:05:02 +01:00
|
|
|
return
|
|
|
|
}
|
|
|
|
|
1999-04-07 16:42:40 +02:00
|
|
|
fail "$errname compilation from source"
|
2001-05-04 21:33:10 +02:00
|
|
|
if {[info exists opts(xfail-gcj)]
|
|
|
|
|| ! [info exists opts(no-exec)]
|
|
|
|
|| [info exists opts(need-threads)]} {
|
2001-04-03 01:36:26 +02:00
|
|
|
untested "$errname execution from source compiled test"
|
|
|
|
untested "$errname output from source compiled test"
|
1999-05-03 14:48:34 +02:00
|
|
|
}
|
2000-03-06 07:05:02 +01:00
|
|
|
return
|
|
|
|
}
|
|
|
|
if {[info exists opts(shouldfail)]} {
|
|
|
|
fail "$errname compilation from source"
|
|
|
|
return
|
1999-04-07 16:42:40 +02:00
|
|
|
}
|
|
|
|
pass "$errname compilation from source"
|
|
|
|
|
2002-06-24 06:44:53 +02:00
|
|
|
# Set up the options the way they are expected by libjava_invoke.
|
2002-02-20 05:14:15 +01:00
|
|
|
if {[info exists opts(xfail-source-output)]} {
|
2002-06-24 06:44:53 +02:00
|
|
|
set opts(xfail-output) x
|
2002-02-20 05:14:15 +01:00
|
|
|
}
|
2002-06-24 06:44:53 +02:00
|
|
|
if {[libjava_invoke $errname "source compiled test" opts $executable \
|
|
|
|
$inpfile $resultfile]} {
|
|
|
|
# Everything ok, so clean up.
|
2001-06-09 00:12:28 +02:00
|
|
|
eval gcj_cleanup $removeList
|
1999-04-07 16:42:40 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
#
|
|
|
|
# Run the test specified by srcfile and resultfile. compile_args and
|
1999-07-06 17:38:09 +02:00
|
|
|
# exec_args are options telling this proc how to work.
|
1999-04-07 16:42:40 +02:00
|
|
|
#
|
|
|
|
proc test_libjava_from_javac { options srcfile compile_args inpfile resultfile exec_args } {
|
|
|
|
global base_dir
|
|
|
|
global LIBJAVA
|
|
|
|
global LIBGC
|
|
|
|
global srcdir subdir objdir
|
|
|
|
global TOOL_OPTIONS
|
|
|
|
global GCJ_UNDER_TEST
|
|
|
|
global tmpdir
|
|
|
|
global runtests
|
2002-06-24 06:44:53 +02:00
|
|
|
global INTERPRETER
|
1999-04-07 16:42:40 +02:00
|
|
|
|
1999-07-06 17:38:09 +02:00
|
|
|
# Make opts into an array.
|
|
|
|
set opts(_) x
|
|
|
|
unset opts(_)
|
|
|
|
foreach item $exec_args {
|
|
|
|
set opts($item) x
|
|
|
|
}
|
|
|
|
|
2001-05-04 21:33:10 +02:00
|
|
|
# If we need threads and we don't have them then set the `no-exec'
|
|
|
|
# flag. This is case is also handled specially later.
|
|
|
|
if {[info exists opts(need-threads)]} {
|
|
|
|
global libjava_uses_threads
|
|
|
|
if {! $libjava_uses_threads} {
|
|
|
|
set opts(no-exec) x
|
|
|
|
}
|
|
|
|
}
|
1999-04-07 16:42:40 +02:00
|
|
|
set errname [file rootname [file tail $srcfile]]
|
|
|
|
if {! [runtest_file_p $runtests $errname]} {
|
|
|
|
return
|
|
|
|
}
|
|
|
|
|
|
|
|
# bytecompile files with Sun's compiler for now.
|
|
|
|
set bc_ok [bytecompile_file $srcfile $objdir]
|
2000-12-16 03:06:29 +01:00
|
|
|
|
|
|
|
set javac [find_javac]
|
|
|
|
# This is an ugly heuristic but it will have to do.
|
|
|
|
if {[string match *gcj* $javac]} {
|
|
|
|
set tag gcjC
|
|
|
|
} else {
|
|
|
|
set tag javac
|
|
|
|
}
|
|
|
|
if {[info exists opts(xfail-$tag)]} {
|
1999-07-06 17:38:09 +02:00
|
|
|
setup_xfail *-*-*
|
|
|
|
}
|
1999-04-07 16:42:40 +02:00
|
|
|
if {! $bc_ok} then {
|
2000-03-06 07:05:02 +01:00
|
|
|
if {[info exists opts(shouldfail)]} {
|
|
|
|
pass "$errname byte compilation"
|
|
|
|
return
|
|
|
|
}
|
1999-04-07 16:42:40 +02:00
|
|
|
fail "$errname byte compilation"
|
2001-04-03 01:36:26 +02:00
|
|
|
untested "$errname compilation from bytecode"
|
2001-05-04 21:33:10 +02:00
|
|
|
if {! [info exists opts(no-exec)]
|
|
|
|
|| [info exists opts(need-threads)]} {
|
2001-04-03 01:36:26 +02:00
|
|
|
untested "$errname execution from bytecode->native test"
|
|
|
|
untested "$errname output from bytecode->native test"
|
1999-05-03 14:48:34 +02:00
|
|
|
}
|
1999-04-07 16:42:40 +02:00
|
|
|
return
|
|
|
|
}
|
2000-03-06 07:05:02 +01:00
|
|
|
if {[info exists opts(shouldfail)]} {
|
|
|
|
fail "$errname byte compilation"
|
|
|
|
return
|
|
|
|
}
|
1999-04-07 16:42:40 +02:00
|
|
|
pass "$errname byte compilation"
|
|
|
|
|
2001-06-09 00:12:28 +02:00
|
|
|
set removeList {}
|
|
|
|
|
1999-04-07 16:42:40 +02:00
|
|
|
# Find name to use for --main, and name of all class files.
|
|
|
|
set jvscan [find_jvscan]
|
|
|
|
verbose "jvscan is $jvscan"
|
|
|
|
set main_name [string trim \
|
2002-12-13 06:00:15 +01:00
|
|
|
[libjava_prune_warnings \
|
2001-06-02 21:13:52 +02:00
|
|
|
[lindex [local_exec "$jvscan --encoding=UTF-8 $srcfile --print-main" "" "" 300] 1]]]
|
1999-04-07 16:42:40 +02:00
|
|
|
verbose "main name is $main_name"
|
|
|
|
set class_out [string trim \
|
2002-12-13 06:00:15 +01:00
|
|
|
[libjava_prune_warnings \
|
2001-06-02 21:13:52 +02:00
|
|
|
[lindex [local_exec "$jvscan --encoding=UTF-8 $srcfile --list-class" "" "" 300] 1]]]
|
1999-04-07 16:42:40 +02:00
|
|
|
verbose "class list is $class_out"
|
2000-03-07 23:44:22 +01:00
|
|
|
|
|
|
|
if {[string match "*parse error*" $main_name]
|
|
|
|
|| [string match "*parse error*" $class_out]} {
|
2001-04-03 01:36:26 +02:00
|
|
|
untested "$errname compilation from bytecode"
|
2001-05-04 21:33:10 +02:00
|
|
|
if {! [info exists opts(no-exec)]
|
|
|
|
|| [info exists opts(need-threads)]} {
|
2001-04-03 01:36:26 +02:00
|
|
|
untested "$errname execution from bytecode->native test"
|
|
|
|
untested "$errname output from bytecode->native test"
|
1999-06-25 15:55:59 +02:00
|
|
|
}
|
2000-03-07 23:44:22 +01:00
|
|
|
return
|
|
|
|
}
|
|
|
|
|
|
|
|
# Turn "a b" into "a.class b.class".
|
|
|
|
# Also, turn "foo.bar" into "foo/bar.class".
|
|
|
|
set class_files {}
|
|
|
|
foreach file [split [string trim $class_out]] {
|
|
|
|
set file [join [split $file .] /]
|
|
|
|
lappend class_files $objdir/$file.class
|
1999-04-07 16:42:40 +02:00
|
|
|
}
|
|
|
|
|
2001-06-09 00:12:28 +02:00
|
|
|
eval lappend removeList $class_files
|
|
|
|
|
1999-04-07 16:42:40 +02:00
|
|
|
# Usually it is an error for a test program not to have a `main'
|
1999-07-15 11:15:26 +02:00
|
|
|
# method. However, for no-exec tests it is ok. Treat no-link
|
|
|
|
# like no-exec here.
|
|
|
|
if {[info exists opts(no-link)]} {
|
|
|
|
set opts(no-exec) x
|
|
|
|
}
|
1999-05-03 14:48:34 +02:00
|
|
|
set largs {}
|
2000-12-16 03:06:29 +01:00
|
|
|
|
|
|
|
if {[info exists opts(no-exec)]} {
|
|
|
|
set type object
|
|
|
|
set mode compile
|
|
|
|
} elseif {$main_name == ""} {
|
|
|
|
perror "No `main' given in program $errname"
|
|
|
|
return
|
1999-04-07 16:42:40 +02:00
|
|
|
} else {
|
|
|
|
set type executable
|
1999-05-03 14:48:34 +02:00
|
|
|
lappend largs "additional_flags=--main=$main_name"
|
2002-05-08 14:38:55 +02:00
|
|
|
# DOS/win32 targets default to .exe if no suffix is given
|
|
|
|
# We then try to delete a file that doesn't exist. It is
|
|
|
|
# simpler to add the suffix everywhere.
|
|
|
|
set executable "${objdir}/${main_name}.exe"
|
1999-05-03 14:48:34 +02:00
|
|
|
set mode link
|
1999-04-07 16:42:40 +02:00
|
|
|
}
|
|
|
|
|
2002-06-24 06:44:53 +02:00
|
|
|
# We purposely ignore errors here; we still want to run the other
|
|
|
|
# appropriate tests.
|
|
|
|
set gij [libjava_find_gij]
|
|
|
|
# libjava_find_gij will return `gij' if it couldn't find the
|
|
|
|
# program; in this case we want to skip the test.
|
|
|
|
if {$INTERPRETER == "yes" && $gij != "gij"} {
|
|
|
|
libjava_invoke $errname "gij test" opts $gij \
|
|
|
|
$inpfile $resultfile $main_name
|
|
|
|
}
|
|
|
|
|
1999-05-03 14:48:34 +02:00
|
|
|
# Initial arguments.
|
|
|
|
set args [libjava_arguments $mode]
|
|
|
|
eval lappend args $largs
|
|
|
|
|
1999-04-07 16:42:40 +02:00
|
|
|
if { $compile_args != "" } {
|
|
|
|
lappend args "additional_flags=$compile_args"
|
|
|
|
}
|
|
|
|
|
|
|
|
if { $compile_args != "" } {
|
|
|
|
set errname "$errname $compile_args"
|
|
|
|
}
|
|
|
|
|
1999-05-03 14:48:34 +02:00
|
|
|
verbose "compilation command = $args" 2
|
1999-07-15 11:15:26 +02:00
|
|
|
# When compiling and not linking, we have to build each .o
|
|
|
|
# separately. We do this because DejaGNU's target_compile won't
|
|
|
|
# accept an empty "destfile" argument when the mode is "compile".
|
|
|
|
if {$mode == "compile"} {
|
|
|
|
foreach c_file $class_files {
|
|
|
|
set executable [file rootname [file tail $c_file]].o
|
2003-02-14 23:17:00 +01:00
|
|
|
# Don't write files which contain $ chars.
|
2003-02-15 17:39:28 +01:00
|
|
|
regsub -all "\\$" $executable "\^" executable
|
2002-12-13 06:00:15 +01:00
|
|
|
set x [libjava_prune_warnings \
|
2003-02-14 23:17:00 +01:00
|
|
|
[libjava_tcompile '$c_file' "$executable" $type $args]]
|
2001-06-09 00:12:28 +02:00
|
|
|
lappend removeList $executable
|
1999-07-15 11:15:26 +02:00
|
|
|
if {$x != ""} {
|
|
|
|
break
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} else {
|
2001-06-09 00:12:28 +02:00
|
|
|
# This is so evil: we de-listify CLASS_FILES so that we can
|
2000-12-16 20:02:54 +01:00
|
|
|
# turn around and quote the `$' in it for the shell. I really
|
|
|
|
# hate DejaGNU. It is so !@#$!@# unpredictable.
|
|
|
|
set hack ""
|
|
|
|
foreach stupid $class_files {
|
|
|
|
set hack "$hack $stupid"
|
|
|
|
}
|
2001-06-09 00:12:28 +02:00
|
|
|
lappend removeList $executable
|
2002-12-13 06:00:15 +01:00
|
|
|
set x [libjava_prune_warnings \
|
2000-12-16 20:02:54 +01:00
|
|
|
[libjava_tcompile $hack "$executable" $type $args]]
|
1999-07-15 11:15:26 +02:00
|
|
|
}
|
1999-07-06 17:38:09 +02:00
|
|
|
if {[info exists opts(xfail-byte)]} {
|
|
|
|
setup_xfail *-*-*
|
|
|
|
}
|
1999-05-03 14:48:34 +02:00
|
|
|
if { $x != "" } {
|
|
|
|
verbose "target_compile failed: $x" 2
|
1999-04-07 16:42:40 +02:00
|
|
|
fail "$errname compilation from bytecode"
|
2001-05-04 21:33:10 +02:00
|
|
|
if {! [info exists opts(no-exec)]
|
|
|
|
|| [info exists opts(need-threads)]} {
|
2001-04-03 01:36:26 +02:00
|
|
|
untested "$errname execution from bytecode->native test"
|
|
|
|
untested "$errname output from bytecode->native test"
|
1999-04-07 16:42:40 +02:00
|
|
|
}
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
pass "$errname compilation from bytecode"
|
|
|
|
|
2002-06-24 06:44:53 +02:00
|
|
|
# Set up the options the way they are expected by libjava_invoke.
|
2002-02-20 05:14:15 +01:00
|
|
|
if {[info exists opts(xfail-byte-output)]} {
|
2002-06-24 06:44:53 +02:00
|
|
|
set opts(xfail-output) x
|
2002-02-20 05:14:15 +01:00
|
|
|
}
|
2002-06-24 06:44:53 +02:00
|
|
|
if {[libjava_invoke $errname "bytecode->native test" opts $executable \
|
|
|
|
$inpfile $resultfile]} {
|
|
|
|
# Everything ok, so clean up.
|
2001-06-09 00:12:28 +02:00
|
|
|
eval gcj_cleanup $removeList
|
1999-04-07 16:42:40 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
#
|
|
|
|
# Run the test specified by srcfile and resultfile. compile_args and
|
1999-07-06 17:38:09 +02:00
|
|
|
# exec_args are options telling this proc how to work.
|
1999-07-15 11:15:26 +02:00
|
|
|
# `no-link' don't try to link the program
|
2000-03-06 07:05:02 +01:00
|
|
|
# `no-exec' don't try to run the test
|
1999-07-06 17:38:09 +02:00
|
|
|
# `xfail-gcj' compilation from source will fail
|
|
|
|
# `xfail-javac' compilation with javac will fail
|
|
|
|
# `xfail-gcjC' compilation with gcj -C will fail
|
2000-03-06 07:05:02 +01:00
|
|
|
# `shouldfail' compilation from source is supposed to fail
|
|
|
|
# This is different from xfail, which marks a known
|
2002-06-13 19:34:49 +02:00
|
|
|
# failure that we just haven't fixed.
|
2000-03-06 07:05:02 +01:00
|
|
|
# A compilation marked this way should fail with any
|
|
|
|
# front end.
|
1999-07-06 17:38:09 +02:00
|
|
|
# `xfail-byte' compilation from bytecode will fail
|
|
|
|
# `xfail-exec' exec will fail
|
2001-05-04 21:33:10 +02:00
|
|
|
# `xfail-output'
|
|
|
|
# output will be wrong
|
2002-02-20 05:14:15 +01:00
|
|
|
# `xfail-byte-output'
|
|
|
|
# output will be wrong when compiled from bytecode
|
|
|
|
# `xfail-source-output'
|
|
|
|
# output will be wrong when compiled from source code
|
2001-05-04 21:33:10 +02:00
|
|
|
# `need-threads'
|
|
|
|
# test relies on thread support
|
1999-04-07 16:42:40 +02:00
|
|
|
#
|
|
|
|
proc test_libjava { options srcfile compile_args inpfile resultfile exec_args } {
|
|
|
|
test_libjava_from_source $options $srcfile $compile_args $inpfile $resultfile $exec_args
|
|
|
|
test_libjava_from_javac $options $srcfile $compile_args $inpfile $resultfile $exec_args
|
|
|
|
}
|
|
|
|
|
|
|
|
#
|
|
|
|
# libjava_version -- extract and print the version number of libjavap
|
|
|
|
#
|
|
|
|
proc default_libjava_version {} {
|
|
|
|
}
|
|
|
|
|
|
|
|
proc default_libjava_start { } {
|
|
|
|
}
|
1999-07-06 17:38:09 +02:00
|
|
|
|
2001-07-27 14:21:56 +02:00
|
|
|
# On IRIX 6, we have to set variables akin to LD_LIBRARY_PATH, but
|
|
|
|
# called LD_LIBRARYN32_PATH (for the N32 ABI) and LD_LIBRARY64_PATH
|
|
|
|
# (for the 64-bit ABI). The right way to do this would be to modify
|
|
|
|
# unix.exp -- but that's not an option since it's part of DejaGNU
|
|
|
|
# proper, so we do it here, by trickery. We really only need to do
|
|
|
|
# this on IRIX, but it shouldn't hurt to do it anywhere else.
|
|
|
|
|
|
|
|
proc ${tool}_set_ld_library_path { name element op } {
|
|
|
|
setenv LD_LIBRARYN32_PATH [getenv LD_LIBRARY_PATH]
|
|
|
|
setenv LD_LIBRARY64_PATH [getenv LD_LIBRARY_PATH]
|
|
|
|
}
|
|
|
|
|
|
|
|
trace variable env(LD_LIBRARY_PATH) w ${tool}_set_ld_library_path
|
|
|
|
|
1999-07-06 17:38:09 +02:00
|
|
|
# Local Variables:
|
|
|
|
# tcl-indent-level:4
|
|
|
|
# End:
|