bootstrap: Add bootstrap build scripts.
[mes.git] / test.sh
1 #! /bin/sh
2
3 set -ex
4
5 t=${1-t}
6 rm -f "$t".i686-unknown-linux-gnu-out
7 rm -f "$t".mes-out
8
9 M1=${M1-M1}
10 HEX2=${HEX2-hex2}
11 MESCC=${MESCC-sh guile/mescc.scm}
12
13 $MESCC -E -o scaffold/tests/$t.E scaffold/tests/$t.c
14 $MESCC -c -o scaffold/tests/$t.M1 scaffold/tests/$t.E
15 $M1 --LittleEndian --Architecture=1\
16     -f stage0/x86.M1\
17     -f scaffold/tests/$t.M1\
18     >  scaffold/tests/$t.hex2
19
20 $MESCC -E -o lib/crt1.E lib/crt1.c
21 $MESCC -c -o lib/crt1.M1 lib/crt1.E
22 $M1 --LittleEndian --Architecture=1 \
23     -f stage0/x86.M1\
24     -f lib/crt1.M1\
25     > lib/crt1.hex2
26 $MESCC -E -o lib/libc-mes.E lib/libc-mes.c
27 $MESCC -c -o lib/libc-mes.M1 lib/libc-mes.E
28 $M1 --LittleEndian --Architecture=1\
29     -f stage0/x86.M1\
30     -f lib/libc-mes.M1\
31     > lib/libc-mes.hex2
32
33 $HEX2 --LittleEndian --Architecture=1 --BaseAddress=0x1000000\
34       -f stage0/elf32-header.hex2\
35       -f lib/crt1.hex2\
36       -f lib/libc-mes.hex2\
37       -f scaffold/tests/$t.hex2\
38       -f stage0/elf32-footer-single-main.hex2\
39       > scaffold/tests/$t.mes-out
40 chmod +x scaffold/tests/$t.mes-out
41
42 r=0
43 set +e
44 scaffold/tests/$t.mes-out
45 m=$?
46
47 [ $m = $r ]