b473c9cecc6577a10b32fa5e4d541b4ef0de8c9c
[mes.git] / build-aux / check-mescc.sh
1 #! /bin/sh
2
3 # GNU Mes --- Maxwell Equations of Software
4 # Copyright © 2017,2018,2019 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 . ./config.sh
23 set -u
24
25 TESTS="
26 lib/tests/scaffold/t.c
27 lib/tests/scaffold/00-exit-0.c
28 lib/tests/scaffold/01-return-0.c
29 lib/tests/scaffold/02-return-1.c
30 lib/tests/scaffold/03-call.c
31 lib/tests/scaffold/04-call-0.c
32 lib/tests/scaffold/05-call-1.c
33 lib/tests/scaffold/06-call-not-1.c
34 lib/tests/scaffold/06-not-call-1.c
35 lib/tests/scaffold/06-call-2.c
36 lib/tests/scaffold/06-call-string.c
37 lib/tests/scaffold/06-call-variable.c
38 lib/tests/scaffold/06-return-void.c
39 lib/tests/scaffold/07-include.c
40 lib/tests/scaffold/08-assign.c
41 lib/tests/scaffold/08-assign-negative.c
42 lib/tests/scaffold/08-assign-global.c
43 lib/tests/scaffold/10-if-0.c
44 lib/tests/scaffold/11-if-1.c
45 lib/tests/scaffold/12-if-eq.c
46 lib/tests/scaffold/13-if-neq.c
47 lib/tests/scaffold/14-if-goto.c
48 lib/tests/scaffold/15-if-not-f.c
49 lib/tests/scaffold/16-if-t.c
50 lib/tests/scaffold/17-compare-char.c
51 lib/tests/scaffold/17-compare-ge.c
52 lib/tests/scaffold/17-compare-gt.c
53 lib/tests/scaffold/17-compare-le.c
54 lib/tests/scaffold/17-compare-lt.c
55 lib/tests/scaffold/17-compare-unsigned-ge.c
56 lib/tests/scaffold/17-compare-unsigned-gt.c
57 lib/tests/scaffold/17-compare-unsigned-le.c
58 lib/tests/scaffold/17-compare-unsigned-lt.c
59 lib/tests/scaffold/17-compare-unsigned-char-le.c
60 lib/tests/scaffold/17-compare-unsigned-short-le.c
61 lib/tests/scaffold/17-compare-unsigned-long-le.c
62 lib/tests/scaffold/17-compare-and.c
63 lib/tests/scaffold/17-compare-or.c
64 lib/tests/scaffold/17-compare-and-or.c
65 lib/tests/scaffold/17-compare-assign.c
66 lib/tests/scaffold/17-compare-call.c
67 lib/tests/scaffold/18-assign-shadow.c
68 lib/tests/scaffold/20-while.c
69 lib/tests/scaffold/21-char-array-simple.c
70 lib/tests/scaffold/21-char-array.c
71 lib/tests/scaffold/22-while-char-array.c
72 lib/tests/scaffold/23-global-pointer-init-null.c
73 lib/tests/scaffold/23-global-pointer-init.c
74 lib/tests/scaffold/23-global-pointer-ref.c
75 lib/tests/scaffold/23-global-pointer-pointer-ref.c
76 lib/tests/scaffold/23-pointer-sub.c
77 lib/tests/scaffold/23-pointer.c
78 lib/tests/mes/30-oputs.c
79 lib/tests/string/30-strlen.c
80 lib/tests/scaffold/32-call-wrap.c
81 lib/tests/scaffold/32-compare.c
82 lib/tests/scaffold/33-and-or.c
83 lib/tests/scaffold/34-pre-post.c
84 lib/tests/scaffold/35-compare-char.c
85 lib/tests/scaffold/36-compare-arithmetic.c
86 lib/tests/scaffold/37-compare-assign.c
87 lib/tests/scaffold/38-compare-call-2.c
88 lib/tests/scaffold/38-compare-call-3.c
89 lib/tests/scaffold/38-compare-call.c
90 lib/tests/scaffold/40-if-else.c
91 lib/tests/scaffold/41-ternary.c
92 lib/tests/scaffold/42-goto-label.c
93 lib/tests/scaffold/43-for-do-while.c
94 lib/tests/scaffold/44-switch.c
95 lib/tests/scaffold/44-switch-fallthrough.c
96 lib/tests/scaffold/44-switch-body-fallthrough.c
97 lib/tests/scaffold/45-void-call.c
98 lib/tests/scaffold/46-function-static.c
99 lib/tests/scaffold/47-function-expression.c
100 lib/tests/scaffold/48-global-static.c
101 lib/tests/assert/50-assert.c
102 lib/tests/mes/50-itoa.c
103 lib/tests/posix/50-getenv.c
104 lib/tests/string/50-strcmp.c
105 lib/tests/string/50-strcpy.c
106 lib/tests/string/50-strncmp.c
107 lib/tests/scaffold/51-pointer-sub.c
108 lib/tests/scaffold/54-argc.c
109 lib/tests/scaffold/55-char-array.c
110 lib/tests/scaffold/60-math.c
111 lib/tests/scaffold/61-array.c
112 lib/tests/scaffold/62-array.c
113 lib/tests/scaffold/63-struct.c
114 lib/tests/scaffold/63-struct-pointer.c
115 lib/tests/scaffold/63-struct-local.c
116 lib/tests/scaffold/63-struct-function.c
117 lib/tests/scaffold/63-struct-assign.c
118 lib/tests/scaffold/63-struct-array.c
119 lib/tests/scaffold/63-struct-array-assign.c
120 lib/tests/scaffold/63-struct-array-compare.c
121 lib/tests/scaffold/63-struct-cell.c
122 lib/tests/scaffold/64-make-cell.c
123 lib/tests/scaffold/65-read.c
124 lib/tests/scaffold/66-local-char-array.c
125 lib/tests/scaffold/70-stdarg.c
126 lib/tests/stdio/70-printf-hello.c
127 lib/tests/stdio/70-printf-simple.c
128 lib/tests/stdio/70-printf.c
129 lib/tests/stdlib/70-strtoull.c
130 lib/tests/string/70-strchr.c
131 lib/tests/scaffold/71-struct-array.c
132 lib/tests/scaffold/72-typedef-struct-def.c
133 lib/tests/scaffold/73-union-hello.c
134 lib/tests/scaffold/73-union.c
135 lib/tests/scaffold/74-multi-line-string.c
136 lib/tests/scaffold/75-struct-union.c
137 lib/tests/scaffold/76-pointer-arithmetic-pp.c
138 lib/tests/scaffold/76-pointer-arithmetic.c
139 lib/tests/scaffold/77-pointer-assign.c
140 lib/tests/scaffold/78-union-struct.c
141 lib/tests/scaffold/79-int-array-simple.c
142 lib/tests/scaffold/79-int-array.c
143 lib/tests/scaffold/7a-struct-char-array.c
144 lib/tests/scaffold/7b-struct-int-array-hello.c
145 lib/tests/scaffold/7b-struct-int-array-pointer.c
146 lib/tests/scaffold/7b-struct-int-array.c
147 lib/tests/scaffold/7c-dynarray.c
148 lib/tests/scaffold/7d-cast-char.c
149 lib/tests/scaffold/7e-struct-array-access.c
150 lib/tests/scaffold/7f-struct-pointer-arithmetic.c
151 lib/tests/scaffold/7g-struct-byte-word-field.c
152 lib/tests/scaffold/7h-struct-assign.c
153 lib/tests/scaffold/7i-struct-struct-simple.c
154 lib/tests/scaffold/7i-struct-struct.c
155 lib/tests/scaffold/7k-empty-for.c
156 lib/tests/scaffold/7k-for-each-elem-simple.c
157 lib/tests/scaffold/7k-for-each-elem.c
158 lib/tests/scaffold/7l-struct-any-size-array-simple.c
159 lib/tests/scaffold/7l-struct-any-size-array.c
160 lib/tests/scaffold/7m-struct-char-array-assign.c
161 lib/tests/scaffold/7n-struct-struct-array.c
162 lib/tests/scaffold/7o-struct-pre-post-simple.c
163 lib/tests/scaffold/7o-struct-pre-post.c
164 lib/tests/scaffold/7p-struct-cast.c
165 lib/tests/scaffold/7q-bit-field-simple.c
166 lib/tests/scaffold/7q-bit-field.c
167 lib/tests/scaffold/7r-sign-extend.c
168 lib/tests/scaffold/7s-struct-short.c
169 lib/tests/scaffold/7s-unsigned-compare.c
170 lib/tests/scaffold/7t-function-destruct.c
171 lib/tests/scaffold/7u-double.c
172 lib/tests/scaffold/7u-long-long.c
173 lib/tests/scaffold/7u-ternary-expression.c
174 lib/tests/scaffold/7u-call-ternary.c
175 lib/tests/scaffold/7u-inc-byte-word.c
176 lib/tests/scaffold/7u-struct-func.c
177 lib/tests/scaffold/7u-struct-size10.c
178 lib/tests/scaffold/7u-vstack.c
179 lib/tests/setjmp/80-setjmp.c
180 lib/tests/stdio/80-sscanf.c
181 lib/tests/stdlib/80-qsort.c
182 lib/tests/stdlib/80-qsort-dupes.c
183 lib/tests/string/80-strncpy.c
184 lib/tests/string/80-strrchr.c
185 lib/tests/scaffold/82-define.c
186 lib/tests/scaffold/83-heterogenoous-init.c
187 lib/tests/scaffold/84-struct-field-list.c
188 lib/tests/scaffold/85-sizeof.c
189 lib/tests/dirent/90-readdir.c
190 lib/tests/io/90-stat.c
191 lib/tests/posix/90-unsetenv.c
192 lib/tests/signal/90-signal.c
193 lib/tests/stdio/90-fopen.c
194 lib/tests/stdio/90-fopen-append.c
195 lib/tests/stdio/90-fread-fwrite.c
196 lib/tests/stdio/90-fseek.c
197 lib/tests/stdlib/90-strtol.c
198 lib/tests/string/90-snprintf.c
199 lib/tests/string/90-strpbrk.c
200 lib/tests/string/90-strspn.c
201 lib/tests/scaffold/90-goto-var.c
202 lib/tests/scaffold/91-goto-array.c
203 lib/tests/scaffold/a0-call-trunc-char.c
204 lib/tests/scaffold/a0-call-trunc-short.c
205 lib/tests/scaffold/a0-call-trunc-int.c
206 lib/tests/scaffold/a0-math-divide-signed-negative.c
207 lib/tests/scaffold/a1-global-no-align.c
208 lib/tests/scaffold/a1-global-no-clobber.c
209 "
210
211 XFAIL_TESTS="
212 lib/tests/scaffold/54-argv.c
213 lib/tests/stdio/90-sprintf.c
214 lib/tests/stdio/90-sprintf.c
215 "
216
217 if test $compiler = mescc; then
218     XFAIL_TESTS="$XFAIL_TESTS
219 lib/tests/scaffold/17-compare-unsigned-char-le.c
220 lib/tests/scaffold/17-compare-unsigned-short-le.c
221 lib/tests/scaffold/66-local-char-array.c
222 lib/tests/scaffold/90-goto-var.c
223 lib/tests/scaffold/91-goto-array.c
224 "
225
226     if test $mes_cpu = x86; then
227         XFAIL_TESTS="$XFAIL_TESTS
228 lib/tests/scaffold/60-math.c
229 "
230     fi
231
232     if test $mes_cpu = x86_64; then
233         XFAIL_TESTS="$XFAIL_TESTS
234 lib/tests/scaffold/a0-call-trunc-int.c
235 "
236     fi
237 fi
238
239 if test $mes_cpu = x86; then
240     XFAIL_TESTS="$XFAIL_TESTS
241 "
242 fi
243
244 if test $mes_cpu = x86_64; then
245     XFAIL_TESTS="$XFAIL_TESTS
246 lib/tests/stdio/70-printf-simple.c
247 lib/tests/stdio/70-printf-stdarg.c
248 lib/tests/stdio/70-printf.c
249 "
250 fi
251
252 if test $compiler = gcc; then
253     XFAIL_TESTS="$XFAIL_TESTS
254 "
255
256     if test $mes_cpu = x86; then
257         XFAIL_TESTS="$XFAIL_TESTS
258 "
259     fi
260
261     if test $mes_cpu = x86_64; then
262         XFAIL_TESTS="$XFAIL_TESTS
263 lib/tests/stdio/70-printf-hello.c
264 lib/tests/string/90-snprintf.c
265 "
266     fi
267 fi
268
269 test_ext=.c
270 log_compiler=${srcdest}build-aux/test-c.sh
271 . ${srcdest}build-aux/test-suite.sh