[ovs-dev] tests: Add timeout to OVS_APP_EXIT_AND_WAIT.

Message ID 1507274142-27044-1-git-send-email-i.maximets@samsung.com
State Accepted
Headers show
Series
  • [ovs-dev] tests: Add timeout to OVS_APP_EXIT_AND_WAIT.
Related show

Commit Message

Ilya Maximets Oct. 6, 2017, 7:15 a.m.
ovs-appctl can wait indefinitely while executing an exit for a
dead service. Let's add a timeout (10 seconds should be
reasonable) to exit calls to avoid hanging up of the testsuite
in such cases.

Signed-off-by: Ilya Maximets <i.maximets@samsung.com>
---
 tests/ovs-macros.at | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

Comments

Ben Pfaff Oct. 24, 2017, 11:29 p.m. | #1
On Fri, Oct 06, 2017 at 10:15:42AM +0300, Ilya Maximets wrote:
> ovs-appctl can wait indefinitely while executing an exit for a
> dead service. Let's add a timeout (10 seconds should be
> reasonable) to exit calls to avoid hanging up of the testsuite
> in such cases.
> 
> Signed-off-by: Ilya Maximets <i.maximets@samsung.com>

Thanks Ilya.  I applied this to master.

(If this was causing problems for you on some earlier branch, let me
know and I'll backport it too.)

Patch

diff --git a/tests/ovs-macros.at b/tests/ovs-macros.at
index dbce0a5..54c096c 100644
--- a/tests/ovs-macros.at
+++ b/tests/ovs-macros.at
@@ -196,8 +196,8 @@  m4_define([OVS_APP_EXIT_AND_WAIT],
   [AT_CHECK([test -e $OVS_RUNDIR/$1.pid])
    TMPPID=$(cat $OVS_RUNDIR/$1.pid)
    AT_CHECK(m4_if([$1],[ovs-vswitchd],
-                  [ovs-appctl -t $1 exit --cleanup],
-                  [ovs-appctl -t $1 exit]))
+                  [ovs-appctl --timeout=10 -t $1 exit --cleanup],
+                  [ovs-appctl --timeout=10 -t $1 exit]))
    OVS_WAIT_WHILE([kill -0 $TMPPID 2>/dev/null])])
 
 dnl OVS_APP_EXIT_AND_WAIT_BY_TARGET(TARGET, PIDFILE)
@@ -207,7 +207,7 @@  dnl argument), and then wait for it to exit.
 m4_define([OVS_APP_EXIT_AND_WAIT_BY_TARGET],
   [AT_CHECK([test -e $2])
    TMPPID=$(cat $2)
-   AT_CHECK([ovs-appctl --target=$1 exit])
+   AT_CHECK([ovs-appctl --timeout=10 --target=$1 exit])
    OVS_WAIT_WHILE([kill -0 $TMPPID 2>/dev/null])])
 
 dnl on_exit "COMMAND"