From 1fcb1a18c8f176db41ca817047f89c609921cf6d 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 4c8d3566d..b190fba2c 100755 --- a/tests/ssl-opt.sh +++ b/tests/ssl-opt.sh @@ -487,6 +487,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 bc079e263b43d05235bd1ce928de51a23257d49e 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 b190fba2c..717689f3c 100755 --- a/tests/ssl-opt.sh +++ b/tests/ssl-opt.sh @@ -275,7 +275,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 e5201e479a12348d0985ea7dccabfc1aadc8f27c 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 717689f3c..8046eb71c 100755 --- a/tests/ssl-opt.sh +++ b/tests/ssl-opt.sh @@ -509,19 +509,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 57e328e805ae54b14dc8059fd71a456b01c5ea3b 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 8046eb71c..83123afda 100755 --- a/tests/ssl-opt.sh +++ b/tests/ssl-opt.sh @@ -477,13 +477,6 @@ run_test() { CLI_EXPECT="$3" shift 3 - # 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" @@ -493,6 +486,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 c5ae9c853216c890e39c17fc9a763b05635a0e27 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 83123afda..17f7e2e48 100755 --- a/tests/ssl-opt.sh +++ b/tests/ssl-opt.sh @@ -482,7 +482,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 ed0aaf46a9c193471f69f0ab66c0fbe2626c4865 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 17f7e2e48..792cc6c02 100755 --- a/tests/ssl-opt.sh +++ b/tests/ssl-opt.sh @@ -484,6 +484,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 33659700a35cf4982ac067ac0510bde44220f0c4 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 792cc6c02..c0a1616c4 100755 --- a/tests/ssl-opt.sh +++ b/tests/ssl-opt.sh @@ -513,7 +513,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 793c4367d74c11dd640a013f31219b4e2a5e02e3 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 ef923746e..27ed8bfca 100755 --- a/tests/compat.sh +++ b/tests/compat.sh @@ -1135,7 +1135,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 " ! ==================================================="