diff options
Diffstat (limited to 'gas/testsuite/lib/gas-defs.exp')
-rw-r--r-- | gas/testsuite/lib/gas-defs.exp | 73 |
1 files changed, 40 insertions, 33 deletions
diff --git a/gas/testsuite/lib/gas-defs.exp b/gas/testsuite/lib/gas-defs.exp index 31743ac..92a10f0 100644 --- a/gas/testsuite/lib/gas-defs.exp +++ b/gas/testsuite/lib/gas-defs.exp @@ -1,19 +1,19 @@ -# Copyright (C) 1993, 1994, 1997, 1998, 1999, 2000, 2001 Free Software -# Foundation, Inc. +# Copyright (C) 1993, 1994, 1997, 1998, 1999, 2000, 2001, 2002 +# Free Software Foundation, Inc. # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. -# +# # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. -# +# # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. # Please email any bugs, comments, and/or additions to this file to: # DejaGnu@cygnus.com @@ -183,10 +183,10 @@ proc gas_init { args } { } -# run_dump_test FILE +# run_dump_test FILE # # Assemble a .s file, then run some utility on it and check the output. -# +# # There should be an assembly language file named FILE.s in the test # suite directory, and a pattern file called FILE.d. `run_dump_test' # will assemble FILE.s, run some tool like `objdump', `objcopy', or @@ -198,9 +198,9 @@ proc gas_init { args } { # flags to pass to the assembler, the program to run to dump the # assembler's output, and the options it wants. The option lines have # the syntax: -# +# # # OPTION: VALUE -# +# # OPTION is the name of some option, like "name" or "objdump", and # VALUE is OPTION's value. The valid options are described below. # Whitespace is ignored everywhere, except within VALUE. The option @@ -208,26 +208,28 @@ proc gas_init { args } { # (hmm, not great for error detection). # # The interesting options are: -# +# # name: TEST-NAME # The name of this test, passed to DejaGNU's `pass' and `fail' # commands. If omitted, this defaults to FILE, the root of the # .s and .d files' names. -# +# # as: FLAGS # When assembling FILE.s, pass FLAGS to the assembler. -# +# # PROG: PROGRAM-NAME # The name of the program to run to analyze the .o file produced # by the assembler. This can be omitted; run_dump_test will guess # which program to run by seeing which of the flags options below # is present. -# +# # objdump: FLAGS # nm: FLAGS # objcopy: FLAGS # Use the specified program to analyze the .o file, and pass it -# FLAGS, in addition to the .o file name. +# FLAGS, in addition to the .o file name. Note that they are run +# with LC_ALL=C in the environment to give consistent sorting +# of symbols. # # source: SOURCE # Assemble the file SOURCE.s. If omitted, this defaults to FILE.s. @@ -250,6 +252,7 @@ proc run_dump_test { name } { global OBJDUMP NM AS OBJCOPY READELF global OBJDUMPFLAGS NMFLAGS ASFLAGS OBJCOPYFLAGS READELFFLAGS global host_triplet + global env if [string match "*/*" $name] { set file $name @@ -401,24 +404,28 @@ proc run_dump_test { name } { # 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" if { $program == "objcopy" } { - send_log "$binary $progopts $progopts1 dump.o dump.out\n" - catch "exec $binary $progopts $progopts1 dump.o dump.out" comp_output - set comp_output [prune_warnings $comp_output] - if ![string match "" $comp_output] then { - send_log "$comp_output\n" - fail $testname - return - } + set cmd "$binary $progopts $progopts1 dump.o dump.out" + } + + # Ensure consistent sorting of symbols + if {[info exists env(LC_ALL)]} { + set old_lc_all $env(LC_ALL) + } + set env(LC_ALL) "C" + send_log "$cmd\n" + catch "exec $cmd" comp_output + if {[info exists old_lc_all]} { + set env(LC_ALL) $old_lc_all } else { - send_log "$binary $progopts $progopts1 dump.o > dump.out\n" - catch "exec $binary $progopts $progopts1 dump.o > dump.out" comp_output - set comp_output [prune_warnings $comp_output] - if ![string match "" $comp_output] then { - send_log "$comp_output\n" - fail $testname - return - } + unset env(LC_ALL) + } + set comp_output [prune_warnings $comp_output] + if ![string match "" $comp_output] then { + send_log "$comp_output\n" + fail $testname + return } verbose_eval {[file_contents "dump.out"]} 3 @@ -566,9 +573,9 @@ proc regexp_diff { file_1 file_2 } { } } - if { $diff_pass } { - break - } elseif { $end_1 && $end_2 } { + if { $diff_pass } { + break + } elseif { $end_1 && $end_2 } { break } elseif { $end_1 } { send_log "extra regexps in $file_2 starting with \"^$line_b$\"\nEOF from $file_1\n" |