t_net.sh: wait for NO-CARRIER bit to settle before starting test
PATCH 1/1 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.
--- tests/t_net.sh | 7 +++++++ 1 file changed, 7 insertions(+)
tests/t_net.sh +7 -0
@@ -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
Signature · 1 line
2.23.0
Your patch has been applied to the master branch.
"Your script, you know what is happening behind the scenes, so it's good enough for me" :-)
commit 8aa037161f37c42585ac4a8d99f37af624211da6
Author: Antonio Quartulli Date: Thu Sep 19 09:28:20 2019 +0200
t_net.sh: wait for NO-CARRIER bit to settle before starting test
Signed-off-by: Antonio Quartulli <[email protected]...>
Acked-by: Gert Doering <[email protected]...>
Message-Id: <[email protected]...>
URL: https://www.mail-archive.com/search?l=mid&[email protected]...
Signed-off-by: Gert Doering <[email protected]...>--
kind regards,
Gert Doering
Hi,
Quoted 29 lines · Antonio Quartulli
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 <[email protected]...>--- tests/t_net.sh | 7 +++++++ 1 file changed, 7 insertions(+)tests/t_net.sh +0
-0@@ -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
tests/t_net.sh reload_dummy() · line 46
Quoted 10 lines
tests/t_net.sh +7
-0+ + # 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
This return value check now checks that sleep succeeded instead of the openvpn --mktun command. I don't think that is what you intended.
-Steffan
Hi,
Quoted 14 lines · Steffan Karger
Quoted 14 lines
tests/t_net.sh +6
-0@@ -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
Quoted 9 lines
tests/t_net.sh reload_dummy() · line 46
Quoted 5 lines
tests/t_net.sh +1
-0+ if [ $? -ne 0 ]; then echo "can't create interface $IFACE" exit 1This return value check now checks that sleep succeeded instead of the openvpn --mktun command. I don't think that is what you intended.
You're absolutely right.
The sleep should be moved right after the if-check.
Will send a new patch to fix that.
Regards,
Signature · 1 line
Antonio Quartulli