summaryrefslogtreecommitdiff
path: root/gas/testsuite/lib
diff options
context:
space:
mode:
authorAlan Modra <amodra@gmail.com>2005-02-21 10:07:08 +0000
committerAlan Modra <amodra@gmail.com>2005-02-21 10:07:08 +0000
commitba7f26d2f9340029fb0dbfa944214be28667a3b3 (patch)
treef3a3e123b114fca17fb424393b2c33ad174eca38 /gas/testsuite/lib
parentcc1bc22af7e433b5cfca0907e069ffbeb8a29660 (diff)
* gas/d10v/instruction_packing-005.d: Adjust.
* gas/d10v/instruction_packing-008.d: Ignore disassembled stabs. * gas/d10v/instruction_packing-009.d: Likewise. * gas/d10v/instruction_packing-010.d: Likewise. * gas/d10v/warning-001.d: Use #warning instead of #error. * gas/d10v/warning-002.d: Likewise. * gas/d10v/warning-003.d: Likewise. * gas/d10v/warning-004.d: Likewise. * gas/d10v/warning-005.d: Likewise. * gas/d10v/warning-006.d: Likewise. * gas/d10v/warning-007.d: Likewise. * gas/d10v/warning-008.d: Likewise. * gas/d10v/warning-009.d: Likewise. * gas/d10v/warning-010.d: Likewise. * gas/d10v/warning-011.d: Likewise. * gas/d10v/warning-012.d: Likewise. * gas/d10v/warning-013.d: Likewise. * gas/d10v/warning-015.d: Likewise. * gas/d10v/warning-016.d: Likewise. * gas/d10v/warning-017.d: Likewise. * gas/d10v/warning-018.d: Likewise. * gas/d10v/warning-019.d: Likewise. * lib/gas-defs.exp (run_dump_test): Don't require a dump program if #warning given. Rearrange to allow $program to remain unset. Fail the test if warning not found when expected. Conversely fail the test if assembler errors or warnings given when not expected.
Diffstat (limited to 'gas/testsuite/lib')
-rw-r--r--gas/testsuite/lib/gas-defs.exp107
1 files changed, 53 insertions, 54 deletions
diff --git a/gas/testsuite/lib/gas-defs.exp b/gas/testsuite/lib/gas-defs.exp
index 9498437f75..9f933734bb 100644
--- a/gas/testsuite/lib/gas-defs.exp
+++ b/gas/testsuite/lib/gas-defs.exp
@@ -1,5 +1,5 @@
-# Copyright (C) 1993, 1994, 1997, 1998, 1999, 2000, 2001, 2002, 2003
-# Free Software Foundation, Inc.
+# Copyright (C) 1993, 1994, 1997, 1998, 1999, 2000, 2001, 2002, 2003,
+# 2004, 2005 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
@@ -371,59 +371,48 @@ proc run_dump_test { name {extra_options {}} } {
append opts($opt_name) $opt_val
}
- if {$opts(PROG) != ""} {
- switch -- $opts(PROG) {
- objdump
- { set program objdump }
- nm
- { set program nm }
- objcopy
- { set program objcopy }
- readelf
- { set program readelf }
- default
- { perror "unrecognized program option $opts(PROG) in $file.d"
- unresolved $subdir/$name
- return }
- }
- } elseif { $opts(error) != "" } {
- # It's meaningless to require an output-testing method when we
- # expect an error. For simplicity, we fake an arbitrary method.
- set program "nm"
- } else {
- # Guess which program to run, by seeing which option was specified.
- set program ""
- foreach p {objdump objcopy nm readelf} {
- if {$opts($p) != ""} {
- if {$program != ""} {
- perror "ambiguous dump program in $file.d"
+ if { (($opts(warning) != "") && ($opts(error) != "")) \
+ || (($opts(warning) != "") && ($opts(stderr) != "")) } {
+ perror "$testname: bad mix of stderr, error and warning test-directives"
+ return
+ }
+
+ set program ""
+ # It's meaningless to require an output-testing method when we
+ # expect an error.
+ if { $opts(error) == "" } {
+ if {$opts(PROG) != ""} {
+ switch -- $opts(PROG) {
+ objdump { set program objdump }
+ nm { set program nm }
+ objcopy { set program objcopy }
+ readelf { set program readelf }
+ default {
+ perror "unrecognized program option $opts(PROG) in $file.d"
unresolved $subdir/$name
- return
- } else {
- set program $p
+ return }
+ }
+ } else {
+ # Guess which program to run, by seeing which option was specified.
+ foreach p {objdump objcopy nm readelf} {
+ if {$opts($p) != ""} {
+ if {$program != ""} {
+ perror "ambiguous dump program in $file.d"
+ unresolved $subdir/$name
+ return
+ } else {
+ set program $p
+ }
}
}
}
- if {$program == ""} {
+ if { $program == "" && $opts(warning) == "" } {
perror "dump program unspecified in $file.d"
unresolved $subdir/$name
return
}
}
- set expmsg $opts(error)
- if { $opts(warning) != "" } {
- set expmsg $opts(warning)
- }
- if { (($opts(warning) != "") && ($opts(error) != "")) \
- || (($opts(warning) != "") && ($opts(stderr) != "")) } {
- perror "$testname: bad mix of stderr, error and warning test-directives"
- return
- }
-
- set progopts1 $opts($program)
- eval set progopts \$[string toupper $program]FLAGS
- eval set binary \$[string toupper $program]
if { $opts(name) == "" } {
set testname "$subdir/$name"
} else {
@@ -441,7 +430,11 @@ proc run_dump_test { name {extra_options {}} } {
set cmdret [catch "exec $cmd" comp_output]
set comp_output [prune_warnings $comp_output]
- if { $cmdret != 0 || $comp_output != "" || $opts(stderr) != "" } then {
+ set expmsg $opts(error)
+ if { $opts(warning) != "" } {
+ set expmsg $opts(warning)
+ }
+ if { $cmdret != 0 || $comp_output != "" || $expmsg != "" } 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
@@ -460,18 +453,17 @@ proc run_dump_test { name {extra_options {}} } {
send_log "$comp_output\n"
verbose "$comp_output" 3
- if { $expmsg != "" \
- && [regexp $expmsg $comp_output] \
+ if { [regexp $expmsg $comp_output] \
&& (($cmdret == 0) == ($opts(warning) != "")) } {
- verbose -log "$exitstat with: <$comp_output>, expected: <$expmsg>"
-
- # Only "pass" and return here if we expected (and got)
- # an error.
- if { $opts(error) != "" } {
+ # We have the expected output from gas.
+ # Return if there's nothing more to do.
+ if { $opts(error) != "" || $program == "" } {
pass $testname
return
}
- } {
+ } else {
+ verbose -log "$exitstat with: <$comp_output>, expected: <$expmsg>"
+
fail $testname
return
}
@@ -503,6 +495,13 @@ proc run_dump_test { name {extra_options {}} } {
}
}
+ if { $program == "" } {
+ return
+ }
+ set progopts1 $opts($program)
+ eval set progopts \$[string toupper $program]FLAGS
+ eval set binary \$[string toupper $program]
+
if { [which $binary] == 0 } {
untested $testname
return