1 1.1 christos #!/bin/sh -e 2 1.1 christos 3 1.1 christos DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" 4 1.1 christos 5 1.1 christos ECHO=echo 6 1.1 christos RM="rm -f" 7 1.1 christos GREP="grep" 8 1.1 christos INTOVOID="/dev/null" 9 1.1 christos 10 1.1 christos die() { 11 1.1 christos $ECHO "$@" 1>&2 12 1.1 christos exit 1 13 1.1 christos } 14 1.1 christos 15 1.1 christos isPresent() { 16 1.1 christos $GREP $@ tmplog || die "$@" "should be present" 17 1.1 christos } 18 1.1 christos 19 1.1 christos mustBeAbsent() { 20 1.1 christos $GREP $@ tmplog && die "$@ should not be there !!" 21 1.1 christos $ECHO "$@ correctly not present" # for some reason, this $ECHO must exist, otherwise mustBeAbsent() always fails (??) 22 1.1 christos } 23 1.1 christos 24 1.1 christos # default compilation : all features enabled - no zbuff 25 1.1 christos $ECHO "testing default library compilation" 26 1.1 christos CFLAGS= make -C $DIR/../lib libzstd libzstd.a > $INTOVOID 27 1.1 christos nm $DIR/../lib/libzstd.a | $GREP "\.o" > tmplog 28 1.1 christos isPresent "zstd_compress.o" 29 1.1 christos isPresent "zstd_decompress.o" 30 1.1 christos isPresent "zdict.o" 31 1.1 christos isPresent "zstd_v07.o" 32 1.1 christos mustBeAbsent "zbuff_compress.o" 33 1.1 christos $RM tmplog 34 1.1 christos 35 1.1 christos # Check that the exec-stack bit isn't set 36 1.1 christos readelf -lW $DIR/../lib/libzstd.so | $GREP "GNU_STACK" > tmplog 37 1.1 christos mustBeAbsent "RWE" 38 1.1 christos $RM $DIR/../lib/libzstd.a $DIR/../lib/libzstd.so* tmplog 39 1.1 christos 40 1.1 christos # compression disabled => also disable zdict 41 1.1 christos $ECHO "testing with compression disabled" 42 1.1 christos ZSTD_LIB_COMPRESSION=0 CFLAGS= make -C $DIR/../lib libzstd.a > $INTOVOID 43 1.1 christos nm $DIR/../lib/libzstd.a | $GREP "\.o" > tmplog 44 1.1 christos mustBeAbsent "zstd_compress.o" 45 1.1 christos isPresent "zstd_decompress.o" 46 1.1 christos mustBeAbsent "zdict.o" 47 1.1 christos isPresent "zstd_v07.o" 48 1.1 christos mustBeAbsent "zbuff_compress.o" 49 1.1 christos $RM $DIR/../lib/libzstd.a tmplog 50 1.1 christos 51 1.1 christos # decompression disabled => also disable legacy 52 1.1 christos $ECHO "testing with decompression disabled" 53 1.1 christos ZSTD_LIB_DECOMPRESSION=0 CFLAGS= make -C $DIR/../lib libzstd.a > $INTOVOID 54 1.1 christos nm $DIR/../lib/libzstd.a | $GREP "\.o" > tmplog 55 1.1 christos isPresent "zstd_compress.o" 56 1.1 christos mustBeAbsent "zstd_decompress.o" 57 1.1 christos isPresent "zdict.o" 58 1.1 christos mustBeAbsent "zstd_v07.o" 59 1.1 christos mustBeAbsent "zbuff_compress.o" 60 1.1 christos $RM $DIR/../lib/libzstd.a tmplog 61 1.1 christos 62 1.1 christos # deprecated function disabled => only remove zbuff 63 1.1 christos $ECHO "testing with deprecated functions disabled" 64 1.1 christos ZSTD_LIB_DEPRECATED=0 CFLAGS= make -C $DIR/../lib libzstd.a > $INTOVOID 65 1.1 christos nm $DIR/../lib/libzstd.a | $GREP "\.o" > tmplog 66 1.1 christos isPresent "zstd_compress.o" 67 1.1 christos isPresent "zstd_decompress.o" 68 1.1 christos isPresent "zdict.o" 69 1.1 christos isPresent "zstd_v07.o" 70 1.1 christos mustBeAbsent "zbuff_compress.o" 71 1.1 christos $RM $DIR/../lib/libzstd.a tmplog 72 1.1 christos 73 1.1 christos # deprecated function enabled => zbuff present 74 1.1 christos $ECHO "testing with deprecated functions enabled" 75 1.1 christos ZSTD_LIB_DEPRECATED=1 CFLAGS= make -C $DIR/../lib libzstd.a > $INTOVOID 76 1.1 christos nm $DIR/../lib/libzstd.a | $GREP "\.o" > tmplog 77 1.1 christos isPresent "zstd_compress.o" 78 1.1 christos isPresent "zstd_decompress.o" 79 1.1 christos isPresent "zdict.o" 80 1.1 christos isPresent "zstd_v07.o" 81 1.1 christos isPresent "zbuff_compress.o" 82 1.1 christos $RM $DIR/../lib/libzstd.a tmplog 83 1.1 christos 84 1.1 christos # dictionary builder disabled => only remove zdict 85 1.1 christos $ECHO "testing with dictionary builder disabled" 86 1.1 christos ZSTD_LIB_DICTBUILDER=0 CFLAGS= make -C $DIR/../lib libzstd.a > $INTOVOID 87 1.1 christos nm $DIR/../lib/libzstd.a | $GREP "\.o" > tmplog 88 1.1 christos isPresent "zstd_compress.o" 89 1.1 christos isPresent "zstd_decompress.o" 90 1.1 christos mustBeAbsent "zdict.o" 91 1.1 christos isPresent "zstd_v07.o" 92 1.1 christos mustBeAbsent "zbuff_compress.o" 93 1.1 christos $RM $DIR/../lib/libzstd.a tmplog 94 1.1 christos 95 1.1 christos # both decompression and dictionary builder disabled => only compression remains 96 1.1 christos $ECHO "testing with both decompression and dictionary builder disabled (only compression remains)" 97 1.1 christos ZSTD_LIB_DECOMPRESSION=0 ZSTD_LIB_DICTBUILDER=0 CFLAGS= make -C $DIR/../lib libzstd.a > $INTOVOID 98 1.1 christos nm $DIR/../lib/libzstd.a | $GREP "\.o" > tmplog 99 1.1 christos isPresent "zstd_compress.o" 100 1.1 christos mustBeAbsent "zstd_decompress.o" 101 1.1 christos mustBeAbsent "zdict.o" 102 1.1 christos mustBeAbsent "zstd_v07.o" 103 1.1 christos mustBeAbsent "zbuff_compress.o" 104 1.1 christos $RM $DIR/../lib/libzstd.a tmplog 105