Debian Codegraph @

examples/B92test-pkg

raw
1 #!/bin/bash
2 # example file to be used with --hookdir
3 #
4 # run tests. Current directory is top of source-code.
5 #
6 # 2005, 2007 Junichi Uekawa
7 #
8 set -e
9
10 BUILDDIR="${BUILDDIR:-/tmp/buildd}"
11
12 echo "Installing the prerequisites"
13 for PKG in $(ls "$BUILDDIR"/*.deb | sed -e's,.*/,,;s,_.*,,' ); do
14 apt-get install -y --force-yes "$PKG" || true
15 apt-get remove -y "$PKG" || true
16 done
17 # ignore the failures since they are not the prime interest
18
19 dpkg -i "$BUILDDIR"/*.deb || true
20 apt-get install -y -f --force-yes
21
22 if chmod a+x "$BUILDDIR"/*/debian/pbuilder-test/*; then
23 :
24 else
25 echo "W: no pbuilder-test script found, skipping"
26 exit 0
27 fi
28 SUCCESS=0
29 COUNT=0
30 unset FAIL || true
31
32 EXIT_CODE=0
33
34 # The current directory is the top of the source-tree.
35 cd "$BUILDDIR"/*/debian/..
36
37 for SCRIPT in $(run-parts --test "$BUILDDIR"/*/debian/pbuilder-test) ; do
38 echo "--- BEGIN test: ${SCRIPT##*/}"
39 if "${SCRIPT}"; then
40 echo SUCCESS
41 ((SUCCESS=SUCCESS+1))
42 else
43 echo FAIL
44 FAIL[${#FAIL[@]}]="${SCRIPT##*/}"
45 EXIT_CODE=1
46 fi
47 echo "--- END test: ${SCRIPT##*/}"
48 ((COUNT=COUNT+1))
49 done
50
51 echo "Summary:"
52 echo "=== $SUCCESS out of $COUNT tests passed"
53 echo "${FAIL[@]/#/ failed }"
54 echo "-- end of testsuite."
55
56 exit "${EXIT_CODE}"