OSDN Git Service

Install libgcj.jar as libgcj-VERSION.jar.
[pf3gnuchains/gcc-fork.git] / libjava / testsuite / lib / libjava.exp
1 # Copyright (C) 1998, 1999, 2000, 2001, 2002 Free Software Foundation
2
3 load_lib "libgloss.exp"
4
5 # GCJ_UNDER_TEST is the compiler under test.
6
7 global tmpdir
8
9 if ![info exists tmpdir] {
10     set tmpdir "/tmp"
11 }
12
13 # This is like `target_compile' but it does some surgery to work
14 # around stupid DejaGNU bugs.  In particular DejaGNU has very poor
15 # quoting, so for instance a `$' will be re-evaluated at spawn time.
16 # We don't want that.
17 proc libjava_tcompile {source destfile type options} {
18     # This strange-looking expression really does quote the `$'.
19     regsub -all -- {\$} $source {\$} source
20     regsub -all -- {\$} $destfile {\$} destfile
21     return [target_compile $source $destfile $type $options]
22 }
23
24 # Read an `xfail' file if it exists.  Returns a list of xfail tokens.
25 proc libjava_read_xfail {file} {
26     if {! [file exists $file]} {
27         return ""
28     }
29     set fd [open $file r]
30     set tokens [string trim [read $fd]]
31     close $fd
32     return $tokens
33 }
34
35 # Find a particular executable.  FIXME: this relies on DejaGnu
36 # internals.  These should probably be exposed in a better way.
37 proc libjava_find_program {prog} {
38     global tool_root_dir
39
40     set file [lookfor_file $tool_root_dir $prog]
41     if { $file == "" } {
42         set file [lookfor_file $tool_root_dir gcc/$prog];
43     }
44     if {$file == ""} {
45         set file $prog
46     }
47     return $file
48 }
49
50 # Find `jv-scan'.
51 proc find_jvscan {} {
52     return [libjava_find_program jv-scan]
53 }
54
55 # Find `gcjh'.
56 proc find_gcjh {} {
57     return [libjava_find_program gcjh]
58 }
59
60 proc find_javac {} {
61     global SUN_JAVAC GCJ_UNDER_TEST env
62     # If JDK doesn't run on your platform but some other
63     # JDK-compatible javac does, you may set SUN_JAVAC to point to it.
64     # One of the most important properties of a SUN_JAVAC is that it
65     # must create class-files even for classes that have not been
66     # specified in the command line, but that were needed to compile
67     # those that have.  For example, Pizza won't do it, but you can
68     # use `kaffe sun.tools.javac.Main', if you have Sun's classes.zip
69     # in the kaffe's default search path.
70     if {![info exists SUN_JAVAC]} {
71         if {[info exists env(SUN_JAVAC)]} {
72             set SUN_JAVAC $env(SUN_JAVAC)
73         } else {
74             set SUN_JAVAC "$GCJ_UNDER_TEST -C"
75         }
76     }
77     return $SUN_JAVAC
78 }
79
80 proc bytecompile_file { file objdir {classpath {}} } {
81     global env
82     set dirname [file dirname $file]
83
84     set javac [find_javac]
85     if {$classpath != ""} then {
86         set env(CLASSPATH) $classpath
87     }
88     set here [pwd]
89     cd $dirname
90     if {[catch {
91         set q [eval exec "$javac [list $file] -d $objdir 2>@ stdout"]
92     } msg]} then {
93         verbose "couldn't compile $file: $msg"
94         set r 0
95     } else {
96         set r 1
97     }
98     cd $here
99     return $r
100 }
101
102 set libjava_initialized 0
103
104 #
105 # Build the status wrapper library as needed.
106 #
107 proc libjava_init { args } {
108     global wrapper_file;
109     global wrap_compile_flags;
110     global libjava_initialized libjava_uses_threads
111     global GCJ_UNDER_TEST
112     global TOOL_EXECUTABLE
113     global original_ld_library_path
114     global env objdir
115     global env gcc_version
116
117     if { $libjava_initialized == 1 } { return; }
118
119     if ![info exists GCJ_UNDER_TEST] {
120         if [info exists TOOL_EXECUTABLE] {
121             set GCJ_UNDER_TEST $TOOL_EXECUTABLE;
122         } else {
123             if [info exists env(GCJ)] {
124                 set GCJ_UNDER_TEST $env(GCJ)
125             } else {
126                 set GCJ_UNDER_TEST "[find_gcj]"
127             }
128         }
129     }
130
131     # Determine the version so we can find the libgcj jar file.
132     set text [eval exec "$GCJ_UNDER_TEST --version 2>@ stdout"]
133     regexp -- "gcj \[^ \]+ (\[^ \]+) .*" $text ignore gcc_version
134     verbose "jar file is libgcj-$gcc_version.jar"
135
136     # The -B is so we find libgcj.spec.
137     set text [eval exec "$GCJ_UNDER_TEST -B$objdir/../ -v 2>@ stdout"]
138     regexp -- "Thread model: (\[^\n\]+)\n" $text ignore model
139     set libjava_uses_threads [expr {! ($model == "no"
140                                        || $model == "none"
141                                        || $model == "single")}]
142
143     # Always set encoding used by gcj.
144     append GCJ_UNDER_TEST " --encoding=UTF-8"
145
146     if [info exists env(LD_LIBRARY_PATH)] {
147         set original_ld_library_path $env(LD_LIBRARY_PATH)
148     } else {
149         if [info exists env(SHLIB_PATH)] {
150             set original_ld_library_path $env(SHLIB_PATH)
151         } else {
152             set original_ld_library_path ""
153         }
154     }
155
156     set wrapper_file "";
157     set wrap_compile_flags "";
158     if [target_info exists needs_status_wrapper] {
159         set result [build_wrapper "testglue.o"];
160         if { $result != "" } {
161             set wrapper_file [lindex $result 0];
162             set wrap_compile_flags [lindex $result 1];
163         } else {
164             warning "Status wrapper failed to build."
165         }
166     }
167
168     set libjava_initialized 1
169 }
170
171 # Find a library.  We know where libtool puts the actual libraries,
172 # and we look there.  The implementation is fairly hacky.  We can't
173 # compile with -nodefaultlibs, because that will also eliminate the
174 # system libraries we need.  In order to have gcj still work, it must
175 # find the appropriate libraries so we must add -L options for their
176 # paths.  However we can't simply use those libraries; we still need
177 # libtool for linking.
178 proc libjava_find_lib {dir name} {
179     global base_dir
180     set gp [get_multilibs]
181     foreach sub {.libs _libs} {
182         if {$gp != ""} {
183             if {[file exists $gp/$dir/$sub/lib${name}.a]} then {
184                 # Just return the `-L' option.  The library itself
185                 # will be picked up via the spec file.
186                 return "-L$gp/$dir/$sub"
187             }
188         }
189         # Just return the `-L' option.  The library itself will be
190         # picked up via the spec file.
191         set lib [findfile $base_dir/../../$dir/$sub/lib${name}.a \
192                    "-L$base_dir/../../$dir/$sub" \
193                    ""]
194         if {$lib != ""} {
195             return $lib
196         }
197     }
198     return ""
199 }
200
201 # Remove a bunch of files.
202 proc gcj_cleanup {args} {
203     foreach file $args {
204         if {[string match *.o $file]} {
205             verbose "removing [file rootname $file].lo"
206             file delete -force [file rootname $file].lo
207         }
208         file delete -force -- $file
209         verbose "removing $file"
210     }
211     # It is simplest to do this instead of trying to figure out what
212     # bits in .libs ought to be removed.
213     catch {system "rm -rf .libs"}
214 }
215
216 # Compute arguments needed for compiler.  MODE is a libtool mode:
217 # either compile or link.
218 proc libjava_arguments {{mode compile}} {
219     global base_dir
220     global LIBJAVA
221     global LIBGC
222     global LIBQTHREADS
223     global LIBZ
224     global srcdir subdir objdir
225     global TOOL_OPTIONS
226     global GCJ_UNDER_TEST
227     global tmpdir
228     global runtests
229     global env
230     global tool_root_dir
231     global gcc_version
232
233     if [info exists LIBJAVA] {
234         set libjava $LIBJAVA;
235     } else {
236         set libjava [libjava_find_lib libjava gcj]
237     }
238
239     if [info exists LIBGC] {
240         set libgc $LIBGC;
241     } else {
242         set libgc [libjava_find_lib boehm-gc gcjgc]
243     }
244
245     if [info exists LIBQTHREADS] {
246         set libqthreads $LIBQTHREADS
247     } else {
248         set libqthreads [libjava_find_lib qthreads gcjcoop]
249     }
250
251     if [info exists LIBZ] {
252         set libz $LIBZ
253     } else {
254         set libz [libjava_find_lib zlib zgcj]
255     }
256
257     # FIXME: there's no way to determine whether -lpthread is
258     # required.  We should get this info from configure, or it should
259     # just be in the compiler driver.
260
261     verbose "using LIBJAVA = $libjava" 2
262     verbose "using LIBGC = $libgc" 2
263     verbose "using LIBQTHREADS = $libqthreads" 2
264     verbose "using LIBZ = $libz" 2
265     set args ""
266
267     # Basically we want to build up a colon separated path list from
268     # the value of $libjava.
269
270     set lpath {}
271     foreach dir [list $libjava $libgc $libz] {
272         foreach item [split $dir " "] {
273             switch -glob -- $item {
274                 "-L*" {
275                     lappend lpath [string range $item 2 end]
276                 }
277             }
278         }
279     }
280
281     # Finally, add the gcc build directory so that we can find the
282     # shared libgcc.  This, like much of dejagnu, is hideous.
283     set gccdir [lookfor_file $tool_root_dir gcc/libgcc_s.so]
284     if {$gccdir != ""} {
285         lappend lpath [file dirname $gccdir]
286     }
287
288     set ld_library_path [join $lpath :]
289
290     # That's enough to make things work for the normal case.
291     # If we wanted to handle an arbitrary value of libjava,
292     # then we'd have to do a lot more work.
293
294     # Set variables the dynamic linker looks at.
295     global original_ld_library_path
296     setenv LD_LIBRARY_PATH "$ld_library_path:$original_ld_library_path"
297     setenv SHLIB_PATH "$ld_library_path:$original_ld_library_path"
298
299     verbose "LD_LIBRARY_PATH = $env(LD_LIBRARY_PATH)"
300
301     # Set the CLASSPATH environment variable
302     verbose "CLASSPATH is .:$srcdir/$subdir:$objdir:$objdir/../libgcj-$gcc_version.jar"
303     global env
304     set env(CLASSPATH) ".:$srcdir/$subdir:$objdir:$objdir/../libgcj-$gcc_version.jar"
305
306     if {$mode == "link"} {
307         global wrapper_file wrap_compile_flags;
308         lappend args "additional_flags=$wrap_compile_flags";
309         lappend args "libs=$wrapper_file";
310         lappend args "libs=$libjava";
311         lappend args "libs=$libgc";
312         lappend args "libs=$libqthreads"
313         lappend args "libs=$libz"
314         lappend args debug
315     }
316
317     if { [target_info needs_status_wrapper]!="" && [info exists gluefile] } {
318         lappend args "libs=${gluefile}"
319         lappend args "ldflags=$wrap_flags"
320     }
321
322     if [info exists TOOL_OPTIONS] {
323         lappend args "additional_flags=$TOOL_OPTIONS"
324     }
325
326     # Search for libtool.  We need it to link.
327     set found_compiler 0
328     set d [absolute $objdir]
329     foreach x {. .. ../.. ../../..} {
330         if {[file exists $d/$x/libtool]} then {
331             # We have to run silently to avoid DejaGNU lossage.
332             lappend args \
333               "compiler=$d/$x/libtool --silent --tag=GCJ --mode=$mode $GCJ_UNDER_TEST -B$objdir/../"
334             set found_compiler 1
335             break
336         }
337     }
338     if {! $found_compiler} {
339         # Append -B$objdir/../ so that we find libgcj.spec before it
340         # is installed.
341         lappend args "compiler=$GCJ_UNDER_TEST -B$objdir/../"
342     }
343
344     # Avoid libtool wrapper scripts when possible.
345     if {$mode == "link"} {
346         lappend args "additional_flags=-no-install"
347     }
348
349     return $args
350 }
351
352 # Link a bunch of objects into a program.  MAIN is the name of the
353 # class holding `main'.  Return 0 on failure.
354 proc gcj_link {program main files {options {}}} {
355     set arguments [libjava_arguments link]
356     if {[llength $options]} {
357         eval lappend arguments $options
358     }
359     lappend arguments "additional_flags=--main=$main"
360     set x [prune_warnings [libjava_tcompile $files $program executable \
361                              $arguments]]
362     if {$x != ""} {
363         verbose "link failure: $x" 2
364         fail "linking $program"
365         setup_xfail "*-*-*"
366         fail "running $program"
367         return 0
368     }
369
370     pass "linking $program"
371     return 1
372 }
373
374 #
375 # Run the test specified by srcfile and resultfile. compile_args and
376 # exec_args are options telling this proc how to work.
377 #
378 proc test_libjava_from_source { options srcfile compile_args inpfile resultfile exec_args } {
379     global base_dir
380     global LIBJAVA
381     global LIBGC
382     global srcdir subdir objdir
383     global TOOL_OPTIONS
384     global GCJ_UNDER_TEST
385     global tmpdir
386     global runtests
387
388     # Make opts into an array.
389     set opts(_) x
390     unset opts(_)
391     foreach item $exec_args {
392         set opts($item) x
393     }
394
395     # If we need threads and we don't have them then set the `no-exec'
396     # flag.  This is case is also handled specially later.
397     if {[info exists opts(need-threads)]} {
398         global libjava_uses_threads
399         if {! $libjava_uses_threads} {
400             set opts(no-exec) x
401         }
402     }
403
404     set errname [file rootname [file tail $srcfile]]
405     if {! [runtest_file_p $runtests $errname]} {
406         return
407     }
408
409     if {[info exists opts(no-link)]} {
410         set mode compile
411     } else {
412         set mode link
413     }
414     set args [libjava_arguments $mode]
415     if {! [info exists opts(no-link)]} {
416         # Add the --main flag
417         lappend args "additional_flags=--main=[file rootname [file tail $srcfile]]"
418         if { $compile_args != "" } {
419             lappend args "additional_flags=$compile_args"
420         }
421     }
422
423     regsub "^.*/(\[^/.\]+)\[.\]\[^/]*$" "$srcfile" "\\1" out
424     set executable "${objdir}/$out"
425     if {[info exists opts(no-link)]} {
426         append executable ".o"
427         set target object
428     } else {
429         set target executable
430     }
431     if { $compile_args != "" } {
432         set errname "$errname $compile_args"
433     }
434
435     set removeList [list $executable]
436
437     set x [prune_warnings \
438              [libjava_tcompile $srcfile "$executable" $target $args]]
439     if {[info exists opts(xfail-gcj)]} {
440         setup_xfail *-*-*
441     }
442     if { $x != "" } {
443         verbose "target_compile failed: $x" 2
444
445         if {[info exists opts(shouldfail)]} {
446             pass "$errname compilation from source"
447             eval gcj_cleanup $removeList
448             return
449         }
450
451         fail "$errname compilation from source"
452         if {[info exists opts(xfail-gcj)]
453             || ! [info exists opts(no-exec)]
454             || [info exists opts(need-threads)]} {
455             untested "$errname execution from source compiled test"
456             untested "$errname output from source compiled test"
457         }
458         return
459     }
460     if {[info exists opts(shouldfail)]} {
461         fail "$errname compilation from source"
462         return
463     }
464     pass "$errname compilation from source"
465
466     if {[info exists opts(no-exec)]} {
467         if {[info exists opts(need-threads)]} {
468             # This means we wanted to try to run it but we couldn't
469             # because threads aren't supported.  So we have to
470             # generate an `untested'.
471             untested "$errname execution from source compiled test"
472             untested "$errname output from source compiled test"
473         }
474         eval gcj_cleanup $removeList
475         return
476     }
477     if {[info exists opts(no-link)]} {
478         eval gcj_cleanup $removeList
479         return
480     }
481
482     set result [libjava_load $executable "" "$inpfile"];
483     set status [lindex $result 0];
484     set output [lindex $result 1];
485     if {[info exists opts(xfail-exec)]} then {
486         setup_xfail *-*-*
487     }
488     $status "$errname execution from source compiled test"
489     if { $status != "pass" } {
490         untested "$errname output from source compiled test"
491         return;
492     }
493
494     verbose "resultfile is $resultfile"
495     set id [open $resultfile r];
496     set expected ""
497     append expected [read $id];
498     regsub -all "\r" "$output" "" output;
499     regsub "\n*$" $expected "" expected
500     regsub "\n*$" $output "" output
501     regsub "^\n*" $expected "" expected
502     regsub "^\n*" $output "" output
503     regsub -all "\[ \t\]\[ \t\]*" $expected " " expected
504     regsub -all "\[ \t\]*\n\n*" $expected "\n" expected
505     regsub -all "\[ \t\]\[ \t\]*" $output " " output
506     regsub -all "\[ \t\]*\n\n*" $output "\n" output
507     verbose "expected is $expected"
508     verbose "actual is $output"
509     set passed 0;
510     if {$options == "regexp_match"} {
511         if [regexp $expected $output] {
512             set passed 1;
513         }
514     } else {
515         if { $expected == $output } {
516             set passed 1;
517         }
518     }
519     if {[info exists opts(xfail-output)]} {
520         setup_xfail *-*-*
521     }
522     if {[info exists opts(xfail-source-output)]} {
523         setup_xfail *-*-*
524     }
525     if { $passed == 1 } {
526         pass "$errname output from source compiled test"
527         eval gcj_cleanup $removeList
528     } else {
529         fail "$errname output from source compiled test"
530     }
531     close $id;
532 }
533
534 #
535 # Run the test specified by srcfile and resultfile. compile_args and
536 # exec_args are options telling this proc how to work.
537 #
538 proc test_libjava_from_javac { options srcfile compile_args inpfile resultfile exec_args } {
539     global base_dir
540     global LIBJAVA
541     global LIBGC
542     global srcdir subdir objdir
543     global TOOL_OPTIONS
544     global GCJ_UNDER_TEST
545     global tmpdir
546     global runtests
547
548     # Make opts into an array.
549     set opts(_) x
550     unset opts(_)
551     foreach item $exec_args {
552         set opts($item) x
553     }
554
555     # If we need threads and we don't have them then set the `no-exec'
556     # flag.  This is case is also handled specially later.
557     if {[info exists opts(need-threads)]} {
558         global libjava_uses_threads
559         if {! $libjava_uses_threads} {
560             set opts(no-exec) x
561         }
562     }
563     set errname [file rootname [file tail $srcfile]]
564     if {! [runtest_file_p $runtests $errname]} {
565         return
566     }
567
568     # bytecompile files with Sun's compiler for now.
569     set bc_ok [bytecompile_file $srcfile $objdir]
570
571     set javac [find_javac]
572     # This is an ugly heuristic but it will have to do.
573     if {[string match *gcj* $javac]} {
574         set tag gcjC
575     } else {
576         set tag javac
577     }
578     if {[info exists opts(xfail-$tag)]} {
579         setup_xfail *-*-*
580     }
581     if {! $bc_ok} then {
582         if {[info exists opts(shouldfail)]} {
583             pass "$errname byte compilation"
584             return
585         }
586         fail "$errname byte compilation"
587         untested "$errname compilation from bytecode"
588         if {! [info exists opts(no-exec)]
589             || [info exists opts(need-threads)]} {
590             untested "$errname execution from bytecode->native test"
591             untested "$errname output from bytecode->native test"
592         }
593         return
594     }
595     if {[info exists opts(shouldfail)]} {
596         fail "$errname byte compilation"
597         return
598     }
599     pass "$errname byte compilation"
600
601     set removeList {}
602
603     # Find name to use for --main, and name of all class files.
604     set jvscan [find_jvscan]
605     verbose "jvscan is $jvscan"
606     set main_name [string trim \
607                      [prune_warnings \
608                         [lindex [local_exec "$jvscan --encoding=UTF-8 $srcfile --print-main" "" "" 300] 1]]]
609     verbose "main name is $main_name"
610     set class_out [string trim \
611                      [prune_warnings \
612                         [lindex [local_exec "$jvscan --encoding=UTF-8 $srcfile --list-class" "" "" 300] 1]]]
613     verbose "class list is $class_out"
614
615     if {[string match "*parse error*" $main_name]
616         || [string match "*parse error*" $class_out]} {
617         untested "$errname compilation from bytecode"
618         if {! [info exists opts(no-exec)]
619             || [info exists opts(need-threads)]} {
620             untested "$errname execution from bytecode->native test"
621             untested "$errname output from bytecode->native test"
622         }
623         return
624     }
625
626     # Turn "a b" into "a.class b.class".
627     # Also, turn "foo.bar" into "foo/bar.class".
628     set class_files {}
629     foreach file [split [string trim $class_out]] {
630         set file [join [split $file .] /]
631         lappend class_files $objdir/$file.class
632     }
633
634     eval lappend removeList $class_files
635
636     # Usually it is an error for a test program not to have a `main'
637     # method.  However, for no-exec tests it is ok.  Treat no-link
638     # like no-exec here.
639     if {[info exists opts(no-link)]} {
640         set opts(no-exec) x
641     }
642     set largs {}
643
644     if {[info exists opts(no-exec)]} {
645         set type object
646         set mode compile
647     } elseif {$main_name == ""} {
648         perror "No `main' given in program $errname"
649         return
650     } else {
651         set type executable
652         lappend largs "additional_flags=--main=$main_name"
653         set executable "${objdir}/$main_name"
654         set mode link
655     }
656
657     # Initial arguments.
658     set args [libjava_arguments $mode]
659     eval lappend args $largs
660
661     if { $compile_args != "" } {
662         lappend args "additional_flags=$compile_args"
663     }
664
665     if { $compile_args != "" } {
666         set errname "$errname $compile_args"
667     }
668
669     verbose "compilation command = $args" 2
670     # When compiling and not linking, we have to build each .o
671     # separately.  We do this because DejaGNU's target_compile won't
672     # accept an empty "destfile" argument when the mode is "compile".
673     if {$mode == "compile"} {
674         foreach c_file $class_files {
675             set executable [file rootname [file tail $c_file]].o
676             set x [prune_warnings \
677                      [libjava_tcompile $c_file "$executable" $type $args]]
678             lappend removeList $executable
679             if {$x != ""} {
680                 break
681             }
682         }
683     } else {
684         # This is so evil: we de-listify CLASS_FILES so that we can
685         # turn around and quote the `$' in it for the shell.  I really
686         # hate DejaGNU.  It is so !@#$!@# unpredictable.
687         set hack ""
688         foreach stupid $class_files {
689             set hack "$hack $stupid"
690         }
691         lappend removeList $executable
692         set x [prune_warnings \
693                  [libjava_tcompile $hack "$executable" $type $args]]
694     }
695     if {[info exists opts(xfail-byte)]} {
696         setup_xfail *-*-*
697     }
698     if { $x != "" } {
699         verbose "target_compile failed: $x" 2
700         fail "$errname compilation from bytecode"
701         if {! [info exists opts(no-exec)]
702             || [info exists opts(need-threads)]} {
703             untested "$errname execution from bytecode->native test"
704             untested "$errname output from bytecode->native test"
705         }
706         return;
707     }
708     pass "$errname compilation from bytecode"
709
710     if {[info exists opts(no-exec)]} {
711         if {[info exists opts(need-threads)]} {
712             untested "$errname execution from bytecode->native test"
713             untested "$errname output from bytecode->native test"
714         }
715         eval gcj_cleanup $removeList
716         return
717     }
718
719     set result [libjava_load $executable "" "$inpfile"];
720     set status [lindex $result 0];
721     set output [lindex $result 1];
722     if {[info exists opts(xfail-exec)]} {
723         setup_xfail *-*-*
724     }
725     $status "$errname execution from bytecode->native test"
726     if { $status != "pass" } {
727         untested "$errname output from bytecode->native test"
728         return
729     }
730
731     verbose "resultfile is $resultfile"
732     set id [open $resultfile r];
733     set expected ""
734     append expected [read $id];
735     regsub -all "\r" "$output" "" output;
736     regsub "\n*$" $expected "" expected
737     regsub "\n*$" $output "" output
738     regsub "^\n*" $expected "" expected
739     regsub "^\n*" $output "" output
740     regsub -all "\[ \t\]\[ \t\]*" $expected " " expected
741     regsub -all "\[ \t\]*\n\n*" $expected "\n" expected
742     regsub -all "\[ \t\]\[ \t\]*" $output " " output
743     regsub -all "\[ \t\]*\n\n*" $output "\n" output
744     verbose "expected is $expected"
745     verbose "actual is $output"
746     set passed 0;
747     if {[info exists opts(xfail-output)]} {
748         setup_xfail *-*-*
749     }
750     if {[info exists opts(xfail-byte-output)]} {
751         setup_xfail *-*-*
752     }
753     if {$options == "regexp_match"} {
754         if [regexp $expected $output] {
755             set passed 1;
756         }
757     } else {
758         if { $expected == $output } {
759             set passed 1;
760         }
761     }
762     if { $passed == 1 } {
763         pass "$errname output from bytecode->native test"
764         eval gcj_cleanup $removeList
765     } else {
766         fail "$errname output from bytecode->native test"
767     }
768     close $id;
769 }
770
771 #
772 # Run the test specified by srcfile and resultfile. compile_args and
773 # exec_args are options telling this proc how to work.
774 #   `no-link'     don't try to link the program
775 #   `no-exec'     don't try to run the test
776 #   `xfail-gcj'   compilation from source will fail
777 #   `xfail-javac' compilation with javac will fail
778 #   `xfail-gcjC'  compilation with gcj -C will fail
779 #   `shouldfail'  compilation from source is supposed to fail
780 #                 This is different from xfail, which marks a known
781 #                 failure that we just havne't fixed.
782 #                 A compilation marked this way should fail with any
783 #                 front end.
784 #   `xfail-byte'  compilation from bytecode will fail
785 #   `xfail-exec'  exec will fail
786 #   `xfail-output'
787 #                 output will be wrong
788 #   `xfail-byte-output'
789 #                 output will be wrong when compiled from bytecode
790 #   `xfail-source-output'
791 #                 output will be wrong when compiled from source code
792 #   `need-threads'
793 #                 test relies on thread support
794 #
795 proc test_libjava { options srcfile compile_args inpfile resultfile exec_args } {
796     test_libjava_from_source $options $srcfile $compile_args $inpfile $resultfile $exec_args
797     test_libjava_from_javac $options $srcfile $compile_args $inpfile $resultfile $exec_args
798  }
799
800 #
801 # libjava_version -- extract and print the version number of libjavap
802 #
803 proc default_libjava_version {} {
804 }
805
806 proc default_libjava_start { } {
807 }
808
809 # On IRIX 6, we have to set variables akin to LD_LIBRARY_PATH, but
810 # called LD_LIBRARYN32_PATH (for the N32 ABI) and LD_LIBRARY64_PATH
811 # (for the 64-bit ABI).  The right way to do this would be to modify
812 # unix.exp -- but that's not an option since it's part of DejaGNU
813 # proper, so we do it here, by trickery.  We really only need to do 
814 # this on IRIX, but it shouldn't hurt to do it anywhere else.
815
816 proc ${tool}_set_ld_library_path { name element op } {
817   setenv LD_LIBRARYN32_PATH [getenv LD_LIBRARY_PATH]
818   setenv LD_LIBRARY64_PATH [getenv LD_LIBRARY_PATH]
819 }
820
821 trace variable env(LD_LIBRARY_PATH) w ${tool}_set_ld_library_path
822
823 # Local Variables:
824 # tcl-indent-level:4
825 # End: