Add a test for supported preprocessor features
This commit is contained in:
parent
4550eec19e
commit
6f2cebc4ca
25
makefile
25
makefile
|
@ -94,6 +94,7 @@ clean:
|
|||
./test/test0021/cleanup.sh
|
||||
./test/test0022/cleanup.sh
|
||||
./test/test0023/cleanup.sh
|
||||
./test/test0024/cleanup.sh
|
||||
./test/test0100/cleanup.sh
|
||||
./test/test0101/cleanup.sh
|
||||
./test/test0102/cleanup.sh
|
||||
|
@ -139,6 +140,7 @@ aarch64-tests: \
|
|||
test0021-aarch64-binary \
|
||||
test0022-aarch64-binary \
|
||||
test0023-aarch64-binary \
|
||||
test0024-aarch64-binary \
|
||||
test0100-aarch64-binary \
|
||||
test0101-aarch64-binary \
|
||||
test0102-aarch64-binary \
|
||||
|
@ -173,6 +175,7 @@ amd64-tests: \
|
|||
test0021-amd64-binary \
|
||||
test0022-amd64-binary \
|
||||
test0023-amd64-binary \
|
||||
test0024-amd64-binary \
|
||||
test0100-amd64-binary \
|
||||
test0101-amd64-binary \
|
||||
test0102-amd64-binary \
|
||||
|
@ -207,6 +210,7 @@ knight-posix-tests: \
|
|||
test0021-knight-posix-binary \
|
||||
test0022-knight-posix-binary \
|
||||
test0023-knight-posix-binary \
|
||||
test0024-knight-posix-binary \
|
||||
test0100-knight-posix-binary \
|
||||
test0101-knight-posix-binary \
|
||||
test0102-knight-posix-binary \
|
||||
|
@ -232,6 +236,7 @@ knight-native-tests: \
|
|||
test0017-knight-native-binary\
|
||||
test0018-knight-native-binary\
|
||||
test0020-knight-native-binary\
|
||||
test0024-knight-native-binary\
|
||||
test0106-knight-native-binary | results
|
||||
|
||||
armv7l-tests: \
|
||||
|
@ -259,6 +264,7 @@ armv7l-tests: \
|
|||
test0021-armv7l-binary \
|
||||
test0022-armv7l-binary \
|
||||
test0023-armv7l-binary \
|
||||
test0024-armv7l-binary \
|
||||
test0100-armv7l-binary \
|
||||
test0101-armv7l-binary \
|
||||
test0102-armv7l-binary \
|
||||
|
@ -293,6 +299,7 @@ x86-tests: \
|
|||
test0021-x86-binary \
|
||||
test0022-x86-binary \
|
||||
test0023-x86-binary \
|
||||
test0024-x86-binary \
|
||||
test0100-x86-binary \
|
||||
test0101-x86-binary \
|
||||
test0102-x86-binary \
|
||||
|
@ -374,6 +381,9 @@ test0022-aarch64-binary: M2-Planet | results
|
|||
test0023-aarch64-binary: M2-Planet | results
|
||||
test/test0023/hello-aarch64.sh
|
||||
|
||||
test0024-aarch64-binary: M2-Planet | results
|
||||
test/test0024/hello-aarch64.sh
|
||||
|
||||
test0100-aarch64-binary: M2-Planet | results
|
||||
test/test0100/hello-aarch64.sh
|
||||
|
||||
|
@ -470,6 +480,9 @@ test0022-amd64-binary: M2-Planet | results
|
|||
test0023-amd64-binary: M2-Planet | results
|
||||
test/test0023/hello-amd64.sh
|
||||
|
||||
test0024-amd64-binary: M2-Planet | results
|
||||
test/test0024/hello-amd64.sh
|
||||
|
||||
test0100-amd64-binary: M2-Planet | results
|
||||
test/test0100/hello-amd64.sh
|
||||
|
||||
|
@ -566,6 +579,9 @@ test0022-knight-posix-binary: M2-Planet | results
|
|||
test0023-knight-posix-binary: M2-Planet | results
|
||||
test/test0023/hello-knight-posix.sh
|
||||
|
||||
test0024-knight-posix-binary: M2-Planet | results
|
||||
test/test0024/hello-knight-posix.sh
|
||||
|
||||
test0100-knight-posix-binary: M2-Planet | results
|
||||
test/test0100/hello-knight-posix.sh
|
||||
|
||||
|
@ -635,6 +651,9 @@ test0018-knight-native-binary: M2-Planet | results
|
|||
test0020-knight-native-binary: M2-Planet | results
|
||||
test/test0020/hello-knight-native.sh
|
||||
|
||||
test0024-knight-native-binary: M2-Planet | results
|
||||
test/test0024/hello-knight-native.sh
|
||||
|
||||
test0106-knight-native-binary: M2-Planet | results
|
||||
test/test0106/hello-knight-native.sh
|
||||
|
||||
|
@ -710,6 +729,9 @@ test0022-armv7l-binary: M2-Planet | results
|
|||
test0023-armv7l-binary: M2-Planet | results
|
||||
test/test0023/hello-armv7l.sh
|
||||
|
||||
test0024-armv7l-binary: M2-Planet | results
|
||||
test/test0024/hello-armv7l.sh
|
||||
|
||||
test0100-armv7l-binary: M2-Planet | results
|
||||
test/test0100/hello-armv7l.sh
|
||||
|
||||
|
@ -806,6 +828,9 @@ test0022-x86-binary: M2-Planet | results
|
|||
test0023-x86-binary: M2-Planet | results
|
||||
test/test0023/hello-x86.sh
|
||||
|
||||
test0024-x86-binary: M2-Planet | results
|
||||
test/test0024/hello-x86.sh
|
||||
|
||||
test0100-x86-binary: M2-Planet | results
|
||||
test/test0100/hello-x86.sh
|
||||
|
||||
|
|
|
@ -135,6 +135,12 @@ a23a357cabc995330776fa01c7cf41978b100c36b0e3c76d1297db0e953c1bc3 test/results/t
|
|||
d7b2ad248521de84f3b4d8194ab6b330f3e5fda0043368f57be0d30f9949172b test/results/test0023-armv7l-binary
|
||||
f793452848e538381213923ecbd209253fabe391bd56c03f4f95d3ce1c4d5982 test/results/test0023-knight-posix-binary
|
||||
b86fc421e50fd551ab3d6296551b3ed03821f6f134906575d932516b26a40285 test/results/test0023-x86-binary
|
||||
deb80d26727f797c397b927938360f846eb982dc0722903cb07947737332c443 test/results/test0024-aarch64-binary
|
||||
847326ee9a1bd6e9f0b8cc546218d0c9a97e8a021b366b1367cd595a63516d09 test/results/test0024-amd64-binary
|
||||
8ee4ee96799a48b4b21e8511ae95866a4d18fe75ddf2796a0c5991e97aabaf82 test/results/test0024-armv7l-binary
|
||||
0c93110e4cf2f8f69eb3a308162478e644ee63fd4881762161be5de50fbe9f06 test/results/test0024-knight-native-binary
|
||||
4862ffbb8e6265bdbf3d5fd824f7b7581206a627f5e7fe83cf5b7f4b30b8ebd4 test/results/test0024-knight-posix-binary
|
||||
69c060eae9ffb12992d89eb02f066c517c5acfd1d9f80152e279fccce7b77f6a test/results/test0024-x86-binary
|
||||
65a25f4ee09e7ad4a0c44f6dad7e5a64aa1e62ac98d8f8d58d91a8b3a34ebe00 test/results/test0100-aarch64-binary
|
||||
4d4d7dc249a4fc1788f4443a7a5feba51392a73dc1b80297a510cbca41afd71e test/results/test0100-amd64-binary
|
||||
98ebb4ac496ed255d769383d027b0bf358f280b248a0994b30c047d2d5506ec4 test/results/test0100-armv7l-binary
|
||||
|
|
|
@ -0,0 +1,21 @@
|
|||
## 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/>.
|
||||
# Ignore the files created by script
|
||||
*.M1
|
||||
*.hex2
|
||||
|
||||
# A place to put a good run for comparison
|
||||
actual.M1
|
|
@ -0,0 +1,19 @@
|
|||
#! /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/>.
|
||||
rm -f test/test0024/return.M1
|
||||
rm -f test/test0024/return.hex2
|
||||
exit 0
|
|
@ -0,0 +1,49 @@
|
|||
#! /bin/sh
|
||||
## Copyright (C) 2017 Jeremiah Orians
|
||||
## Copyright (C) 2020 deesix <deesix@tuta.io>
|
||||
## 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
|
||||
bin/M2-Planet --architecture aarch64 \
|
||||
-f test/test0024/return.c \
|
||||
-o test/test0024/return.M1 || exit 1
|
||||
|
||||
# Macro assemble with libc written in M1-Macro
|
||||
M1 -f test/common_aarch64/aarch64_defs.M1 \
|
||||
-f test/common_aarch64/libc-core.M1 \
|
||||
-f test/test0024/return.M1 \
|
||||
--LittleEndian \
|
||||
--architecture aarch64 \
|
||||
-o test/test0024/return.hex2 || exit 2
|
||||
|
||||
# Resolve all linkages
|
||||
hex2 -f test/common_aarch64/ELF-aarch64.hex2 \
|
||||
-f test/test0024/return.hex2 \
|
||||
--LittleEndian \
|
||||
--architecture aarch64 \
|
||||
--BaseAddress 0x400000 \
|
||||
-o test/results/test0024-aarch64-binary \
|
||||
--exec_enable || exit 3
|
||||
|
||||
# Ensure binary works if host machine supports test
|
||||
if [ "$(get_machine ${GET_MACHINE_FLAGS})" = "aarch64" ]
|
||||
then
|
||||
# Verify that the compiled program returns the correct result
|
||||
./test/results/test0024-aarch64-binary
|
||||
[ 42 = $? ] || exit 4
|
||||
fi
|
||||
exit 0
|
|
@ -0,0 +1,41 @@
|
|||
#! /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
|
||||
bin/M2-Planet --architecture amd64 -f test/test0024/return.c \
|
||||
-o test/test0024/return.M1 || exit 1
|
||||
|
||||
# Macro assemble with libc written in M1-Macro
|
||||
M1 -f test/common_amd64/amd64_defs.M1 \
|
||||
-f test/common_amd64/libc-core.M1 \
|
||||
-f test/test0024/return.M1 \
|
||||
--LittleEndian \
|
||||
--architecture amd64 \
|
||||
-o test/test0024/return.hex2 || exit 2
|
||||
|
||||
# Resolve all linkages
|
||||
hex2 -f test/common_amd64/ELF-amd64.hex2 -f test/test0024/return.hex2 --LittleEndian --architecture amd64 --BaseAddress 0x00600000 -o test/results/test0024-amd64-binary --exec_enable || exit 3
|
||||
|
||||
# Ensure binary works if host machine supports test
|
||||
if [ "$(get_machine ${GET_MACHINE_FLAGS})" = "amd64" ]
|
||||
then
|
||||
# Verify that the compiled program returns the correct result
|
||||
./test/results/test0024-amd64-binary
|
||||
[ 42 = $? ] || exit 3
|
||||
fi
|
||||
exit 0
|
|
@ -0,0 +1,41 @@
|
|||
#! /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
|
||||
bin/M2-Planet --architecture armv7l -f test/test0024/return.c \
|
||||
-o test/test0024/return.M1 || exit 1
|
||||
|
||||
# Macro assemble with libc written in M1-Macro
|
||||
M1 -f test/common_armv7l/armv7l_defs.M1 \
|
||||
-f test/common_armv7l/libc-core.M1 \
|
||||
-f test/test0024/return.M1 \
|
||||
--LittleEndian \
|
||||
--architecture armv7l \
|
||||
-o test/test0024/return.hex2 || exit 2
|
||||
|
||||
# Resolve all linkages
|
||||
hex2 -f test/common_armv7l/ELF-armv7l.hex2 -f test/test0024/return.hex2 --LittleEndian --architecture armv7l --BaseAddress 0x10000 -o test/results/test0024-armv7l-binary --exec_enable || exit 3
|
||||
|
||||
# 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
|
||||
./test/results/test0024-armv7l-binary
|
||||
[ 42 = $? ] || exit 3
|
||||
fi
|
||||
exit 0
|
|
@ -0,0 +1,41 @@
|
|||
#! /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
|
||||
bin/M2-Planet --architecture knight-native -f test/test0024/return.c \
|
||||
-o test/test0024/return.M1 || exit 1
|
||||
|
||||
# Macro assemble with libc written in M1-Macro
|
||||
M1 -f test/common_knight/knight-native_defs.M1 \
|
||||
-f test/common_knight/libc-native.M1 \
|
||||
-f test/test0024/return.M1 \
|
||||
--BigEndian \
|
||||
--architecture knight-native \
|
||||
-o test/test0024/return.hex2 || exit 2
|
||||
|
||||
# Resolve all linkages
|
||||
hex2 -f test/test0024/return.hex2 --BigEndian --architecture knight-native --BaseAddress 0x0 -o test/results/test0024-knight-native-binary --exec_enable || exit 3
|
||||
|
||||
# Ensure binary works if host machine supports test
|
||||
if [ "$(get_machine ${GET_MACHINE_FLAGS})" = "knight*" ]
|
||||
then
|
||||
# Verify that the compiled program returns the correct result
|
||||
./test/results/test0024-knight-native-binary
|
||||
[ 42 = $? ] || exit 3
|
||||
fi
|
||||
exit 0
|
|
@ -0,0 +1,41 @@
|
|||
#! /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
|
||||
bin/M2-Planet --architecture knight-posix -f test/test0024/return.c \
|
||||
-o test/test0024/return.M1 || exit 1
|
||||
|
||||
# Macro assemble with libc written in M1-Macro
|
||||
M1 -f test/common_knight/knight_defs.M1 \
|
||||
-f test/common_knight/libc-core.M1 \
|
||||
-f test/test0024/return.M1 \
|
||||
--BigEndian \
|
||||
--architecture knight-posix \
|
||||
-o test/test0024/return.hex2 || exit 2
|
||||
|
||||
# Resolve all linkages
|
||||
hex2 -f test/common_knight/ELF-knight.hex2 -f test/test0024/return.hex2 --BigEndian --architecture knight-posix --BaseAddress 0x0 -o test/results/test0024-knight-posix-binary --exec_enable || exit 3
|
||||
|
||||
# Ensure binary works if host machine supports test
|
||||
if [ "$(get_machine ${GET_MACHINE_FLAGS})" = "knight*" ]
|
||||
then
|
||||
# Verify that the compiled program returns the correct result
|
||||
./test/results/test0024-knight-posix-binary
|
||||
[ 42 = $? ] || exit 3
|
||||
fi
|
||||
exit 0
|
|
@ -0,0 +1,41 @@
|
|||
#! /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
|
||||
bin/M2-Planet --architecture x86 -f test/test0024/return.c \
|
||||
-o test/test0024/return.M1 || exit 1
|
||||
|
||||
# Macro assemble with libc written in M1-Macro
|
||||
M1 -f test/common_x86/x86_defs.M1 \
|
||||
-f test/common_x86/libc-core.M1 \
|
||||
-f test/test0024/return.M1 \
|
||||
--LittleEndian \
|
||||
--architecture x86 \
|
||||
-o test/test0024/return.hex2 || exit 2
|
||||
|
||||
# Resolve all linkages
|
||||
hex2 -f test/common_x86/ELF-i386.hex2 -f test/test0024/return.hex2 --LittleEndian --architecture x86 --BaseAddress 0x8048000 -o test/results/test0024-x86-binary --exec_enable || exit 3
|
||||
|
||||
# Ensure binary works if host machine supports test
|
||||
if [ "$(get_machine ${GET_MACHINE_FLAGS})" = "x86" ]
|
||||
then
|
||||
# Verify that the compiled program returns the correct result
|
||||
./test/results/test0024-x86-binary
|
||||
[ 42 = $? ] || exit 3
|
||||
fi
|
||||
exit 0
|
|
@ -0,0 +1,32 @@
|
|||
/* Copyright (C) 2016 Jeremiah Orians
|
||||
* Copyright (C) 2021 Sanne Wouda
|
||||
* 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/>.
|
||||
*/
|
||||
|
||||
#define THE_ANSWER 42
|
||||
|
||||
int main()
|
||||
{
|
||||
#if FOO
|
||||
return 0;
|
||||
#else
|
||||
#if defined(THE_ANSWER) && !defined(THE_UNIVERSE)
|
||||
return THE_ANSWER;
|
||||
#else
|
||||
return 1;
|
||||
#endif
|
||||
#endif
|
||||
}
|
Loading…
Reference in New Issue