diff mbox series

[ovs-dev] tests: Cleanup more on_exit commands.

Message ID 20240725131534.914412-1-xsimonar@redhat.com
State Accepted
Headers show
Series [ovs-dev] tests: Cleanup more on_exit commands. | expand

Checks

Context Check Description
ovsrobot/apply-robot success apply and check: success
ovsrobot/github-robot-_Build_and_Test success github build: passed
ovsrobot/github-robot-_ovn-kubernetes success github build: passed

Commit Message

Xavier Simonart July 25, 2024, 1:15 p.m. UTC
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 <xsimonar@redhat.com>
---
 tests/ofproto-macros.at | 2 +-
 tests/ovn-macros.at     | 8 ++++----
 2 files changed, 5 insertions(+), 5 deletions(-)

Comments

Ales Musil Aug. 7, 2024, 11:27 a.m. UTC | #1
On Thu, Jul 25, 2024 at 3:15 PM Xavier Simonart <xsimonar@redhat.com> wrote:

> 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 <xsimonar@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
> dev@openvswitch.org
> https://mail.openvswitch.org/mailman/listinfo/ovs-dev
>
>
Looks good to me, thanks.

Acked-by: Ales Musil <amusil@redhat.com>
Numan Siddique Aug. 8, 2024, 3:54 a.m. UTC | #2
On Wed, Aug 7, 2024 at 7:28 AM Ales Musil <amusil@redhat.com> wrote:
>
> On Thu, Jul 25, 2024 at 3:15 PM Xavier Simonart <xsimonar@redhat.com> wrote:
>
> > 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 <xsimonar@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
> > dev@openvswitch.org
> > https://mail.openvswitch.org/mailman/listinfo/ovs-dev
> >
> >
> Looks good to me, thanks.
>
> Acked-by: Ales Musil <amusil@redhat.com>

Thanks.  Applied to main.

Numan

>
> --
>
> Ales Musil
>
> Senior Software Engineer - OVN Core
>
> Red Hat EMEA <https://www.redhat.com>
>
> amusil@redhat.com
> <https://red.ht/sig>
> _______________________________________________
> dev mailing list
> dev@openvswitch.org
> https://mail.openvswitch.org/mailman/listinfo/ovs-dev
diff mbox series

Patch

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