2 # Remote testing of Automake tarballs made easy.
3 # This script requires Bash 4.x or later.
5 # Copyright (C) 2013-2024 Free Software Foundation, Inc.
7 # This program is free software; you can redistribute it and/or modify
8 # it under the terms of the GNU General Public License as published by
9 # the Free Software Foundation; either version 2, or (at your option)
12 # This program is distributed in the hope that it will be useful,
13 # but WITHOUT ANY WARRANTY; without even the implied warranty of
14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 # GNU General Public License for more details.
17 # You should have received a copy of the GNU General Public License
18 # along with this program. If not, see <https://www.gnu.org/licenses/>.
20 # TODO: some documentation would be nice ...
25 fatal
() { echo "$me: $*" >&2; exit 1; }
28 test_script=$HOME/.am-test/run
29 if test -f "$test_script" && test -x "$test_script"; then
32 nice -n19 ./configure && nice -n19 make -j10 check
39 while test $# -gt 0; do
41 -b|
--batch) interactive
=0;;
42 -c|
--command) cmd
=${2-}; shift;;
43 # Useful to avoid spurious errors due to skewed clocks between
44 # the system where the tarball is built and the target system.
45 -S|
--sleep) maybe_sleep
="sleep ${2-}"; shift;;
46 -*) fatal
"'$1': invalid option";;
47 *) remote
=$1; shift; break;;
51 [[ -n $remote ]] || fatal
"no remote given"
53 if ((interactive
)); then
55 AM_TESTSUITE_FAILED=yes
56 export AM_TESTSUITE_FAILED
57 # We should not modify the environment with which the failed
58 # tests have run, hence do not read ".profile", ".bashrc", and
60 exec bash --noprofile --norc -i
66 tarball
=$
(echo automake
*.
tar.xz
)
69 *' '*) fatal
"too many automake tarballs: $tarball";;
72 test -f $tarball || fatal
"no automake tarball found"
74 distdir
=${tarball%%.tar.xz}
76 env
='PATH=$HOME/bin:$PATH'
78 env
+=" TERM='$TERM' AM_COLOR_TESTS=always"
82 # $ ssh "command" arg-1 ... arg-2
83 # but doesn't work as expected. So we need the following hack
84 # to propagate the command line arguments to the remote shell.
88 *\'*) quoted_args
+=" "$
(printf '%s\n' "$1" |
sed "s/'/'\\''/g");;
89 *) quoted_args
+=" '$1'";;
97 scp
$tarball $remote:tmp
/
101 # Multiple '-t' to force tty allocation.
103 set -x; set -e; set -u;
106 if test -e $distdir; then
107 # Use 'perl', not only 'rm -rf', to correctly handle read-only
108 # files or directory. Fall back to 'rm' if something goes awry.
109 perl -e 'use File::Path qw/rmtree/; rmtree(\"$distdir\")' \
110 || rm -rf $distdir || exit 1
115 am_extra_acdir=$HOME/.am-test/extra-aclocal
116 am_extra_bindir=$HOME/.am-test/extra-bin
117 am_extra_setup=$HOME/.am-test/extra-setup.sh
118 if test -d "$am_extra_acdir"; then
119 export ACLOCAL_PATH=$am_extra_acdir${ACLOCAL_PATH+":$ACLOCAL_PATH"}
121 if test -d "$am_extra_bindir"; then
122 export PATH=$am_extra_bindir:$PATH
125 xz -dc $tarball | tar xf -
127 if test -f \"\$am_extra_setup\"; then
128 . \"\$am_extra_setup\"
130 ($cmd) || $do_on_error