chiark / gitweb /
changelog: document changes since 0.6.0
[secnet.git] / comprehensive-test
1 #!/bin/bash
2 set -e
3 set -o pipefail
4
5 oot_rel=oot-rel.tmp~
6 oot_abs=$(cd .. && pwd)/oot-comprehensive-test.tmp~
7
8 nproc=$(nproc || echo 1)
9 mflags=-j$nproc
10
11 for arg in "$@"; do
12     case "$arg" in
13         --oot-abs=*) oot_abs=${arg%*=} ;;
14         *) echo >&2 "unknown arg/option $1"; exit 1;;
15     esac
16 done
17
18 case "${OLD_SECNET_DIR:?must be set, perhaps to the empty string}" in
19     ''|/*)
20         ;;
21     ../*)
22         OLD_SECNET_DIR="${PWD%/*}/${OLD_SECNET_DIR#../}"
23         echo >&2 "x OLD_SECNET_DIR=$OLD_SECNET_DIR"
24         ;;
25     *)
26         echo >&2 "relative non-.. OLD_SECNET_DIR $OLD_SECNET_DIR !";
27         exit 1
28         ;;
29 esac
30
31 x () { echo >&2 "x $*"; "$@"; }
32
33 srcdir=$(pwd)
34
35 build_and_test () {
36     cd "$srcdir"
37     x git clean -xdff
38     if [ "x$1" != x. ]; then
39         rm -rf "$1"
40         mkdir "$1"
41     fi
42     x ./autogen.sh
43     x cd "$1"
44     x "$srcdir/configure" CFLAGS='-O0 -g'
45     x make $mflags all check
46     for t in mtest/check stest/check; do
47         x make $mflags clean
48         x make $mflags $t
49     done
50     x make $mflags clean
51     if [ "x$1" != x. ]; then
52          find -type f
53      else
54          git-ls-files -o
55     fi | perl -ne '
56         s{^\./}{};
57         s{^}{/};
58         next if m{^/ct-files$};
59         next if m{^/autom4te\.cache/};
60         next if m{/Makefile$};
61         next if m{\.mk$};
62         next if m{^/common\.make$};
63         next if m{^/(?:config|\.makefiles)\.stamp$};
64         next if m{^/config\.(?:log|status|h)$};
65         warn "clean in '"$1"' missed $_";
66         $bad=1;
67         END { exit $bad; }
68     '
69     cd "$srcdir"
70 }
71
72 build_and_test .
73 build_and_test "$oot_rel"
74 build_and_test "$oot_abs"
75
76 echo "----- $0 ok -----"