This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [PATCH 3/3] gdb/testsuite: Handle targets with lots of registers
- From: Pedro Alves <palves at redhat dot com>
- To: Andrew Burgess <andrew dot burgess at embecosm dot com>, gdb-patches at sourceware dot org
- Cc: "Maciej W. Rozycki" <macro at mips dot com>
- Date: Fri, 4 May 2018 13:47:16 +0100
- Subject: Re: [PATCH 3/3] gdb/testsuite: Handle targets with lots of registers
- References: <cover.1523286728.git.andrew.burgess@embecosm.com> <f708d6f5e4f81f3f08c27916fb8d6a18d753cde8.1523286728.git.andrew.burgess@embecosm.com> <alpine.DEB.2.00.1804130017080.11756@tp.orcam.me.uk> <4273f7eb-464a-3abc-fc50-b6598ed3b896@redhat.com> <alpine.DEB.2.00.1804131425230.11756@tp.orcam.me.uk> <20180504120124.GK3375@embecosm.com>
On 05/04/2018 01:01 PM, Andrew Burgess wrote:
> Thanks for the review feedback.
>
> I've updated the patch below inline with Pedro's feedback, and
> included a header check as requested by Maciej. I tested this on
> x86-64 and against RiscV which is the target that was originally
> causing me problems.
Thanks.
> # Test for a regression where this command would internal-error if the
> -# program wasn't running.
> -gdb_test "maint print registers" "Name.*Nr.*Rel.*Offset.*Size.*Type.*"
> +# program wasn't running. If there's a lot of registers then this
> +# might overflow expect's buffers, so process the output line at a
> +# time.
> +set saw_registers 0
> +set saw_headers 0
> +set test "maint print registers"
> +gdb_test_multiple $test $test {
> + -re "\[^\r\n\]+Name\[^\r\n\]+Nr\[^\r\n\]+Rel\[^\r\n\]+Offset\[^\r\n\]+Size\[^\r\n\]+Type\[^\r\n\]+\[\r\n\]+" {
> + set saw_headers 1
> + exp_continue
> + }
> + -re "^\[^\r\n\]+\[0-9\]+\[^\r\n\]+\[0-9\]+\[^\r\n\]+\[0-9\]+\[^\r\n\]+\[0-9\]+\[^\r\n\]+\[\r\n\]+" {
> + set saw_registers 1
> + exp_continue
> + }
> + -re "^\\*\[0-9\]+\[^\r\n\]+\[\r\n\]+" {
> + exp_continue
> + }
> + -re "$gdb_prompt $" {
> + gdb_assert $saw_registers "$test: saw some registers"
> + gdb_assert $saw_headers "$test: saw header line"
We try to avoid the potential for different FAIL / PASS
names/messages. I.e., if the test times out, or gdb crashes,
you'll get "FAIL: $test" only , while if it reaches the prompt,
you'll get two tests recorded in gdb.sum. The idea of matching
FAIL/PASS is to make it easier for scripts to distinguish
regressions/progressions vs new failures/passes. (Text in
trailing ()s, like " (timeout)" is considered informational, and
can/should be stripped for test-matching purposes). If you want to
record that the register and headers were seen, better put it in gdb.log,
with send_log or verbose -log, and do:
gdb_assert {$saw_registers && $saw_headers} $test
OK with that change.
Thanks,
Pedro Alves