]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
gdb/testsuite: add a new check-all-boards target
authorAndrew Burgess <aburgess@redhat.com>
Thu, 26 Oct 2023 11:05:06 +0000 (12:05 +0100)
committerAndrew Burgess <aburgess@redhat.com>
Tue, 28 Nov 2023 10:36:43 +0000 (10:36 +0000)
The make-check-all.sh script (gdb/testsuite/make-check-all.sh) is
great, it makes it super easy to run some test(s) using all the
available board files.

This commit aims to make this script even easier to access by adding a
check-all-boards target to the GDB Makefile.  This new target checks
for (and requires) a number of environment variables, so the target
should be used like this:

  make check-all-boards GDB_TARGET_USERNAME=remote-target \
                        GDB_HOST_USERNAME=remote-host \
TESTS="gdb.base/break.exp"

Where GDB_TARGET_USERNAME and GDB_HOST_USERNAME are the user names
that should be passed to the make-check-all.sh --target-user and
--host-user command line options respectively.

My personal intention is to set these variables in my environment, so
all I'll need to do is:

  make check-all-boards TESTS="gdb.base/break.exp"

The make rule always passes --keep-results to the make-check-all.sh
script, as I find that the most useful.  It's super frustrating to run
the tests and realise you forgot that option and the results have been
discarded.

gdb/Makefile.in
gdb/testsuite/Makefile.in
gdb/testsuite/README

index a50628e8ed00f1bfd8c8212d832ed5c74e1c6fb7..3510577f0903d72f389e3b4646cbab0138958e68 100644 (file)
@@ -1971,6 +1971,14 @@ check-parallel: force
          $(MAKE) $(TARGET_FLAGS_TO_PASS) check-parallel; \
        else true; fi
 
+check-all-boards: force
+       @if [ -f testsuite/Makefile ]; then \
+         rootme=`pwd`; export rootme; \
+         rootsrc=`cd $(srcdir); pwd`; export rootsrc; \
+         cd testsuite; \
+         $(MAKE) $(TARGET_FLAGS_TO_PASS) check-all-boards; \
+       else true; fi
+
 # The idea is to parallelize testing of multilibs, for example:
 #   make -j3 check//sh-hms-sim/{-m1,-m2,-m3,-m3e,-m4}/{,-nofpu}
 # will run 3 concurrent sessions of check, eventually testing all 10
index 3fc9a907f5b327fca0376d4f19ebdabbe7c31d30..3488e6acc48f8e0e84ecf1db97c9fb2ddfdb3f4f 100644 (file)
@@ -368,6 +368,25 @@ check-perf: all $(abs_builddir)/site.exp
        @if test ! -d gdb.perf; then mkdir gdb.perf; fi
        $(DO_RUNTEST) --directory=gdb.perf --outdir gdb.perf GDB_PERFTEST_MODE=$(GDB_PERFTEST_MODE) $(RUNTESTFLAGS) $(TIMESTAMP)
 
+
+check-all-boards: all $(abs_builddir)/site.exp
+       @if [ -z "$(GDB_TARGET_USERNAME)" ]; then \
+               echo "Must define GDB_TARGET_USERNAME"; \
+               false; \
+       fi
+       @if [ -z "$(GDB_HOST_USERNAME)" ]; then \
+               echo "Must define GDB_HOST_USERNAME"; \
+               false; \
+       fi
+       @if [ -z "$(TESTS)" ]; then \
+               echo "Must define TESTS"; \
+               false; \
+       fi
+       ${abs_srcdir}/make-check-all.sh --keep-results \
+               --host-user "$(GDB_HOST_USERNAME)" \
+               --target-user "$(GDB_TARGET_USERNAME)" \
+               "$(TESTS)"
+
 force:;
 
 clean mostlyclean:
index 330a385f3494cf9d31bf286e9de3a90b02cc23cc..843d8269b0cadfd8a9b98c66a4518f0c3bffca60 100644 (file)
@@ -328,6 +328,48 @@ For example, to turn on gdbserver debugging, you can do:
 
        make check GDBSERVER_DEBUG="debug,replay"
 
+GDB_TARGET_USERNAME
+GDB_HOST_USERNAME
+
+These settings are only used with the check-all-boards target, and
+should be the usernames of two separate users on the local machine,
+both of which the current user can ssh to without a password.
+
+These users will be used by board files that simulate remote targets
+by switching to a different user on the same machine.  These users
+will have random files copied into their $HOME directories, so it is a
+good idea to setup new users just for this purpose.
+
+Testing All Simple Boards
+*************************
+
+There are a number of boards that ship with GDB that simulate common
+debug scenarios.  For example by sshing to a different user on the
+local machine and running gdbserver as this alternative user we aim to
+simulate a true remote debug experience.
+
+There is a script binutils-gdb/gdb/testssuite/make-check-all.sh which
+can be used to run a defined set of tests using all of the available
+simple board files.  Support for using this script is also included in
+GDB's makefile, and can be used as:
+
+  make check-all-boards GDB_TARGET_USERNAME=remote-target \
+                       GDB_HOST_USERNAME=remote-host \
+                       TESTS="gdb.base/break.exp"
+
+The 'remote-target' and 'remote-host' can be replaced with any user
+names on the local machine, the only requirements are that the current
+user must be able to ssh to these users without a password, and these
+users must be happy to have arbitrary files copied into their $HOME
+directory.  Ideally, these users would be setup just for GDB testing.
+
+The check-all-boards target requires that TESTS be defined, though it
+is fine to include multiple tests.
+
+The results are preserved, and can be found in the directory
+gdb/testsuite/check-all/.  The results are split by the board file
+used.
+
 Architecture-specific Parameters
 ******************************