1#!/bin/bash
2#
3# $1: path to minimal example binaries...
4#     if lws is built with -DLWS_WITH_MINIMAL_EXAMPLES=1
5#     that will be ./bin from your build dir
6#
7# $2: path for logs and results.  The results will go
8#     in a subdir named after the directory this script
9#     is in
10#
11# $3: offset for test index count
12#
13# $4: total test count
14#
15# $5: path to ./minimal-examples dir in lws
16#
17# Test return code 0: OK, 254: timed out, other: error indication
18
19. $5/selftests-library.sh
20
21COUNT_TESTS=30
22
23dotest $1 $2 warmcat
24dotest $1 $2 warmcat-pipe -p
25dotest $1 $2 warmcat-h1 --h1
26dotest $1 $2 warmcat-h1-pipe --h1 -p
27dotest $1 $2 warmcat-stag -s
28dotest $1 $2 warmcat-pipe-stag -p -s
29dotest $1 $2 warmcat-h1-stag --h1 -s
30dotest $1 $2 warmcat-h1-pipe-stag --h1 -p -s
31dotest $1 $2 warmcat-post --post
32dotest $1 $2 warmcat-post-pipe --post -p
33dotest $1 $2 warmcat-post-pipe-stag --post -p -s
34dotest $1 $2 warmcat-h1-post --post --h1
35dotest $1 $2 warmcat-h1-post-pipe --post --h1 -p
36dotest $1 $2 warmcat-h1-post-pipe-stag --post --h1 -p -s
37dotest $1 $2 warmcat-restrict-pipe --limit 1 -p
38dotest $1 $2 warmcat-restrict-h1-pipe --limit 1 -p --h1
39dotest $1 $2 warmcat-restrict-pipe-stag --limit 1 -p -s
40dotest $1 $2 warmcat-restrict-h1-pipe-stag --limit 1 -p --h1 -s
41dofailtest $1 $2 fail-warmcat-restrict --limit 1
42dofailtest $1 $2 fail-warmcat-restrict-h1 --limit 1 --h1
43dofailtest $1 $2 fail-warmcat-restrict-stag --limit 1 -s
44dofailtest $1 $2 fail-warmcat-restrict-h1-stag --limit 1 --h1 -s
45
46spawn "" $5/http-server/minimal-http-server-tls $1/lws-minimal-http-server-tls
47dotest $1 $2 localhost -l
48spawn $SPID $5/http-server/minimal-http-server-tls $1/lws-minimal-http-server-tls
49dotest $1 $2 localhost-pipe -l -p
50spawn $SPID $5/http-server/minimal-http-server-tls $1/lws-minimal-http-server-tls
51dotest $1 $2 localhost-h1 -l --h1
52spawn $SPID $5/http-server/minimal-http-server-tls $1/lws-minimal-http-server-tls
53dotest $1 $2 localhost-h1-pipe -l --h1 -p
54spawn $SPID $5/http-server/minimal-http-server-tls $1/lws-minimal-http-server-tls
55dotest $1 $2 localhost-stag -l -s
56spawn $SPID $5/http-server/minimal-http-server-tls $1/lws-minimal-http-server-tls
57dotest $1 $2 localhost-pipe-stag -l -p -s
58spawn $SPID $5/http-server/minimal-http-server-tls $1/lws-minimal-http-server-tls
59dotest $1 $2 localhost-h1-stag -l --h1 -s
60spawn $SPID $5/http-server/minimal-http-server-tls $1/lws-minimal-http-server-tls
61dotest $1 $2 localhost-h1-pipe-stag -l --h1 -p -s
62
63kill $SPID 2>/dev/null
64wait $SPID 2>/dev/null
65exit $FAILS
66
67