3 # Mes --- Maxwell Equations of Software
4 # Copyright © 2017,2018 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
6 # This file is part of Mes.
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.
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.
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/>.
21 export BLOOD_ELF GUILE HEX2 M1 MES MESCC
22 export M1FLAGS HEX2FLAGS PREPROCESS LIBC
23 export MES_ARENA MES_PREFIX MES_SEED
26 MESCC=${MESCC-scripts/mescc}
28 MES_PREFIX=${MES_PREFIX-.}
32 BLOOD_ELF=${BLOOD_ELF-blood-elf}
33 MES_SEED=${MES_SEED-../mes-seed}
34 MESCC=${MESCC-$(command -v mescc)}
35 [ -z "$MESCC" ] && MESCC=scripts/mescc
36 MES=${MES-$(command -v mes)}
37 [ -z "$MES" ] && MES=src/mes
76 47-function-expression
104 7e-struct-array-access
105 7f-struct-pointer-arithmetic
106 7g-struct-byte-word-field
111 7l-struct-any-size-array
112 7m-struct-char-array-assign
113 7n-struct-struct-array
117 83-heterogenoous-init
126 expect=$(echo $broken | wc -w)
132 if [ -z "${t/[012][0-9]-*/}" ]; then
134 elif [ -z "${t/8[0-9]-*/}" ]; then
139 sh build-aux/test.sh "scaffold/tests/$t" &> scaffold/tests/"$t".log
172 19_pointer_arithmetic
174 20_pointer_comparison
180 26_character_constants
191 36_array_initialisers
193 38_multiple_array_index
200 44_scoped_declarations
205 49_bracket_evaluation
207 50_logical_second_arg
220 26_character_constants
227 38_multiple_array_index
233 49_bracket_evaluation
236 #22_floating_point ; float
237 #23_type_coercion ; float
238 #24_math_library ; float
240 #28_strings ; TODO: strncpy strchr strrchr memset memcpy memcmp
241 #30_hanoi ; fails with GCC
242 #32_led ; unsupported: (decl (decl-spec-list (stor-spec (static)) (type-spec (fixed-type "int"))) (init-declr-list (init-declr (array-of (ident "d") (p-expr (fixed "32"))))))
243 #34_array_assignment ; fails with GCC
244 #36_array_initialisers ; unspported: (decl (decl-spec-list (type-spec (fixed-type "int"))) (init-declr-list (init-declr (array-of (ident "Array") (p-expr (fixed "10"))) (initzer (initzer-list (initzer (p-expr (fixed "12"))) (initzer (p-expr (fixed "34"))) (initzer (p-expr (fixed "56"))) (initzer (p-expr (fixed "78"))) (initzer (p-expr (fixed "90"))) (initzer (p-expr (fixed "123"))) (initzer (p-expr (fixed "456"))) (initzer (p-expr (fixed "789"))) (initzer (p-expr (fixed "8642"))) (initzer (p-expr (fixed "9753"))))))))
245 #37_sprintf ; integer formatting unsupported
246 #38_multiple_array_index ; unspported: (decl (decl-spec-list (type-spec (fixed-type "int"))) (init-declr-list (init-declr (array-of (array-of (ident "a") (p-expr (fixed "4"))) (p-expr (fixed "4"))))))
247 #39_typedef ;unsupported: (decl (decl-spec-list (stor-spec (typedef)) (type-spec (typename "MyFunStruct"))) (init-declr-list (init-declr (ptr-declr (pointer) (ident "MoreFunThanEver")))))
249 #40_stdio ; f* functions
250 #42_function_pointer ; f* functions
251 #46_grep ; f* functions
252 #49_bracket_evaluation ; float
253 #51_static ; unsupported: (decl (decl-spec-list (stor-spec (static)) (type-spec (fixed-type "int"))) (init-declr-list (init-declr (ident "fred") (initzer (p-expr (fixed "1234"))))))
254 #52_unnamed_enum ; unsupported: (decl (decl-spec-list (stor-spec (typedef)) (type-spec (enum-def (enum-def-list (enum-defn (ident "e")) (enum-defn (ident "f")) (enum-defn (ident "g")))))) (init-declr-list (init-declr (ident "h"))))
255 #55_lshift_type ; unsigned
258 expect=$(echo $broken | wc -w)
260 if [ ! -f scaffold/tinycc/"$t.c" ]; then
264 sh build-aux/test.sh "scaffold/tinycc/$t" &> scaffold/tinycc/"$t".log
275 [ $expect != 0 ] && echo "expect: $expect"
276 [ $fail != 0 ] && echo "failed: $fail"
277 [ $fail -lt $expect ] && echo "solved: $(($expect - $fail))"
280 if [ $fail != 0 -a $fail -gt $expect ]; then
281 echo FAILED: $fail/$total
283 elif [ $fail != 0 ]; then
284 echo PASS: $pass/$total