blob: 1d227906ec81a1c32e56f18021875b752b0ae75b (
plain)
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
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
|
#!/usr/bin/env bash
# Remote testing of Automake tarballs made easy.
# This script requires Bash 4.x or later.
# Copyright (C) 2013 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2, or (at your option)
# any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
# 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
"
|