[pushed,gdb/testsuite] Add another xfail case in gdb.python/py-record-btrace.exp

Message ID 20230301124424.28398-1-tdevries@suse.de
State Committed
Headers
Series [pushed,gdb/testsuite] Add another xfail case in gdb.python/py-record-btrace.exp |

Commit Message

Tom de Vries March 1, 2023, 12:44 p.m. UTC
  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(-)


base-commit: d80081ef39c729b0f5f548c9567be2d80dcc2fd0
  

Patch

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"