t_net.sh: execute sleep after checking exit code of previous command
PATCH 1/1 t_net.sh: execute sleep after checking exit code of previous command
Ensure to check the exit code of the mktun command *before* running sleep, otherwise '$?' will resolve to the exit code of sleep itself, thus nullifying the check.
Reported-by Steffan Karger <[email protected]...>
Signed-off-by Antonio Quartulli <[email protected]...>
--- tests/t_net.sh | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
tests/t_net.sh +5 -5
@@ -35,17 +35,17 @@ reload_dummy() $RUN_SUDO $openvpn --dev $IFACE --dev-type tun --rmtun >/dev/null $RUN_SUDO $openvpn --dev $IFACE --dev-type tun --mktun >/dev/null + if [ $? -ne 0 ]; then + echo "can't create interface $IFACE" + exit 1 + fi + # 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 - fi - #ip link set dev $IFACE address 00:11:22:33:44:55 }
Signature · 1 line
2.23.0
Acked-by Gert Doering <[email protected]...>
Your patch has been applied to the master branch.
"Yes, of course, Steffan is right" :-)
commit 6ccb3b2e3ae841934ecb461461ac1e212da64109
Author: Antonio Quartulli Date: Thu Sep 19 22:22:57 2019 +0200
t_net.sh: execute sleep after checking exit code of previous command
Signed-off-by: Antonio Quartulli <[email protected]...>
Acked-by: Gert Doering <[email protected]...>
Message-Id: <[email protected]...>
URL: https://www.mail-archive.com/[email protected]/msg18845.html
Signed-off-by: Gert Doering <[email protected]...>--
kind regards,
Gert Doering