diff options
author | Joseph Myers <joseph@codesourcery.com> | 2007-08-28 13:21:58 +0000 |
---|---|---|
committer | Joseph Myers <joseph@codesourcery.com> | 2007-08-28 13:21:58 +0000 |
commit | 7f6a71ffb6ce85438f442a992e2def6eda2e1554 (patch) | |
tree | b0cab57986aed86fe6234c0ad4a205191c031c4b /gas/testsuite | |
parent | ad71ef64ac2a85db4cdcf06706db646792ba094a (diff) | |
download | ppe42-binutils-7f6a71ffb6ce85438f442a992e2def6eda2e1554.tar.gz ppe42-binutils-7f6a71ffb6ce85438f442a992e2def6eda2e1554.zip |
bfd:
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.
binutils/testsuite:
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.
gas:
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.
gas/testsuite:
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.
ld:
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.
ld/testsuite:
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.
Diffstat (limited to 'gas/testsuite')
-rw-r--r-- | gas/testsuite/ChangeLog | 27 | ||||
-rw-r--r-- | gas/testsuite/gas/all/gas.exp | 3 | ||||
-rw-r--r-- | gas/testsuite/gas/cfi/cfi.exp | 5 | ||||
-rw-r--r-- | gas/testsuite/gas/elf/elf.exp | 8 | ||||
-rw-r--r-- | gas/testsuite/gas/i386/i386.exp | 10 | ||||
-rw-r--r-- | gas/testsuite/gas/macros/macros.exp | 1 | ||||
-rw-r--r-- | gas/testsuite/gas/maxq10/maxq10.exp | 9 | ||||
-rw-r--r-- | gas/testsuite/gas/maxq20/maxq20.exp | 8 | ||||
-rw-r--r-- | gas/testsuite/gas/sparc/sparc.exp | 5 | ||||
-rw-r--r-- | gas/testsuite/lib/gas-defs.exp | 115 | ||||
-rw-r--r-- | gas/testsuite/lib/gas-dg.exp | 2 | ||||
-rwxr-xr-x | gas/testsuite/lib/run | 2 |
12 files changed, 144 insertions, 51 deletions
diff --git a/gas/testsuite/ChangeLog b/gas/testsuite/ChangeLog index 1bbbec163a..1d196d06d4 100644 --- a/gas/testsuite/ChangeLog +++ b/gas/testsuite/ChangeLog @@ -1,3 +1,30 @@ +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. diff --git a/gas/testsuite/gas/all/gas.exp b/gas/testsuite/gas/all/gas.exp index 6dabbca689..081c4183be 100644 --- a/gas/testsuite/gas/all/gas.exp +++ b/gas/testsuite/gas/all/gas.exp @@ -117,7 +117,7 @@ proc do_comment {} { 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 } @@ -254,6 +254,7 @@ case $target_triplet in { { *c54x*-*-* } { } default { test_cond + remote_download host "$srcdir/$subdir/incbin.dat" run_dump_test incbin } } diff --git a/gas/testsuite/gas/cfi/cfi.exp b/gas/testsuite/gas/cfi/cfi.exp index b396f9e852..593c8ff4e6 100644 --- a/gas/testsuite/gas/cfi/cfi.exp +++ b/gas/testsuite/gas/cfi/cfi.exp @@ -28,11 +28,10 @@ if [istarget "x86_64-*"] then { } 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" } diff --git a/gas/testsuite/gas/elf/elf.exp b/gas/testsuite/gas/elf/elf.exp index 83c80824b3..8b7833f02e 100644 --- a/gas/testsuite/gas/elf/elf.exp +++ b/gas/testsuite/gas/elf/elf.exp @@ -15,7 +15,13 @@ proc run_elf_list_test { name suffix opts readelf_opts readelf_pipe } { 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 diff --git a/gas/testsuite/gas/i386/i386.exp b/gas/testsuite/gas/i386/i386.exp index 3a651ac448..f68ab81b0c 100644 --- a/gas/testsuite/gas/i386/i386.exp +++ b/gas/testsuite/gas/i386/i386.exp @@ -4,19 +4,17 @@ 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 { diff --git a/gas/testsuite/gas/macros/macros.exp b/gas/testsuite/gas/macros/macros.exp index 62392ec3b4..436923e53c 100644 --- a/gas/testsuite/gas/macros/macros.exp +++ b/gas/testsuite/gas/macros/macros.exp @@ -53,6 +53,7 @@ if { ![istarget hppa*-*-*] || [istarget *-*-linux*] } { 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 "" diff --git a/gas/testsuite/gas/maxq10/maxq10.exp b/gas/testsuite/gas/maxq10/maxq10.exp index 8887b53494..a765177c62 100644 --- a/gas/testsuite/gas/maxq10/maxq10.exp +++ b/gas/testsuite/gas/maxq10/maxq10.exp @@ -4,10 +4,9 @@ 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 { } { @@ -15,8 +14,8 @@ 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 { diff --git a/gas/testsuite/gas/maxq20/maxq20.exp b/gas/testsuite/gas/maxq20/maxq20.exp index 6d952e9e3e..cf0c93e43c 100644 --- a/gas/testsuite/gas/maxq20/maxq20.exp +++ b/gas/testsuite/gas/maxq20/maxq20.exp @@ -6,8 +6,8 @@ proc gas_64_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_32_check { } { @@ -15,8 +15,8 @@ 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]] } diff --git a/gas/testsuite/gas/sparc/sparc.exp b/gas/testsuite/gas/sparc/sparc.exp index 876f9acf80..0111d571b7 100644 --- a/gas/testsuite/gas/sparc/sparc.exp +++ b/gas/testsuite/gas/sparc/sparc.exp @@ -10,10 +10,9 @@ 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 { } { diff --git a/gas/testsuite/lib/gas-defs.exp b/gas/testsuite/lib/gas-defs.exp index 8d4902a4d0..112bb5270a 100644 --- a/gas/testsuite/lib/gas-defs.exp +++ b/gas/testsuite/lib/gas-defs.exp @@ -23,17 +23,80 @@ 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 @@ -42,8 +105,11 @@ proc gas_run { prog as_opts redir } { 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 ""] @@ -71,12 +137,8 @@ proc gas_start { prog as_opts } { 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 { } { @@ -422,6 +484,9 @@ proc run_dump_test { name {extra_options {}} } { unresolved $subdir/$name return } + if { $opt_name == "as" } { + set opt_val [subst $opt_val] + } set opts($opt_name) $opt_val } @@ -554,10 +619,11 @@ proc run_dump_test { name {extra_options {}} } { 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) != "" } { @@ -632,7 +698,7 @@ proc run_dump_test { name {extra_options {}} } { 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 } @@ -642,9 +708,11 @@ proc run_dump_test { name {extra_options {}} } { # 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 @@ -653,7 +721,8 @@ proc run_dump_test { name {extra_options {}} } { } 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 { @@ -708,8 +777,8 @@ proc objdump { opts } { 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 } @@ -719,12 +788,8 @@ proc objdump_start_no_subdir { prog opts } { 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 { } { diff --git a/gas/testsuite/lib/gas-dg.exp b/gas/testsuite/lib/gas-dg.exp index 801b9b4e93..3b90548cac 100644 --- a/gas/testsuite/lib/gas-dg.exp +++ b/gas/testsuite/lib/gas-dg.exp @@ -21,7 +21,7 @@ proc gas-dg-test { prog do_what tool_flags } { "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" diff --git a/gas/testsuite/lib/run b/gas/testsuite/lib/run deleted file mode 100755 index d4150f8d4c..0000000000 --- a/gas/testsuite/lib/run +++ /dev/null @@ -1,2 +0,0 @@ -#!/bin/sh -eval exec $@ |