summaryrefslogtreecommitdiffabout
path: root/tests/builtin.at
Side-by-side diff
Diffstat (limited to 'tests/builtin.at') (more/less context) (ignore whitespace changes)
-rw-r--r--tests/builtin.at77
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])
+
+

Return to:

Send suggestions and report system problems to the System administrator.