aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorToni Uhlig <matzeton@googlemail.com>2020-02-01 21:22:53 +0100
committerToni Uhlig <matzeton@googlemail.com>2020-02-01 21:22:53 +0100
commitd33d8774104fa838f2856c0f48ffb84eb3d53b78 (patch)
tree5800869dd8e01d4b806363a5d4f2d2b403157042
parentb6495665b8cfc2acf140e3348ae3e29839b643ee (diff)
added very simple integration test script
Signed-off-by: Toni Uhlig <matzeton@googlemail.com>
-rwxr-xr-xtest/integration_test.sh35
1 files changed, 35 insertions, 0 deletions
diff --git a/test/integration_test.sh b/test/integration_test.sh
new file mode 100755
index 0000000..e261954
--- /dev/null
+++ b/test/integration_test.sh
@@ -0,0 +1,35 @@
+#!/usr/bin/env bash
+
+set -e
+set -x
+set -o pipefail
+
+
+SRC_ROOT=$(realpath $(dirname $0)/..)
+PTUNNEL_BIN=${SRC_ROOT}/src/ptunnel-ng
+
+TUNNEL_TIMEOUT=25
+timeout --foreground -k1 ${TUNNEL_TIMEOUT} \
+ valgrind --error-exitcode=1 --exit-on-first-error=yes \
+ "${PTUNNEL_BIN}" -v4 -r127.0.0.1 -R3000 >/dev/null &
+PTUNNEL_SERVER_PID=$!
+
+timeout --foreground -k1 ${TUNNEL_TIMEOUT} \
+ valgrind --error-exitcode=1 --exit-on-first-error=yes \
+ "${PTUNNEL_BIN}" -v4 -p127.0.0.1 -r127.0.0.1 -R3000 >/dev/null &
+PTUNNEL_CLIENT_PID=$!
+
+timeout --foreground -k1 ${TUNNEL_TIMEOUT} \
+ nc -l -p 3000 >/dev/null &
+DATA_SERVER_PID=$!
+
+sleep 3
+DATA_TIMEOUT=20
+timeout --foreground -k1 ${DATA_TIMEOUT} \
+ sh -c "dd if=/dev/urandom bs=8192 | nc 127.0.0.1 3000" || true
+
+wait ${PTUNNEL_SERVER_PID} || true
+wait ${PTUNNEL_CLIENT_PID} || true
+wait ${DATA_SERVER_PID} || true
+
+printf 'done\n'