diff mbox series

[ovs-dev,02/11] tests: Avoid unloading not existing modules.

Message ID 20250710153345.104954-3-xsimonar@redhat.com
State Superseded
Headers show
Series Multiple unit/system tests fixes. | 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 fail github build: failed

Commit Message

Xavier Simonart July 10, 2025, 3:33 p.m. UTC
Do not try to remove a module if it failed to load.
This caused errors in logs when running tests.

Signed-off-by: Xavier Simonart <xsimonar@redhat.com>
---
 tests/system-kmod-macros.at | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

Comments

Mark Michelson July 21, 2025, 8:49 p.m. UTC | #1
Should the same change be made to OVS_TRAFFIC_VSWITCHD_START? That macro 
uses modprobe -q, so the errors in the logs are not present. However, it 
probably still makes sense to only try to unload modules if they loaded 
successfully.

On 7/10/25 11:33 AM, Xavier Simonart via dev wrote:
> Do not try to remove a module if it failed to load.
> This caused errors in logs when running tests.
> 
> Signed-off-by: Xavier Simonart <xsimonar@redhat.com>
> ---
>   tests/system-kmod-macros.at | 3 +--
>   1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/tests/system-kmod-macros.at b/tests/system-kmod-macros.at
> index 41a8b7914..7771146f0 100644
> --- a/tests/system-kmod-macros.at
> +++ b/tests/system-kmod-macros.at
> @@ -64,8 +64,7 @@ m4_define([CONFIGURE_VETH_OFFLOADS],
>   m4_define([CHECK_CONNTRACK],
>        m4_foreach([mod], [[nf_conntrack_ipv4], [nf_conntrack_ipv6], [nf_nat_ftp],
>                           [nf_nat_tftp]],
> -                [modprobe mod || echo "Module mod not loaded."
> -                 on_exit 'modprobe -r mod'
> +                [modprobe mod && on_exit 'modprobe -r mod' || echo "Module mod not loaded."
>                   ])
>        sysctl -w net.netfilter.nf_conntrack_helper=0
>        on_exit "${ovs_builddir}/tests/ovstest test-netlink-conntrack flush"
Xavier Simonart July 23, 2025, 7:15 a.m. UTC | #2
Hi Mark

Thanks for the review and comments. I'll send v2.

Thanks
Xavier


On Mon, Jul 21, 2025 at 10:49 PM Mark Michelson <mmichels@redhat.com> wrote:

> Should the same change be made to OVS_TRAFFIC_VSWITCHD_START? That macro
> uses modprobe -q, so the errors in the logs are not present. However, it
> probably still makes sense to only try to unload modules if they loaded
> successfully.
>
> On 7/10/25 11:33 AM, Xavier Simonart via dev wrote:
> > Do not try to remove a module if it failed to load.
> > This caused errors in logs when running tests.
> >
> > Signed-off-by: Xavier Simonart <xsimonar@redhat.com>
> > ---
> >   tests/system-kmod-macros.at | 3 +--
> >   1 file changed, 1 insertion(+), 2 deletions(-)
> >
> > diff --git a/tests/system-kmod-macros.at b/tests/system-kmod-macros.at
> > index 41a8b7914..7771146f0 100644
> > --- a/tests/system-kmod-macros.at
> > +++ b/tests/system-kmod-macros.at
> > @@ -64,8 +64,7 @@ m4_define([CONFIGURE_VETH_OFFLOADS],
> >   m4_define([CHECK_CONNTRACK],
> >        m4_foreach([mod], [[nf_conntrack_ipv4], [nf_conntrack_ipv6],
> [nf_nat_ftp],
> >                           [nf_nat_tftp]],
> > -                [modprobe mod || echo "Module mod not loaded."
> > -                 on_exit 'modprobe -r mod'
> > +                [modprobe mod && on_exit 'modprobe -r mod' || echo
> "Module mod not loaded."
> >                   ])
> >        sysctl -w net.netfilter.nf_conntrack_helper=0
> >        on_exit "${ovs_builddir}/tests/ovstest test-netlink-conntrack
> flush"
>
>
diff mbox series

Patch

diff --git a/tests/system-kmod-macros.at b/tests/system-kmod-macros.at
index 41a8b7914..7771146f0 100644
--- a/tests/system-kmod-macros.at
+++ b/tests/system-kmod-macros.at
@@ -64,8 +64,7 @@  m4_define([CONFIGURE_VETH_OFFLOADS],
 m4_define([CHECK_CONNTRACK],
      m4_foreach([mod], [[nf_conntrack_ipv4], [nf_conntrack_ipv6], [nf_nat_ftp],
                         [nf_nat_tftp]],
-                [modprobe mod || echo "Module mod not loaded."
-                 on_exit 'modprobe -r mod'
+                [modprobe mod && on_exit 'modprobe -r mod' || echo "Module mod not loaded."
                 ])
      sysctl -w net.netfilter.nf_conntrack_helper=0
      on_exit "${ovs_builddir}/tests/ovstest test-netlink-conntrack flush"