Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/tests/net/ipsec Make tests more stable
details: https://anonhg.NetBSD.org/src/rev/d717a95c3375
branches: trunk
changeset: 355210:d717a95c3375
user: ozaki-r <ozaki-r%NetBSD.org@localhost>
date: Wed Jul 19 02:06:11 2017 +0000
description:
Make tests more stable
sleep command seems to wait longer than expected on anita so
use polling to wait for a state change.
diffstat:
tests/net/ipsec/t_ipsec_misc.sh | 31 ++++++++++++++++++++++++++++---
1 files changed, 28 insertions(+), 3 deletions(-)
diffs (59 lines):
diff -r 7bb1f307d9e9 -r d717a95c3375 tests/net/ipsec/t_ipsec_misc.sh
--- a/tests/net/ipsec/t_ipsec_misc.sh Tue Jul 18 23:12:24 2017 +0000
+++ b/tests/net/ipsec/t_ipsec_misc.sh Wed Jul 19 02:06:11 2017 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: t_ipsec_misc.sh,v 1.11 2017/07/18 02:16:07 ozaki-r Exp $
+# $NetBSD: t_ipsec_misc.sh,v 1.12 2017/07/19 02:06:11 ozaki-r Exp $
#
# Copyright (c) 2017 Internet Initiative Japan Inc.
# All rights reserved.
@@ -438,6 +438,31 @@
cat $outfile
}
+wait_sa_disappeared()
+{
+ local spi=$1
+ local i=
+
+ export RUMP_SERVER=$SOCK_LOCAL
+ for i in $(seq 1 10); do
+ $HIJACKING setkey -D |grep -q "spi=$spi"
+ [ $? != 0 ] && break
+ sleep 1
+ done
+ if [ $i -eq 10 ]; then
+ atf_fail "SA (spi=$spi) didn't disappear in 10s"
+ fi
+ export RUMP_SERVER=$SOCK_PEER
+ for i in $(seq 1 10); do
+ $HIJACKING setkey -D |grep -q "spi=$spi"
+ [ $? != 0 ] && break
+ sleep 1
+ done
+ if [ $i -eq 10 ]; then
+ atf_fail "SA (spi=$spi) didn't disappear in 10s"
+ fi
+}
+
test_spi()
{
local proto=$1
@@ -504,7 +529,7 @@
check_packet_spi $outfile $ip_local $ip_peer $proto_cap 10020
fi
- sleep $((3 + 1))
+ wait_sa_disappeared 10020
export RUMP_SERVER=$SOCK_LOCAL
atf_check -s exit:0 -o ignore rump.ping -c 1 -n -w 3 $ip_peer
@@ -516,7 +541,7 @@
check_packet_spi $outfile $ip_local $ip_peer $proto_cap 10010
fi
- sleep $((6 + 1 - (3 + 1)))
+ wait_sa_disappeared 10010
export RUMP_SERVER=$SOCK_LOCAL
atf_check -s exit:0 -o ignore rump.ping -c 1 -n -w 3 $ip_peer
Home |
Main Index |
Thread Index |
Old Index