Avoid unnecessary errors trying to stop or restart already
stopped processes.
Tests were not failing due to this, but potentially confusing errors were
logged.

Fixes: c0ef76883406 ("tests: Cleanup on_exit commands.")
Signed-off-by: Xavier Simonart <xsimo...@redhat.com>
---
 tests/ofproto-macros.at | 2 +-
 tests/ovn-macros.at     | 8 ++++----
 2 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/tests/ofproto-macros.at b/tests/ofproto-macros.at
index 5bc162cae..030fe0fa0 100644
--- a/tests/ofproto-macros.at
+++ b/tests/ofproto-macros.at
@@ -196,7 +196,7 @@ m4_define([_OVS_VSWITCHD_START],
 
    dnl Start ovsdb-server.
    AT_CHECK([ovsdb-server --detach --no-chdir --pidfile --log-file 
--remote=punix:$OVS_RUNDIR/db.sock], [0], [], [stderr])
-   on_exit "test -e `cat ovsdb-server.pid` && kill `cat ovsdb-server.pid`"
+   on_exit "test -e ovsdb-server.pid && kill `cat ovsdb-server.pid`"
    AT_CHECK([[sed < stderr '
 /vlog|INFO|opened log file/d
 /ovsdb_server|INFO|ovsdb-server (Open vSwitch)/d']])
diff --git a/tests/ovn-macros.at b/tests/ovn-macros.at
index 47ada5c70..624e91faf 100644
--- a/tests/ovn-macros.at
+++ b/tests/ovn-macros.at
@@ -971,7 +971,7 @@ start_scapy_server() {
 sleep_northd() {
   echo Northd going to sleep
   AT_CHECK([kill -STOP $(cat northd/ovn-northd.pid)])
-  on_exit "kill -CONT $(cat northd/ovn-northd.pid)"
+  on_exit "test -e northd/ovn-northd.pid && kill -CONT $(cat 
northd/ovn-northd.pid)"
 }
 
 wake_up_northd() {
@@ -982,7 +982,7 @@ wake_up_northd() {
 sleep_sb() {
   echo SB going to sleep
   AT_CHECK([kill -STOP $(cat ovn-sb/ovsdb-server.pid)])
-  on_exit "kill -CONT $(cat ovn-sb/ovsdb-server.pid)"
+  on_exit "test -e ovn-sb/ovsdb-server.pid && kill -CONT $(cat 
ovn-sb/ovsdb-server.pid)"
 }
 wake_up_sb() {
   echo SB waking up
@@ -1006,7 +1006,7 @@ sleep_ovs() {
   hv=$1
   echo ovs $hv going to sleep
   AT_CHECK([kill -STOP $(cat $hv/ovs-vswitchd.pid)])
-  on_exit "kill -CONT $(cat $hv/ovs-vswitchd.pid)"
+  on_exit "test -e $hv/ovs-vswitchd.pid && kill -CONT $(cat 
$hv/ovs-vswitchd.pid)"
 }
 
 wake_up_ovs() {
@@ -1018,7 +1018,7 @@ wake_up_ovs() {
 sleep_ovsdb() {
   echo OVSDB $1 going to sleep
   AT_CHECK([kill -STOP $(cat $1/ovsdb-server.pid)])
-  on_exit "kill -CONT $(cat $1/ovsdb-server.pid)"
+  on_exit "test -e $1/ovsdb-server.pid && kill -CONT $(cat 
$1/ovsdb-server.pid)"
 }
 wake_up_ovsdb() {
   echo OVSDB $1 waking up
-- 
2.31.1

_______________________________________________
dev mailing list
d...@openvswitch.org
https://mail.openvswitch.org/mailman/listinfo/ovs-dev

Reply via email to