aboutsummaryrefslogtreecommitdiff
path: root/examples/B92test-pkg
blob: 1325e50a8aa81098ca629ec14f9e3a636b398e81 (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
#!/bin/bash
# example file to be used with --hookdir
#
# run tests. Current directory is top of source-code.
#
# 2005, 2007 Junichi Uekawa
# 
set -e 

echo "Installing the prerequisites"
# ignore the failures since they are not the prime interest
for PKG in $(ls /tmp/buildd/*.deb | sed -e's,.*/,,;s,_.*,,' ); do
    apt-get install -y --force-yes "$PKG" || true 
    apt-get remove -y "$PKG" || true 
done

# install the single package, then try to satisfy dependencies.
dpkg -i /tmp/buildd/*.deb || true
apt-get install -y -f --force-yes

if chmod a+x /tmp/buildd/*/debian/pbuilder-test/*; then
    :
else
    echo "W: no pbuilder-test script found, skipping"
    exit 0
fi

SUCCESS=0
COUNT=0
unset FAIL || true
NOFAIL=1

# The current directory is the top of the source-tree.
cd /tmp/buildd/*/debian/..

for SCRIPT in $(run-parts --test /tmp/buildd/*/debian/pbuilder-test) ; do
    echo "--- BEGIN test: ${SCRIPT##*/}"
    if "${SCRIPT}"; then
    	echo SUCCESS
	((SUCCESS=SUCCESS+1))
    else
    	echo FAIL
	FAIL[${#FAIL[@]}]="${SCRIPT##*/}"
	NOFAIL=0
    fi
    echo "--- END test: ${SCRIPT##*/}"
    ((COUNT=COUNT+1))
done

echo "Summary:"
echo "=== $SUCCESS out of $COUNT tests passed"
echo "${FAIL[@]/#/ failed }"
echo "-- end of testsuite."