blob: da9f69aeebd543b1a946d7d4b7083664f2537e4d (
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
|
#!/bin/sh
PATH="$(dirname $0):$PATH"
which=$1
shift
run_all()
{
set -e
make -s -r -f - ${which}.list <<\EOF
%.list: */summary
(echo 'all:\'; \
list-files.sh $* | sed 's,^.*$$,test@/&\\,'; \
echo \;) > $@.new
mv -f $@.new $@
EOF
# The spawn of make run copies that do run_one(), below.
make -s -j$(getconf _NPROCESSORS_ONLN) -r -f ${which}.list -f - <<EOF
test@/%:; $0 subr \$* $*
EOF
}
run_one()
{
file=$1
shift
dir=${file//\//:}
name=${file##*/}
mkdir -p $work/$dir &&
bunzip2 < $file.bz2 > $work/$dir/$name &&
echo "${*//{\}/$name}" > $work/$dir/cmd && {
(cd $work/$dir && . cmd) > $work/$dir/log 2>&1
status=$?
echo $status > $work/$dir/status
if [ $status -ne 0 ] || [ -s $work/$dir/log ]; then
# Test failed, leave everything there.
echo "FAIL ($status) $file $dir"
return 0
fi
# Look for excess files. Consider it failed if there are any.
ls -A $work/$dir | fgrep -q -v "$name
cmd
log
status" && { echo "FAIL (files) $file $dir"; return 0; }
# Fully clean test, erase the evidence.
rm -rf $work/$dir
}
}
if [ "$which" = subr ]; then
run_one "$@"
else
work=$1
shift
export work
run_all "$@"
fi
|