2019-04-07 22:11:18 +01:00
|
|
|
#! /bin/sh
|
|
|
|
## Copyright (C) 2017 Jeremiah Orians
|
|
|
|
## This file is part of M2-Planet.
|
|
|
|
##
|
|
|
|
## M2-Planet is free software: you can redistribute it and/or modify
|
|
|
|
## it under the terms of the GNU General Public License as published by
|
|
|
|
## the Free Software Foundation, either version 3 of the License, or
|
|
|
|
## (at your option) any later version.
|
|
|
|
##
|
|
|
|
## M2-Planet is distributed in the hope that it will be useful,
|
|
|
|
## but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
## GNU General Public License for more details.
|
|
|
|
##
|
|
|
|
## You should have received a copy of the GNU General Public License
|
|
|
|
## along with M2-Planet. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
|
|
|
|
set -x
|
|
|
|
# Build the test
|
2020-02-28 23:27:12 +00:00
|
|
|
./bin/M2-Planet --architecture armv7l -f test/test0105/lisp.h \
|
2019-04-07 22:11:18 +01:00
|
|
|
-f test/common_armv7l/functions/malloc.c \
|
|
|
|
-f functions/calloc.c \
|
|
|
|
-f functions/in_set.c \
|
2020-01-25 16:35:28 +00:00
|
|
|
-f test/common_armv7l/functions/file.c \
|
|
|
|
-f test/common_armv7l/functions/exit.c \
|
2019-04-07 22:11:18 +01:00
|
|
|
-f functions/numerate_number.c \
|
|
|
|
-f functions/match.c \
|
|
|
|
-f functions/file_print.c \
|
2020-02-28 23:27:12 +00:00
|
|
|
-f test/test0105/lisp.c \
|
|
|
|
-f test/test0105/lisp_cell.c \
|
|
|
|
-f test/test0105/lisp_eval.c \
|
|
|
|
-f test/test0105/lisp_print.c \
|
|
|
|
-f test/test0105/lisp_read.c \
|
2019-04-07 22:11:18 +01:00
|
|
|
--debug \
|
2020-02-28 23:27:12 +00:00
|
|
|
-o test/test0105/lisp.M1 || exit 1
|
2019-04-07 22:11:18 +01:00
|
|
|
|
|
|
|
# Build debug footer
|
2020-02-28 23:27:12 +00:00
|
|
|
blood-elf -f test/test0105/lisp.M1 \
|
2020-05-01 03:35:22 +01:00
|
|
|
--entry _start \
|
2020-02-28 23:27:12 +00:00
|
|
|
-o test/test0105/lisp-footer.M1 || exit 2
|
2019-04-07 22:11:18 +01:00
|
|
|
|
|
|
|
# Macro assemble with libc written in M1-Macro
|
|
|
|
M1 -f test/common_armv7l/armv7l_defs.M1 \
|
|
|
|
-f test/common_armv7l/libc-core.M1 \
|
2020-02-28 23:27:12 +00:00
|
|
|
-f test/test0105/lisp.M1 \
|
|
|
|
-f test/test0105/lisp-footer.M1 \
|
2019-04-07 22:11:18 +01:00
|
|
|
--LittleEndian \
|
|
|
|
--architecture armv7l \
|
2020-02-28 23:27:12 +00:00
|
|
|
-o test/test0105/lisp.hex2 || exit 3
|
2019-04-07 22:11:18 +01:00
|
|
|
|
|
|
|
# Resolve all linkages
|
|
|
|
hex2 -f test/common_armv7l/ELF-armv7l-debug.hex2 \
|
2020-02-28 23:27:12 +00:00
|
|
|
-f test/test0105/lisp.hex2 \
|
2019-04-07 22:11:18 +01:00
|
|
|
--LittleEndian \
|
|
|
|
--architecture armv7l \
|
|
|
|
--BaseAddress 0x10000 \
|
2020-02-28 23:27:12 +00:00
|
|
|
-o test/results/test0105-armv7l-binary \
|
2019-04-07 22:11:18 +01:00
|
|
|
--exec_enable || exit 4
|
|
|
|
|
2019-04-21 18:22:41 +01:00
|
|
|
# Ensure binary works if host machine supports test
|
|
|
|
if [ "$(get_machine ${GET_MACHINE_FLAGS})" = "armv7l" ]
|
|
|
|
then
|
|
|
|
# Verify that the compiled program returns the correct result
|
2020-02-28 23:27:12 +00:00
|
|
|
out=$(./test/results/test0105-armv7l-binary --version 2>&1 )
|
2019-04-21 18:22:41 +01:00
|
|
|
[ 0 = $? ] || exit 5
|
|
|
|
[ "$out" = "Slow_Lisp 0.1" ] || exit 6
|
|
|
|
|
|
|
|
# Verify that the resulting file works
|
2020-02-28 23:27:12 +00:00
|
|
|
out=$(./test/results/test0105-armv7l-binary --file test/test0105/test.scm)
|
2019-04-21 18:22:41 +01:00
|
|
|
[ "$out" = "42" ] || exit 7
|
|
|
|
fi
|
2019-04-07 22:11:18 +01:00
|
|
|
exit 0
|