1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88
|
#!/bin/bash
# Script for sysstat simulation test environment
# (C) 2020-2023 Sebastien GODARD (sysstat <at> orange.fr)
FAILURES=""
if [ "$1" = "conf" ]
then
# Configure sysstat in test mode
make distclean
./configure sa_lib_dir=. sar_dir=. conf_dir=. conf_file=sysstat.sysconfig sa_dir=tests --enable-debuginfo --disable-stripping
elif [ "$1" = "conflto" ]
then
# Configure sysstat in test mode with LTO support
make distclean
./configure sa_lib_dir=. sar_dir=. conf_dir=. conf_file=sysstat.sysconfig sa_dir=tests --enable-debuginfo --enable-lto --disable-stripping
elif [ "$1" = "comp" ]
then
# Compile sysstat in test mode
make simtest TFLAGS="-DTEST"
else
if [ "$1" != "sim" ]
then
# Configure then compile sysstat in test mode
make distclean
# ./configure sa_lib_dir=. sar_dir=. conf_dir=. conf_file=sysstat.sysconfig sa_dir=tests --enable-debuginfo && make TFLAGS="-DTEST" && make simtest
./configure sa_lib_dir=. sar_dir=. conf_dir=. conf_file=sysstat.sysconfig sa_dir=tests --enable-debuginfo --disable-stripping && make simtest TFLAGS="-DTEST"
fi
rm -f tests/results.tmp
COUNT=0
TOTAL=`ls -1 tests/0* | wc -l`
LIST=`ls tests | grep -E '^[0-9]+$' | sort -n`
for f in ${LIST}; do
if [ "$2" = cont -a -f tests/LAST ]
then
L=`cat tests/LAST`
if [ $f -lt $L ]
then
continue
else
rm -f tests/LAST
fi
fi
let "COUNT+=1"
echo $f
echo -n "$f: " >> tests/results.tmp
cat tests/$f | /bin/sh
if [ $? -eq 0 ]
then
if [ -f tests/SKIPPED ]
then
echo Skipped. >> tests/results.tmp
rm tests/SKIPPED;
else
echo Success! >> tests/results.tmp;
fi
else
FAILURES="$FAILURES $f"
echo Failed... >> tests/results.tmp;
echo $f > tests/LAST;
if [ "$1" != "ignore" -a "$2" != "ignore" ]
then
exit 3
fi
fi
done
rm -f tests/root
ln -s root1 tests/root
echo Run ${COUNT}/${TOTAL} test\(s\)
[ -n "$FAILURES" ] || echo Simulation tests: Success!
fi
if [ "$?" = "0" -a "$1" = "all" ]
then
# Debian: disable cleaning after the test. so *.tmp files are not removed
# make extratest && make distclean && ./configure --disable-nls --disable-sensors --disable-pcp sa_lib_dir=. sar_dir=. conf_dir=. conf_file=sysstat.sysconfig sa_dir=tests --enable-debuginfo --disable-stripping && make TFLAGS="-DTEST" && echo "EXTRA TESTS: Success!"
make extratest && echo "EXTRA TESTS: Success!" || FAILURES="${FAILURES}${FAILURES:+ and }EXTRA TESTS"
fi
if [ "$?" != "0" -o -n "$FAILURES" ]
then
echo "Simulation tests failed${FAILURES:+ on }${FAILURES}."
exit 4
fi
|