From fcf6c164709e58b68d3dd849416da4681ce54710 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Manuel=20P=C3=A9gouri=C3=A9-Gonnard?= Date: Mon, 8 Jun 2020 11:40:06 +0200 Subject: [PATCH 1/8] ssl-opt.sh: add proxy to all DTLS tests MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit A lot of DTLS test are timing-sensitive, especially those that contain assertions about retransmission. Sometimes some DTLS test fails intermittently on the CI with no clear apparent reason; we need more information in the log to understand the cause of those failures. Adding a proxy means we'll get timing information from the proxy logs. An alternative would be to add timing information to the debug output of ssl_server2 and ssl_client2. But that's more complex because getting sub-second timing info is outside the scope of the C standard, and our current timing module only provides a APi for sub-second intervals, not absolute time. Using the proxy is easier as it's a single point that sees all messages, so elapsed time is fine here, and it's already implemented in the proxy output. Signed-off-by: Manuel Pégourié-Gonnard --- tests/ssl-opt.sh | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/tests/ssl-opt.sh b/tests/ssl-opt.sh index 9d4f650e8..cd51a61b9 100755 --- a/tests/ssl-opt.sh +++ b/tests/ssl-opt.sh @@ -631,6 +631,12 @@ run_test() { # update DTLS variable detect_dtls "$SRV_CMD" + # if the test uses DTLS but no custom proxy, add a simple proxy + # as it provides timing info that's useful to debug failures + if [ "X$PXY_CMD" = "X" -a "$DTLS" -eq 1 ]; then + PXY_CMD="$P_PXY" + fi + # prepend valgrind to our commands if active if [ "$MEMCHECK" -gt 0 ]; then if is_polar "$SRV_CMD"; then From e63fc6d52bd5d2a004131164c92f01c993df4231 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Manuel=20P=C3=A9gouri=C3=A9-Gonnard?= Date: Mon, 8 Jun 2020 11:49:05 +0200 Subject: [PATCH 2/8] ssl-opt.sh: remove old buildbot-specific condition MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Manuel Pégourié-Gonnard --- tests/ssl-opt.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/ssl-opt.sh b/tests/ssl-opt.sh index cd51a61b9..8ccd7ff6a 100755 --- a/tests/ssl-opt.sh +++ b/tests/ssl-opt.sh @@ -405,7 +405,7 @@ fail() { fi echo " ! outputs saved to o-XXX-${TESTS}.log" - if [ "X${USER:-}" = Xbuildbot -o "X${LOGNAME:-}" = Xbuildbot -o "${LOG_FAILURE_ON_STDOUT:-0}" != 0 ]; then + if [ "${LOG_FAILURE_ON_STDOUT:-0}" != 0 ]; then echo " ! server output:" cat o-srv-${TESTS}.log echo " ! ========================================================" From cbd5c0334381dedb97b5750287c4947c18d755a6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Manuel=20P=C3=A9gouri=C3=A9-Gonnard?= Date: Mon, 8 Jun 2020 12:06:21 +0200 Subject: [PATCH 3/8] ssl-opt.sh: include test name in log files MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This is a convenience for when we get log files from failed CI runs, or attach them to bug reports, etc. Signed-off-by: Manuel Pégourié-Gonnard --- tests/ssl-opt.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/ssl-opt.sh b/tests/ssl-opt.sh index 8ccd7ff6a..1c7bc0d38 100755 --- a/tests/ssl-opt.sh +++ b/tests/ssl-opt.sh @@ -653,19 +653,19 @@ run_test() { # run the commands if [ -n "$PXY_CMD" ]; then - echo "$PXY_CMD" > $PXY_OUT + printf "# $NAME\n$PXY_CMD\n" > $PXY_OUT $PXY_CMD >> $PXY_OUT 2>&1 & PXY_PID=$! wait_proxy_start "$PXY_PORT" "$PXY_PID" fi check_osrv_dtls - echo "$SRV_CMD" > $SRV_OUT + printf "# $NAME\n$SRV_CMD\n" > $SRV_OUT provide_input | $SRV_CMD >> $SRV_OUT 2>&1 & SRV_PID=$! wait_server_start "$SRV_PORT" "$SRV_PID" - echo "$CLI_CMD" > $CLI_OUT + printf "# $NAME\n$CLI_CMD\n" > $CLI_OUT eval "$CLI_CMD" >> $CLI_OUT 2>&1 & wait_client_done From bedcb3eb24da35f934b7b1468d18688740977f77 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Manuel=20P=C3=A9gouri=C3=A9-Gonnard?= Date: Thu, 25 Jun 2020 09:52:54 +0200 Subject: [PATCH 4/8] Fix logic error in setting client port MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit We need to do this after we possibly added the proxy. Signed-off-by: Manuel Pégourié-Gonnard --- tests/ssl-opt.sh | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/tests/ssl-opt.sh b/tests/ssl-opt.sh index 1c7bc0d38..a03846353 100755 --- a/tests/ssl-opt.sh +++ b/tests/ssl-opt.sh @@ -621,13 +621,6 @@ run_test() { return fi - # fix client port - if [ -n "$PXY_CMD" ]; then - CLI_CMD=$( echo "$CLI_CMD" | sed s/+SRV_PORT/$PXY_PORT/g ) - else - CLI_CMD=$( echo "$CLI_CMD" | sed s/+SRV_PORT/$SRV_PORT/g ) - fi - # update DTLS variable detect_dtls "$SRV_CMD" @@ -637,6 +630,13 @@ run_test() { PXY_CMD="$P_PXY" fi + # fix client port + if [ -n "$PXY_CMD" ]; then + CLI_CMD=$( echo "$CLI_CMD" | sed s/+SRV_PORT/$PXY_PORT/g ) + else + CLI_CMD=$( echo "$CLI_CMD" | sed s/+SRV_PORT/$SRV_PORT/g ) + fi + # prepend valgrind to our commands if active if [ "$MEMCHECK" -gt 0 ]; then if is_polar "$SRV_CMD"; then From 581af9f720afec7488be6051f7c9d5e2645761af Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Manuel=20P=C3=A9gouri=C3=A9-Gonnard?= Date: Thu, 25 Jun 2020 09:54:46 +0200 Subject: [PATCH 5/8] Simplify test syntax MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Manuel Pégourié-Gonnard --- tests/ssl-opt.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/ssl-opt.sh b/tests/ssl-opt.sh index a03846353..958c36891 100755 --- a/tests/ssl-opt.sh +++ b/tests/ssl-opt.sh @@ -626,7 +626,7 @@ run_test() { # if the test uses DTLS but no custom proxy, add a simple proxy # as it provides timing info that's useful to debug failures - if [ "X$PXY_CMD" = "X" -a "$DTLS" -eq 1 ]; then + if [ -z "$PXY_CMD" ] && [ "$DTLS" -eq 1 ]; then PXY_CMD="$P_PXY" fi From 7442f843d564345f9d3f4ecbeb51aa75c706c194 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Manuel=20P=C3=A9gouri=C3=A9-Gonnard?= Date: Thu, 16 Jul 2020 10:19:32 +0200 Subject: [PATCH 6/8] Fix added proxy command when IPv6 is used MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit For explicit proxy commands (included with `-p "$P_PXY ` in the test case), it's the test's writer responsibility to handle IPv6; only fix the proxy command when we're auto-adding it. Signed-off-by: Manuel Pégourié-Gonnard --- tests/ssl-opt.sh | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tests/ssl-opt.sh b/tests/ssl-opt.sh index 958c36891..f01511879 100755 --- a/tests/ssl-opt.sh +++ b/tests/ssl-opt.sh @@ -628,6 +628,10 @@ run_test() { # as it provides timing info that's useful to debug failures if [ -z "$PXY_CMD" ] && [ "$DTLS" -eq 1 ]; then PXY_CMD="$P_PXY" + case " $SRV_CMD " in + *' server_addr=::1 '*) + PXY_CMD="$PXY_CMD server_addr=::1 listen_addr=::1";; + esac fi # fix client port From a1919ad6e006017a5a1a40b0205683dbaf315914 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Manuel=20P=C3=A9gouri=C3=A9-Gonnard?= Date: Mon, 27 Jul 2020 09:45:32 +0200 Subject: [PATCH 7/8] Fix misuse of printf in shell script MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Manuel Pégourié-Gonnard --- tests/ssl-opt.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/ssl-opt.sh b/tests/ssl-opt.sh index f01511879..8398ab864 100755 --- a/tests/ssl-opt.sh +++ b/tests/ssl-opt.sh @@ -657,7 +657,7 @@ run_test() { # run the commands if [ -n "$PXY_CMD" ]; then - printf "# $NAME\n$PXY_CMD\n" > $PXY_OUT + printf "# %s\n%s\n" "$NAME" "$PXY_CMD" > $PXY_OUT $PXY_CMD >> $PXY_OUT 2>&1 & PXY_PID=$! wait_proxy_start "$PXY_PORT" "$PXY_PID" From 62870c9a7e331346c35ea42b180134571a6418bc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Manuel=20P=C3=A9gouri=C3=A9-Gonnard?= Date: Mon, 27 Jul 2020 09:46:53 +0200 Subject: [PATCH 8/8] Remove obsolete buildbot reference in compat.sh MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Manuel Pégourié-Gonnard --- tests/compat.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/compat.sh b/tests/compat.sh index 362664297..12445609f 100755 --- a/tests/compat.sh +++ b/tests/compat.sh @@ -1259,7 +1259,7 @@ run_client() { cp $CLI_OUT c-cli-${TESTS}.log echo " ! outputs saved to c-srv-${TESTS}.log, c-cli-${TESTS}.log" - if [ "X${USER:-}" = Xbuildbot -o "X${LOGNAME:-}" = Xbuildbot -o "${LOG_FAILURE_ON_STDOUT:-0}" != 0 ]; then + if [ "${LOG_FAILURE_ON_STDOUT:-0}" != 0 ]; then echo " ! server output:" cat c-srv-${TESTS}.log echo " ! ==================================================="