aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHans-Peter Nilsson <hp@axis.com>2005-02-07 02:38:43 +0000
committerHans-Peter Nilsson <hp@axis.com>2005-02-07 02:38:43 +0000
commitbb00e2846a1933ac682782a4113cacf28463db2d (patch)
tree49d539fcdc23ceb692f4eeb823e50b1e3b12fe8d
parentcfdf4aaa1d8d327b71f99a143a0d1093e6450515 (diff)
downloadgdb-bb00e2846a1933ac682782a4113cacf28463db2d.zip
gdb-bb00e2846a1933ac682782a4113cacf28463db2d.tar.gz
gdb-bb00e2846a1933ac682782a4113cacf28463db2d.tar.bz2
* lib/ld-lib.exp: Support new directive "warning".
-rw-r--r--ld/testsuite/ChangeLog4
-rw-r--r--ld/testsuite/lib/ld-lib.exp44
2 files changed, 42 insertions, 6 deletions
diff --git a/ld/testsuite/ChangeLog b/ld/testsuite/ChangeLog
index 62a2108..aa4ca53 100644
--- a/ld/testsuite/ChangeLog
+++ b/ld/testsuite/ChangeLog
@@ -1,3 +1,7 @@
+2005-02-07 Hans-Peter Nilsson <hp@axis.com>
+
+ * lib/ld-lib.exp: Support new directive "warning".
+
2005-02-02 Daniel Jacobowitz <dan@codesourcery.com>
* ld-mips-elf/eh-frame3.d, ld-mips-elf/eh-frame4.d: Move comments
diff --git a/ld/testsuite/lib/ld-lib.exp b/ld/testsuite/lib/ld-lib.exp
index b4e3f33..c36c2e5 100644
--- a/ld/testsuite/lib/ld-lib.exp
+++ b/ld/testsuite/lib/ld-lib.exp
@@ -587,6 +587,10 @@ proc simple_diff { file_1 file_2 } {
# to pass. The PROG, objdump, nm and objcopy options have no
# meaning and need not supplied if this is present.
#
+# warning: REGEX
+# Expect a linker warning matching REGEX. It is an error to issue
+# both "error" and "warning".
+#
# Each option may occur at most once unless otherwise mentioned.
#
# After the option lines come regexp lines. `run_dump_test' calls
@@ -634,6 +638,7 @@ proc run_dump_test { name } {
set opts(PROG) {}
set opts(source) {}
set opts(error) {}
+ set opts(warning) {}
set opts(objcopy_linked_file) {}
set asflags(${file}.s) {}
@@ -800,6 +805,15 @@ proc run_dump_test { name } {
# Perhaps link the file(s).
if { $run_ld } {
set objfile "tmpdir/dump"
+ set expmsg $opts(error)
+
+ if { $opts(warning) != "" } {
+ if { $expmsg != "" } {
+ perror "$testname: mixing error and warning test-directives"
+ return
+ }
+ set expmsg $opts(warning)
+ }
# Add -L$srcdir/$subdir so that the linker command can use
# linker scripts in the source directory.
@@ -810,18 +824,36 @@ proc run_dump_test { name } {
set cmdret [catch "exec $cmd" comp_output]
set comp_output [prune_warnings $comp_output]
- if { $cmdret != 0 || ![string match "" $comp_output] } then {
- verbose -log "failed with: <$comp_output>, expected: <$opts(error)>"
+ 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
+ # 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 { $cmdret != 0 && [lindex $errorCode 0] == "NONE" } {
+ set cmdret 0
+ }
+
+ set exitstat "succeeded"
+ if { $cmdret != 0 } { set exitstat "failed" }
+ verbose -log "$exitstat with: <$comp_output>, expected: <$expmsg>"
send_log "$comp_output\n"
verbose "$comp_output" 3
- if { $opts(error) != "" && $run_objcopy == 0 } {
- if [regexp $opts(error) $comp_output] {
+ if { $expmsg != "" && $run_objcopy == 0 \
+ && [regexp $expmsg $comp_output] \
+ && (($cmdret == 0) == ($opts(warning) != "")) } {
+ # Only "pass" and return here if we expected (and got)
+ # an error.
+ if { $opts(error) != "" } {
pass $testname
return
}
+ } {
+ fail $testname
+ return
}
- fail $testname
- return
}
if { $run_objcopy } {