mirror of
https://github.com/warmcat/libwebsockets.git
synced 2025-03-16 00:00:07 +01:00

This converts several of the selftests to return a status in their exit code about whether they 'worked'. A small bash script framework is added, with a selftest.sh in the mininmal example dirs that support it, and a ./minimal-examples/selftests.sh script that can be run from the build dir with no args that discovers and runs all the selftest.sh scripts underneath. That is also integrated into travis and the enabled tests must pass now for travis to pass. Travis does not have a modern libuv so it can't run a couple of tests which are nulled out if it sees it's running in travis env.
47 lines
1.2 KiB
Bash
Executable file
47 lines
1.2 KiB
Bash
Executable file
#!/bin/bash
|
|
#
|
|
# $1: path to minimal example binaries...
|
|
# if lws is built with -DLWS_WITH_MINIMAL_EXAMPLES=1
|
|
# that will be ./bin from your build dir
|
|
#
|
|
# $2: path for logs and results. The results will go
|
|
# in a subdir named after the directory this script
|
|
# is in
|
|
#
|
|
# $3: offset for test index count
|
|
#
|
|
# $4: total test count
|
|
#
|
|
# $5: path to ./minimal-examples dir in lws
|
|
#
|
|
# Test return code 0: OK, 254: timed out, other: error indication
|
|
|
|
. $5/selftests-library.sh
|
|
|
|
COUNT_TESTS=6
|
|
|
|
dotest $1 $2 warmcat
|
|
dotest $1 $2 warmcat-h1 --h1
|
|
|
|
spawn "" $5/http-server/minimal-http-server-tls $1/lws-minimal-http-server-tls
|
|
dotest $1 $2 localhost -l
|
|
spawn $SPID $5/http-server/minimal-http-server-tls $1/lws-minimal-http-server-tls
|
|
dotest $1 $2 localhost-h1 -l --h1
|
|
kill $SPID 2>/dev/null
|
|
wait $SPID 2>/dev/null
|
|
|
|
|
|
if [ -z "$TRAVIS_OS_NAME" ] ; then
|
|
SPID=""
|
|
spawn "" $5/http-server/minimal-http-server-libuv $1/lws-minimal-http-server-libuv -s
|
|
dotest $1 $2 localhost-suv -l
|
|
spawn $SPID $5/http-server/minimal-http-server-libuv $1/lws-minimal-http-server-libuv -s
|
|
dotest $1 $2 localhost-suv-h1 -l --h1
|
|
|
|
kill $SPID 2>/dev/null
|
|
wait $SPID 2>/dev/null
|
|
fi
|
|
|
|
exit $FAILS
|
|
|
|
|