+2007-08-28 Mark Shinwell <shinwell@codesourcery.com>
+ Joseph Myers <joseph@codesourcery.com>
+
+ * elf32-arm.c (elf32_arm_compare_mapping): Compare first on vma,
+ then on type.
+
2007-08-28 Robert Sebastian Gerus <arachnist@gmail.com>
* config.bfd: Add support for i[3-7]86-*-dragonfly*.
static int
elf32_arm_compare_mapping (const void * a, const void * b)
{
- return ((const elf32_arm_section_map *) a)->vma
- > ((const elf32_arm_section_map *) b)->vma;
+ const elf32_arm_section_map *amap = (const elf32_arm_section_map *) a;
+ const elf32_arm_section_map *bmap = (const elf32_arm_section_map *) b;
+
+ if (amap->vma > bmap->vma)
+ return 1;
+ else if (amap->vma < bmap->vma)
+ return -1;
+ else if (amap->type > bmap->type)
+ /* Ensure results do not depend on the host qsort for objects with
+ multiple mapping symbols at the same address by sorting on type
+ after vma. */
+ return 1;
+ else if (amap->type < bmap->type)
+ return -1;
+ else
+ return 0;
}
+2007-08-28 Mark Shinwell <shinwell@codesourcery.com>
+ Joseph Myers <joseph@codesourcery.com>
+
+ * binutils-all/ar.exp (long_filenames): Delete temporary files on
+ the host.
+ * binutils-all/arm/objdump.exp: Only check "which $OBJDUMP" if
+ host is local.
+ * binutils-all/objcopy.exp: Use ${srecfile} to get the name of the
+ srec file to be passed to binutils_run.
+ (objcopy_test_readelf): Use remote_exec.
+ * binutils-all/readelf.exp (readelf_find_size): Use remote_exec.
+ (readelf_test): Likewise.
+ (readelf_wi_test): Likewise.
+ * lib/utils-lib.exp (run_dump_test): Only check "which $binary" if
+ host is local. Use remote_exec. Use $tempfile not
+ tmpdir/bintest.o.
+
2007-08-09 Alan Modra <amodra@bigpond.net.au>
* binutils-all/copy-2.d (not-target): Match *-*-*aout.
set file2 tmpdir/$n2
remote_file build delete $file1
+ remote_file host delete $n1
# Some file systems truncate file names at 14 characters, which
# makes it impossible to run this test. Check for that now.
puts $f "first"
close $f
-
remote_file build delete $file2
+ remote_file host delete $n2
set status [catch "set f [open tmpdir/$n2 w]" errs]
if { $status != 0 } {
return
}
-if {[which $OBJDUMP] == 0} then {
+if {![is_remote host] && [which $OBJDUMP] == 0} then {
perror "$OBJDUMP does not exist"
return
}
verbose $line
fail "objcopy -O srec"
} else {
- set got [binutils_run $OBJDUMP "$OBJDUMPFLAGS -f ${copyfile}.srec"]
+ set got [binutils_run $OBJDUMP "$OBJDUMPFLAGS -f ${srecfile}"]
if ![regexp "file format srec" $got] then {
send_log "objdump failed\n"
fail "objcopy -O srec"
}
verbose -log "$OBJCOPY $OBJCOPYFLAGS tmpdir/bintest.o tmpdir/copy.o"
- catch "exec $OBJCOPY $OBJCOPYFLAGS tmpdir/bintest.o tmpdir/copy.o" exec_output
- if ![string match "" $exec_output] then {
+ set exec_output [remote_exec host "$OBJCOPY $OBJCOPYFLAGS tmpdir/bintest.o tmpdir/copy.o"]
+ if { [lindex $exec_output 0] != 0
+ || ![string match "" [lindex $exec_output 1]] } then {
fail "objcopy ($testname)"
return
}
verbose -log "$READELF -a tmpdir/bintest.o > tmpdir/bintest.o.out"
- catch "exec $READELF -a tmpdir/bintest.o > tmpdir/bintest.o.out" exec_output
- set exec_output [prune_warnings $exec_output]
+ set exec_output [remote_exec host "$READELF -a tmpdir/bintest.o" "" "/dev/null" "tmpdir/bintest.o.out"]
+ if { [lindex $exec_output 0] != 0 } then {
+ unresolved "objcopy ($testname)"
+ return
+ }
+ set exec_output [prune_warnings [lindex $exec_output 1]]
if ![string match "" $exec_output] then {
unresolved "objcopy ($testname)"
return
}
verbose -log "$READELF -a tmpdir/copy.o > tmpdir/copy.o.out"
- catch "exec $READELF -a tmpdir/copy.o > tmpdir/copy.o.out" exec_output
- set exec_output [prune_warnings $exec_output]
+ set exec_output [remote_exec host "$READELF -a tmpdir/copy.o" "" "/dev/null" "tmpdir/copy.o.out"]
+ if { [lindex $exec_output 0] != 0 } then {
+ unresolved "objcopy ($testname)"
+ return
+ }
+ set exec_output [prune_warnings [lindex $exec_output 1]]
if ![string match "" $exec_output] then {
unresolved "objcopy ($testname)"
return
set readelf_size ""
set testname "finding out ELF size with readelf -h"
- catch "exec $READELF $READELFFLAGS -h $binary_file > readelf.out" got
+ set got [remote_exec host "$READELF $READELFFLAGS -h $binary_file" "" "/dev/null" "readelf.out"]
+ if [is_remote host] then {
+ remote_upload host "readelf.out"
+ }
- if ![string match "" $got] then {
+ if { [lindex $got 0] != 0 || ![string match "" [lindex $got 1]]} then {
send_log $got
fail $testname
return
global subdir
send_log "exec $READELF $READELFFLAGS $options $binary_file > readelf.out\n"
- catch "exec $READELF $READELFFLAGS $options $binary_file > readelf.out" got
+ set got [remote_exec host "$READELF $READELFFLAGS $options $binary_file" "" "/dev/null" "readelf.out"]
foreach xfail $xfails {
setup_xfail $xfail
}
- if ![string match "" $got] then {
+ if { [lindex $got 0] != 0 || ![string match "" [lindex $got 1]] } then {
fail "readelf $options (reason: unexpected output)"
send_log $got
send_log "\n"
set tempfile [remote_download host tmpdir/testprog.o]
# Run "readelf -wi" on it.
- send_log "exec $READELF $READELFFLAGS -wi $tempfile > readelf.out\n"
- catch "exec $READELF $READELFFLAGS -wi $tempfile > readelf.out" got
+ set got [remote_exec host "$READELF $READELFFLAGS -wi $tempfile" "" "/dev/null" "readelf.out"]
# Upload the results.
set output [remote_upload host readelf.out]
file_on_host delete $tempfile
# Strip any superflous warnings.
- set got [prune_readelf_wi_warnings $got]
+ set got [prune_readelf_wi_warnings [lindex $got 1]]
if ![string match "" $got] then {
fail "readelf $READELFFLAGS -wi (reason: unexpected output)"
set srcfile $srcdir/$subdir/$opts(source)
}
- set exec_output [binutils_assemble ${srcfile} tmpdir/bintest.o]
+ set exec_output [binutils_assemble ${srcfile} $tempfile]
if [string match "" $exec_output] then {
send_log "$exec_output\n"
verbose "$exec_output"
eval set progopts \$[string toupper $dumpprogram]FLAGS
eval set binary \$[string toupper $dumpprogram]
- if { [which $binary] == 0 } {
+ if { ![is_remote host] && [which $binary] == 0 } {
untested $testname
return
}
verbose "running $binary $progopts $progopts1" 3
- set cmd "$binary $progopts $progopts1 ${copyfile}.o > tmpdir/dump.out"
+ set cmd "$binary $progopts $progopts1 ${copyfile}.o"
# Ensure consistent sorting of symbols
if {[info exists env(LC_ALL)]} {
}
set env(LC_ALL) "C"
send_log "$cmd\n"
- catch "exec $cmd" comp_output
+ set comp_output [remote_exec host $cmd "" "/dev/null" "tmpdir/dump.out"]
if {[info exists old_lc_all]} {
set env(LC_ALL) $old_lc_all
} else {
unset env(LC_ALL)
}
- set comp_output [prune_warnings $comp_output]
+ if { [lindex $comp_output 0] != 0 } then {
+ send_log "$comp_output\n"
+ fail $testname
+ return
+ }
+ set comp_output [prune_warnings [lindex $comp_output 1]]
if ![string match "" $comp_output] then {
send_log "$comp_output\n"
fail $testname
+2007-08-28 Mark Shinwell <shinwell@codesourcery.com>
+ Joseph Myers <joseph@codesourcery.com>
+
+ * as.c (main): Flush stderr before printing listings to ensure
+ consistent output order across platforms.
+
2007-08-28 Robert Sebastian Gerus <arachnist@gmail.com>
* configure.tgt: Add support for i[3-7]86-*-dragonfly*.
if (keep_it)
write_object_file ();
+ fflush (stderr);
+
#ifndef NO_LISTING
listing_print (listing_filename);
#endif
+2007-08-28 Mark Shinwell <shinwell@codesourcery.com>
+ Joseph Myers <joseph@codesourcery.com>
+
+ * lib/gas-defs.exp (gas_version): Use remote_* functions instead
+ of exec.
+ (gas_host_run): New.
+ (gas_run): Use gas_host_run.
+ (gas_start): Likewise.
+ (run_dump_test): Likewise.
+ (objdump): Use gas_host_run.
+ (objdump_start_no_subdir): Likewise.
+ * lib/gas-dg.exp (gas-dg-test): Use "remote_file host delete".
+ * lib/run: Remove.
+ * gas/macros/macros.exp: Download app4b.s to host.
+ * gas/i386/i386.exp (gas_64_check): Use gas_host_run.
+ (gas_32_check): Likewise.
+ * gas/maxq10/maxq10.exp (gas_64_check): Likewise
+ (gas_32_check): Likewise.
+ * gas/maxq20/maxq20.exp (gas_64_check): Likewise
+ (gas_32_check): Likewise.
+ * gas/sparc/sparc.exp (gas_64_check): Likewise.
+ * gas/cfi/cfi.exp: Likewise.
+ * gas/elf/elf.exp (run_list_test): Likewise. Use temporary file
+ for readelf output in place of pipe.
+ * gas/all/gas.exp: Download incbin.dat to host.
+ (do_comment): Allow \r\r\n.
+
2007-08-09 Paul Brook <paul@codesourcery.com>
* gas/arm/relax_load_align.d: new test.
expect {
-re "^ +1\[ \t\]+# This\[^\n\]*\n" { set x1 1 }
-re "^ +2\[ \t\]+# correctly\[^\n\]*\n" { set x2 1 }
- -re "^ +3\[ \t\]+/. C comments too. ./\r?\n" { set x3 1 }
+ -re "^ +3\[ \t\]+/. C comments too. ./\r?\r?\n" { set x3 1 }
-re "\[^\n\]*\n" { }
timeout { perror "timeout\n"; break }
eof { break }
{ *c54x*-*-* } { }
default {
test_cond
+ remote_download host "$srcdir/$subdir/incbin.dat"
run_dump_test incbin
}
}
} elseif { [istarget sparc*-*-*] } then {
global NM
global NMFLAGS
- global srcdir
- catch "exec $srcdir/lib/run $NM $NMFLAGS --help" nm_help
+ set nm_status [gas_host_run "$NM $NMFLAGS --help" ""]
run_dump_test "cfi-sparc-1"
- if { [regexp "elf64\[_-\]sparc" $nm_help] } then {
+ if { [regexp "elf64\[_-\]sparc" [lindex $nm_status 1]] } then {
run_dump_test "cfi-sparc64-1"
}
return
}
send_log "$READELF $readelf_opts dump.o $readelf_pipe > dump.out\n"
- catch "exec $READELF $readelf_opts dump.o $readelf_pipe > dump.out\n" comp_output
+ set status [gas_host_run "$READELF $readelf_opts dump.o" ">readelf.out"]
+ if { [lindex $status 0] != 0 || ![string match "" [lindex $status 1]] } then {
+ send_log "[lindex $status 1]\n"
+ fail $testname
+ return
+ }
+ catch "exec cat readelf.out $readelf_pipe > dump.out\n" comp_output
if ![string match "" $comp_output] then {
send_log "$comp_output\n"
fail $testname
proc gas_64_check { } {
global NM
global NMFLAGS
- global srcdir
- catch "exec $srcdir/lib/run $NM $NMFLAGS --help" nm_help
- return [regexp "targets:.*x86-64" $nm_help]
+ set status [gas_host_run "$NM $NMFLAGS --help" ""]
+ return [regexp "targets:.*x86-64" [lindex $status 1]];
}
proc gas_32_check { } {
global NM
global NMFLAGS
- global srcdir
- catch "exec $srcdir/lib/run $NM $NMFLAGS --help" nm_help
- return [regexp "targets:.*i386" $nm_help]
+ set status [gas_host_run "$NM $NMFLAGS --help" ""]
+ return [regexp "targets:.*i386" [lindex $status 1]];
}
if [expr ([istarget "i*86-*-*"] || [istarget "x86_64-*-*"]) && [gas_32_check]] then {
run_dump_test app1
run_dump_test app2
run_dump_test app3
+remote_download host "$srcdir/$subdir/app4b.s"
run_dump_test app4
run_list_test badarg ""
proc gas_64_check { } {
global NM
global NMFLAGS
- global srcdir
- catch "exec $srcdir/lib/run $NM $NMFLAGS --help" nm_help
- return [regexp "targets:.*maxq" $nm_help]
+ set status [gas_host_run "$NM $NMFLAGS --help" ""]
+ return [regexp "targets:.*maxq" [lindex $status 1]]
}
proc gas_32_check { } {
global NMFLAGS
global srcdir
- catch "exec $srcdir/lib/run $NM $NMFLAGS --help" nm_help
- return [regexp "targets:.*maxq" $nm_help]
+ set status [gas_host_run "$NM $NMFLAGS --help" ""]
+ return [regexp "targets:.*maxq" [lindex $status 1]]
}
if [expr ([istarget "maxq-*-*"] || [istarget "maxq-coff-*"]) && [gas_32_check]] then {
global NMFLAGS
global srcdir
- catch "exec $srcdir/lib/run $NM $NMFLAGS --help" nm_help
- return [regexp "targets:.*maxq" $nm_help]
+ set status [gas_host_run "$NM $NMFLAGS --help" ""]
+ return [regexp "targets:.*maxq" [lindex $status 1]]
}
proc gas_32_check { } {
global NMFLAGS
global srcdir
- catch "exec $srcdir/lib/run $NM $NMFLAGS --help" nm_help
- return [regexp "targets:.*maxq" $nm_help]
+ set status [gas_host_run "$NM $NMFLAGS --help" ""]
+ return [regexp "targets:.*maxq" [lindex $status 1]]
}
proc gas_64_check { } {
global NM
global NMFLAGS
- global srcdir
- catch "exec $srcdir/lib/run $NM $NMFLAGS --help" nm_help
- return [regexp "elf64\[_-\]sparc" $nm_help]
+ set status [gas_host_run "$NM $NMFLAGS --help" ""]
+ return [regexp "elf64\[_-\]sparc" [lindex $status 1]]
}
proc sparc_elf_setup { } {
proc gas_version {} {
global AS
- catch "exec $AS -version < /dev/null" tmp
+ if [is_remote host] then {
+ remote_exec host "$AS -version < /dev/null" "" "" "gas.version"
+ remote_exec host "which $AS" "" "" "gas.which"
+
+ remote_upload host "gas.version"
+ remote_upload host "gas.which"
+
+ set which_as [file_contents "gas.which"]
+ set tmp [file_contents "gas.version"]
+
+ remote_file build delete "gas.version"
+ remote_file build delete "gas.which"
+ remote_file host delete "gas.version"
+ remote_file host delete "gas.which"
+ } else {
+ set which_as [which $AS]
+ catch "exec $AS -version < /dev/null" tmp
+ }
+
# Should find a way to discard constant parts, keep whatever's
# left, so the version string could be almost anything at all...
regexp "\[^\n\]* (cygnus-|)(\[-0-9.a-zA-Z-\]+)\[\r\n\].*" $tmp version cyg number
if ![info exists number] then {
- return "[which $AS] (no version number)\n"
+ return "$which_as (no version number)\n"
}
- clone_output "[which $AS] $number\n"
+ clone_output "$which_as $number\n"
unset version
}
+proc gas_host_run { cmd redir } {
+ verbose "Executing $cmd $redir"
+ set return_contents_of ""
+ if [regexp ">& */dev/null" $redir] then {
+ set output_file ""
+ set command "$cmd $redir"
+ } elseif [regexp "> */dev/null" $redir] then {
+ set output_file ""
+ set command "$cmd 2>gas.stderr"
+ set return_contents_of "gas.stderr"
+ } elseif [regexp ">&.*" $redir] then {
+ set output_file [regsub ">&" $redir ""]
+ set command "$cmd 2>&1"
+ } elseif [regexp "2>.*" $redir] then {
+ set output_file "gas.out"
+ set command "$cmd $redir"
+ set return_contents_of "gas.out"
+ } elseif [regexp ">.*" $redir] then {
+ set output_file ""
+ set command "$cmd $redir 2>gas.stderr"
+ set return_contents_of "gas.stderr"
+ } elseif { "$redir" == "" } then {
+ set output_file "gas.out"
+ set command "$cmd 2>&1"
+ set return_contents_of "gas.out"
+ } else {
+ fail "gas_host_run: unknown form of redirection string"
+ }
+
+ set status [remote_exec host [concat sh -c [list $command]] "" "/dev/null" "$output_file"]
+ set to_return ""
+ if { "$return_contents_of" != "" } then {
+ remote_upload host "$return_contents_of"
+ set to_return [file_contents "$return_contents_of"]
+ regsub "\n$" $to_return "" to_return
+ }
+
+ if { [lindex $status 0] == 0 && "$output_file" != ""
+ && "$output_file" != "$return_contents_of" } then {
+ remote_upload host "$output_file"
+ }
+
+ return [list [lindex $status 0] "$to_return"]
+}
+
proc gas_run { prog as_opts redir } {
global AS
global ASFLAGS
global subdir
global host_triplet
- verbose -log "Executing $srcdir/lib/run $AS $ASFLAGS $as_opts $srcdir/$subdir/$prog $redir"
- catch "exec $srcdir/lib/run $AS $ASFLAGS $as_opts $srcdir/$subdir/$prog $redir" comp_output
+ set status [gas_host_run "$AS $ASFLAGS $as_opts $srcdir/$subdir/$prog" "$redir"]
+ set comp_output [lindex $status 1]
+ if { [lindex $status 0] != 0 && [regexp "2>.*" $redir] } then {
+ append comp_output "child process exited abnormally"
+ }
set comp_output [prune_warnings $comp_output]
verbose "output was $comp_output"
return [list $comp_output ""]
set gas_started 1
verbose -log "Starting $AS $ASFLAGS $as_opts $prog" 2
- catch {
- spawn -noecho -nottycopy $srcdir/lib/run $AS $ASFLAGS $as_opts $srcdir/$subdir/$prog
- } foo
- if ![regexp {^[0-9]+} $foo] then {
- perror "Can't run $subdir/$prog: $foo"
- }
+ set status [gas_host_run "$AS $ASFLAGS $as_opts $srcdir/$subdir/$prog" ">&gas.out"]
+ spawn -noecho -nottycopy cat gas.out
}
proc gas_finish { } {
unresolved $subdir/$name
return
}
+ if { $opt_name == "as" } {
+ set opt_val [subst $opt_val]
+ }
set opts($opt_name) $opt_val
}
set sourcefile $srcdir/$subdir/$opts(source)
}
- set cmd "$srcdir/lib/run $AS $ASFLAGS $opts(as) -o dump.o $sourcefile"
+ set cmd "$AS $ASFLAGS $opts(as) -o dump.o $sourcefile"
send_log "$cmd\n"
- set cmdret [catch "exec $cmd" comp_output]
- set comp_output [prune_warnings $comp_output]
+ set status [gas_host_run $cmd ""]
+ set cmdret [lindex $status 0]
+ set comp_output [prune_warnings [lindex $status 1]]
set expmsg $opts(error)
if { $opts(warning) != "" } {
eval set progopts \$[string toupper $program]FLAGS
eval set binary \$[string toupper $program]
- if { [which $binary] == 0 } {
+ if { ![is_remote host] && [which $binary] == 0 } {
untested $testname
return
}
# Objcopy, unlike the other two, won't send its output to stdout,
# so we have to run it specially.
- set cmd "$binary $progopts $progopts1 dump.o > dump.out"
+ set cmd "$binary $progopts $progopts1 dump.o"
+ set redir ">dump.out"
if { $program == "objcopy" } {
set cmd "$binary $progopts $progopts1 dump.o dump.out"
+ set redir ""
}
# Ensure consistent sorting of symbols
}
set env(LC_ALL) "C"
send_log "$cmd\n"
- catch "exec $cmd" comp_output
+ set status [gas_host_run "$cmd" "$redir"]
+ set comp_output [prune_warnings [lindex $status 1]]
if {[info exists old_lc_all]} {
set env(LC_ALL) $old_lc_all
} else {
global comp_output
global host_triplet
- catch "exec $OBJDUMP $opts" comp_output
- set comp_output [prune_warnings $comp_output]
+ set status [gas_host_run "$OBJDUMP $opts" ""]
+ set comp_output [prune_warnings [lindex $status 1]]
verbose "objdump output=$comp_output\n" 3
}
global spawn_id
verbose "Starting $OBJDUMP $opts $prog" 2
- catch {
- spawn -noecho -nottyinit $srcdir/lib/run $OBJDUMP $opts $prog
- } foo
- if ![regexp {^[0-9]+} $foo] then {
- perror "Can't run $prog: $foo"
- }
+ set status [gas_host_run "$OBJDUMP $opts $prog" ">&gas.out"]
+ spawn -noecho -nottycopy cat gas.out
}
proc objdump_finish { } {
"run" {
# This is the only place where we care if an executable was
# created or not. If it was, dg.exp will try to run it.
- catch "exec rm -f $output_file"
+ remote_file host delete "$output_file"
}
default {
perror "$do_what: not a valid dg-do keyword"
+++ /dev/null
-#!/bin/sh
-eval exec $@
+2007-08-28 Mark Shinwell <shinwell@codesourcery.com>
+ Joseph Myers <joseph@codesourcery.com>
+
+ * ldlang.c (sort_sections_by_lma): Sort by internal id after lma
+ for stable sort.
+
2007-08-28 Robert Sebastian Gerus <arachnist@gmail.com>
* configure.host: Add support for i[3-7]86-*-dragonfly*.
else if (bfd_section_lma (sec1->owner, sec1)
> bfd_section_lma (sec2->owner, sec2))
return 1;
+ else if (sec1->id < sec2->id)
+ return -1;
+ else if (sec1->id > sec2->id)
+ return 1;
return 0;
}
+2007-08-28 Mark Shinwell <shinwell@codesourcery.com>
+ Joseph Myers <joseph@codesourcery.com>
+
+ * ld-elfcomm/elfcomm.exp: Use run_host_cmd. Only check "which
+ $CC" if host is local.
+ * ld-checks/checks.exp: Use run_host_cmd.
+ * ld-elf/exclude.exp: Likewise.
+ * ld-elf/elf.exp: Download merge.ld if host is remote.
+ * ld-elf/binutils.exp (binutils_test): Use remote_exec.
+ * ld-elf/tls_common.exp: Use run_host_cmd.
+ * lib/ld-lib.exp (ld_version): Only check "which $ld" if host is
+ local. Use remote_exec.
+ (run_host_cmd): New.
+ (run_host_cmd_yesno): New.
+ (default_ld_relocate): Use run_host_cmd_yesno.
+ (default_ld_link): Likewise.
+ (default_ld_simple_link): Use run_host_cmd.
+ (default_ld_compile): Only check "which $ccprog" if host is local.
+ Use remote_file and remote_exec.
+ (default_ld_assemble): Only check "which $as" if host is local.
+ Use run_host_cmd.
+ (default_ld_nm): Use remote_exec, remote_upload and remote_file.
+ (run_dump_test): Use remote_exec, remote_upload and remote_file.
+ Only check "which $binary" if host is local.
+ (run_ld_link_tests): Use remote_exec, remote_upload and
+ remote_file.
+ * ld-selective/selective.exp: Only check "which $CXX" if host is
+ local. Use remote_exec.
+ * ld-scripts/phdrs.exp: Only check "which $objdump" if host is
+ local. Use run_host_cmd.
+ * ld-scripts/phdrs2.exp: Likewise.
+ * ld-scripts/weak.exp: Likewise.
+ * ld-undefined/weak-undef.exp: Likewise.
+ * ld-scripts/crossref.exp: Only check "which $CC" if host is local.
+ Use run_host_cmd.
+ * ld-scripts/map-address.exp: Upload map_address.map if host is
+ remote.
+ * ld-srec/srec.exp (run_srec_tests): Use run_host_cmd. Only check
+ "which $CC" and "which $CXX" if host is local.
+ * ld-undefined/undefined.exp: Only check "which $CC" if host is
+ local. Use remote_file and run_host_cmd.
+ * config/default.exp: Use remote_exec to create tmpdir.
+
2007-08-24 H.J. Lu <hongjiu.lu@intel.com>
* ld-i386/i386.exp (i386tests): Add a test for TLS IE->LE
set strip [findfile $base_dir/../binutils/strip-new $base_dir/../binutils/strip-new [transform strip]]
}
-if {![file isdirectory tmpdir]} then {
- catch "exec mkdir tmpdir" status
-}
+remote_exec host "mkdir -p tmpdir"
# Make a symlink from tmpdir/as to the assembler in the build tree, so
# that we can use a -B option to gcc to force it to use the newly
# Perform the equivalent of invoking ld_simple_link
# except that we need to massage the output futher.
- verbose -log "$ld -o tmpdir/asm.x $ldflags tmpdir/asm.o"
- catch "exec $ld -o tmpdir/asm.x $ldflags tmpdir/asm.o" exec_output
+ set exec_output [run_host_cmd "$ld" "-o tmpdir/asm.x $ldflags tmpdir/asm.o"]
set exec_output [prune_warnings $exec_output]
# Make sure that we got some output from the linker
}
send_log "$READELF -l --wide tmpdir/$test > tmpdir/$test.exp\n"
- catch "exec $READELF -l --wide tmpdir/$test > tmpdir/$test.exp" got
- if ![string match "" $got] then {
+ set got [remote_exec host "$READELF -l --wide tmpdir/$test" "" "/dev/null" "tmpdir/$test.exp"]
+ if { [lindex $got 0] != 0 || ![string match "" [lindex $got 1]] } then {
send_log "$got\n"
unresolved "$test_name"
return
}
send_log "$prog tmpdir/$test\n"
- catch "exec $prog tmpdir/$test" got
- if ![string match "" $got] then {
+ set got [remote_exec host "$prog tmpdir/$test"]
+ if { [lindex $got 0] != 0 || ![string match "" [lindex $got 1]] } then {
send_log "$got\n"
fail "$test_name"
return
}
send_log "$READELF -l --wide tmpdir/$test > tmpdir/$test.out\n"
- catch "exec $READELF -l --wide tmpdir/$test > tmpdir/$test.out" got
- if ![string match "" $got] then {
+ set got [remote_exec host "$READELF -l --wide tmpdir/$test" "" "/dev/null" "tmpdir/$test.out"]
+ if { [lindex $got 0] != 0 || ![string match "" [lindex $got 1]] } then {
send_log "$got\n"
unresolved "$test_name"
return
set LDFLAGS "$LDFLAGS --local-store 0:0"
}
+if { [is_remote host] } then {
+ remote_download host merge.ld
+}
+
set test_list [lsort [glob -nocomplain $srcdir/$subdir/*.d]]
foreach t $test_list {
# We need to strip the ".d", but can leave the dirname.
return
}
-catch "exec rm -f tmpdir/libexclude.a" catch_output
-catch "exec $ar cq tmpdir/libexclude.a tmpdir/exclude2.o" catch_output
+remote_file host delete "tmpdir/libexclude.a"
+set catch_output [run_host_cmd "$ar" "cq tmpdir/libexclude.a tmpdir/exclude2.o"]
if {![string match "" $catch_output]} {
unresolved $test1
return
return
}
-send_log "$READELF -l --wide tmpdir/tls_common\n"
-catch "exec $READELF -l --wide tmpdir/tls_common" readelf_output
+set readelf_output [run_host_cmd "$READELF" "-l --wide tmpdir/tls_common"]
if ![regexp ".*TLS.*0x0+ 0x0+4 R .*" $readelf_output] then {
send_log "$readelf_output\n"
fail "tls_common"
set test1c1 "$test1 (change 1)"
set test1c2 "$test1 (change 2)"
-if { [which $CC] == 0 } {
+if { ![is_remote host] && [which $CC] == 0 } {
untested $test1w1
untested $test1w2
untested $test1c1
global READELF
send_log "$READELF -s tmpdir/common1.o | grep foo\n"
- catch "exec $READELF -s tmpdir/common1.o | grep foo" exec_output
+ set exec_output [run_host_cmd "readelf" "-s tmpdir/common1.o | grep foo"]
+
if { ![regexp "(\[ \]*)(\[0-9\]+):(\[ \]*)(\[0\]*)80(\[ \]+)4(\[ \]+)OBJECT(\[ \]+)GLOBAL(\[ \]+)DEFAULT(\[ \]+)(PRC\\\[0xff03\\\]|COM|SCOM)(\[ \]+)_?foo2" $exec_output]
|| ![regexp "(\[ \]*)(\[0-9\]+):(\[ \]*)(\[0-9\]+)(\[ \]+)21(\[ \]+)OBJECT(\[ \]+)GLOBAL(\[ \]+)DEFAULT(\[ \]+)(\[0-9\]+)(\[ \]+)_?foo1" $exec_output] } {
send_log "$exec_output\n"
set test2 "NOCROSSREFS 2"
set test3 "NOCROSSREFS 3"
-if { [which $CC] == 0 } {
+if { ![is_remote host] && [which $CC] == 0 } {
untested $test1
untested $test2
untested $test3
# IA64 has both ordered and unordered sections in an input file.
setup_xfail ia64-*-*
-verbose -log "$ld $flags -o tmpdir/cross1 -T $srcdir/$subdir/cross1.t tmpdir/cross1.o tmpdir/cross2.o"
-
-catch "exec $ld $flags -o tmpdir/cross1 -T $srcdir/$subdir/cross1.t tmpdir/cross1.o tmpdir/cross2.o" exec_output
+set exec_output [run_host_cmd "$ld" "$flags -o tmpdir/cross1 -T $srcdir/$subdir/cross1.t tmpdir/cross1.o tmpdir/cross2.o"]
set exec_output [prune_warnings $exec_output]
return
}
-verbose -log "$ld $flags -o tmpdir/cross2 -T $srcdir/$subdir/cross2.t tmpdir/cross3.o"
-
-catch "exec $ld $flags -o tmpdir/cross2 -T $srcdir/$subdir/cross2.t tmpdir/cross3.o" exec_output
-
+set exec_output [run_host_cmd "$ld" "$flags -o tmpdir/cross2 -T $srcdir/$subdir/cross2.t tmpdir/cross3.o"]
set exec_output [prune_warnings $exec_output]
regsub -all "(^|\n)($ld: warning: cannot find entry symbol\[^\n\]*\n?)" $exec_output "\\1" exec_output
return
}
-verbose -log "$ld $flags -o tmpdir/cross3 -T $srcdir/$subdir/cross3.t tmpdir/cross3-partial.o tmpdir/cross2.o"
-
-catch "exec $ld $flags -o tmpdir/cross3 -T $srcdir/$subdir/cross3.t tmpdir/cross3-partial.o tmpdir/cross2.o" exec_output
+set exec_output [run_host_cmd "$ld" "$flags -o tmpdir/cross3 -T $srcdir/$subdir/cross3.t tmpdir/cross3-partial.o tmpdir/cross2.o"]
set exec_output [prune_warnings $exec_output]
tmpdir/map-address.o \
-Map tmpdir/map-address.map"]} {
fail $testname
-} elseif {[regexp_diff \
+ return
+}
+
+if [is_remote host] then {
+ remote_upload host "tmpdir/map_address.map"
+}
+
+if {[regexp_diff \
"tmpdir/map-address.map" \
"$srcdir/$subdir/map-address.d"]} {
fail $testname
if ![ld_simple_link $ld tmpdir/phdrs $ldopt] {
fail $testname
} else {
- if {[which $objdump] == 0} {
+ if {![is_remote host] && [which $objdump] == 0} {
unresolved $testname
return
}
-
- verbose -log "$objdump --private tmpdir/phdrs"
- catch "exec $objdump --private tmpdir/phdrs" exec_output
+ set exec_output [run_host_cmd "$objdump" "--private tmpdir/phdrs"]
set exec_output [prune_warnings $exec_output]
verbose -log $exec_output
if ![ld_simple_link $ld tmpdir/phdrs2 $ldopt] {
fail $testname
} else {
- if {[which $objdump] == 0} {
+ if {![is_remote host] && [which $objdump] == 0} {
unresolved $testname
return
}
- verbose -log "$objdump --private tmpdir/phdrs2"
- catch "exec $objdump --private tmpdir/phdrs2" exec_output
+ set exec_output [run_host_cmd "$objdump" "--private tmpdir/phdrs2"]
set exec_output [prune_warnings $exec_output]
verbose -log $exec_output
if {! [ld_simple_link $ld tmpdir/weak "$flags -T $srcdir/$subdir/weak.t tmpdir/weak1.o tmpdir/weak2.o"] } then {
fail $testname
} else {
- if {[which $objdump] == 0} then {
+ if {![is_remote host] && [which $objdump] == 0} then {
unresolved $testname
set LDFLAGS "$saved_LDFLAGS"
return
}
- verbose -log "$objdump -s tmpdir/weak"
- catch "exec $objdump -s tmpdir/weak" exec_output
+ set exec_output [run_host_cmd "$objdump" "-s tmpdir/weak"]
set exec_output [prune_warnings $exec_output]
verbose -log $exec_output
}
# If we don't have g++ for the target, mark all tests as untested.
-if { [which $CXX] == 0 } {
+if { ![is_remote host] && [which $CXX] == 0 } {
foreach testitem $seltests {
untested "[lindex $testitem 0]"
}
if [string match "*gcc*" [lindex $CC 0]] {
# Starting with 3.4.0, -fvtable-gc is no longer supported and thus
# the functionality we try to test for cannot be expected to work.
- catch "exec -- $CC -dumpversion" version
+ set version [remote_exec host "$CC -dumpversion"]
+ set version [lindex $version 1]
if [regexp "^(\[1-9\]\[0-9\]+|\[4-9\]|3.(\[1-9\]\[0-9\]+|\[4-9\]))\\." $version] {
setup_xfail {*-*-*}
}
# V850 targets need libgcc.a
if [istarget v850*-*-elf] {
- catch "exec $CC -print-libgcc-file-name" libgcc
+ set libgcc [remote_exec host "$CC -print-libgcc-file-name"]
+ set libgcc [lindex $libgcc 1]
+ regsub -all "\[\r\n\]" $libgcc "" libgcc
set objfile "$objfile $libgcc"
}
# ARM targets need libgcc.a in THUMB mode so that __call_via_r3 is provided
if {[istarget arm-*-*] || [istarget xscale-*-*]} {
- catch "exec $CC -print-libgcc-file-name" libgcc
+ set libgcc [remote_exec host "$CC -print-libgcc-file-name"]
+ set libgcc [lindex $libgcc 1]
+ regsub -all "\[\r\n\]" $libgcc "" libgcc
set objfile "$objfile $libgcc"
}
# HPPA linux targets need libgcc.a for millicode routines ($$dyncall).
if [istarget hppa*-*-linux*] {
- catch "exec $CC -print-libgcc-file-name" libgcc
+ set libgcc [remote_exec host "$CC -print-libgcc-file-name"]
+ set libgcc [lindex $libgcc 1]
+ regsub -all "\[\r\n\]" $libgcc "" libgcc
set objfile "$objfile $libgcc"
}
}
send_log "$objcopy -O srec tmpdir/sr1 tmpdir/sr1.sr\n"
- verbose "$objcopy -O srec tmpdir/sr1 tmpdir/sr1.sr"
- catch "exec $objcopy -O srec tmpdir/sr1 tmpdir/sr1.sr" exec_output
+ set exec_output [run_host_cmd "$objcopy" "-O srec tmpdir/sr1 tmpdir/sr1.sr"]
set exec_output [prune_warnings $exec_output]
if ![string match "" $exec_output] {
send_log "$exec_output\n"
set test2 "S-records with constructors"
# See whether the default linker script uses SIZEOF_HEADERS.
-catch "exec $ld --verbose" exec_output
+set exec_output [run_host_cmd "$ld" "--verbose"]
set sizeof_headers [string match "*SIZEOF_HEADERS*" $exec_output]
# First test linking a C program. We don't require any libraries. We
# directly to the S-record format, and require that the two files
# contain the same data.
-if { [which $CC] == 0 } {
+if { ![is_remote host] && [which $CC] == 0 } {
untested $test1
untested $test2
return
# destructors. Note that since we are not linking against any
# libraries, this program won't actually work or anything.
-if { [which $CXX] == 0 } {
+if { ![is_remote host] && [which $CXX] == 0 } {
untested $test2
return
}
set testfn "undefined function"
set testline "undefined line"
-if { [which $CC] == 0 } {
+if { ![is_remote host] && [which $CC] == 0 } {
verbose "Could not find C compiler!" 1
untested $testund
untested $testfn
return
}
-catch "exec rm -f tmpdir/undefined" exec_output
+remote_file host delete "tmpdir/undefined"
set flags [big_or_little_endian]
# Using -e start prevents the SunOS linker from trying to build a
# shared library.
send_log "$ld -e start $flags -o tmpdir/undefined tmpdir/undefined.o\n"
-verbose "$ld -e start $flags -o tmpdir/undefined tmpdir/undefined.o"
+set exec_output [run_host_cmd "$ld" "-e start $flags -o tmpdir/undefined tmpdir/undefined.o"]
-catch "exec $ld -e start $flags -o tmpdir/undefined tmpdir/undefined.o" exec_output
send_log "$exec_output\n"
verbose "$exec_output"
if {! [ld_simple_link $ld tmpdir/weak-undef "$flags tmpdir/weak-undef.o -T $srcdir/$subdir/weak-undef.t"] } then {
fail $testname
} else {
- if {[which $objdump] == 0} then {
+ if {![is_remote host] && [which $objdump] == 0} then {
unresolved $testname
return
}
- verbose -log "$objdump -s tmpdir/weak-undef"
- catch "exec $objdump -s tmpdir/weak-undef" exec_output
+ set exec_output [run_host_cmd "$objdump" "-s tmpdir/weak-undef"]
set exec_output [prune_warnings $exec_output]
verbose -log $exec_output
proc default_ld_version { ld } {
global host_triplet
- if { [which $ld] == 0 } then {
+ if { ![is_remote host] && [which $ld] == 0 } then {
perror "$ld does not exist"
exit 1
}
- catch "exec $ld --version" tmp
- set tmp [prune_warnings $tmp]
+ remote_exec host "$ld --version" "" "/dev/null" "ld.version"
+ remote_upload host "ld.version"
+ set tmp [prune_warnings [file_contents "ld.version"]]
+ remote_file build delete "ld.version"
+ remote_file host delete "ld.version"
+
regexp "\[^\n\]* (cygnus-|)(\[-0-9.a-zA-Z-\]+)\[\r\n\].*" $tmp version cyg number
if [info exists number] then {
clone_output "$ld $number\n"
}
}
-# Link an object using relocation.
-#
-proc default_ld_relocate { ld target objects } {
- global HOSTING_EMU
- global host_triplet
- global exec_output
+proc run_host_cmd { prog command } {
+ global link_output
- if { [which $ld] == 0 } then {
- perror "$ld does not exist"
+ if { ![is_remote host] && [which "$prog"] == 0 } then {
+ perror "$prog does not exist"
return 0
}
- catch "exec rm -f $target" exec_output
+ verbose -log "$prog $command"
+ set status [remote_exec host [concat sh -c [list "$prog $command 2>&1"]] "" "/dev/null" "ld.tmp"]
+ remote_upload host "ld.tmp"
+ set link_output [file_contents "ld.tmp"]
+ regsub "\n$" $link_output "" link_output
+ if { [lindex $status 0] != 0 && [string match "" $link_output] } then {
+ append link_output "child process exited abnormally"
+ }
+ remote_file build delete ld.tmp
+ remote_file host delete ld.tmp
- verbose -log "$ld $HOSTING_EMU -o $target -r $objects"
+ if [string match "" $link_output] then {
+ return ""
+ }
- catch "exec $ld $HOSTING_EMU -o $target -r $objects" exec_output
- set exec_output [prune_warnings $exec_output]
+ verbose -log "$link_output"
+ return "$link_output"
+}
+
+proc run_host_cmd_yesno { prog command } {
+ global exec_output
+
+ set exec_output [prune_warnings [run_host_cmd "$prog" "$command"]]
if [string match "" $exec_output] then {
- return 1
- } else {
- verbose -log "$exec_output"
- return 0
+ return 1;
}
+ return 0;
+}
+
+# Link an object using relocation.
+#
+proc default_ld_relocate { ld target objects } {
+ global HOSTING_EMU
+
+ remote_file host delete $target
+ return [run_host_cmd_yesno "$ld" "$HOSTING_EMU -o $target -r $objects"]
}
# Check to see if ld is being invoked with a non-endian output format
set objs "$HOSTING_CRT0 $objects"
set libs "$LIBS $HOSTING_LIBS"
- if { [which $ld] == 0 } then {
- perror "$ld does not exist"
- return 0
- }
-
if [is_endian_output_format $objects] then {
set flags [big_or_little_endian]
} else {
set flags ""
}
- catch "exec rm -f $target" exec_output
-
- verbose -log "$ld $HOSTING_EMU $flags -o $target $objs $libs"
+ remote_file host delete $target
- catch "exec $ld $HOSTING_EMU $flags -o $target $objs $libs" link_output
- set exec_output [prune_warnings $link_output]
- if [string match "" $exec_output] then {
- return 1
- } else {
- verbose -log "$exec_output"
- return 0
- }
+ return [run_host_cmd_yesno "$ld" "$HOSTING_EMU $flags -o $target $objs $libs"]
}
# Link a program using ld, without including any libraries.
#
proc default_ld_simple_link { ld target objects } {
global host_triplet
- global link_output
global gcc_ld_flag
global exec_output
- if { [which $ld] == 0 } then {
- perror "$ld does not exist"
- return 0
- }
-
if [is_endian_output_format $objects] then {
set flags [big_or_little_endian]
} else {
set flags "$gcc_ld_flag $flags"
}
- catch "exec rm -f $target" exec_output
+ remote_file host delete $target
- verbose -log "$ld $flags -o $target $objects"
-
- catch "exec $ld $flags -o $target $objects" link_output
- set exec_output [prune_warnings $link_output]
+ set exec_output [run_host_cmd "$ld" "$flags -o $target $objects"]
+ set exec_output [prune_warnings $exec_output]
# We don't care if we get a warning about a non-existent start
# symbol, since the default linker script might use ENTRY.
if [string match "" $exec_output] then {
return 1
} else {
- verbose -log "$exec_output"
return 0
}
}
if {[llength $cc_prog] > 1} then {
set cc_prog [lindex $cc_prog 0]
}
- if {[which $cc_prog] == 0} then {
+ if {![is_remote host] && [which $cc_prog] == 0} then {
perror "$cc_prog does not exist"
return 0
}
- catch "exec rm -f $object" exec_output
+ remote_file build delete "$object"
+ remote_file host delete "$object"
set flags "-I$srcdir/$subdir $CFLAGS"
verbose -log "$cc $flags $ccflags -c $source -o $object"
- catch "exec $cc $flags $ccflags -c $source -o $object" exec_output
+ set status [remote_exec host [concat sh -c [list "$cc $flags $ccflags -c $source -o $object 2>&1"]] "" "/dev/null" "ld.tmp"]
+ remote_upload host "ld.tmp"
+ set exec_output [file_contents "ld.tmp"]
+ remote_file build delete "ld.tmp"
+ remote_file host delete "ld.tmp"
set exec_output [prune_warnings $exec_output]
if [string match "" $exec_output] then {
if {![file exists $object]} then {
regexp ".*/(\[^/\]*)$" $source all dobj
regsub "\\.c" $dobj ".o" realobj
verbose "looking for $realobj"
- if {[file exists $realobj]} then {
+ if {[remote_file host exists $realobj]} then {
verbose -log "mv $realobj $object"
- catch "exec mv $realobj $object" exec_output
- set exec_output [prune_warnings $exec_output]
- if {![string match "" $exec_output]} then {
- verbose -log "$exec_output"
- perror "could not move $realobj to $object"
- return 0
- }
+ remote_upload "$realobj" "$object"
} else {
perror "$object not found after compilation"
return 0
global ASFLAGS
global host_triplet
- if {[which $as] == 0} then {
- perror "$as does not exist"
- return 0
- }
-
if ![info exists ASFLAGS] { set ASFLAGS "" }
set flags [big_or_little_endian]
-
- verbose -log "$as $flags $ASFLAGS -o $object $source"
-
- catch "exec $as $flags $ASFLAGS -o $object $source" exec_output
+ set exec_output [run_host_cmd "$as" "$flags $ASFLAGS -o $object $source"]
set exec_output [prune_warnings $exec_output]
if [string match "" $exec_output] then {
return 1
} else {
- verbose -log "$exec_output"
perror "$source: assembly failed"
return 0
}
global nm_output
global host_triplet
- if {[which $nm] == 0} then {
- perror "$nm does not exist"
- return 0
- }
-
if {[info exists nm_output]} {
unset nm_output
}
set old_lc_all $env(LC_ALL)
}
set env(LC_ALL) "C"
+
verbose -log "$nm $NMFLAGS $nmflags $object >tmpdir/nm.out"
- catch "exec $nm $NMFLAGS $nmflags $object >tmpdir/nm.out" exec_output
+ set status [remote_exec host [concat sh -c [list "$nm $NMFLAGS $nmflags $object 2>ld.stderr"]] "" "/dev/null" "tmpdir/nm.out"]
if {[info exists old_lc_all]} {
set env(LC_ALL) $old_lc_all
} else {
unset env(LC_ALL)
}
- set exec_output [prune_warnings $exec_output]
+ remote_upload host "ld.stderr"
+ remote_upload host "tmpdir/nm.out" "tmpdir/nm.out"
+ set exec_output [prune_warnings [file_contents "ld.stderr"]]
+ remote_file host delete "ld.stderr"
+ remote_file build delete "ld.stderr"
if [string match "" $exec_output] then {
set file [open tmpdir/nm.out r]
while { [gets $file line] != -1 } {
}
}
}
+ if { $opt_name == "as" || $opt_name == "ld" } {
+ set opt_val [subst $opt_val]
+ }
set opts($opt_name) [concat $opts($opt_name) $opt_val]
}
foreach opt { as ld } {
set cmd "$AS $ASFLAGS $opts(as) $asflags($sourcefile) -o $objfile $sourcefile"
send_log "$cmd\n"
- set cmdret [catch "exec $cmd" comp_output]
- set comp_output [prune_warnings $comp_output]
+ set cmdret [remote_exec host [concat sh -c [list "$cmd 2>&1"]] "" "/dev/null" "ld.tmp"]
+ remote_upload host "ld.tmp"
+ set comp_output [prune_warnings [file_contents "ld.tmp"]]
+ remote_file host delete "ld.tmp"
+ remote_file build delete "ld.tmp"
- if { $cmdret != 0 || ![string match "" $comp_output] } then {
+ if { [lindex $cmdret 0] != 0 || ![string match "" $comp_output] } then {
send_log "$comp_output\n"
verbose "$comp_output" 3
$opts(ld) -o $objfile $objfiles"
send_log "$cmd\n"
- set cmdret [catch "exec $cmd" comp_output]
- set comp_output [prune_warnings $comp_output]
-
- if { $cmdret != 0 } then {
- # If the executed program writes to stderr and stderr is not
- # redirected, exec *always* returns failure, regardless of the
- # program exit code. Thankfully, we can retrieve the true
- # return status from a special variable. Redirection would
- # cause a Tcl-specific message to be appended, and we'd rather
- # not deal with that if we can help it.
- global errorCode
- if { [lindex $errorCode 0] == "NONE" } {
- set cmdret 0
- }
- }
+ set cmdret [remote_exec host [concat sh -c [list "$cmd 2>&1"]] "" "/dev/null" "ld.tmp"]
+ remote_upload host "ld.tmp"
+ set comp_output [prune_warnings [file_contents "ld.tmp"]]
+ remote_file host delete "ld.tmp"
+ remote_file build delete "ld.tmp"
+ set cmdret [lindex $cmdret 0]
if { $cmdret == 0 && $run_objcopy } {
set infile $objfile
set objfile "tmpdir/dump1"
- catch "exec rm -f $objfile" exec_output
+ remote_file host delete $objfile
# Note that we don't use OBJCOPYFLAGS here; any flags must be
# explicitly specified.
set cmd "$OBJCOPY $opts(objcopy_linked_file) $infile $objfile"
send_log "$cmd\n"
- set cmdret [catch "exec $cmd" comp_output]
- append comp_output [prune_warnings $comp_output]
-
- if { $cmdret != 0 } then {
- global errorCode
- if { [lindex $errorCode 0] == "NONE" } {
- set cmdret 0
- }
- }
+ set cmdret [remote_exec host [concat sh -c [list "$cmd 2>&1"]] "" "/dev/null" "ld.tmp"]
+ remote_upload host "ld.tmp"
+ append comp_output [prune_warnings [file_contents "ld.tmp"]]
+ remote_file host delete "ld.tmp"
+ remote_file build delete "ld.tmp"
+ set cmdret [lindex $cmdret 0]
}
+ regsub "\n$" $comp_output "" comp_output
if { $cmdret != 0 || $comp_output != "" || $expmsg != "" } then {
set exitstat "succeeded"
if { $cmdret != 0 } { set exitstat "failed" }
eval set progopts \$[string toupper $program]FLAGS
eval set binary \$[string toupper $program]
- if { [which $binary] == 0 } {
+ if { ![is_remote host] && [which $binary] == 0 } {
untested $testname
return
}
}
set env(LC_ALL) "C"
send_log "$cmd\n"
- catch "exec $cmd" comp_output
+ set cmdret [remote_exec host [concat sh -c [list "$cmd 2>ld.tmp"]] "" "/dev/null"]
+ remote_upload host "ld.tmp"
+ set comp_output [prune_warnings [file_contents "ld.tmp"]]
+ remote_file host delete "ld.tmp"
+ remote_file build delete "ld.tmp"
if {[info exists old_lc_all]} {
set env(LC_ALL) $old_lc_all
} else {
unset env(LC_ALL)
}
- set comp_output [prune_warnings $comp_output]
if ![string match "" $comp_output] then {
send_log "$comp_output\n"
fail $testname
set old_lc_all $env(LC_ALL)
}
set env(LC_ALL) "C"
- set cmd "$binary $progopts $binfile > dump.out"
+ set cmd "$binary $progopts $binfile"
+ set status [remote_exec host [concat sh -c [list "$cmd >dump.out 2>ld.stderr"]] "" "/dev/null"]
send_log "$cmd\n"
- catch "exec $cmd" comp_output
+ remote_upload host "ld.stderr"
+ set comp_output [prune_warnings [file_contents "ld.stderr"]]
+ remote_file host delete "ld.stderr"
+ remote_file build delete "ld.stderr"
+
if {[info exists old_lc_all]} {
set env(LC_ALL) $old_lc_all
} else {
unset env(LC_ALL)
}
- set comp_output [prune_warnings $comp_output]
if ![string match "" $comp_output] then {
send_log "$comp_output\n"
break
}
+ remote_upload host "dump.out"
+
if { [regexp_diff "dump.out" "$srcdir/$subdir/$dumpfile"] } then {
verbose "output is [file_contents "dump.out"]" 2
set failed 1
+ remote_file build delete "dump.out"
+ remote_file host delete "dump.out"
break
}
+ remote_file build delete "dump.out"
+ remote_file host delete "dump.out"
}
}