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
Andy Green bce8cca042 refactor: also migrate tls to the ops struct and private.h pattern
Several new ops are planned for tls... so better to bite the bullet and
clean it out to the same level as roles + event-libs first.

Also adds a new travis target "mbedtls" and all the tests except
autobahn against mbedtls build.
2018-05-02 12:10:36 +08:00

55 lines
1.1 KiB
Bash
Executable file

#/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
echo
echo "----------------------------------------------"
echo "------- tests: lws minimal example selftests"
echo
LOGGING_PATH=/tmp/logs
# for mebedtls, we need the CA certs in ./build where we run from
cp ../minimal-examples/http-client/minimal-http-client-multi/warmcat.com.cer .
cp ../minimal-examples/http-client/minimal-http-client-post/libwebsockets.org.cer .
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