From 2c29b1ed19711fa2a16558015e5a6b46a09aefeb Mon Sep 17 00:00:00 2001 From: Tom de Vries Date: Wed, 1 Mar 2023 13:44:04 +0100 Subject: [PATCH] [gdb/testsuite] Add another xfail case in gdb.python/py-record-btrace.exp 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 "", line 1, in ^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 --- 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" -- 2.30.2