From 8511762a57552154007bbdcbf8bce4ba28e60032 Mon Sep 17 00:00:00 2001 From: Anton Lindqvist Date: Sun, 28 Jan 2024 12:36:22 +0000 Subject: Use the wait until construct in ixp.sh in the hopes of making it more stable. --- regress/usr.sbin/bgpd/integrationtests/ixp.sh | 10 +++---- .../bgpd/integrationtests/network_statement.sh | 32 ++++------------------ regress/usr.sbin/bgpd/integrationtests/util.sh | 11 ++++++++ 3 files changed, 22 insertions(+), 31 deletions(-) create mode 100644 regress/usr.sbin/bgpd/integrationtests/util.sh (limited to 'regress/usr.sbin') diff --git a/regress/usr.sbin/bgpd/integrationtests/ixp.sh b/regress/usr.sbin/bgpd/integrationtests/ixp.sh index ae4b1d152e4..8779285019a 100644 --- a/regress/usr.sbin/bgpd/integrationtests/ixp.sh +++ b/regress/usr.sbin/bgpd/integrationtests/ixp.sh @@ -1,5 +1,5 @@ #!/bin/ksh -# $OpenBSD: ixp.sh,v 1.1 2023/10/12 09:18:56 claudio Exp $ +# $OpenBSD: ixp.sh,v 1.2 2024/01/28 12:36:21 anton Exp $ set -e @@ -43,6 +43,8 @@ if [ "$(id -u)" -ne 0 ]; then exit 1 fi +. "${BGPDCONFIGDIR}/util.sh" + trap 'error_notify $?' EXIT echo check if rdomains are busy @@ -84,17 +86,15 @@ route -T ${RDOMAIN2} exec ${BGPD} \ route -T ${RDOMAIN2} exec ${BGPD} \ -v -f ${BGPDCONFIGDIR}/bgpd.ixp.rdomain2_4.conf -sleep 3 - +wait_until "route -T ${RDOMAIN1} exec bgpctl show rib detail | ! cmp /dev/null -" route -T ${RDOMAIN1} exec bgpctl show rib detail | grep -v 'Last update:' | \ tee ixp.rdomain1.out -sleep .2 diff -u ${BGPDCONFIGDIR}/ixp.rdomain1.ok ixp.rdomain1.out echo OK +wait_until "route -T ${RDOMAIN2} exec bgpctl show rib detail | ! cmp /dev/null -" route -T ${RDOMAIN2} exec bgpctl show rib detail | grep -v 'Last update:' | \ tee ixp.rdomain2.out -sleep .2 diff -u ${BGPDCONFIGDIR}/ixp.rdomain2.ok ixp.rdomain2.out echo OK diff --git a/regress/usr.sbin/bgpd/integrationtests/network_statement.sh b/regress/usr.sbin/bgpd/integrationtests/network_statement.sh index 66c704ed5eb..8925dbf3ef1 100644 --- a/regress/usr.sbin/bgpd/integrationtests/network_statement.sh +++ b/regress/usr.sbin/bgpd/integrationtests/network_statement.sh @@ -1,5 +1,5 @@ #!/bin/ksh -# $OpenBSD: network_statement.sh,v 1.8 2023/02/15 14:19:08 claudio Exp $ +# $OpenBSD: network_statement.sh,v 1.9 2024/01/28 12:36:21 anton Exp $ set -e @@ -34,7 +34,6 @@ error_notify() { route -qn -T ${RDOMAIN2} flush || true ifconfig lo${RDOMAIN1} destroy || true ifconfig lo${RDOMAIN2} destroy || true - rm -f ${TMP} if [ $1 -ne 0 ]; then echo FAILED exit 1 @@ -43,27 +42,14 @@ error_notify() { fi } -wait_until() { - local _i=0 - - cat >"$TMP" - while [ "$_i" -lt 8 ]; do - sh -x "$TMP" && return 0 - sleep 0.5 - _i="$((_i + 1))" - done - echo timeout - return 1 -} - if [ "$(id -u)" -ne 0 ]; then echo need root privileges >&2 exit 1 fi -trap 'error_notify $?' EXIT +. "${BGPDCONFIGDIR}/util.sh" -TMP="$(mktemp -t bgpd.XXXXXX)" +trap 'error_notify $?' EXIT echo check if rdomains are busy for n in ${RDOMAINS}; do @@ -104,9 +90,7 @@ sleep 1 route -T ${RDOMAIN1} exec bgpctl nei RDOMAIN2 up sleep 1 -wait_until <