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