From f45578648a8b3e429fc4fff877f62dab28bac5b4 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 df3f53b3b..f5ac5ac20 100755 --- a/tests/ssl-opt.sh +++ b/tests/ssl-opt.sh @@ -675,6 +675,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 3f3302f1834db4bcef17482bdbdf8215d1a51eda 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 f5ac5ac20..60a02730c 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 d06125c64950ffdf6980eac6a601c2f07c1e068d 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 60a02730c..b4e033a5e 100755 --- a/tests/ssl-opt.sh +++ b/tests/ssl-opt.sh @@ -697,19 +697,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 69b01f7694d99935f0b23135e699b57124605313 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 b4e033a5e..364ab544c 100755 --- a/tests/ssl-opt.sh +++ b/tests/ssl-opt.sh @@ -665,13 +665,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" @@ -681,6 +674,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 70fce9831eff78fc9e3f5ab3d0d67cf7533eec64 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 364ab544c..18cbd7893 100755 --- a/tests/ssl-opt.sh +++ b/tests/ssl-opt.sh @@ -670,7 +670,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 8779e9a70b626207839cfc7faa30b3435878c5f4 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 18cbd7893..6008837d0 100755 --- a/tests/ssl-opt.sh +++ b/tests/ssl-opt.sh @@ -672,6 +672,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 a3b994fa4d12cb1063029b3afa7ac1dbaa457126 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 6008837d0..4e69a73dc 100755 --- a/tests/ssl-opt.sh +++ b/tests/ssl-opt.sh @@ -701,7 +701,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 882148ed5c027496f516ecb36a21e22948dde0a7 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 54bc0b7d1..5e1b836ab 100755 --- a/tests/compat.sh +++ b/tests/compat.sh @@ -1219,7 +1219,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 " ! ==================================================="