build: Make build more autotools-like.
[mes.git] / build-aux / check-boot.sh
1 #! /bin/bash
2
3 # GNU Mes --- Maxwell Equations of Software
4 # Copyright © 2018 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
5 #
6 # This file is part of GNU Mes.
7 #
8 # GNU 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 # GNU 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 GNU Mes.  If not, see <http://www.gnu.org/licenses/>.
20
21 set -e
22
23 . ${srcdest}build-aux/config.sh
24 . ${srcdest}build-aux/trace.sh
25
26 export GUILE MES
27 MES=${MES-./src/mes}
28
29 GUILE=${GUILE-guile}
30 if ! command -v $GUILE > /dev/null; then
31     GUILE=true
32 fi
33
34 tests="
35
36 00-zero.scm
37 01-true.scm
38 02-symbol.scm
39 03-string.scm
40 04-quote.scm
41 05-list.scm
42 06-tick.scm
43 07-if.scm
44 08-if-if.scm
45
46 10-cons.scm
47 11-list.scm
48 12-car.scm
49 13-cdr.scm
50 14-exit.scm
51 15-display.scm
52
53 16-if-eq-quote.scm
54
55 20-define.scm
56 20-define-quoted.scm
57 20-define-quote.scm
58
59 21-define-procedure.scm
60 22-define-procedure-2.scm
61 23-begin.scm
62 24-begin-define.scm
63 25-begin-define-2.scm
64 26-begin-define-later.scm
65 27-lambda-define.scm
66 28-define-define.scm
67 29-lambda-define.scm
68 2a-lambda-lambda.scm
69 2b-define-lambda.scm
70 2c-define-lambda-recurse.scm
71 2d-define-lambda-set.scm
72 2d-compose.scm
73 2e-define-first.scm
74 2f-define-second.scm
75 2f-define-second-lambda.scm
76 2g-vector.scm
77
78 30-capture.scm
79 31-capture-define.scm
80 32-capture-modify-close.scm
81 32-capture-modify-close.scm
82 33-procedure-override-close.scm
83 34-cdr-override-close.scm
84 35-closure-modify.scm
85 36-closure-override.scm
86 37-closure-lambda.scm
87 38-simple-format.scm
88 39-global-define-override.scm
89 3a-global-define-lambda-override.scm
90
91 40-define-macro.scm
92 41-when.scm
93 42-if-when.scm
94 43-or.scm
95 44-or-if.scm
96 45-pass-if.scm
97 46-report.scm
98 47-pass-if-eq.scm
99 48-let.scm
100 49-macro-override.scm
101 4a-define-macro-define-macro.scm
102 4b-define-macro-define.scm
103 4c-quasiquote.scm
104 4d-let-map.scm
105 4e-let-global.scm
106
107 50-primitive-load.scm
108 51-module.scm
109 52-define-module.scm
110 53-closure-display.scm
111
112 60-let-syntax.scm
113 "
114
115 for i in $tests; do
116     echo -n $i
117     if [ ! -f scaffold/boot/$i ]; then
118         echo ' [SKIP]'
119         continue;
120     fi
121     trace "TEST $i.guile" $GUILE -L ${srcdest}module -C module -L . <(echo '(use-modules (mes guile))'; cat scaffold/boot/$i)
122     x=$(
123         if [ "$MES" = guile ]; then
124             true
125         elif [ -z "${i/5[0-9]-*/}" ]; then
126             cat scaffold/boot/$i | MES_BOOT=${srcdest}boot-00.scm $MES 2>&1;
127         elif [ -z "${i/6[0-9]-*/}" ]; then
128             cat scaffold/boot/$i | MES_BOOT=${srcdest}boot-01.scm $MES 2>&1;
129         else
130             MES_BOOT=${srcdest}scaffold/boot/$i $MES 2>&1;
131         fi
132      ) \
133         && echo ' [PASS]' \
134         || (r=$?; echo ' [FAIL]'; echo -e "$x"; echo scaffold/boot/$i; exit $r)
135 done