chiark / gitweb /
comprehensive-test: new script
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Fri, 6 Dec 2019 22:24:26 +0000 (22:24 +0000)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Sat, 7 Dec 2019 15:49:34 +0000 (15:49 +0000)
This does an in-tree build, and two out-of-tree builds, one absolute,
and one relative.  It runs `make check' (not fullcheck, which is very
slow indeed).

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
comprehensive-test [new file with mode: 0755]

diff --git a/comprehensive-test b/comprehensive-test
new file mode 100755 (executable)
index 0000000..12d63d6
--- /dev/null
@@ -0,0 +1,40 @@
+#!/bin/bash
+set -e
+set -o pipefail
+
+oot_rel=oot-rel.tmp~
+oot_abs=$(cd .. && pwd)/oot-comprehensive-test.tmp~
+
+nproc=$(nproc || echo 1)
+mflags=-j$nproc
+
+for arg in "$@"; do
+    case "$arg" in
+       --oot-abs=*) oot_abs=${arg%*=} ;;
+       *) echo >&2 "unknown arg/option $1"; exit 1;;
+    esac
+done
+
+x () { echo >&2 "x $*"; "$@"; }
+
+srcdir=$(pwd)
+
+build_and_test () {
+    cd "$srcdir"
+    x git clean -xdff
+    if [ "x$1" != x. ]; then
+       rm -rf "$1"
+       mkdir "$1"
+    fi
+    x ./autogen.sh
+    x cd "$1"
+    x "$srcdir/configure" CFLAGS='-O0 -g'
+    x make $mflags all check
+    cd "$srcdir"
+}
+
+build_and_test .
+build_and_test "$oot_rel"
+build_and_test "$oot_abs"
+
+echo "----- $0 ok -----"