File: comprehensive-test

package info (click to toggle)
secnet 0.6.8
  • links: PTS
  • area: main
  • in suites: forky, sid
  • size: 1,956 kB
  • sloc: ansic: 15,234; python: 1,057; perl: 966; sh: 596; tcl: 484; java: 231; asm: 114; yacc: 89; php: 64; makefile: 48; awk: 40
file content (81 lines) | stat: -rwxr-xr-x 1,694 bytes parent folder | download | duplicates (2)
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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
#!/bin/bash
# This file is part of secnet.
# See LICENCE and this file CREDITS for full list of copyright holders.
# SPDX-License-Identifier: GPL-3.0-or-later
# There is NO WARRANTY.

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

case "${OLD_SECNET_DIR-:?must be set, perhaps to the empty string}" in
    ''|/*)
        ;;
    ../*)
	OLD_SECNET_DIR="${PWD%/*}/${OLD_SECNET_DIR#../}"
	echo >&2 "x OLD_SECNET_DIR=$OLD_SECNET_DIR"
	;;
    *)
	echo >&2 "relative non-.. OLD_SECNET_DIR $OLD_SECNET_DIR !";
	exit 1
	;;
esac

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
    for t in mtest/check stest/check; do
	x make $mflags clean
	x make $mflags $t
    done
    x make $mflags clean
    if [ "x$1" != x. ]; then
	 find -type f
     else
	 git-ls-files -o
    fi | perl -ne '
	s{^\./}{};
	s{^}{/};
        next if m{^/ct-files$};
        next if m{^/autom4te\.cache/};
        next if m{/Makefile$};
	next if m{\.mk$};
	next if m{^/common\.make$};
	next if m{^/(?:config|\.makefiles)\.stamp$};
	next if m{^/config\.(?:log|status|h)$};
        warn "clean in '"$1"' missed $_";
        $bad=1;
        END { exit $bad; }
    '
    cd "$srcdir"
}

build_and_test .
build_and_test "$oot_rel"
build_and_test "$oot_abs"

echo "----- $0 ok -----"