[1/2] gdb/testsuite: log 'make check' command in make-check-all.sh

Message ID 047bb72318595c2c3e2435bc0b8ff062515c28e3.1699381067.git.aburgess@redhat.com
State New
Headers
Series Make make-check-all.sh more accessible |

Checks

Context Check Description
linaro-tcwg-bot/tcwg_gdb_build--master-arm success Testing passed
linaro-tcwg-bot/tcwg_gdb_build--master-aarch64 success Testing passed

Commit Message

Andrew Burgess Nov. 7, 2023, 6:18 p.m. UTC
  I have been making more use of the make-check-all.sh script to run
tests against all boards.

But one thing is pretty annoying.  When a test fails on some random
board, I have to run make-check-all.sh with --verbose and --dry-run in
order to see what RUNTESTFLAGS I should be using.

I always run with --keep-results on, so, in this commit, I propose
that, when --keep-results is on the 'make check' command will be
written out to a file within the stored results directory, like:

  check-all/BOARD_NAME/make-check.sh

then, if I want to rerun a test, I can just:

  sh check-all/BOARD_NAME/make-check.sh

and the test will be re-run for me.
---
 gdb/testsuite/make-check-all.sh | 4 ++++
 1 file changed, 4 insertions(+)
  

Comments

Tom de Vries Nov. 24, 2023, 3:36 p.m. UTC | #1
On 11/7/23 19:18, Andrew Burgess wrote:
> I have been making more use of the make-check-all.sh script to run
> tests against all boards.
> 

Hi Andrew,

Nice :)

> But one thing is pretty annoying.  When a test fails on some random
> board, I have to run make-check-all.sh with --verbose and --dry-run in
> order to see what RUNTESTFLAGS I should be using.
> 

I wondered why I haven't run into this problem, so I thought I describe 
the answer here, in case that's useful.

I have a setup where I have a test-case.sh file containing for instance:
...
rtf=$(cd src/gdb/testsuite; echo gdb.tui/*.exp gdb.python/tui*.exp)
...
and all my test scripts source it to determine what test-cases to run.

So, rerunning the same set of test-cases is trivial that way.

Then about the host/target board: my regular test script take the board 
files as argument, so if I see after running make-check-all.sh:
...
TARGET BOARD: dwarf4-gdb-index
...
and I want to rerun that configuration, I just run:
...
$ ./test.sh -dwarf4-gdb-index
...

I thought at some point about adding a similar syntax to 
make-check-all.sh, which could be a different way of handling the 
problem you describe.

> I always run with --keep-results on,

Me too.  Maybe we should make that the default?

> so, in this commit, I propose
> that, when --keep-results is on the 'make check' command will be
> written out to a file within the stored results directory, like:
> 
>    check-all/BOARD_NAME/make-check.sh
> 
> then, if I want to rerun a test, I can just:
> 
>    sh check-all/BOARD_NAME/make-check.sh
> 
> and the test will be re-run for me.

I think it's useful, both to use and as log file.

I also wonder whether it would be a good idea to:
- generate the file, and
- run it from make-check-all.sh.
That way we don't have to worry about keeping the "make check" command 
and the record of the "make check" command in sync.

Anyway, as is, LGTM.

Thanks,
- Tom

> ---
>   gdb/testsuite/make-check-all.sh | 4 ++++
>   1 file changed, 4 insertions(+)
> 
> diff --git a/gdb/testsuite/make-check-all.sh b/gdb/testsuite/make-check-all.sh
> index 7d8adb58e87..6d67567758f 100755
> --- a/gdb/testsuite/make-check-all.sh
> +++ b/gdb/testsuite/make-check-all.sh
> @@ -186,6 +186,10 @@ do_tests ()
>   
>   	mkdir -p "$dir"
>   	cp gdb.sum gdb.log "$dir"
> +
> +	# Record the 'make check' command to enable easy re-running.
> +	echo "make check RUNTESTFLAGS=\"${rtf[*]} ${tests[*]}\"" \
> +	     > "$dir/make-check.sh"
>       fi
>   }
>
  

Patch

diff --git a/gdb/testsuite/make-check-all.sh b/gdb/testsuite/make-check-all.sh
index 7d8adb58e87..6d67567758f 100755
--- a/gdb/testsuite/make-check-all.sh
+++ b/gdb/testsuite/make-check-all.sh
@@ -186,6 +186,10 @@  do_tests ()
 
 	mkdir -p "$dir"
 	cp gdb.sum gdb.log "$dir"
+
+	# Record the 'make check' command to enable easy re-running.
+	echo "make check RUNTESTFLAGS=\"${rtf[*]} ${tests[*]}\"" \
+	     > "$dir/make-check.sh"
     fi
 }