Skip to content

Commit dbd5d71

Browse files
author
Andras Fekete
committed
Add in a marker to the PCAP file
1 parent 9a00760 commit dbd5d71

1 file changed

Lines changed: 13 additions & 14 deletions

File tree

scripts/dtls.test

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -50,15 +50,19 @@ prepend() { # Usage: cmd 2>&1 | prepend "sometext "
5050
while read line; do echo "${1}${line}"; done
5151
}
5252

53-
run_test() { # usage: run_test "<udp-proxy args>" "<server args>" "<client args>"
53+
run_test() { # usage: run_test "<testName>" "<udp-proxy args>" "<server args>" "<client args>"
5454
((NUM_TESTS_RUN++))
55-
stdbuf -oL -eL $WOLFSSL_ROOT/examples/server/server -u -p$SERVER_PORT $DTLS_VERSION $2 2>&1 | prepend "[server] " &
55+
echo "" | nc -u 127.0.0.1 $SERVER_PORT # This is a marker for the PCAP file
56+
echo "$1" | nc -u 127.0.0.1 $SERVER_PORT # This is a marker for the PCAP file
57+
echo "" | nc -u 127.0.0.1 $SERVER_PORT # This is a marker for the PCAP file
58+
echo -e "\n${1}\n"
59+
stdbuf -oL -eL $WOLFSSL_ROOT/examples/server/server -u -p$SERVER_PORT $DTLS_VERSION $3 2>&1 | prepend "[server] " &
5660
SERVER_PID=$(($! - 1))
57-
stdbuf -oL -eL $UDP_PROXY_BIN -p $PROXY_PORT -s 127.0.0.1:$SERVER_PORT $UDP_PROXY_EXTRA_ARGS $1 2>&1 | prepend "[udp-proxy] " &
61+
stdbuf -oL -eL $UDP_PROXY_BIN -p $PROXY_PORT -s 127.0.0.1:$SERVER_PORT $UDP_PROXY_EXTRA_ARGS $2 2>&1 | prepend "[udp-proxy] " &
5862
UDP_PROXY_PID=$(($! - 1))
5963
sleep 0.2
6064
# Wrap this command in a timeout so that a deadlock won't bring down the entire test
61-
timeout -s KILL 5m stdbuf -oL -eL $WOLFSSL_ROOT/examples/client/client -u -p$PROXY_PORT $DTLS_VERSION $3 2>&1 | prepend "[client] "
65+
timeout -s KILL 5m stdbuf -oL -eL $WOLFSSL_ROOT/examples/client/client -u -p$PROXY_PORT $DTLS_VERSION $4 2>&1 | prepend "[client] "
6266
if [ $? != 0 ]; then
6367
echo "***Test failed***"
6468
((NUM_TESTS_FAILED++))
@@ -71,21 +75,18 @@ run_test() { # usage: run_test "<udp-proxy args>" "<server args>" "<client args>
7175

7276
test_dropping_packets () {
7377
for i in $(seq 3 11);do
74-
echo -e "\ndropping ${i}th packet\n"
75-
run_test "-d $i" "-Ta" ""
78+
run_test "Dropping ${i}th packet" "-d $i" "-Ta" ""
7679
done
7780

7881
# dropping last ack would be client error as wolfssl_read doesn't support WANT_WRITE as returned error
7982
for i in $(seq 0 10);do
80-
echo -e "\nTesting WANT_WRITE: dropping packet $i\n"
81-
run_test "-f $i" "-Ta -6" "-6"
83+
run_test "Testing WANT_WRITE: dropping packet $i" "-f $i" "-Ta -6" "-6"
8284
done
8385
}
8486

8587
# this test is based on detecting newSessionTicket message by its size. This is rather fragile.
8688
test_dropping_new_session_ticket() { # usage: test_dropping_new_session_ticket <size>
87-
echo -e "\ndropping new session ticket packet of size $1\n"
88-
run_test "-F $1" "-w" "-w --waitTicket"
89+
run_test "Dropping new session ticket packet of size $1" "-F $1" "-w" "-w --waitTicket"
8990
}
9091

9192
test_permutations () {
@@ -97,9 +98,8 @@ for p in itertools.permutations("$2"):
9798
EOF
9899
)
99100
for i in $PERMUTATIONS;do
100-
echo -e "\nTesting $SIDE permutations order $i...\n"
101101
UDP_LOGFILE=$(mktemp)
102-
run_test "-r $i -S $SIDE -l $UDP_LOGFILE" "-Ta -w" "-w"
102+
run_test "Testing $SIDE permutations order $i" "-r $i -S $SIDE -l $UDP_LOGFILE" "-Ta -w" "-w"
103103
echo "...produced $(grep -P 'client:|server:' $UDP_LOGFILE | wc -l) messages"
104104
rm -f $UDP_LOGFILE
105105
done
@@ -119,9 +119,8 @@ for i in tt:
119119
EOF
120120
)
121121
for DELAY in $DELAYS;do
122-
echo -e "\nTesting delay $DELAY...\n"
123122
UDP_LOGFILE=$(mktemp)
124-
run_test "-l $UDP_LOGFILE -t $DELAY" "-Ta -w" "-w"
123+
run_test "Testing delay $DELAY" "-l $UDP_LOGFILE -t $DELAY" "-Ta -w" "-w"
125124
echo "...produced $(grep -P 'client:|server:' $UDP_LOGFILE | wc -l) messages"
126125
rm -f $UDP_LOGFILE
127126
done

0 commit comments

Comments
 (0)