[gcc/devel/c++-modules] testsuite: Add target/xfail argument to check-function-bodies

Nathan Sidwell nathan@gcc.gnu.org
Fri Jan 24 14:40:00 GMT 2020


https://gcc.gnu.org/g:4c33b2daeb5a87aedef77993971db1a1a1c291e6

commit 4c33b2daeb5a87aedef77993971db1a1a1c291e6
Author: Richard Sandiford <richard.sandiford@arm.com>
Date:   Mon Jan 20 19:38:12 2020 +0000

    testsuite: Add target/xfail argument to check-function-bodies
    
    check-function-bodies allows individual function tests to be
    annotated with target/xfail selectors, but sometimes it's
    useful to have the same selector for all functions.
    
    2020-01-23  Richard Sandiford  <richard.sandiford@arm.com>
    
    gcc/
    	* doc/sourcebuild.texi (check-function-bodies): Add an
    	optional target/xfail selector.
    
    gcc/testsuite/
    	* lib/scanasm.exp (check-function-bodies): Add an optional
    	target/xfail selector.

Diff:
---
 gcc/ChangeLog                 |  5 +++++
 gcc/doc/sourcebuild.texi      |  2 +-
 gcc/testsuite/ChangeLog       |  5 +++++
 gcc/testsuite/lib/scanasm.exp | 18 ++++++++++++++----
 4 files changed, 25 insertions(+), 5 deletions(-)

diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index d16ebbb..d634b37 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,5 +1,10 @@
 2020-01-23  Richard Sandiford  <richard.sandiford@arm.com>
 
+	* doc/sourcebuild.texi (check-function-bodies): Add an
+	optional target/xfail selector.
+
+2020-01-23  Richard Sandiford  <richard.sandiford@arm.com>
+
 	PR rtl-optimization/93124
 	* auto-inc-dec.c (merge_in_block): Don't add auto inc/decs to
 	bare USE and CLOBBER insns.
diff --git a/gcc/doc/sourcebuild.texi b/gcc/doc/sourcebuild.texi
index af711ad..1f412de 100644
--- a/gcc/doc/sourcebuild.texi
+++ b/gcc/doc/sourcebuild.texi
@@ -2723,7 +2723,7 @@ assembly output.
 Passes if @var{symbol} is not defined as a hidden symbol in the test's
 assembly output.
 
-@item check-function-bodies @var{prefix} @var{terminator} [@var{option}]
+@item check-function-bodies @var{prefix} @var{terminator} [@var{option} [@{ target/xfail @var{selector} @}]]
 Looks through the source file for comments that give the expected assembly
 output for selected functions.  Each line of expected output starts with the
 prefix string @var{prefix} and the expected output for a function as a whole
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index d10c6fc..04f3e80 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,5 +1,10 @@
 2020-01-23  Richard Sandiford  <richard.sandiford@arm.com>
 
+	* lib/scanasm.exp (check-function-bodies): Add an optional
+	target/xfail selector.
+
+2020-01-23  Richard Sandiford  <richard.sandiford@arm.com>
+
 	* gcc.dg/torture/pr93124.c: New test.
 
 2020-01-22  David Malcolm  <dmalcolm@redhat.com>
diff --git a/gcc/testsuite/lib/scanasm.exp b/gcc/testsuite/lib/scanasm.exp
index ec91788..5ca58d4 100644
--- a/gcc/testsuite/lib/scanasm.exp
+++ b/gcc/testsuite/lib/scanasm.exp
@@ -604,7 +604,7 @@ proc check_function_body { functions name body_regexp } {
 
 # Check the implementations of functions against expected output.  Used as:
 #
-# { dg-do { check-function-bodies PREFIX TERMINATOR[ OPTION] } }
+# { dg-do { check-function-bodies PREFIX TERMINATOR[ OPTION[ SELECTOR]] } }
 #
 # See sourcebuild.texi for details.
 
@@ -612,11 +612,11 @@ proc check-function-bodies { args } {
     if { [llength $args] < 2 } {
 	error "too few arguments to check-function-bodies"
     }
-    if { [llength $args] > 3 } {
+    if { [llength $args] > 4 } {
 	error "too many arguments to check-function-bodies"
     }
 
-    if { [llength $args] == 3 } {
+    if { [llength $args] >= 3 } {
 	set required_flag [lindex $args 2]
 
 	upvar 2 dg-extra-tool-flags extra_tool_flags
@@ -631,6 +631,16 @@ proc check-function-bodies { args } {
 	}
     }
 
+    set xfail_all 0
+    if { [llength $args] >= 4 } {
+	switch [dg-process-target [lindex $args 3]] {
+	    "S" { }
+	    "N" { return }
+	    "F" { set xfail_all 1 }
+	    "P" { }
+	}
+    }
+
     set testcase [testname-for-summary]
     # The name might include a list of options; extract the file name.
     set filename [lindex $testcase 0]
@@ -694,7 +704,7 @@ proc check-function-bodies { args } {
 	    }
 	} elseif { [string equal -length $terminator_len $line $terminator] } {
 	    if { ![string equal $selector "N"] } {
-		if { [string equal $selector "F"] } {
+		if { $xfail_all || [string equal $selector "F"] } {
 		    setup_xfail "*-*-*"
 		}
 		set testname "$testcase check-function-bodies $function_name"



More information about the Gcc-cvs mailing list