2 # Remote testing of Automake tarballs made easy.
3 # This script requires Bash 4.x or later.
4 # TODO: some documentation would be nice ...
9 fatal () { echo "$me: $*" >&2; exit 1; }
12 test_script=$HOME/.am-test/run
13 if test -f "$test_script" && test -x "$test_script"; then
16 nice -n19 ./configure && nice -n19 make -j10 check
22 while test $# -gt 0; do
24 -b|--batch) interactive=0;;
25 -c|--command) cmd=${2-}; shift;;
26 -*) fatal "'$1': invalid option";;
27 *) remote=$1; shift; break;;
31 [[ -n $remote ]] || fatal "no remote given"
33 if ((interactive)); then
35 AM_TESTSUITE_FAILED=yes
36 export AM_TESTSUITE_FAILED
37 # We should not modify the environment with which the failed
38 # tests have run, hence do not read ".profile", ".bashrc", and
40 exec bash --noprofile --norc -i
46 tarball=$(echo automake*.tar.xz)
49 *' '*) fatal "too many automake tarballs: $tarball";;
52 test -f $tarball || fatal "no automake tarball found"
54 distdir=${tarball%%.tar.xz}
56 env='PATH=$HOME/bin:$PATH'
58 env+=" TERM='$TERM' AM_COLOR_TESTS=always"
62 # $ ssh "command" arg-1 ... arg-2
63 # but doesn't work as expected. So we need the following hack
64 # to propagate the command line arguments to the remote shell.
68 *\'*) quoted_args+=" "$(printf '%s\n' "$1" | sed "s/'/'\\''/g");;
69 *) quoted_args+=" '$1'";;
77 scp $tarball $remote:tmp/
79 # Multiple '-t' to force tty allocation.
81 set -x; set -e; set -u;
84 if test -e $distdir; then
85 # Use 'perl', not only 'rm -rf', to correctly handle read-only
86 # files or directory. Fall back to 'rm' if something goes awry.
87 perl -e 'use File::Path qw/rmtree/; rmtree(\"$distdir\")' \
88 || rm -rf $distdir || exit 1
91 xz -dc $tarball | tar xf -
94 am_extra_acdir=$HOME/.am-test/extra-aclocal
95 am_extra_bindir=$HOME/.am-test/extra-bin
96 am_extra_setup=$HOME/.am-test/extra-setup.sh
97 if test -d "$am_extra_acdir"; then
98 export ACLOCAL_PATH=$am_extra_acdir${ACLOCAL_PATH+":$ACLOCAL_PATH"}
100 if test -d "$am_extra_bindir"; then
101 export PATH=$am_extra_bindir:$PATH
105 if test -f \"\$am_extra_setup\"; then
106 . \"\$am_extra_setup\"
108 ($cmd) || $do_on_error