build: Support --srcdir build.
[mes.git] / build-aux / check-mes.sh
1 #! /bin/sh
2
3 # Mes --- Maxwell Equations of Software
4 # Copyright © 2017,2018 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
5 #
6 # This file is part of Mes.
7 #
8 # Mes is free software; you can redistribute it and/or modify it
9 # under the terms of the GNU General Public License as published by
10 # the Free Software Foundation; either version 3 of the License, or (at
11 # your option) any later version.
12 #
13 # Mes is distributed in the hope that it will be useful, but
14 # WITHOUT ANY WARRANTY; without even the implied warranty of
15 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16 # GNU General Public License for more details.
17 #
18 # You should have received a copy of the GNU General Public License
19 # along with Mes.  If not, see <http://www.gnu.org/licenses/>.
20
21 set -e
22
23 . build-aux/config.sh
24 . build-aux/trace.sh
25
26 if [ "$MES" = guile ]; then
27     mes=guile-
28 fi
29 BASH=${BASH-bash}
30 GUILE=${GUILE-guile}
31 MES=${MES-src/mes}
32 MES_ARENA=${MES_ARENA-100000000}
33
34 tests="
35 tests/boot.test
36 tests/read.test
37 tests/base.test
38 tests/quasiquote.test
39 tests/let.test
40 tests/closure.test
41 tests/scm.test
42 tests/display.test
43 tests/cwv.test
44 tests/math.test
45 tests/vector.test
46 tests/srfi-1.test
47 tests/srfi-9.test
48 tests/srfi-13.test
49 tests/srfi-14.test
50 tests/srfi-43.test
51 tests/optargs.test
52 tests/fluids.test
53 tests/catch.test
54 tests/getopt-long.test
55 tests/guile.test
56 tests/syntax.test
57 tests/let-syntax.test
58 tests/pmatch.test
59 tests/match.test
60 tests/psyntax.test
61 "
62
63 mkdir -p ${top_builddest}tests
64 set +e
65 fail=0
66 total=0
67 for t in $tests; do
68     if [ ! -f $t ]; then
69         echo $t: [SKIP];
70         continue
71     fi
72     ${top_builddir}/pre-inst-env sh "$t" &> ${top_builddest}$t.${mes}log
73     r=$?
74     total=$((total+1))
75     if [ $r = 0 ]; then
76         echo $t: [${mes}OK]
77     else
78         echo $t: [${mes}FAIL]
79         fail=$((fail+1))
80     fi
81 done
82 if [ $fail != 0 ]; then
83     echo FAILED: $fail/$total
84     exit 1
85 else
86     echo PASS: $total
87 fi