aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorToni Uhlig <matzeton@googlemail.com>2020-03-11 18:47:16 +0100
committerToni Uhlig <matzeton@googlemail.com>2020-03-11 18:47:16 +0100
commitfcc8c6479f1c66091c9a21e2da20e85fdb3bdc4b (patch)
tree2fc656274bfa89ead2ff098b8b73de49bccf8d2a
parentcaa3d5cb0dba5ecf2c1474cbfffc29c810e810b1 (diff)
send/recv/verify data test
Signed-off-by: Toni Uhlig <matzeton@googlemail.com>
-rwxr-xr-xtest/integration_test.sh42
1 files changed, 42 insertions, 0 deletions
diff --git a/test/integration_test.sh b/test/integration_test.sh
index 1708216..9ff45a3 100755
--- a/test/integration_test.sh
+++ b/test/integration_test.sh
@@ -17,6 +17,9 @@ fi
test -x "${PTUNNEL_BIN}"
+####################
+# Test PERFORMANCE #
+####################
TUNNEL_TIMEOUT=25
DATA_TIMEOUT=22
@@ -51,9 +54,48 @@ cat /tmp/ptunnel-server.log
cat /tmp/ptunnel-client.log |& grep 'Incoming connection.'
cat /tmp/ptunnel-server.log |& grep 'Starting new session to 127.0.0.1:3000'
+# verify results
CLIENT_ACK_SERIES=$(cat /tmp/ptunnel-client.log |& grep 'Received ack-series starting at seq' | wc -l)
SERVER_ACK_SERIES=$(cat /tmp/ptunnel-server.log |& grep 'Received ack-series starting at seq' | \
grep -v 'Received ack-series starting at seq 65535' | wc -l)
test ${CLIENT_ACK_SERIES} -eq ${SERVER_ACK_SERIES}
+#######################
+# Test DATA INTEGRITY #
+#######################
+TUNNEL_TIMEOUT=10
+DATA_TIMEOUT=7
+
+echo -n >/tmp/ptunnel-server.log
+echo -n >/tmp/ptunnel-client.log
+
+timeout --foreground -k1 ${TUNNEL_TIMEOUT} \
+ ${VALGRIND_BIN} ${VALGRIND_ARGS} \
+ "${PTUNNEL_BIN}" -v4 -r127.0.0.1 -R3000 -l4000 ${PTUNNEL_ARGS} -o/tmp/ptunnel-server.log &
+PTUNNEL_SERVER_PID=$!
+
+timeout --foreground -k1 ${TUNNEL_TIMEOUT} \
+ ${VALGRIND_BIN} ${VALGRIND_ARGS} \
+ "${PTUNNEL_BIN}" -v4 -p127.0.0.1 -r127.0.0.1 -R3000 -l4000 ${PTUNNEL_ARGS} -o/tmp/ptunnel-client.log &
+PTUNNEL_CLIENT_PID=$!
+
+timeout --foreground -k1 ${DATA_TIMEOUT} \
+ nc -l -p 3000 >/tmp/ptunnel-data-recv || true &
+DATA_SERVER_PID=$!
+
+sleep 3
+timeout --foreground -k1 ${DATA_TIMEOUT} \
+ sh -c "dd if=/dev/urandom bs=8192 count=1 >/tmp/ptunnel-data-send && cat /tmp/ptunnel-data-send | sha256sum | cut -d' ' -f1 >/tmp/ptunnel-data-send.sha256 && cat /tmp/ptunnel-data-send | nc 127.0.0.1 4000" || true
+
+wait ${PTUNNEL_CLIENT_PID} || true
+wait ${PTUNNEL_SERVER_PID} || true
+wait ${DATA_SERVER_PID} || true
+
+# verify results
+test ${CLIENT_ACK_SERIES} -eq ${SERVER_ACK_SERIES}
+CLIENT_SHA=$(cat /tmp/ptunnel-data-send.sha256)
+SERVER_SHA=$(cat /tmp/ptunnel-data-recv | sha256sum | cut -d' ' -f1)
+test ${CLIENT_SHA} = ${SERVER_SHA}
+
+
printf 'done\n'