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