M2-Planet/test/test19/hello.sh

33 lines
1001 B
Bash
Raw Normal View History

2018-02-24 02:18:23 +00:00
#! /bin/sh
set -ex
# Build the test
2018-08-21 01:41:37 +01:00
bin/M2-Planet -f functions/file.c \
-f functions/malloc.c \
-f functions/calloc.c \
-f functions/exit.c \
-f functions/match.c \
-f functions/numerate_number.c \
2018-02-24 02:18:23 +00:00
-f test/test19/getopt.c \
-o test/test19/getopt.M1 || exit 1
# Macro assemble with libc written in M1-Macro
M1 -f test/common_x86/x86_defs.M1 \
2018-08-21 01:41:37 +01:00
-f functions/libc-core.M1 \
2018-02-24 02:18:23 +00:00
-f test/test19/getopt.M1 \
--LittleEndian \
--Architecture 1 \
-o test/test19/getopt.hex2 || exit 2
# Resolve all linkages
hex2 -f test/common_x86/ELF-i386.hex2 -f test/test19/getopt.hex2 --LittleEndian --Architecture 1 --BaseAddress 0x8048000 -o test/results/test19-binary --exec_enable || exit 3
# Ensure binary works if host machine supports test
if [ "$(get_machine)" = "x86_64" ]
then
# Verify that the resulting file works
./test/results/test19-binary -f test/test19/input -o test/test19/proof || exit 4
out=$(sha256sum -c test/test19/proof.answer)
[ "$out" = "test/test19/proof: OK" ] || exit 5
fi
exit 0