-
Notifications
You must be signed in to change notification settings - Fork 11
/
cpan-installation-test.sh
executable file
·66 lines (53 loc) · 1.73 KB
/
cpan-installation-test.sh
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
#!/bin/bash
PERL_INSTALLATION=v28
LOGDIR=~/var/cpan-installation-test
if [[ ! -d $LOGDIR ]]; then mkdir -p $LOGDIR; fi
eval "$(perlbrew init-in-bash)"
perlbrew use ${PERL_INSTALLATION}
function run_with_timeout () {
local time=10
if [[ $1 =~ ^[0-9]+$ ]]; then time=$1; shift; fi
# Run in a subshell to avoid job control messages
( "$@" &
child=$!
# Avoid default notification in non-interactive shell for SIGTERM
trap -- "" SIGTERM
( sleep $time
kill $child 2> /dev/null ) &
wait $child
)
}
function test_one_dist {
local dist=$1
local distdir=$(echo $dist | perl -p -e 's/[^0-9A-Za-z\.]+/-/gi; s/\A-+//; s/-+\z//;')
local lib_name="${PERL_INSTALLATION}@cpan_installation_test_${RANDOM}"
perlbrew list-modules | grep -v '^Perl$' | cpanm --uninstall -f
(
echo "Perlbrew"
echo "========"
perlbrew info
echo "========"
echo ">>> Use ${lib_name} for $dist";
perlbrew lib create $lib_name
perlbrew use $lib_name
echo "--- cpanm $dist";
run_with_timeout 600 cpanm --verbose $dist
rc=$?
echo "--- done"
if [[ $rc -eq 0 ]]; then
touch $LOGDIR/${distdir}-cpanm.ok
else
touch $LOGDIR/${distdir}-cpanm.fail
fi
perlbrew list-modules > $LOGDIR/${distdir}-installed.log
perlbrew use ${PERL_INSTALLATION}
perlbrew lib delete $lib_name
echo "<<< DELETED ${lib_name}";
) > $LOGDIR/${distdir}.log 2>&1
}
# MODULES=$(echo Elastijk App::csv2tsv yagg URI::Fast Test::Locus grepmail)
# MODULES=$(echo Search::Xapian App::unichar App::sdif Getargs::Long FileHandle::Unget Net::Stripe)
for dist in $*
do
test_one_dist $dist
done