From aad1198faf414b7782baa8ac8ddb7f63b67ffba2 Mon Sep 17 00:00:00 2001 From: Jeremiah Orians Date: Sat, 1 Feb 2020 17:50:26 -0500 Subject: [PATCH] Revised tests to include dwarf stubs --- CHANGELOG.org | 1 + makefile | 3 ++ test/test.answers | 8 +++--- test/test27/cleanup.sh | 1 + test/test27/hello-aarch64.sh | 44 +++++++++++++++++----------- test/test27/hello-amd64.sh | 44 +++++++++++++++++----------- test/test27/hello-armv7l.sh | 44 +++++++++++++++++----------- test/test27/hello-knight-posix.sh | 39 ++++++++++++++----------- test/test27/hello-x86.sh | 48 +++++++++++++++++++------------ 9 files changed, 146 insertions(+), 86 deletions(-) diff --git a/CHANGELOG.org b/CHANGELOG.org index 424d3fd..86c3134 100644 --- a/CHANGELOG.org +++ b/CHANGELOG.org @@ -16,6 +16,7 @@ * Current ** Added +Added test for chdir and getcwd family of posix primitives ** Changed diff --git a/makefile b/makefile index d7a42e0..1c4d5f9 100644 --- a/makefile +++ b/makefile @@ -353,6 +353,9 @@ test25-aarch64-binary: M2-Planet | results test26-aarch64-binary: M2-Planet | results test/test26/hello-aarch64.sh +test27-aarch64-binary: M2-Planet | results + test/test27/hello-aarch64.sh + test99-aarch64-binary: M2-Planet | results test/test99/hello-aarch64.sh diff --git a/test/test.answers b/test/test.answers index b6a9161..a9d91b3 100644 --- a/test/test.answers +++ b/test/test.answers @@ -153,11 +153,11 @@ e1fca774a067de5edb7eb1165619573993d2a5e5647c05568a68f3a53a7990cd test/results/t 60206125928d77a758cd73ec8e85f8592423ce678570ebbe7876b71dc38aaeaf test/results/test26-amd64-binary 649349e01a90ce93ba72ba1b9bb81a9bd9d79b580ddff366173c98835c10b976 test/results/test26-armv7l-binary 576511f1f6699e7798bcab2f36bf8eb86825fd13748770b17f46c3a691200b01 test/results/test26-x86-binary -12de91f702b0ced71801c1662dc0a3e253158238e1d1a0b9bc54015a24fd77cc test/results/test27-aarch64-binary -1250294c2fddcdd37072fef4c753de3bd5b1a5f754d75448044211116be08bd9 test/results/test27-amd64-binary -669af3d269283cb44ae6f29ff7f0522e615380befe0a5a5e0fe731f122236f0a test/results/test27-armv7l-binary +32afdc9cb944b6f1db101050dd45947bdffac5ca92eb0407169e6466f878433d test/results/test27-aarch64-binary +e265ee574e7277f81dbecde7d0941f18704379898299c47b24e55cd6ca1b362a test/results/test27-amd64-binary +4d7a84b6f861807c629bf26bba759ce45c5f3f093b28bcd050dd93f449e2bf47 test/results/test27-armv7l-binary d83e0aae5b335f34a528bbb6c213bbef9d993abae335e0f909183bc6debfd37b test/results/test27-knight-posix-binary -cc21839d9b89016cb9ccc059dfbe19c2490c2527975401812d950bf12f716c85 test/results/test27-x86-binary +9d0ea091b1ac5fa5a9882ce93c816f2047a6751dc6edb7fef808a545ce3261f2 test/results/test27-x86-binary fd72ce6ebbf8263ef9fdff9ca7d789a55ba399ab222c2f5f93b138c61830376d test/results/test99-aarch64-binary 717c42e1a1a91ef5b67ce298bc92a148418a5dec6761a358a52b22a01f16c928 test/results/test99-amd64-binary 4e759b212b087824f7b0f14c5147272c9984c4a4d00074b2fd771c3d004c9aec test/results/test99-armv7l-binary diff --git a/test/test27/cleanup.sh b/test/test27/cleanup.sh index a3c57c6..dd71671 100755 --- a/test/test27/cleanup.sh +++ b/test/test27/cleanup.sh @@ -15,5 +15,6 @@ ## You should have received a copy of the GNU General Public License ## along with M2-Planet. If not, see . rm -f test/test27/chdir.M1 +rm -f test/test27/chdir-footer.M1 rm -f test/test27/chdir.hex2 exit 0 diff --git a/test/test27/hello-aarch64.sh b/test/test27/hello-aarch64.sh index 5cd873e..bdfe508 100755 --- a/test/test27/hello-aarch64.sh +++ b/test/test27/hello-aarch64.sh @@ -18,35 +18,47 @@ set -x # Build the test bin/M2-Planet --architecture aarch64 \ - -f test/common_aarch64/functions/chdir.c \ - -f test/common_aarch64/functions/malloc.c \ - -f test/common_aarch64/functions/getcwd.c \ - -f test/common_aarch64/functions/exit.c \ - -f test/common_aarch64/functions/file.c \ - -f functions/calloc.c \ - -f functions/string.c \ - -f functions/match.c \ - -f functions/file_print.c \ - -f test/test27/chdir.c \ + -f test/common_aarch64/functions/chdir.c \ + -f test/common_aarch64/functions/malloc.c \ + -f test/common_aarch64/functions/getcwd.c \ + -f test/common_aarch64/functions/exit.c \ + -f test/common_aarch64/functions/file.c \ + -f functions/calloc.c \ + -f functions/string.c \ + -f functions/match.c \ + -f functions/file_print.c \ + -f test/test27/chdir.c \ + --debug \ -o test/test27/chdir.M1 || exit 1 +# Build debug footer +blood-elf --64 -f test/test27/chdir.M1 \ + -o test/test27/chdir-footer.M1 || exit 2 + # 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/test27/chdir.M1 \ + -f test/test27/chdir-footer.M1 \ --LittleEndian \ --architecture aarch64 \ - -o test/test27/chdir.hex2 || exit 2 + -o test/test27/chdir.hex2 || exit 3 # Resolve all linkages -hex2 -f test/common_aarch64/ELF-aarch64.hex2 -f test/test27/chdir.hex2 --LittleEndian --architecture aarch64 --BaseAddress 0x40000 -o test/results/test27-aarch64-binary --exec_enable || exit 3 +hex2 -f test/common_aarch64/ELF-aarch64-debug.hex2 \ + -f test/test27/chdir.hex2 \ + --LittleEndian \ + --architecture aarch64 \ + --BaseAddress 0x40000 \ + -o test/results/test27-aarch64-binary \ + --exec_enable || exit 4 # Ensure binary works if host machine supports test if [ "$(get_machine ${GET_MACHINE_FLAGS})" = "aarch64" ] then - . ./sha256.sh - # Verify that the resulting file works - ./test/results/test27-aarch64-binary - [ 0 = $? ] || exit 4 + . ./sha256.sh + # Verify that the resulting file works + ./test/results/test27-aarch64-binary + [ 0 = $? ] || exit 5 fi exit 0 diff --git a/test/test27/hello-amd64.sh b/test/test27/hello-amd64.sh index af6fb49..f3ec986 100755 --- a/test/test27/hello-amd64.sh +++ b/test/test27/hello-amd64.sh @@ -18,35 +18,47 @@ set -x # Build the test bin/M2-Planet --architecture amd64 \ - -f test/common_amd64/functions/chdir.c \ - -f test/common_amd64/functions/malloc.c \ - -f test/common_amd64/functions/getcwd.c \ - -f test/common_amd64/functions/exit.c \ - -f test/common_amd64/functions/file.c \ - -f functions/calloc.c \ - -f functions/string.c \ - -f functions/match.c \ - -f functions/file_print.c \ - -f test/test27/chdir.c \ + -f test/common_amd64/functions/chdir.c \ + -f test/common_amd64/functions/malloc.c \ + -f test/common_amd64/functions/getcwd.c \ + -f test/common_amd64/functions/exit.c \ + -f test/common_amd64/functions/file.c \ + -f functions/calloc.c \ + -f functions/string.c \ + -f functions/match.c \ + -f functions/file_print.c \ + -f test/test27/chdir.c \ + --debug \ -o test/test27/chdir.M1 || exit 1 +# Build debug footer +blood-elf --64 -f test/test27/chdir.M1 \ + -o test/test27/chdir-footer.M1 || exit 2 + # 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/test27/chdir.M1 \ + -f test/test27/chdir-footer.M1 \ --LittleEndian \ --architecture amd64 \ - -o test/test27/chdir.hex2 || exit 2 + -o test/test27/chdir.hex2 || exit 3 # Resolve all linkages -hex2 -f test/common_amd64/ELF-amd64.hex2 -f test/test27/chdir.hex2 --LittleEndian --architecture amd64 --BaseAddress 0x00600000 -o test/results/test27-amd64-binary --exec_enable || exit 3 +hex2 -f test/common_amd64/ELF-amd64-debug.hex2 \ + -f test/test27/chdir.hex2 \ + --LittleEndian \ + --architecture amd64 \ + --BaseAddress 0x00600000 \ + -o test/results/test27-amd64-binary \ + --exec_enable || exit 4 # Ensure binary works if host machine supports test if [ "$(get_machine ${GET_MACHINE_FLAGS})" = "amd64" ] then - . ./sha256.sh - # Verify that the resulting file works - ./test/results/test27-amd64-binary - [ 0 = $? ] || exit 4 + . ./sha256.sh + # Verify that the resulting file works + ./test/results/test27-amd64-binary + [ 0 = $? ] || exit 5 fi exit 0 diff --git a/test/test27/hello-armv7l.sh b/test/test27/hello-armv7l.sh index 6ab4e29..333ae35 100755 --- a/test/test27/hello-armv7l.sh +++ b/test/test27/hello-armv7l.sh @@ -18,35 +18,47 @@ set -x # Build the test bin/M2-Planet --architecture armv7l \ - -f test/common_armv7l/functions/chdir.c \ - -f test/common_armv7l/functions/malloc.c \ - -f test/common_armv7l/functions/getcwd.c \ - -f test/common_armv7l/functions/exit.c \ - -f test/common_armv7l/functions/file.c \ - -f functions/calloc.c \ - -f functions/string.c \ - -f functions/match.c \ - -f functions/file_print.c \ - -f test/test27/chdir.c \ + -f test/common_armv7l/functions/chdir.c \ + -f test/common_armv7l/functions/malloc.c \ + -f test/common_armv7l/functions/getcwd.c \ + -f test/common_armv7l/functions/exit.c \ + -f test/common_armv7l/functions/file.c \ + -f functions/calloc.c \ + -f functions/string.c \ + -f functions/match.c \ + -f functions/file_print.c \ + -f test/test27/chdir.c \ + --debug \ -o test/test27/chdir.M1 || exit 1 +# Build debug footer +blood-elf -f test/test27/chdir.M1 \ + -o test/test27/chdir-footer.M1 || exit 2 + # 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/test27/chdir.M1 \ + -f test/test27/chdir-footer.M1 \ --LittleEndian \ --architecture armv7l \ - -o test/test27/chdir.hex2 || exit 2 + -o test/test27/chdir.hex2 || exit 3 # Resolve all linkages -hex2 -f test/common_armv7l/ELF-armv7l.hex2 -f test/test27/chdir.hex2 --LittleEndian --architecture armv7l --BaseAddress 0x10000 -o test/results/test27-armv7l-binary --exec_enable || exit 3 +hex2 -f test/common_armv7l/ELF-armv7l-debug.hex2 \ + -f test/test27/chdir.hex2 \ + --LittleEndian \ + --architecture armv7l \ + --BaseAddress 0x10000 \ + -o test/results/test27-armv7l-binary \ + --exec_enable || exit 4 # Ensure binary works if host machine supports test if [ "$(get_machine ${GET_MACHINE_FLAGS})" = "armv7l" ] then - . ./sha256.sh - # Verify that the resulting file works - ./test/results/test27-armv7l-binary - [ 0 = $? ] || exit 4 + . ./sha256.sh + # Verify that the resulting file works + ./test/results/test27-armv7l-binary + [ 0 = $? ] || exit 5 fi exit 0 diff --git a/test/test27/hello-knight-posix.sh b/test/test27/hello-knight-posix.sh index 9c2d4cb..995b022 100755 --- a/test/test27/hello-knight-posix.sh +++ b/test/test27/hello-knight-posix.sh @@ -18,16 +18,17 @@ set -x # Build the test bin/M2-Planet --architecture knight-posix \ - -f test/common_knight/functions/chdir.c \ - -f test/common_knight/functions/malloc.c \ - -f test/common_knight/functions/getcwd.c \ - -f test/common_knight/functions/exit.c \ - -f test/common_knight/functions/file.c \ - -f functions/calloc.c \ - -f functions/string.c \ - -f functions/match.c \ - -f functions/file_print.c \ - -f test/test27/chdir.c \ + -f test/common_knight/functions/chdir.c \ + -f test/common_knight/functions/malloc.c \ + -f test/common_knight/functions/getcwd.c \ + -f test/common_knight/functions/exit.c \ + -f test/common_knight/functions/file.c \ + -f functions/calloc.c \ + -f functions/string.c \ + -f functions/match.c \ + -f functions/file_print.c \ + -f test/test27/chdir.c \ + --debug \ -o test/test27/chdir.M1 || exit 1 # Macro assemble with libc written in M1-Macro @@ -36,17 +37,23 @@ M1 -f test/common_knight/knight_defs.M1 \ -f test/test27/chdir.M1 \ --BigEndian \ --architecture knight-posix \ - -o test/test27/chdir.hex2 || exit 2 + -o test/test27/chdir.hex2 || exit 3 # Resolve all linkages -hex2 -f test/test27/chdir.hex2 --BigEndian --architecture knight-posix --BaseAddress 0x0 -o test/results/test27-knight-posix-binary --exec_enable || exit 3 +hex2 -f test/common_knight/ELF-knight.hex2 \ + -f test/test27/chdir.hex2 \ + --BigEndian \ + --architecture knight-posix \ + --BaseAddress 0x0 \ + -o test/results/test27-knight-posix-binary \ + --exec_enable || exit 4 # Ensure binary works if host machine supports test if [ "$(get_machine ${GET_MACHINE_FLAGS})" = "knight*" ] then - . ./sha256.sh - # Verify that the resulting file works - ./test/results/test27-knight-posix-binary - [ 0 = $? ] || exit 4 + . ./sha256.sh + # Verify that the resulting file works + ./test/results/test27-knight-posix-binary + [ 0 = $? ] || exit 5 fi exit 0 diff --git a/test/test27/hello-x86.sh b/test/test27/hello-x86.sh index 49c2eff..b8a6ca8 100755 --- a/test/test27/hello-x86.sh +++ b/test/test27/hello-x86.sh @@ -18,37 +18,49 @@ set -x # Build the test bin/M2-Planet --architecture x86 \ - -f test/common_x86/functions/chdir.c \ - -f test/common_x86/functions/malloc.c \ - -f test/common_x86/functions/getcwd.c \ - -f test/common_x86/functions/fork.c \ - -f test/common_x86/functions/execve.c \ - -f test/common_x86/functions/exit.c \ - -f test/common_x86/functions/file.c \ - -f functions/calloc.c \ - -f functions/string.c \ - -f functions/match.c \ - -f functions/file_print.c \ - -f test/test27/chdir.c \ + -f test/common_x86/functions/chdir.c \ + -f test/common_x86/functions/malloc.c \ + -f test/common_x86/functions/getcwd.c \ + -f test/common_x86/functions/fork.c \ + -f test/common_x86/functions/execve.c \ + -f test/common_x86/functions/exit.c \ + -f test/common_x86/functions/file.c \ + -f functions/calloc.c \ + -f functions/string.c \ + -f functions/match.c \ + -f functions/file_print.c \ + -f test/test27/chdir.c \ + --debug \ -o test/test27/chdir.M1 || exit 1 +# Build debug footer +blood-elf -f test/test27/chdir.M1 \ + -o test/test27/chdir-footer.M1 || exit 2 + # 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/test27/chdir.M1 \ + -f test/test27/chdir-footer.M1 \ --LittleEndian \ --architecture x86 \ - -o test/test27/chdir.hex2 || exit 2 + -o test/test27/chdir.hex2 || exit 3 # Resolve all linkages -hex2 -f test/common_x86/ELF-i386.hex2 -f test/test27/chdir.hex2 --LittleEndian --architecture x86 --BaseAddress 0x8048000 -o test/results/test27-x86-binary --exec_enable || exit 3 +hex2 -f test/common_x86/ELF-i386-debug.hex2 \ + -f test/test27/chdir.hex2 \ + --LittleEndian \ + --architecture x86 \ + --BaseAddress 0x8048000 \ + -o test/results/test27-x86-binary \ + --exec_enable || exit 4 # Ensure binary works if host machine supports test if [ "$(get_machine ${GET_MACHINE_FLAGS})" = "x86" ] then - . ./sha256.sh - # Verify that the resulting file works - ./test/results/test27-x86-binary - [ 0 = $? ] || exit 4 + . ./sha256.sh + # Verify that the resulting file works + ./test/results/test27-x86-binary + [ 0 = $? ] || exit 5 fi exit 0