[ gas/ChangeLog ]
[deliverable/binutils-gdb.git] / gas / testsuite / lib / gas-defs.exp
index 92a10f0030815d9875b4a653dccf6918829870c9..682987defe76021ca070013fdd9bc656f14034c9 100644 (file)
@@ -16,7 +16,7 @@
 # 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
+# dejagnu@gnu.org
 
 # This file was written by Ken Raeburn (raeburn@cygnus.com).
 
@@ -168,7 +168,7 @@ proc gas_init { args } {
 
     case "$target_cpu" in {
        "m68???"                { set target_cpu_family m68k }
-       "i[34]86"               { set target_cpu_family i386 }
+       "i[3-7]86"              { set target_cpu_family i386 }
        default                 { set target_cpu_family $target_cpu }
     }
 
@@ -182,8 +182,45 @@ proc gas_init { args } {
     return
 }
 
+#
+# is_elf_format
+#      true if the object format is known to be ELF
+#
+proc is_elf_format {} {
+    if { ![istarget *-*-sysv4*] \
+        && ![istarget *-*-unixware*] \
+        && ![istarget *-*-elf*] \
+        && ![istarget *-*-eabi*] \
+        && ![istarget hppa*64*-*-hpux*] \
+        && ![istarget *-*-linux*] \
+        && ![istarget *-*-irix5*] \
+        && ![istarget *-*-irix6*] \
+        && ![istarget *-*-netbsd*] \
+        && ![istarget *-*-solaris2*] } {
+       return 0
+    }
+
+    if { [istarget *-*-linux*aout*] \
+        || [istarget *-*-linux*oldld*] } {
+       return 0
+    }
+
+    if { ![istarget *-*-netbsdelf*] \
+        && ([istarget *-*-netbsd*aout*] \
+            || [istarget *-*-netbsdpe*] \
+            || [istarget arm*-*-netbsd*] \
+            || [istarget sparc-*-netbsd*] \
+            || [istarget i*86-*-netbsd*] \
+            || [istarget m68*-*-netbsd*] \
+            || [istarget vax-*-netbsd*] \
+            || [istarget ns32k-*-netbsd*]) } {
+       return 0
+    }
+    return 1
+}
+
 
-# run_dump_test FILE
+# run_dump_test FILE (optional:) EXTRA_OPTIONS
 #
 # Assemble a .s file, then run some utility on it and check the output.
 #
@@ -207,6 +244,12 @@ proc gas_init { args } {
 # list ends with the first line that doesn't match the above syntax
 # (hmm, not great for error detection).
 #
+# The optional EXTRA_OPTIONS argument to `run_dump_test' is a list of
+# two-element lists.  The first element of each is an option name, and
+# the second additional arguments to be added on to the end of the
+# option list as given in FILE.d.  (If omitted, no additional options
+# are added.)
+#
 # The interesting options are:
 #
 #   name: TEST-NAME
@@ -247,7 +290,7 @@ proc gas_init { args } {
 # regexps in FILE.d.  `regexp_diff' is defined later in this file; see
 # further comments there.
 
-proc run_dump_test { name } {
+proc run_dump_test { name {extra_options {}} } {
     global subdir srcdir
     global OBJDUMP NM AS OBJCOPY READELF
     global OBJDUMPFLAGS NMFLAGS ASFLAGS OBJCOPYFLAGS READELFFLAGS
@@ -293,6 +336,22 @@ proc run_dump_test { name } {
        set opts($opt_name) $opt_val
     }
 
+    foreach i $extra_options {
+       set opt_name [lindex $i 0]
+       set opt_val [lindex $i 1]
+       if ![info exists opts($opt_name)] {
+           perror "unknown option $opt_name given in extra_opts"
+           unresolved $subdir/$name
+           return
+       }
+       # add extra option to end of existing option, adding space
+       # if necessary.
+       if [string length $opts($opt_name)] {
+           append opts($opt_name) " "
+       }
+       append opts($opt_name) $opt_val
+    }
+
     if {$opts(PROG) != ""} {
        switch -- $opts(PROG) {
            objdump
@@ -352,7 +411,7 @@ proc run_dump_test { name } {
     catch "exec $srcdir/lib/run $AS $ASFLAGS $opts(as) -o dump.o $sourcefile" comp_output
     set comp_output [prune_warnings $comp_output]
 
-    if ![string match "" $comp_output] then {
+    if { ![string match "" $comp_output] || $opts(stderr) != "" } then {
        if { $opts(stderr) == "" }  then {
            send_log "$comp_output\n"
            verbose "$comp_output" 3
This page took 0.024206 seconds and 4 git commands to generate.