aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorAntonio Quartulli2019-09-19 09:28:20 +0200
committerGert Doering2019-09-19 09:44:04 +0200
commit8aa037161f37c42585ac4a8d99f37af624211da6 (patch)
treeedb85ae1b775404af06bbd3385e96adc5635ca9a /tests
parentdaaa43941c7fa3b7689a5abcbd4e8e30f63856d2 (diff)
downloadopenvpn-8aa037161f37c42585ac4a8d99f37af624211da6.zip
openvpn-8aa037161f37c42585ac4a8d99f37af624211da6.tar.gz
t_net.sh: wait for NO-CARRIER bit to settle before starting test
Interfaces of type tun are marked as NO-CARRIER when no process is attached to them. However, this bit gets set with some delay after creation. For this reason, it is better to wait for the bit to settle before starting any test, otherwise any timing influence on the test may lead to inconsistencies due to the NO-CARRIER bit randomly being or not in the snapshot output taken by t_net.sh. This patch add a 'sleep 1' command right after creation of the interface, to give the NO-CARRIER bit a chance to settle. This issue has been witnessed on a buildbot that is apparently slowler than average to run the unit tests. Signed-off-by: Antonio Quartulli <a@unstable.cc> Acked-by: Gert Doering <gert@greenie.muc.de> Message-Id: <20190919072820.9913-1-a@unstable.cc> URL: https://www.mail-archive.com/search?l=mid&q=20190919072820.9913-1-a@unstable.cc Signed-off-by: Gert Doering <gert@greenie.muc.de>
Diffstat (limited to 'tests')
-rwxr-xr-xtests/t_net.sh7
1 files changed, 7 insertions, 0 deletions
diff --git a/tests/t_net.sh b/tests/t_net.sh
index 18799d1..97e947a 100755
--- a/tests/t_net.sh
+++ b/tests/t_net.sh
@@ -34,6 +34,13 @@ reload_dummy()
{
$RUN_SUDO $openvpn --dev $IFACE --dev-type tun --rmtun >/dev/null
$RUN_SUDO $openvpn --dev $IFACE --dev-type tun --mktun >/dev/null
+
+ # it seems that tun devices will settle on NO-CARRIER while not connected to
+ # any process, but this won't happen immediately. To avoid having the
+ # NO-CARRIER bit appear in the middle of the tests - which would compromise
+ # the results - let's wait 1 sec here for it to settle.
+ sleep 1
+
if [ $? -ne 0 ]; then
echo "can't create interface $IFACE"
exit 1