3 # Copyright (C) 2023-2024 Free Software Foundation, Inc.
4 # This program is free software; you can redistribute it and/or modify
5 # it under the terms of the GNU General Public License as published by
6 # the Free Software Foundation; either version 3 of the License, or
7 # (at your option) any later version.
9 # This program is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 # GNU General Public License for more details.
14 # You should have received a copy of the GNU General Public License
15 # along with this program. If not, see <http://www.gnu.org/licenses/>.
17 # Run make check with all boards from gdb/testsuite/boards.
19 # It is recommended to create users on the local system that will act as
20 # "remote host" and "remote target", for the boards that use them.
21 # Pass their usernames to --host-user and --target-user. This helps
24 # - remote host/target boards will use $HOME and leave (potentially
25 # lots of) files behind,
26 # - it enables more strict checking of build/host/target file
28 # - it prevents a command running on one "machine" to kill or send a
29 # signal to a process on another machine.
31 # Recommended usage example:
33 # bash$ cd $objdir/gdb/testsuite
34 # bash$ $srcdir/testsuite/gdb/make-check-all.sh \
35 # --host-user remote-host \
36 # --target-user remote-target \
37 # gdb.base/advance.exp
41 # Boards that run the host tools (compiler, gdb) on a remote host.
44 local-remote-host-notty
47 # Boards that use gdbserver to launch target executables on local target.
49 native-extended-gdbserver
51 native-stdio-gdbserver
54 # Boards that use gdbserver to launch target executables on a remote target.
55 remote_gdbserver_boards
=(
56 remote-gdbserver-on-localhost
57 remote-stdio-gdbserver
60 # Boards that run compiler, gdb and target executables on a remote machine
61 # that serves both as host and target.
63 local-remote-host-native
66 # Boards that run everything on local target and local host.
85 # Get RUNTESTFLAGS needed for specific boards.
92 local-remote-host-native
)
99 remote-stdio-gdbserver
)
102 "REMOTE_HOSTNAME=localhost"
104 if [ "$target_user" != "" ]; then
107 "REMOTE_USERNAME=$target_user"
112 "REMOTE_USERNAME=$USER"
116 remote-gdbserver-on-localhost
)
117 if [ "$target_user" != "" ]; then
120 "REMOTE_TARGET_USERNAME=$target_user"
124 local-remote-host|local-remote-host-notty
)
125 if [ "$host_user" != "" ]; then
128 "REMOTE_HOST_USERNAME=$host_user"
133 "REMOTE_HOST_USERNAME=$USER"
142 # Summarize make check output.
148 # We need the sort -u, because some items, for instance "# of expected
149 # passes" are output twice.
150 grep -E "^(#|FAIL:|ERROR:|WARNING:)" \
155 # Run make check, and possibly save test results.
159 echo "RTF: ${rtf[*]}"
168 RUNTESTFLAGS
="${rtf[*]} ${tests[*]}" \
173 if $keep_results; then
174 # Set cfg to identifier unique to host/target board combination.
175 if [ "$h" = "" ]; then
176 if [ "$b" = "" ]; then
189 cp gdb.
sum gdb.log
"$dir"
191 # Record the 'make check' command to enable easy re-running.
192 echo "make check RUNTESTFLAGS=\"${rtf[*]} ${tests[*]}\"" \
193 > "$dir/make-check.sh"
197 # Set default values for global vars and modify according to command line
211 # Parse command line arguments.
212 while [ $# -gt 0 ]; do
247 # Cleanup function, scheduled to run on exit.
250 if [ "$tmpdir" != "" ]; then
252 echo "keeping tmp dir $tmpdir"
259 # Top-level function, called with command line arguments of the script.
262 # Parse command line arguments.
265 # Create tmpdir and schedule cleanup.
271 echo "TESTS: ${tests[*]}"
274 # Variables that point to current host (h) and target board (b) when
275 # executing do_tests.
279 # For reference, run the tests without any explicit host or target board.
284 # Run the boards for local host and local target.
285 for b
in "${target_boards[@]}"; do
286 echo "TARGET BOARD: $b"
294 # Run the boards that use gdbserver, for local host, and for both local and
296 for b
in "${gdbserver_boards[@]}" "${remote_gdbserver_boards[@]}"; do
297 echo "TARGET BOARD: $b"
305 # Run the boards that use remote host, in combination with boards that use
306 # gdbserver on remote target.
307 for h
in "${remote_host_boards[@]}"; do
308 for b
in "${remote_gdbserver_boards[@]}"; do
309 echo "HOST BOARD: $h, TARGET BOARD: $b"
321 # Run the boards that function as both remote host and remote target.
322 for b
in "${host_target_boards[@]}"; do
323 echo "HOST/TARGET BOARD: $b"
333 # Call top-level function with command line arguments.