bootstrap: Add bootstrap build scripts.
[mes.git] / check-mescc.sh
1 #! /bin/sh
2
3 GUILE=${GUILE-guile}
4 MES=${MES-./mes}
5 M1=${M1-M1}
6 HEX2=${HEX2-hex2}
7 MESCC=${MESCC-guile/mescc.scm}
8 MES_PREFIX=${MES_PREFIX-.}
9
10 tests="
11 t
12 00-exit-0
13 01-return-0
14 02-return-1
15 03-call
16 04-call-0
17 05-call-1
18 06-call-!1
19 10-if-0
20 11-if-1
21 12-if-==
22 13-if-!=
23 14-if-goto
24 15-if-!f
25 16-if-t
26 20-while
27 21-char[]
28 22-while-char[]
29 23-pointer
30 30-strlen
31 31-eputs
32 32-compare
33 33-and-or
34 34-pre-post
35 35-compare-char
36 36-compare-arithmetic
37 37-compare-assign
38 38-compare-call
39 40-if-else
40 41-?
41 42-goto-label
42 43-for-do-while
43 44-switch
44 45-void-call
45 50-assert
46 51-strcmp
47 52-itoa
48 53-strcpy
49 54-argv
50 60-math
51 61-array
52 63-struct-cell
53 64-make-cell
54 65-read
55 70-printf
56 71-struct-array
57 72-typedef-struct-def
58 73-union
59 74-multi-line-string
60 75-struct-union
61 76-pointer-arithmetic
62 77-pointer-assign
63 78-union-struct
64 79-int-array
65 7a-struct-char-array
66 7b-struct-int-array
67 7c-dynarray
68 7d-cast-char
69 7e-struct-array-access
70 7f-struct-pointer-arithmetic
71 7g-struct-byte-word-field
72 7h-struct-assign
73 7i-struct-struct
74 7j-strtoull
75 7k-for-each-elem
76 7l-struct-any-size-array
77 7m-struct-char-array-assign
78 7n-struct-struct-array
79 "
80
81 if [ ! -x ./i686-unknown-linux-gnu-tcc ]; then
82     tests=$(echo "$tests" | grep -Ev "02-return-1|05-call-1")
83 fi
84
85 set +e
86 fail=0
87 total=0
88 for t in $tests; do
89     sh test.sh "$t" &> scaffold/tests/$t.log
90     r=$?
91     total=$((total+1))
92     if [ $r = 0 ]; then
93         echo $t: [OK]
94     else
95         echo $t: [FAIL]
96         fail=$((fail+1))
97     fi
98 done
99 if [ $fail != 0 ]; then
100     echo FAILED: $fail/$total
101     exit 1
102 else
103     echo PASS: $total
104 fi