1
0
Fork 0
mirror of https://github.com/warmcat/libwebsockets.git synced 2025-03-16 00:00:07 +01:00
libwebsockets/minimal-examples/selftests.sh

47 lines
828 B
Bash
Raw Normal View History

#/bin/bash
#
# run this from your build dir having configured
# -DLWS_WITH_MINIMAL_EXAMPLES=1 to get all the examples
# that apply built into ./bin
#
# Eg,
#
# build $ ../minimal-examples/selftests.sh
LOGGING_PATH=/tmp/logs
MINEX=`dirname $0`
MINEX=`realpath $MINEX`
TESTS=0
for i in `find $MINEX -name selftest.sh` ; do
C=`cat $i | grep COUNT_TESTS= | cut -d= -f2`
TESTS=$(( $TESTS + $C ))
done
FAILS=0
WH=1
for i in `find $MINEX -name selftest.sh` ; do
C=`cat $i | grep COUNT_TESTS= | cut -d= -f2`
sh $i `pwd`/bin $LOGGING_PATH $WH $TESTS $MINEX
FAILS=$(( $FAILS + $? ))
L=`ps fax | grep lws- | cut -d' ' -f2`
kill $L 2>/dev/null
kill -9 $L 2>/dev/null
wait $L 2>/dev/null
WH=$(( $WH + $C ))
done
if [ $FAILS -eq 0 ] ; then
echo "All $TESTS passed"
exit 0
else
echo "Failed: $FAILS / $TESTS"
exit 1
fi