public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
* [pushed] [gdb/testsuite] Add another xfail case in gdb.python/py-record-btrace.exp
@ 2023-03-01 12:44 Tom de Vries
  0 siblings, 0 replies; only message in thread
From: Tom de Vries @ 2023-03-01 12:44 UTC (permalink / raw)
  To: gdb-patches

I ran into:
...
(gdb) PASS: gdb.python/py-record-btrace.exp: function call: \
  python print(c.prev)
python print(c == c.next.prev)^M
Traceback (most recent call last):^M
  File "<string>", line 1, in <module>^M
AttributeError: 'NoneType' object has no attribute 'prev'^M
Error while executing Python code.^M
(gdb) FAIL: gdb.python/py-record-btrace.exp: function call: \
  python print(c == c.next.prev)
...
due to having only 4 insn instead of 100:
...
python print(len(insn))^M
4^M
...

This could be caused by the same hw bug as we already have an xfail for, so
expand the xfail matching.

Tested on x86_64-linux.

PR testsuite/30185
Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=30185

Approved-By: Markus T. Metzger <markus.t.metzger@intel.com>
---
 gdb/testsuite/gdb.python/py-record-btrace.exp | 20 ++++++++++++++++++-
 1 file changed, 19 insertions(+), 1 deletion(-)

diff --git a/gdb/testsuite/gdb.python/py-record-btrace.exp b/gdb/testsuite/gdb.python/py-record-btrace.exp
index 703db0ce8e1..bd397d3c974 100644
--- a/gdb/testsuite/gdb.python/py-record-btrace.exp
+++ b/gdb/testsuite/gdb.python/py-record-btrace.exp
@@ -101,6 +101,25 @@ with_test_prefix "prepare record" {
 	return
     }
 
+    # Also handle the case that we're running into the hw bug without
+    # triggering a decode error.
+    gdb_test_multiple "python print(len(insn))" "" {
+	-re -wrap "100" {
+	    pass $gdb_test_name
+	}
+	-re -wrap "" {
+	    if { $have_xfail } {
+		xfail $gdb_test_name
+		set got_xfail 1
+	    } else {
+		fail $gdb_test_name
+	    }
+	}
+    }
+    if { $got_xfail } {
+	return
+    }
+
     gdb_test_no_output "python call = r.function_call_history"
     gdb_test_no_output "python i = insn\[0\]"
     gdb_test_no_output "python c = call\[0\]"
@@ -138,7 +157,6 @@ with_test_prefix "function call" {
 }
 
 with_test_prefix "list" {
-    gdb_test "python print(len(insn))" "100"
     gdb_test "python print(len(insn\[23:65\]))" "42"
     gdb_test "python print(insn\[17:\]\[2\].number)" "20"
     gdb_test "python print(i in insn)" "True"

base-commit: d80081ef39c729b0f5f548c9567be2d80dcc2fd0
-- 
2.35.3


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2023-03-01 12:44 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-03-01 12:44 [pushed] [gdb/testsuite] Add another xfail case in gdb.python/py-record-btrace.exp Tom de Vries

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).