diff options
author | Sergey Poznyakoff <gray@gnu.org> | 2019-06-12 19:23:39 +0300 |
---|---|---|
committer | Sergey Poznyakoff <gray@gnu.org> | 2019-06-12 19:29:45 +0300 |
commit | 85563afeac954a50de7e4c207f43b57a4e63e474 (patch) | |
tree | 967054eb92014811e067f1d56c99e12c268f1824 /tests/builtin.at | |
parent | f5c72b5e74ea7aaf1375f763f977e3249c6b7fc4 (diff) | |
download | pies-85563afeac954a50de7e4c207f43b57a4e63e474.tar.gz pies-85563afeac954a50de7e4c207f43b57a4e63e474.tar.bz2 |
More tests for built-in services
* tests/builtin.at: Check tcpmux services.
* tests/nt.c: Add tcpmux support, improve error checking.
* tests/chargen.c: Improve error checking.
Diffstat (limited to 'tests/builtin.at')
-rw-r--r-- | tests/builtin.at | 77 |
1 files changed, 77 insertions, 0 deletions
diff --git a/tests/builtin.at b/tests/builtin.at index 40f65fa..893f213 100644 --- a/tests/builtin.at +++ b/tests/builtin.at @@ -129,3 +129,80 @@ to the input. m4_popdef([IT_BUILTIN]) m4_popdef([IT_SPECIAL]) + +# IT_TCPMUX([KW],[ID],[INPUT],[OUTPUT]) +m4_define([IT_TCPMUX], +[AT_SETUP([tcpmux: $1]) +AT_KEYWORDS([inetd builtin internal tcpmux $1]) +AT_CHECK([ +PIES_XFAIL_CHECK +PIES_CONTROL_INIT +: ${PIES_TEST_INET_SOCKET:=unix://$PWD/in.sock} +m4_if([$3],[],[],[AT_DATA([input],[$3])]) +cat > pies.conf <<_EOT +component master { + socket "$PIES_TEST_INET_SOCKET"; + service tcpmux; + flags internal; +} +component one { + service one; + flags (tcpmuxplus); + tcpmux-master master; + command "$auxdir/in.test $PWD/one.log"; + stderr file "$PWD/one.err"; +} +component two { + service two; + flags (tcpmuxplus); + tcpmux-master master; + command "$auxdir/in.test $PWD/two.log"; + stderr file "$PWD/two.err"; +} +component test { + command "nt -t [$2]m4_if([$3],[],,[ -i $PWD/input]) -o $PWD/test.out '$PIES_TEST_INET_SOCKET'"; + stderr file "$PWD/test.err"; + return-code * { + action disable; + exec "piesctl --no-netrc --url=$PIES_CTLSOCK shutdown"; + } +} +_EOT + +set -e +to 10 \ + pies --foreground --stderr \ + --config-file control.conf --config-file pies.conf --debug 1 2>errlog + +for err in one.err two.err test.err +do + if test -s $err; then + echo "$err:" + cat $err + fi +done >&2 + +if test -f test.out; then + cat test.out | tr -d '\r' +fi +], +[0], +[$4]) +AT_CLEANUP +]) + +IT_TCPMUX([help],[help],[], +[one +two +]) + +IT_TCPMUX([service],[one], +[Test one +quit +], +[OK Test one +]) + +m4_popdef([IT_TCPMUX]) + + |