Hash :
dbe3eea4
Author :
Date :
2013-01-10T23:40:26
Rename 'maint/' -> 'maintainer/', for Git's sake
Otherwise, Git gets confused by the fact that a directory ('maint')
is named like a branch, and forces me to tweak the command line to
resolve the ambiguity for it.
* maint/: Rename ...
* maintainer/: ... like this.
* Makefile.am, GNUmakefile: Adjust.
Signed-off-by: Stefano Lattarini <stefano.lattarini@gmail.com>
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109
#!/usr/bin/env bash
# Remote testing of Automake tarballs made easy.
# This script requires Bash 4.x or later.
# TODO: some documentation would be nice ...
set -u
me=${0##*/}
fatal () { echo "$me: $*" >&2; exit 1; }
cmd='
test_script=$HOME/.am-test/run
if test -f "$test_script" && test -x "$test_script"; then
"$test_script" "$@"
else
nice -n19 ./configure && nice -n19 make -j10 check
fi
'
remote=
interactive=1
while test $# -gt 0; do
case $1 in
-b|--batch) interactive=0;;
-c|--command) cmd=${2-}; shift;;
-*) fatal "'$1': invalid option";;
*) remote=$1; shift; break;;
esac
shift
done
[[ -n $remote ]] || fatal "no remote given"
if ((interactive)); then
do_on_error='{
AM_TESTSUITE_FAILED=yes
export AM_TESTSUITE_FAILED
# We should not modify the environment with which the failed
# tests have run, hence do not read ".profile", ".bashrc", and
# company.
exec bash --noprofile --norc -i
}'
else
do_on_error='exit $?'
fi
tarball=$(echo automake*.tar.xz)
case $tarball in
*' '*) fatal "too many automake tarballs: $tarball";;
esac
test -f $tarball || fatal "no automake tarball found"
distdir=${tarball%%.tar.xz}
env='PATH=$HOME/bin:$PATH'
if test -t 1; then
env+=" TERM='$TERM' AM_COLOR_TESTS=always"
fi
# This is tempting:
# $ ssh "command" arg-1 ... arg-2
# but doesn't work as expected. So we need the following hack
# to propagate the command line arguments to the remote shell.
quoted_args=--
while (($# > 0)); do
case $1 in
*\'*) quoted_args+=" "$(printf '%s\n' "$1" | sed "s/'/'\\''/g");;
*) quoted_args+=" '$1'";;
esac
shift
done
set -e
set -x
scp $tarball $remote:tmp/
# Multiple '-t' to force tty allocation.
ssh -t -t $remote "
set -x; set -e; set -u;
set $quoted_args
cd tmp
if test -e $distdir; then
# Use 'perl', not only 'rm -rf', to correctly handle read-only
# files or directory. Fall back to 'rm' if something goes awry.
perl -e 'use File::Path qw/rmtree/; rmtree(\"$distdir\")' \
|| rm -rf $distdir || exit 1
test ! -e $distdir
fi
xz -dc $tarball | tar xf -
cd $distdir
"'
am_extra_acdir=$HOME/.am-test/extra-aclocal
am_extra_bindir=$HOME/.am-test/extra-bin
am_extra_setup=$HOME/.am-test/extra-setup.sh
if test -d "$am_extra_acdir"; then
export ACLOCAL_PATH=$am_extra_acdir${ACLOCAL_PATH+":$ACLOCAL_PATH"}
fi
if test -d "$am_extra_bindir"; then
export PATH=$am_extra_bindir:$PATH
fi
'"
export $env
if test -f \"\$am_extra_setup\"; then
. \"\$am_extra_setup\"
fi
($cmd) || $do_on_error
"