chiark / gitweb /
comprehensive-test: new script
[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 x () { echo >&2 "x $*"; "$@"; }
19
20 srcdir=$(pwd)
21
22 build_and_test () {
23     cd "$srcdir"
24     x git clean -xdff
25     if [ "x$1" != x. ]; then
26         rm -rf "$1"
27         mkdir "$1"
28     fi
29     x ./autogen.sh
30     x cd "$1"
31     x "$srcdir/configure" CFLAGS='-O0 -g'
32     x make $mflags all check
33     cd "$srcdir"
34 }
35
36 build_and_test .
37 build_and_test "$oot_rel"
38 build_and_test "$oot_abs"
39
40 echo "----- $0 ok -----"