From: Andrew Burgess Date: Tue, 3 Jun 2025 13:26:50 +0000 (+0100) Subject: gdb/testsuite: use TESTS from make-check-all.sh X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=c7658b9d8942ae6fbee93e0d3db8a81532f8abac;p=thirdparty%2Fbinutils-gdb.git gdb/testsuite: use TESTS from make-check-all.sh Update the make-check-all.sh script to use TESTS rather than passing the test names within RUNTESTFLAGS. This addresses the following issue: I was running some tests like this: make -C gdb check-all-boards TESTS="gdb.base/break*.exp" And I was finding that I would get lots of DUPLICATE test results, which is not what I expected. What's happening here is that the 'make check-all-boards' rule runs the 'make-check-all.sh' script, which then runs 'make check' with various board files. However, passing TESTS=... to the initial 'make check-all-boards' command invocation automatically causes the TESTS value to be added to the MAKEFLAGS environment variable, this is then picked up by the later calls to 'make check'. Now, in GDB's testfile/Makefile, we check for TESTS, and if this is set, we expand the value and set `expanded_tests_or_none`. Otherwise, if TESTS is not set, expanded_tests_or_none is left empty. Finally, when handling 'make check', the value of `expanded_tests_or_none` is passed through to dejagnu, along with the RUNTESTFLAGS value. What this means is that, when make-check-all.sh passes the test names in the RUNTESTFLAGS, then dejagnu ends up seeing the list of tests twice, once from RUNTESTFLAGS, and once from expanded_tests_or_none, and this is why I was seeing duplicate testnames. The easiest fix for the above is to have make-check-all.sh pass the test names using TESTS="...", this will override the TESTS="..." value already present in MAKEFLAGS, and means dejagnu will see the test names just once. Additionally, this is a start towards allowing parallel test running from the make-check-all.sh script. Parallel test running only works if the test names are passed in TESTS, and not in RUNTESTFLAGS. Currently, in testsuite/Makefile, if RUNTESTFLAGS is not empty, then we force single threaded test running. But with this change, at least for the `local` board, we can now benefit from multi-threaded test running, as this board has an empty RUNTESTFLAGS now. For the other boards we'd need to set FORCE_PARALLEL in order to benefit from parallel test running, but we'll need to double check that all the board files actually support parallel test running first, so I'm leaving that for another day. --- diff --git a/gdb/testsuite/make-check-all.sh b/gdb/testsuite/make-check-all.sh index c2fbadb88df..ab7257476c3 100755 --- a/gdb/testsuite/make-check-all.sh +++ b/gdb/testsuite/make-check-all.sh @@ -192,7 +192,7 @@ do_tests () # Run make check. make $maketarget \ - RUNTESTFLAGS="${rtf[*]} ${tests[*]}" \ + RUNTESTFLAGS="${rtf[*]}" TESTS="${tests[*]}" \ 2>&1 \ | summary @@ -216,7 +216,7 @@ do_tests () cp gdb.sum gdb.log "$dir" # Record the 'make check' command to enable easy re-running. - echo "make $maketarget RUNTESTFLAGS=\"${rtf[*]} ${tests[*]}\"" \ + echo "make $maketarget RUNTESTFLAGS=\"${rtf[*]}\" TESTS=\"${tests[*]}\"" \ > "$dir/make-check.sh" fi }