#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
# If this target does not support weak symbols, skip this test.
}
}
+# If this target does not have fork, skip this test.
+
+proc dg-require-fork { args } {
+ if { ![check_fork_available] } {
+ upvar dg-do-what dg-do-what
+ set dg-do-what [list [lindex ${dg-do-what} 0] "N" "P"]
+ }
+}
+
+# If this target does not have mkfifo, skip this test.
+
+proc dg-require-mkfifo { args } {
+ if { ![check_mkfifo_available] } {
+ upvar dg-do-what dg-do-what
+ set dg-do-what [list [lindex ${dg-do-what} 0] "N" "P"]
+ }
+}
+
+# If this target does not use __cxa_atexit, skip this test.
+
+proc dg-require-cxa-atexit { args } {
+ if { ![ check_cxa_atexit_available ] } {
+ upvar dg-do-what dg-do-what
+ set dg-do-what [list [lindex ${dg-do-what} 0] "N" "P"]
+ }
+}
+
# Check the flags with which the test will be run against options in
# a test directive that will skip or xfail that test. The DejaGnu proc
# check_conditional_xfail will look at the options in compiler_flags, so
return $answer
}
+# Compare flags for a test directive against flags that will be used to
+# compile the test: multilib flags, flags for torture options, and either
+# the default flags for this group of tests or flags specified with a
+# previous dg-options directive.
+
+proc check-flags { args } {
+ global compiler_flags
+ global TOOL_OPTIONS
+ # These variables are from DejaGnu's dg-test.
+ upvar dg-extra-tool-flags extra_tool_flags
+ upvar tool_flags tool_flags
+
+ # The args are within another list; pull them out.
+ set args [lindex $args 0]
+
+ # Start the list with a dummy tool name so the list will match "*"
+ # if there are no flags.
+ set compiler_flags " toolname "
+ append compiler_flags $extra_tool_flags
+ append compiler_flags $tool_flags
+ # If running a subset of the test suite, $TOOL_OPTIONS may not exist.
+ catch {append compiler_flags " $TOOL_OPTIONS "}
+ set dest [target_info name]
+ if [board_info $dest exists multilib_flags] {
+ append compiler_flags "[board_info $dest multilib_flags] "
+ }
+
+ # The target list might be an effective-target keyword, so replace
+ # the original list with "*-*-*", since we already know it matches.
+ set result [check_conditional_xfail [lreplace $args 1 1 "*-*-*"]]
+
+ # Any value in this variable was left over from an earlier test.
+ set compiler_flags ""
+
+ return $result
+}
+
# Skip the test (report it as UNSUPPORTED) if the target list and
# included flags are matched and the excluded flags are not matched.
#
# group of tests or flags specified with a previous dg-options command.
proc dg-skip-if { args } {
+ # Don't bother if we're already skipping the test.
+ upvar dg-do-what dg-do-what
+ if { [lindex ${dg-do-what} 1] == "N" } {
+ return
+ }
+
set args [lreplace $args 0 0]
- set selector "target [join [lindex $args 1]]"
+ set selector [list target [lindex $args 1]]
if { [dg-process-target $selector] == "S" } {
- # The target list matched; now check the flags. The DejaGnu proc
- # check_conditional_xfail will look at the options in compiler_flags,
- # so set that up for this test based on flags we know about. Start
- # the list with a dummy tool name so the list will match "*" if
- # there are no flags.
-
- global compiler_flags
- upvar dg-extra-tool-flags extra_tool_flags
-
- set compiler_flags " toolname "
- append compiler_flags $extra_tool_flags
- set dest [target_info name]
- if [board_info $dest exists multilib_flags] {
- append compiler_flags "[board_info $dest multilib_flags] "
- }
+ # These are defined in DejaGnu's dg-test, needed by check-flags.
+ upvar dg-extra-tool-flags dg-extra-tool-flags
+ upvar tool_flags tool_flags
- # The target list might be an effective-target keyword, so replace
- # the original list with "*-*-*".
- if [check_conditional_xfail [lreplace $args 1 1 "*-*-*"]] {
+ if [check-flags $args] {
upvar dg-do-what dg-do-what
set dg-do-what [list [lindex ${dg-do-what} 0] "N" "P"]
}
-
- # Any value in this variable was left over from an earlier test.
- set compiler_flags ""
}
}
}
set args [lreplace $args 0 0]
- set selector "target [join [lindex $args 1]]"
+ set selector [list target [lindex $args 1]]
if { [dg-process-target $selector] == "S" } {
global compiler_conditional_xfail_data
set compiler_conditional_xfail_data [lreplace $args 1 1 "*-*-*"]
}
}
+# Record whether the program is expected to return a nonzero status.
+
+set shouldfail 0
+
+proc dg-shouldfail { args } {
+ # Don't bother if we're already skipping the test.
+ upvar dg-do-what dg-do-what
+ if { [lindex ${dg-do-what} 1] == "N" } {
+ return
+ }
+
+ global shouldfail
+
+ set args [lreplace $args 0 0]
+ if { [llength $args] > 1 } {
+ set selector [list target [lindex $args 1]]
+ if { [dg-process-target $selector] == "S" } {
+ # The target matches, now check the flags. These variables
+ # are defined in DejaGnu's dg-test, needed by check-flags.
+ upvar dg-extra-tool-flags dg-extra-tool-flags
+ upvar tool_flags tool_flags
+
+ if [check-flags $args] {
+ set shouldfail 1
+ }
+ }
+ } else {
+ set shouldfail 1
+ }
+}
+
# Intercept the call to the DejaGnu version of dg-process-target to
# support use of an effective-target keyword in place of a list of
# target triplets to xfail or skip a test.