From 364bb90300750187bfe01baf890299fc25d20614 Mon Sep 17 00:00:00 2001 From: Tom de Vries Date: Wed, 28 Oct 2020 10:01:32 +0100 Subject: [gdb/testsuite] Fix gdb.cp/nsalias.exp with -readnow When running test-case gdb.cp/nsalias.exp with target board readnow, we get: ... FAIL: gdb.cp/nsalias.exp: complaint for too many recursively imported \ declarations ... The complaint is not detected, because: - the complaint is triggered during the file command instead of during "print N100::x" - the "set complaints 1" is not effective because it's issued after the file command Fix the FAIL by setting the complaints limit earlier, and detecting the complaint also during the file command. Tested on x86_64-linux. gdb/testsuite/ChangeLog: 2020-10-28 Tom de Vries * lib/gdb.exp (gdb_file_cmd): Set gdb_file_cmd_msg. * gdb.cp/nsalias.exp: Set complaints limit before file cmd. Expect complaint during file command for -readnow. --- gdb/testsuite/gdb.cp/nsalias.exp | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) (limited to 'gdb/testsuite/gdb.cp/nsalias.exp') diff --git a/gdb/testsuite/gdb.cp/nsalias.exp b/gdb/testsuite/gdb.cp/nsalias.exp index 892e5e2..a7163dc 100644 --- a/gdb/testsuite/gdb.cp/nsalias.exp +++ b/gdb/testsuite/gdb.cp/nsalias.exp @@ -314,9 +314,21 @@ if {[gdb_compile [list ${binfile}1.o ${binfile}3.o] \ return -1 } -clean_restart ${testfile}-r +clean_restart +# Set complaints before loading the file. Otherwise the complaint won't +# trigger for -readnow. gdb_test_no_output "set complaints 1" -gdb_test "print N100::x" \ - ".* has too many recursively imported declarations.*" \ - "complaint for too many recursively imported declarations" + +gdb_load [standard_output_file ${testfile}-r] + +set readnow_p [readnow] + +set test "complaint for too many recursively imported declarations" +set re ".* has too many recursively imported declarations.*" +if { $readnow_p } { + global gdb_file_cmd_msg + gdb_assert {[regexp $re $gdb_file_cmd_msg]} $test +} else { + gdb_test "print N100::x" $re $test +} -- cgit v1.1