gas run_dump_test rename not-target and not-skip
[binutils-gdb.git] / gas / testsuite / lib / gas-defs.exp
index 7dc48077e7e51344b6abd2b6988ca455a1a9af50..e040e947a97811a0e7fb6be8332ae77e7c37b7a4 100644 (file)
@@ -1,4 +1,4 @@
-# Copyright (C) 1993-2015 Free Software Foundation, Inc.
+# Copyright (C) 1993-2018 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
@@ -359,14 +359,13 @@ proc run_dump_tests { testcases {extra_options {}} } {
 #
 #   addr2line: FLAGS
 #   nm: FLAGS
-#   objcopy: FLAGS
 #   objdump: FLAGS
 #   readelf: FLAGS
 #      Use the specified program to analyze the .o file, and pass it
 #      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 addr2line]
+#        PROG: [nm objdump readelf addr2line]
 #       instead.
 #      Note: for objdump, we automatically replaces the standard section
 #      names (.text, .data and .bss) by target ones if any (eg. rx-elf
@@ -383,31 +382,39 @@ proc run_dump_tests { testcases {extra_options {}} } {
 #      is useful if several .d files differ by options only.  Options are
 #      always read from FILE.d.
 #
-#   target: GLOBS...
-#       Run this test only on a specified list of targets.  More precisely,
-#       each glob in the space-separated list is passed to "istarget"; if
-#       it evaluates true for any of them, the test will be run, otherwise
-#       it will be marked unsupported.
+#   target: GLOB|PROC ...
+#      Run this test only on a specified list of targets.  More precisely,
+#      in the space-separated list each glob is passed to "istarget" and
+#      each proc is called as a TCL procedure.  List items are interpreted
+#      such that procs are denoted by surrounding square brackets, and any
+#      other items are consired globs.  If the call evaluates true for any
+#      of them, the test will be run, otherwise it will be marked
+#      unsupported.
 #
-#   not-target: GLOBS...
-#       Do not run this test on a specified list of targets.  Again,
-#       the each glob in the space-separated list is passed to
-#       "istarget", and the test is run if it evaluates *false* for
-#       *all* of them.  Otherwise it will be marked unsupported.
+#   notarget: GLOB|PROC ...
+#      Do not run this test on a specified list of targets.  Again, each
+#      glob in the space-separated list is passed to "istarget" and each
+#      proc is called as a TCL procedure, and the test is run if it
+#      evaluates *false* for *all* of them.  Otherwise it will be marked
+#      unsupported.
 #
-#   skip: GLOBS...
-#   not-skip: GLOBS...
-#       These are exactly the same as "not-target" and "target",
+#   skip: GLOB|PROC ...
+#   noskip: GLOB|PROC ...
+#       These are exactly the same as "notarget" and "target",
 #       respectively, except that they do nothing at all if the check
 #       fails.  They should only be used in groups, to construct a single
 #       test which is run on all targets but with variant options or
 #       expected output on some targets.  (For example, see
 #       gas/arm/inst.d and gas/arm/wince_inst.d.)
 #
+#   xfail: GLOB|PROC ...
+#      Run this test and it is is expected to fail on a specified list
+#      of targets.
+#
 #   error: REGEX
 #      An error with message matching REGEX must be emitted for the test
-#      to pass.  The PROG, objdump, nm and objcopy options have no
-#      meaning and need not supplied if this is present.
+#      to pass.  The PROG, addr2line, nm, objdump, and readelf options
+#      have no meaning and need not supplied if this is present.
 #
 #   warning: REGEX
 #      Expect a gas warning matching REGEX.  It is an error to issue
@@ -416,12 +423,12 @@ proc run_dump_tests { testcases {extra_options {}} } {
 #   stderr: FILE
 #       FILE contains regexp lines to be matched against the diagnostic
 #       output of the assembler.  This does not preclude the use of
-#       PROG, nm, objdump, or objcopy.
+#       PROG, addr2line, nm, objdump, or readelf.
 #
 #   error-output: FILE
 #       Means the same as 'stderr', but also indicates that the assembler
-#       is expected to exit unsuccessfully (therefore PROG, objdump, nm,
-#       and objcopy have no meaning and should not be supplied).
+#       is expected to exit unsuccessfully (therefore PROG, addr2line, nm,
+#      objdump, and readelf have no meaning and should not be supplied).
 #
 #   section-subst: no
 #       Means that the section substitution for objdump is disabled.
@@ -457,7 +464,6 @@ proc run_dump_test { name {extra_options {}} } {
     set opts(as) {}
     set opts(objdump) {}
     set opts(nm) {}
-    set opts(objcopy) {}
     set opts(readelf) {}
     set opts(name) {}
     set opts(PROG) {}
@@ -468,9 +474,10 @@ proc run_dump_test { name {extra_options {}} } {
     set opts(error-output) {}
     set opts(warning) {}
     set opts(target) {}
-    set opts(not-target) {}
+    set opts(notarget) {}
     set opts(skip) {}
-    set opts(not-skip) {}
+    set opts(noskip) {}
+    set opts(xfail) {}
     set opts(section-subst) {}
 
     foreach i $opt_array {
@@ -537,7 +544,6 @@ proc run_dump_test { name {extra_options {}} } {
                addr2line { set program addr2line }
                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"
@@ -546,7 +552,7 @@ proc run_dump_test { name {extra_options {}} } {
            }
        } else {
            # Guess which program to run, by seeing which option was specified.
-           foreach p {objdump objcopy nm readelf addr2line} {
+           foreach p {objdump nm readelf addr2line} {
                if {$opts($p) != ""} {
                    if {$program != ""} {
                        perror "ambiguous dump program in $file.d"
@@ -566,22 +572,22 @@ proc run_dump_test { name {extra_options {}} } {
     }
 
     # Handle skipping the test on specified targets.
-    # You can have both skip/not-skip and target/not-target, but you can't
-    # have both skip and not-skip, or target and not-target, in the same file.
+    # You can have both skip/noskip and target/notarget, but you can't
+    # have both skip and noskip, or target and notarget, in the same file.
     if { $opts(skip) != "" } then {
-       if { $opts(not-skip) != "" } then {
-           perror "$testname: mixing skip and not-skip directives is invalid"
+       if { $opts(noskip) != "" } then {
+           perror "$testname: mixing skip and noskip directives is invalid"
            unresolved $testname
            return
        }
        foreach glob $opts(skip) {
-           if {[istarget $glob]} { return }
+           if {[match_target $glob]} { return }
        }
     }
-    if { $opts(not-skip) != "" } then {
+    if { $opts(noskip) != "" } then {
        set skip 1
-       foreach glob $opts(not-skip) {
-           if {[istarget $glob]} {
+       foreach glob $opts(noskip) {
+           if {[match_target $glob]} {
                set skip 0
                break
            }
@@ -589,14 +595,14 @@ proc run_dump_test { name {extra_options {}} } {
        if {$skip} { return }
     }
     if { $opts(target) != "" } then {
-       if { $opts(not-target) != "" } then {
-           perror "$testname: mixing target and not-target directives is invalid"
+       if { $opts(notarget) != "" } then {
+           perror "$testname: mixing target and notarget directives is invalid"
            unresolved $testname
            return
        }
        set skip 1
        foreach glob $opts(target) {
-           if {[istarget $glob]} {
+           if {[match_target $glob]} {
                set skip 0
                break
            }
@@ -606,15 +612,20 @@ proc run_dump_test { name {extra_options {}} } {
            return
        }
     }
-    if { $opts(not-target) != "" } then {
-       foreach glob $opts(not-target) {
-           if {[istarget $glob]} {
+    if { $opts(notarget) != "" } then {
+       foreach glob $opts(notarget) {
+           if {[match_target $glob]} {
                unsupported $testname
                return
            }
        }
     }
 
+    # Setup xfailures.
+    foreach targ $opts(xfail) {
+       setup_xfail $targ
+    }
+
     if { $opts(source) == "" } {
        set sourcefile ${file}.s
     } else {
@@ -727,15 +738,8 @@ proc run_dump_test { name {extra_options {}} } {
     if { $progopts1 == "" } { set $progopts1 "-r" }
     verbose "running $binary $progopts $progopts1" 3
 
-    # 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"
     set redir ">dump.out"
-    if { $program == "objcopy" } {
-       set cmd "$binary $progopts $progopts1 dump.o dump.out"
-       set redir ""
-    }
-
     send_log "$cmd\n"
     set status [gas_host_run "$cmd" "$redir"]
     set comp_output [prune_warnings [lindex $status 1]]