| 1 | #!/usr/bin/env sh |
| 2 | |
| 3 | set -e |
| 4 | |
| 5 | SCRIPT_DIR=$(cd "$(dirname "$0")" && pwd) |
| 6 | INCLUDE_DIR="$SCRIPT_DIR/../linux/include" |
| 7 | LIB_DIR="$SCRIPT_DIR/../linux/lib" |
| 8 | |
| 9 | |
| 10 | print() { |
| 11 | printf '%b' "${*}" |
| 12 | } |
| 13 | |
| 14 | println() { |
| 15 | printf '%b\n' "${*}" |
| 16 | } |
| 17 | |
| 18 | die() { |
| 19 | println "$@" 1>&2 |
| 20 | exit 1 |
| 21 | } |
| 22 | |
| 23 | test_not_present() { |
| 24 | print "Testing that '$1' is not present... " |
| 25 | grep -r $1 "$INCLUDE_DIR" "$LIB_DIR" && die "Fail!" |
| 26 | println "Okay" |
| 27 | } |
| 28 | |
| 29 | println "This test checks that the macro removal process worked as expected" |
| 30 | println "If this test fails, then freestanding.py wasn't able to remove one of these" |
| 31 | println "macros from the source code completely. You'll either need to rewrite the check" |
| 32 | println "or improve freestanding.py." |
| 33 | println "" |
| 34 | |
| 35 | test_not_present "ZSTD_NO_INTRINSICS" |
| 36 | test_not_present "ZSTD_NO_UNUSED_FUNCTIONS" |
| 37 | test_not_present "ZSTD_LEGACY_SUPPORT" |
| 38 | test_not_present "STATIC_BMI2" |
| 39 | test_not_present "ZSTD_DLL_EXPORT" |
| 40 | test_not_present "ZSTD_DLL_IMPORT" |
| 41 | test_not_present "__ICCARM__" |
| 42 | test_not_present "_MSC_VER" |
| 43 | test_not_present "_WIN32" |
| 44 | test_not_present "__linux__" |