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