diff mbox

[testsuite] xfail target-specific asms, & gcov

Message ID 4ED2A060.30802@acm.org
State New
Headers show

Commit Message

Nathan Sidwell Nov. 27, 2011, 8:41 p.m. UTC
I couldn't figure out a way to have a scan-assembler check be specific to a 
particular target and xfailed.  It appeared one could have one or the other, but 
not both.

this patch extends scan-assembler (and scan-assembler-not) to allow something like:
/* { dg-final { scan-assembler "\\.hidden\t__gcov___ZN1X4FinkEv" { target { ! 
*-*-darwin* } } { xfail *-*-* } } } */

If there's already a way to do this, I'm all ears.

The other part of the patch allows gcov tests to be xfailed, both the gcov 
processing itself, and individual line counts.  It appears that there used to be 
some support for this, but it had severely bit rotted.  For instance one will be 
able to append { xfail ... } to a count(...) line.

The goal of these patches is so I can xfail some of the recent gcov tests I've 
added when I revert part of the changes that are causing the problem left in 
PR51113.  That defect is showing that a deeper analysis is needed.  While I'm 
doing that, it'd be good to unbreak things even if it means losing some of the 
new feature I attempted to add.

ok?

nathan

Comments

Mike Stump Dec. 1, 2011, 3:39 p.m. UTC | #1
On Nov 27, 2011, at 3:41 PM, Nathan Sidwell <nathan@acm.org> wrote:
> this patch extends scan-assembler (and scan-assembler-not) to allow  
> something like:
> /* { dg-final { scan-assembler "\\.hidden 
> \t__gcov___ZN1X4FinkEv" { target { ! *-*-darwin* } } { xfail *-*- 
> * } } } */

> ok?

Almost...   Every test that can fail, should be able to pass and every  
test that can pass, should be able to fail.  The usual structure:

If (test fails)
   fail foo
else
   pass foo

Makes this trivially true.  In your patch, you alter the spelling of a  
test, never do that.  Once that is fixed, Ok.
Nathan Sidwell Dec. 1, 2011, 8:06 p.m. UTC | #2
On 12/01/11 15:39, Mike Stump wrote:

> Makes this trivially true. In your patch, you alter the spelling of a test,
> never do that. Once that is fixed, Ok.

Oh dear,  I didn't mean to do that.  Anyway, I decided to remove the visibility 
tests here for the moment, so the scanasm change is moot and not committed. 
Thanks for review anyway.

nathan
diff mbox

Patch

2011-11-27  Nathan Sidwell  <nathan@acm.org>

	* lib/scanasm.exp (dg-scan): Allow multiple target options.
	* lib/gcov.exp (verify-lines): Add support for xfailing.
	(run-gcov): Likewise.

Index: testsuite/lib/scanasm.exp
===================================================================
--- testsuite/lib/scanasm.exp	(revision 181744)
+++ testsuite/lib/scanasm.exp	(working copy)
@@ -37,12 +37,9 @@  proc dg-scan { name positive testcase ou
 	error "$name: too few arguments"
         return
     }
-    if { [llength $orig_args] > 2 } {
-	error "$name: too many arguments"
-	return
-    }
-    if { [llength $orig_args] >= 2 } {
-	switch [dg-process-target [lindex $orig_args 1]] {
+    set len [llength $orig_args]
+    for {set arg 1} {$arg < $len} {incr arg} {
+	switch [dg-process-target [lindex $orig_args $arg]] {
 	    "S" { }
 	    "N" { return }
 	    "F" { setup_xfail "*-*-*" }
Index: testsuite/lib/gcov.exp
===================================================================
--- testsuite/lib/gcov.exp	(revision 181744)
+++ testsuite/lib/gcov.exp	(working copy)
@@ -39,19 +39,28 @@  proc clean-gcov { testcase } {
 #
 proc verify-lines { testcase file } {
     #send_user "verify-lines\n"
+    global subdir
     set failed 0
     set fd [open $file r]
     while { [gets $fd line] >= 0 } {
         # We want to match both "-" and "#####" as count as well as numbers,
         # since we want to detect lines that shouldn't be marked as covered.
-	if [regexp "^ *(\[^:]*): *(\[0-9\\-#]+):.*count\\((\[0-9\\-#]+)\\)" \
-		"$line" all is n shouldbe] {
+	if [regexp "^ *(\[^:]*): *(\[0-9\\-#]+):.*count\\((\[0-9\\-#]+)\\)(.*)" \
+		"$line" all is n shouldbe rest] {
+	    if [regexp "^ *{(.*)}" $rest all xfailed] {
+		switch [dg-process-target $xfailed] {
+		    "N" { continue }
+		    "F" { setup_xfail "*-*-*" }
+		}
+	    }
 	    if { $is == "" } {
-		fail "$n:no data available for this line"
+		fail "$subdir/$testcase:$n:no data available for this line"
 		incr failed
 	    } elseif { $is != $shouldbe } {
-		fail "$n:is $is:should be $shouldbe"
+		fail "$subdir/$testcase:$n:is $is:should be $shouldbe"
 		incr failed
+	    } else {
+		pass "$subdir/$testcase:$n line count"
 	    }
 	}
     }
@@ -230,32 +239,36 @@  proc run-gcov { args } {
     global GCOV
     global srcdir subdir
 
-    set gcov_args [lindex $args end]
-
+    set gcov_args ""
     set gcov_verify_calls 0
     set gcov_verify_branches 0
-    set gcov_execute_xfail ""
-    set gcov_verify_xfail ""
+    set xfailed 0
 
     foreach a $args {
 	if { $a == "calls" } {
 	  set gcov_verify_calls 1
 	} elseif { $a == "branches" } {
 	  set gcov_verify_branches 1
+	} elseif { $gcov_args == "" } {
+	    set gcov_args $a
+	} else {
+	    switch [dg-process-target $a] {
+		"N" { return }
+		"F" { set xfailed 1 }
+	    }
 	}
     }
 
     # Extract the test name from the arguments.
     set testcase [lindex $gcov_args end]
 
-    if { $gcov_execute_xfail != "" } {
-	eval setup_xfail [split $gcov_execute_xfail]
-    }
-
     verbose "Running $GCOV $testcase" 2
     set testcase [remote_download host $testcase]
     set result [remote_exec host $GCOV $gcov_args]
     if { [lindex $result 0] != 0 } {
+	if { $xfailed } {
+	    setup_xfail "*-*-*"
+	}
 	fail "$subdir/$testcase gcov failed: [lindex $result 1]"
 	clean-gcov $testcase
 	return
@@ -264,16 +277,15 @@  proc run-gcov { args } {
     # Get the gcov output file after making sure it exists.
     set files [glob -nocomplain $testcase.gcov]
     if { $files == "" } {
+	if { $xfailed } {
+	    setup_xfail "*-*-*"
+	}
         fail "$subdir/$testcase gcov failed: $testcase.gcov does not exist"
         clean-gcov $testcase
         return
     }
     remote_upload host $testcase.gcov $testcase.gcov
 
-    if { $gcov_verify_xfail != "" } {
-	eval setup_xfail [split $gcov_verify_xfail]
-    }
-
     # Check that line execution counts are as expected.
     set lfailed [verify-lines $testcase $testcase.gcov]
 
@@ -293,6 +305,9 @@  proc run-gcov { args } {
     # Report whether the gcov test passed or failed.  If there were
     # multiple failures then the message is a summary.
     set tfailed [expr $lfailed + $bfailed + $cfailed]
+    if { $xfailed } {
+	setup_xfail "*-*-*"
+    }
     if { $tfailed > 0 } {
 	fail "$subdir/$testcase gcov: $lfailed failures in line counts, $bfailed in branch percentages, $cfailed in return percentages"
     } else {