gnu_vector.exp: Respect `should_kfail' for PR8549

Message ID m3h9i9sf64.fsf@oc1027705133.ibm.com
State New, archived
Headers

Commit Message

Andreas Arnez Jan. 19, 2016, 4:32 p.m. UTC
  The gnu_vector test case yields a new FAIL on s390x:

  FAIL: gdb.base/gnu_vector.exp: verify vector return value

It was introduced by commit 77ae9c1933b50 "gdb.base/gnu_vector.exp:
Don't test output from the inferior".  That commit dropped the special
handling for GDB's inability (on some targets) to set the return value.

This change re-establishes the logic from before, converting the above
FAIL to a KFAIL (PRMS gdb/8549).

gdb/testsuite/ChangeLog:

	* gdb.base/gnu_vector.exp: Re-establish handling for should_kfail
	when GDB can not set the vector return value.
---
 gdb/testsuite/gdb.base/gnu_vector.exp | 14 +++++++++++++-
 1 file changed, 13 insertions(+), 1 deletion(-)
  

Comments

Yao Qi Jan. 19, 2016, 5:33 p.m. UTC | #1
Andreas Arnez <arnez@linux.vnet.ibm.com> writes:

> -gdb_test "p res" "\\{4, 2, 7, 6\\}.*" "verify vector return value"
> +set test "verify vector return value"
> +gdb_test_multiple "p res" $test {
> +    -re ".*= \\{4, 2, 7, 6\\}\r\n.*$gdb_prompt $" {
> +	pass $test
> +    }
> +    -re ".*= \\{10, 20, 48, 72\\}\r\n.*$gdb_prompt $" {
> +	if { $should_kfail } {
> +	    kfail "gdb/8549" $test
> +	} else {
> +	    fail $test
> +	}
> +    }
> +}

IMO, if GDB for a certain target doesn't handle "return" and "finish"
correctly, the return value can be some random results.  Why do we match
"\\{10, 20, 48, 72\\}" here?  I presume that because "10, 20, 48, 72"
was returned in the previous test.  Do *all* targets don't correctly handle
"return" and "finish" return "\\{10, 20, 48, 72\\}"?  In other words, if
we know it is broken already, why do still match the output?  We can
kfail it according to the target triplet.
  

Patch

diff --git a/gdb/testsuite/gdb.base/gnu_vector.exp b/gdb/testsuite/gdb.base/gnu_vector.exp
index 6414afd..127c0b7 100644
--- a/gdb/testsuite/gdb.base/gnu_vector.exp
+++ b/gdb/testsuite/gdb.base/gnu_vector.exp
@@ -240,4 +240,16 @@  gdb_test_multiple "return (int4) \{4, 2, 7, 6\}" $test {
 }
 
 gdb_test "next" ""
-gdb_test "p res" "\\{4, 2, 7, 6\\}.*" "verify vector return value"
+set test "verify vector return value"
+gdb_test_multiple "p res" $test {
+    -re ".*= \\{4, 2, 7, 6\\}\r\n.*$gdb_prompt $" {
+	pass $test
+    }
+    -re ".*= \\{10, 20, 48, 72\\}\r\n.*$gdb_prompt $" {
+	if { $should_kfail } {
+	    kfail "gdb/8549" $test
+	} else {
+	    fail $test
+	}
+    }
+}