# Copyright (C) 1993, 1994, 1997, 1998, 1999, 2000, 2001, 2002, 2003,
-# 2004, 2005, 2007, 2009 Free Software Foundation, Inc.
+# 2004, 2005, 2007, 2008, 2009 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
return [list $comp_output ""]
}
+proc gas_run_stdin { prog as_opts redir } {
+ global AS
+ global ASFLAGS
+ global comp_output
+ global srcdir
+ global subdir
+ global host_triplet
+
+ 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 ""]
+}
+
proc all_ones { args } {
foreach x $args { if [expr $x!=1] { return 0 } }
return 1
global comp_output
gas_run $file $as_opts ">/dev/null"
- if ![string match "" $comp_output] then {
- send_log "$comp_output\n"
- verbose "$comp_output" 3
- }
- if [string match "" $comp_output] then {
- fail "$testname"
- } else {
+ send_log "$comp_output\n"
+ verbose "$comp_output" 3
+ if { ![string match "" $comp_output]
+ && ![string match "*Assertion failure*" $comp_output]
+ && ![string match "*Internal error*" $comp_output] } then {
pass "$testname"
+ } else {
+ fail "$testname"
}
}
&& ![istarget hppa*64*-*-hpux*] \
&& ![istarget *-*-linux*] \
&& ![istarget frv-*-uclinux*] \
+ && ![istarget sh*-*-uclinux*] \
&& ![istarget *-*-irix5*] \
&& ![istarget *-*-irix6*] \
&& ![istarget *-*-netbsd*] \
return 1
}
+# True if the object format is known to be PE COFF.
+#
+proc is_pecoff_format {} {
+ if { ![istarget *-*-mingw*] \
+ && ![istarget *-*-cygwin*] \
+ && ![istarget *-*-pe*] } {
+ return 0
+ }
+
+ return 1
+}
+
# run_dump_tests TESTCASES EXTRA_OPTIONS
# Wrapper for run_dump_test, which is suitable for invoking as
# run_dump_tests [lsort [glob -nocomplain $srcdir/$subdir/*.d]]
# as: FLAGS
# When assembling FILE.s, pass FLAGS to the assembler.
#
+# addr2line: FLAGS
# nm: FLAGS
# objcopy: FLAGS
# objdump: FLAGS
# 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. If no FLAGS are needed then use:
-# PROG: [nm objcopy objdump readelf]
+# PROG: [nm objcopy objdump readelf addr2line]
# instead.
#
# source: SOURCE
global subdir srcdir
global OBJDUMP NM AS OBJCOPY READELF
global OBJDUMPFLAGS NMFLAGS ASFLAGS OBJCOPYFLAGS READELFFLAGS
+ global ADDR2LINE ADDR2LINEFLAGS
global host_triplet
global env
unresolved $subdir/$name
return
}
+ set opts(addr2line) {}
set opts(as) {}
set opts(objdump) {}
set opts(nm) {}
if { $opts(error) == "" && $opts(error-output) == "" } {
if {$opts(PROG) != ""} {
switch -- $opts(PROG) {
+ addr2line { set program addr2line }
objdump { set program objdump }
nm { set program nm }
objcopy { set program objcopy }
}
} else {
# Guess which program to run, by seeing which option was specified.
- foreach p {objdump objcopy nm readelf} {
+ foreach p {objdump objcopy nm readelf addr2line} {
if {$opts($p) != ""} {
if {$program != ""} {
perror "ambiguous dump program in $file.d"
set nws {[^ ]*}
# whitespace is ignored anywhere except within the options list;
# option names are alphabetic plus dash
- set pat "^#${ws}(\[a-zA-Z-\]*)$ws:${ws}(.*)$ws\$"
+ set pat "^#${ws}(\[a-zA-Z0-9-\]*)$ws:${ws}(.*)$ws\$"
while { [gets $f line] != -1 } {
set line [string trim $line]
# Whitespace here is space-tab.
}
pass $testname
}
+
+# run_list_test_stdin NAME (optional): OPTS TESTNAME
+#
+# Similar to run_list_test, but use stdin as input.
+
+proc run_list_test_stdin { name {opts {}} {testname {}} } {
+ global srcdir subdir
+ if { [string length $testname] == 0 } then {
+ set testname "[file tail $subdir] $name"
+ }
+ set file $srcdir/$subdir/$name
+ gas_run_stdin ${name}.s $opts ">&dump.out"
+ if { [regexp_diff "dump.out" "${file}.l"] } then {
+ fail $testname
+ verbose "output is [file_contents "dump.out"]" 2
+ return
+ }
+ pass $testname
+}