mirror of
https://github.com/intel/isa-l.git
synced 2025-01-19 04:26:08 +01:00
build: Add extended test scripts
Change-Id: Ia5d57d8e1c0037ecf3d235651adcc33913049c94 Signed-off-by: Greg Tucker <greg.b.tucker@intel.com>
This commit is contained in:
parent
74d5d3660b
commit
7ab24b769e
37
tools/test_autorun.sh
Executable file
37
tools/test_autorun.sh
Executable file
@ -0,0 +1,37 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
set -e #exit on fail
|
||||
|
||||
# Override defaults if exist
|
||||
READLINK=readlink
|
||||
command -V greadlink >/dev/null 2>&1 && READLINK=greadlink
|
||||
|
||||
|
||||
out="$PWD"
|
||||
src=$($READLINK -f $(dirname $0))/..
|
||||
cd "$src"
|
||||
|
||||
[ -z "$1" ] && ./tools/test_checks.sh
|
||||
|
||||
while [ -n "$1" ]; do
|
||||
case "$1" in
|
||||
check )
|
||||
./tools/test_checks.sh
|
||||
shift ;;
|
||||
ext )
|
||||
./tools/test_extended.sh
|
||||
shift ;;
|
||||
format )
|
||||
shift ;;
|
||||
all )
|
||||
./tools/test_checks.sh
|
||||
./tools/test_extended.sh
|
||||
shift ;;
|
||||
* )
|
||||
echo $0 undefined option: $1
|
||||
shift ;;
|
||||
esac
|
||||
done
|
||||
|
||||
./tools/check_format.sh
|
||||
|
67
tools/test_checks.sh
Executable file
67
tools/test_checks.sh
Executable file
@ -0,0 +1,67 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
set -xe #exit on fail
|
||||
|
||||
# Defaults
|
||||
cpus=1
|
||||
S=$RANDOM
|
||||
MAKE=make
|
||||
READLINK=readlink
|
||||
|
||||
# Override defaults if exist
|
||||
command -V gmake >/dev/null 2>&1 && MAKE=gmake
|
||||
command -V greadlink >/dev/null 2>&1 && READLINK=greadlink
|
||||
|
||||
out="$PWD"
|
||||
src=$($READLINK -f $(dirname $0))/..
|
||||
cd "$src"
|
||||
tmp_install_dir=$out/tmp_install
|
||||
|
||||
# Run on mult cpus
|
||||
if command -V lscpu >/dev/null 2>&1; then
|
||||
cpus=`lscpu -p | tail -1 | cut -d, -f 2`
|
||||
cpus=$(($cpus + 1))
|
||||
elif command -V sysctl; then
|
||||
if sysctl -n hw.ncpu >/dev/null 2>&1; then
|
||||
cpus=$(sysctl -n hw.ncpu)
|
||||
cpus=$(($cpus + 1))
|
||||
fi
|
||||
fi
|
||||
echo "Using $cpus cpu threads"
|
||||
|
||||
# Pick a random test seed
|
||||
if [ -z "$S" ]; then
|
||||
S=`tr -cd 0-9 </dev/urandom | head -c 4 | sed -e 's/^0*/1/g'`
|
||||
[ "$S" -gt 0 ] 2> /dev/null || S="123"
|
||||
fi
|
||||
echo "Running with TEST_SEED=$S"
|
||||
|
||||
# Fix Darwin issues
|
||||
if uname | grep -q 'Darwin' 2>&1; then
|
||||
export SED=`which sed`
|
||||
fi
|
||||
|
||||
# Tests
|
||||
time ./autogen.sh
|
||||
time ./configure --prefix=$tmp_install_dir $opt_config_target
|
||||
time $MAKE -j $cpus
|
||||
time $MAKE check -j $cpus D="-D TEST_SEED=$S"
|
||||
time $MAKE install
|
||||
|
||||
# Check for gnu executable stack set
|
||||
if command -V readelf >/dev/null 2>&1; then
|
||||
if readelf -W -l $tmp_install_dir/lib/libisal.so | grep 'GNU_STACK' | grep -q 'RWE'; then
|
||||
echo Stack NX check $tmp_install_dir/lib/libisal.so Fail
|
||||
exit 1
|
||||
else
|
||||
echo Stack NX check $tmp_install_dir/lib/libisal.so Pass
|
||||
fi
|
||||
else
|
||||
echo Stack NX check not supported
|
||||
fi
|
||||
|
||||
$MAKE clean
|
||||
|
||||
|
||||
|
||||
echo $0: Pass
|
161
tools/test_extended.sh
Executable file
161
tools/test_extended.sh
Executable file
@ -0,0 +1,161 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# Extended tests: Run a few more options other than make check
|
||||
|
||||
set -xe #exit on fail
|
||||
|
||||
# Defaults
|
||||
cpus=1
|
||||
S=$RANDOM
|
||||
MAKE=make
|
||||
READLINK=readlink
|
||||
test_level=check
|
||||
build_opt=''
|
||||
msg=''
|
||||
|
||||
# Override defaults if exist
|
||||
command -V gmake >/dev/null 2>&1 && MAKE=gmake
|
||||
command -V greadlink >/dev/null 2>&1 && READLINK=greadlink
|
||||
[ -n "$CC" ] && build_opt+="CC=$CC "
|
||||
[ -n "$AS" ] && build_opt+="AS=$AS "
|
||||
|
||||
out="$PWD"
|
||||
src=$($READLINK -f $(dirname $0))/..
|
||||
cd "$src"
|
||||
|
||||
# Run on mult cpus
|
||||
if command -V lscpu >/dev/null 2>&1; then
|
||||
cpus=`lscpu -p | tail -1 | cut -d, -f 2`
|
||||
cpus=$(($cpus + 1))
|
||||
elif command -V sysctl; then
|
||||
if sysctl -n hw.ncpu >/dev/null 2>&1; then
|
||||
cpus=$(sysctl -n hw.ncpu)
|
||||
cpus=$(($cpus + 1))
|
||||
fi
|
||||
fi
|
||||
echo "Using $cpus cpu threads"
|
||||
|
||||
if [ -z "$S" ]; then
|
||||
S=`tr -cd 0-9 </dev/urandom | head -c 4 | sed -e 's/^0*/1/g'`
|
||||
[ "$S" -gt 0 ] 2> /dev/null || S="123"
|
||||
fi
|
||||
msg+="Running with TEST_SEED=$S".$'\n'
|
||||
|
||||
# Fix Darwin issues
|
||||
if uname | grep -q 'Darwin' 2>&1; then
|
||||
export SED=`which sed`
|
||||
fi
|
||||
|
||||
# Check for test libs to add
|
||||
if command -V ldconfig >/dev/null 2>&1; then
|
||||
if ldconfig -p | grep -q libz.so; then
|
||||
test_level=test
|
||||
msg+=$'With extra tests\n'
|
||||
fi
|
||||
if ldconfig -p | grep -q libefence.so; then
|
||||
build_opt+="LDFLAGS+='-lefence' "
|
||||
msg+=$'With efence\n'
|
||||
fi
|
||||
fi
|
||||
|
||||
# Std makefile build test
|
||||
$MAKE -f Makefile.unx clean
|
||||
time $MAKE -f Makefile.unx -j $cpus $build_opt
|
||||
msg+=$'Std makefile build: Pass\n'
|
||||
|
||||
# Check for gnu executable stack set
|
||||
if command -V readelf >/dev/null 2>&1; then
|
||||
if readelf -W -l bin/libisal.so | grep 'GNU_STACK' | grep -q 'RWE'; then
|
||||
echo $0: Stack NX check bin/libisal.so: Fail
|
||||
exit 1
|
||||
else
|
||||
msg+=$'Stack NX check bin/lib/libisal.so: Pass\n'
|
||||
fi
|
||||
else
|
||||
msg+=$'Stack NX check not supported: Skip\n'
|
||||
fi
|
||||
|
||||
# Std makefile build perf tests
|
||||
time $MAKE -f Makefile.unx -j $cpus perfs
|
||||
msg+=$'Std makefile build perf: Pass\n'
|
||||
|
||||
# Std makefile run tests
|
||||
time $MAKE -f Makefile.unx -j $cpus $build_opt $test_level
|
||||
msg+=$'Std makefile tests: Pass\n'
|
||||
|
||||
# Std makefile build other
|
||||
time $MAKE -f Makefile.unx -j $cpus $build_opt other
|
||||
msg+=$'Other tests build: Pass\n'
|
||||
|
||||
# Try to pick a random src file
|
||||
if command -V shuf >/dev/null 2>&1; then
|
||||
in_file=$(find $src -type f -size +0 -name \*.c -o -name \*.asm -print 2>/dev/null | shuf | head -1 );
|
||||
else
|
||||
in_file=configure.ac
|
||||
fi
|
||||
|
||||
echo Other tests using $in_file
|
||||
./igzip_file_perf $in_file
|
||||
./igzip_stateless_file_perf $in_file
|
||||
./igzip_hist_perf $in_file
|
||||
./igzip_semi_dyn_file_perf $in_file
|
||||
./igzip_inflate_perf $in_file
|
||||
./igzip_fuzz_inflate $in_file
|
||||
msg+=$'Other tests run: Pass\n'
|
||||
|
||||
if command -V shuf >/dev/null 2>&1; then
|
||||
in_files=$(find $src -type f -size +0 -print 2>/dev/null | shuf | head -10 );
|
||||
./igzip_rand_test $in_files
|
||||
./igzip_inflate_test $in_files
|
||||
msg+=$'Compression file tests: Pass\n'
|
||||
else
|
||||
msg+=$'Compression file test: Skip\n'
|
||||
fi
|
||||
|
||||
time $MAKE -f Makefile.unx -j $cpus $build_opt ex
|
||||
msg+=$'Examples build: Pass\n'
|
||||
|
||||
./crc_simple_test
|
||||
./crc64_example
|
||||
./xor_example
|
||||
./igzip_example ${in_file} ${in_file}.cmp
|
||||
rm -rf ${in_file}.cmp
|
||||
msg+=$'Examples run: Pass\n'
|
||||
|
||||
# Test custom hufftables
|
||||
./generate_custom_hufftables $in_file
|
||||
$MAKE -f Makefile.unx -j $cpus checks
|
||||
./igzip_rand_test $in_file
|
||||
rm -rf hufftables_c.c
|
||||
msg+=$'Custom hufftable build: Pass\n'
|
||||
|
||||
$MAKE -f Makefile.unx clean
|
||||
|
||||
# noarch build
|
||||
time $MAKE -f Makefile.unx -j $cpus arch=noarch $build_opt
|
||||
time $MAKE -f Makefile.unx -j $cpus arch=noarch $build_opt check
|
||||
$MAKE -f Makefile.unx arch=noarch clean
|
||||
msg+=$'Noarch build: Pass\n'
|
||||
|
||||
# Try mingw build
|
||||
if command -V x86_64-w64-mingw32-gcc >/dev/null 2>&1; then
|
||||
time $MAKE -f Makefile.unx -j $cpus arch=mingw
|
||||
msg+=$'Mingw build: Pass\n'
|
||||
|
||||
if command -V wine >/dev/null 2>&1; then
|
||||
time $MAKE -f Makefile.unx -j $cpus arch=mingw check
|
||||
msg+=$'Mingw check tests: Pass\n'
|
||||
else
|
||||
msg+=$'No wine, mingw check: Skip\n'
|
||||
fi
|
||||
$MAKE -f Makefile.unx arch=mingw clean
|
||||
else
|
||||
msg+=$'No mingw build: Skip\n'
|
||||
fi
|
||||
|
||||
set +x
|
||||
echo
|
||||
echo "Summary test $0:"
|
||||
echo "Build opt: $build_opt"
|
||||
echo "$msg"
|
||||
echo "$0: Final: Pass"
|
Loading…
x
Reference in New Issue
Block a user