From b8f5bb23c6a040775387b2d365366c44f8e1775e Mon Sep 17 00:00:00 2001 From: ell1e Date: Sat, 25 Nov 2023 15:11:32 +0100 Subject: [PATCH] Move verification out into separate script to fix ARM64 use Some platforms don't have the clang sanitizer checks available that are used in the verification tests, currently on these the output files can't even be amalgamated. To fix this, separate amalgamation and verification so that the later can be skipped. --- amalgamate.sh | 20 -------------------- amalgamate_and_verify.sh | 30 ++++++++++++++++++++++++++++++ test.sh | 2 +- 3 files changed, 31 insertions(+), 21 deletions(-) create mode 100755 amalgamate_and_verify.sh diff --git a/amalgamate.sh b/amalgamate.sh index cfa72b1..415e2ba 100755 --- a/amalgamate.sh +++ b/amalgamate.sh @@ -8,26 +8,6 @@ OUTPUT_PREFIX=_build/amalgamation cmake -H. -B_build -DAMALGAMATE_SOURCES=ON -G"Unix Makefiles" -echo "int main() { return 0; }" > main.c -echo "Test compile with GCC..." -gcc -pedantic -Wall -I$OUTPUT_PREFIX main.c $OUTPUT_PREFIX/miniz.c -o test.out -echo "Test compile with GCC ANSI..." -gcc -ansi -pedantic -Wall -I$OUTPUT_PREFIX main.c $OUTPUT_PREFIX/miniz.c -o test.out -if command -v clang -then - echo "Test compile with clang..." - clang -Wall -Wpedantic -fsanitize=unsigned-integer-overflow -I$OUTPUT_PREFIX main.c $OUTPUT_PREFIX/miniz.c -o test.out -fi -for def in MINIZ_NO_STDIO MINIZ_NO_TIME MINIZ_NO_DEFLATE_APIS MINIZ_NO_INFLATE_APIS MINIZ_NO_ARCHIVE_APIS MINIZ_NO_ARCHIVE_WRITING_APIS MINIZ_NO_ZLIB_APIS MINIZ_NO_ZLIB_COMPATIBLE_NAMES MINIZ_NO_MALLOC -do - echo "Test compile with GCC and define $def..." - gcc -ansi -pedantic -Wall -I$OUTPUT_PREFIX main.c $OUTPUT_PREFIX/miniz.c -o test.out -D${def} -done -echo "Test compile with GCC and MINIZ_USE_UNALIGNED_LOADS_AND_STORES=1..." -gcc -ansi -pedantic -Wall -I$OUTPUT_PREFIX main.c $OUTPUT_PREFIX/miniz.c -o test.out -DMINIZ_USE_UNALIGNED_LOADS_AND_STORES=1 -rm test.out -rm main.c - cp $OUTPUT_PREFIX/miniz.* amalgamation/ cp ChangeLog.md amalgamation/ cp LICENSE amalgamation/ diff --git a/amalgamate_and_verify.sh b/amalgamate_and_verify.sh new file mode 100755 index 0000000..de22d62 --- /dev/null +++ b/amalgamate_and_verify.sh @@ -0,0 +1,30 @@ +#!/bin/bash + +set -e + +source ./amalgamate.sh + +echo "int main() { return 0; }" > main.c +echo "Test compile with GCC..." +gcc -pedantic -Wall -I$OUTPUT_PREFIX main.c $OUTPUT_PREFIX/miniz.c -o test.out +echo "Test compile with GCC ANSI..." +gcc -ansi -pedantic -Wall -I$OUTPUT_PREFIX main.c $OUTPUT_PREFIX/miniz.c -o test.out +if command -v clang +then + echo "Test compile with clang..." + clang -Wall -Wpedantic -fsanitize=unsigned-integer-overflow -I$OUTPUT_PREFIX main.c $OUTPUT_PREFIX/miniz.c -o test.out +fi +for def in MINIZ_NO_STDIO MINIZ_NO_TIME MINIZ_NO_DEFLATE_APIS MINIZ_NO_INFLATE_APIS MINIZ_NO_ARCHIVE_APIS MINIZ_NO_ARCHIVE_WRITING_APIS MINIZ_NO_ZLIB_APIS MINIZ_NO_ZLIB_COMPATIBLE_NAMES MINIZ_NO_MALLOC +do + echo "Test compile with GCC and define $def..." + gcc -ansi -pedantic -Wall -I$OUTPUT_PREFIX main.c $OUTPUT_PREFIX/miniz.c -o test.out -D${def} +done +echo "Test compile with GCC and MINIZ_USE_UNALIGNED_LOADS_AND_STORES=1..." +gcc -ansi -pedantic -Wall -I$OUTPUT_PREFIX main.c $OUTPUT_PREFIX/miniz.c -o test.out -DMINIZ_USE_UNALIGNED_LOADS_AND_STORES=1 +rm test.out +rm main.c + +echo "Amalgamation verified." + + + diff --git a/test.sh b/test.sh index 6eab345..585ce29 100644 --- a/test.sh +++ b/test.sh @@ -2,7 +2,7 @@ set -e -. amalgamate.sh +. amalgamate_and_verify.sh cat << "EOF" > miniz_export.h #ifndef MINIZ_EXPORT