This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[testsuite] backport compat.exp changes to 3.4 (checked in)


This patch backports to 3.4-branch support for additional test directives
in compat tests, and fixes the ERRORS in compat tests on the 3.4 branch
from some of my backports from yesterday.  Tested by running the C compat
tests on powerpc64-linux with -m32/-m64; I'll do more complete testing
of this and other patches by the end of the day.  Checked in, since it
only affects compat tests and has been tested with those.

2005-12-21  Janis Johnson  <janis187@us.ibm.com>

	Backport:
	2004-11-30  Janis Johnson  <janis187@us.ibm.com>
	* lib/compat.exp (compat-get-options): Fix for use with dg-xfail-if.
	2004-05-25  Janis Johnson  <janis187@us.ibm.com>
	* lib/compat.exp (compat-get-options-main): New.
	(compat-get-options): Remove unneeded code, warn for ignored
	command.
	(compat-execute): Check flag set by dg-require-* commands, break up
	long lines.

Index: gcc/testsuite/lib/compat.exp
===================================================================
--- gcc/testsuite/lib/compat.exp	(revision 108904)
+++ gcc/testsuite/lib/compat.exp	(working copy)
@@ -1,4 +1,4 @@
-# Copyright (C) 2002 Free Software Foundation, Inc.
+# Copyright (C) 2002, 2003, 2004 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
@@ -147,22 +147,52 @@
 }
 
 #
-# compat-get-options -- get special tool flags to use for a source file
+# compat-get-options-main -- get target requirements for a test and
+# options for the primary source file and the test as a whole
 #
-# SRC is the full patchname of the source file.
+# SRC is the full pathname of the primary source file.
+#
+proc compat-get-options-main { src } {
+    # dg-options sets a variable called dg-extra-tool-flags.
+    set dg-extra-tool-flags ""
+
+    # dg-require-* sets dg-do-what.
+    upvar dg-do-what dg-do-what 
+
+    set tmp [dg-get-options $src]
+    foreach op $tmp {
+	set cmd [lindex $op 0]
+	if { ![string compare "dg-options" $cmd] \
+	     || [string match "dg-require-*" $cmd]  } {
+	    set status [catch "$op" errmsg]
+	    if { $status != 0 } {
+		perror "src: $errmsg for \"$op\"\n"
+		unresolved "$src: $errmsg for \"$op\""
+		return
+	    }
+	} elseif { ![string compare "dg-xfail-if" $cmd] } {
+	    warning "compat.exp does not support $cmd in primary source file"
+	} else {
+	    # Ignore unrecognized dg- commands, but warn about them.
+	    warning "compat.exp does not support $cmd"
+	}
+    }
+
+    # Return flags to use for compiling the primary source file and for
+    # linking.
+    return ${dg-extra-tool-flags}
+}
+
+#
+# compat-get-options -- get special tool flags to use for a secondary
+# source file
+#
+# SRC is the full pathname of the source file.
 # The result is a list of options to use.
 #
 # This code is copied from proc dg-test in dg.exp from DejaGNU.
 #
 proc compat-get-options { src } {
-    # Define our own special function `unknown` so we catch spelling errors.
-    # But first rename the existing one so we can restore it afterwards.
-    catch {rename dg-save-unknown ""}
-    rename unknown dg-save-unknown
-    proc unknown { args } {
-	return -code error "unknown dg option: $args"
-    }
-
     # dg-options sets a variable called dg-extra-tool-flags.
     set dg-extra-tool-flags ""
 
@@ -170,26 +200,28 @@
     global compiler_conditional_xfail_data
     set compiler_conditional_xfail_data ""
 
+    # dg-xfail-if needs access to dg-do-what.
+    upvar dg-do-what dg-do-what 
+
     set tmp [dg-get-options $src]
     foreach op $tmp {
 	set cmd [lindex $op 0]
-	if { ![string compare "dg-options" $cmd] || ![string compare "dg-xfail-if" $cmd] } {
+	if { ![string compare "dg-options" $cmd] \
+	     || ![string compare "dg-xfail-if" $cmd] } {
 	    set status [catch "$op" errmsg]
 	    if { $status != 0 } {
 		perror "src: $errmsg for \"$op\"\n"
 		unresolved "$src: $errmsg for \"$op\""
 		return
 	    }
+	} elseif { [string match "dg-require-*" $cmd] } {
+	    warning "compat.exp does not support $cmd in secondary source files"
 	} else {
 	    # Ignore unrecognized dg- commands, but warn about them.
 	    warning "compat.exp does not support $cmd"
 	}
     }
 
-    # Restore normal error handling.
-    rename unknown ""
-    rename dg-save-unknown unknown
-
     return ${dg-extra-tool-flags}
 }
 
@@ -209,6 +241,21 @@
     global testcase
     global gluefile
     global compiler_conditional_xfail_data
+    global dg-do-what-default
+
+    # Get extra flags for this test from the primary source file, and
+    # process other dg-* options that this suite supports.  Warn about
+    # unsupported flags.
+    verbose "compat-execute: $src1" 1
+    set dg-do-what [list ${dg-do-what-default} "" P]
+    set extra_flags_1 [compat-get-options-main $src1]
+
+    # Check whether this test is supported for this target.
+    if { [lindex ${dg-do-what} 1 ] == "N" } {
+	unsupported "$src1"
+	verbose "$src1 not supported on this target, skipping it" 3
+	return
+    }
 
     # Set up the names of the other source files.
     regsub "_main.*" $src1 "" base
@@ -219,7 +266,6 @@
     # Use the dg-options mechanism to specify extra flags for this test. 
     # The extra flags in each file are used to compile that file, and the
     # extra flags in *_main.* are also used for linking.
-    set extra_flags_1 [compat-get-options $src1]
     set extra_flags_2 [compat-get-options $src2]
     set compile_xfail_2 $compiler_conditional_xfail_data
     set extra_flags_3 [compat-get-options $src3]
@@ -241,6 +287,10 @@
     if {[string first "$srcdir/" "$src1"] == 0} {
 	set testcase [string range "$src1" [string length "$srcdir/"] end]
     }
+    if {[string first "$tmpdir/" "$testcase"] == 0} {
+	set testcase [string range "$testcase" [string length "$tmpdir/"] end]
+	set testcase "tmpdir-$testcase"
+    }
     regsub "_main.*" $testcase "" testcase
     # Set up the base name of executable files so they'll be unique.
     regsub -all "\[./\]" $testcase "-" execbase
@@ -285,15 +335,19 @@
 	# later.  Skip this if we don't have an alternate compiler.
 	if { $use_alt != 0 } then {
 	    compat-use-alt-compiler
-	    compat-obj "$src2" "$obj2_alt" $alt_option $extra_flags_2 $optstr $compile_xfail_2
-	    compat-obj "$src3" "$obj3_alt" $alt_option $extra_flags_3 $optstr $compile_xfail_3
+	    compat-obj "$src2" "$obj2_alt" $alt_option $extra_flags_2 \
+		       $optstr $compile_xfail_2
+	    compat-obj "$src3" "$obj3_alt" $alt_option $extra_flags_3 \
+		       $optstr $compile_xfail_3
 	}
 
 	# Compile pieces with the compiler under test.
 	compat-use-tst-compiler
 	compat-obj "$src1" "$obj1" $tst_option $extra_flags_1 $optstr ""
-	compat-obj "$src2" "$obj2_tst" $tst_option $extra_flags_2 $optstr $compile_xfail_2
-	compat-obj "$src3" "$obj3_tst" $tst_option $extra_flags_3 $optstr $compile_xfail_3
+	compat-obj "$src2" "$obj2_tst" $tst_option $extra_flags_2 \
+		   $optstr $compile_xfail_2
+	compat-obj "$src3" "$obj3_tst" $tst_option $extra_flags_3 \
+		   $optstr $compile_xfail_3
 
 	# Link (using the compiler under test), run, and clean up tests.
 	compat-run "${obj2_tst}-${obj3_tst}" \


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]