diff mbox series

[ovs-dev,09/10] tests: Speed up "multicast group buffer split".

Message ID 20240212175537.1356073-10-xsimonar@redhat.com
State Accepted
Headers show
Series Fixes to Unit tests. | 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 Feb. 12, 2024, 5:55 p.m. UTC
Signed-off-by: Xavier Simonart <xsimonar@redhat.com>
---
 tests/ovn-controller.at | 14 ++++++++------
 tests/ovn-macros.at     | 11 +++++++++++
 tests/ovn.at            |  8 +++++---
 3 files changed, 24 insertions(+), 9 deletions(-)

Comments

Ilya Maximets Feb. 19, 2024, 8:56 p.m. UTC | #1
On 2/12/24 18:55, Xavier Simonart wrote:
> Signed-off-by: Xavier Simonart <xsimonar@redhat.com>
> ---
>  tests/ovn-controller.at | 14 ++++++++------
>  tests/ovn-macros.at     | 11 +++++++++++
>  tests/ovn.at            |  8 +++++---
>  3 files changed, 24 insertions(+), 9 deletions(-)
> 
> diff --git a/tests/ovn-controller.at b/tests/ovn-controller.at
> index 3089aea9d..c10bc155b 100644
> --- a/tests/ovn-controller.at
> +++ b/tests/ovn-controller.at
> @@ -2693,19 +2693,20 @@ ovs-vsctl add-br br-phys
>  ovn_attach n1 br-phys 192.168.0.1
>  
>  for i in $(seq 1 320); do
> -    ovs-vsctl -- add-port br-int hv1-vif$i -- \
> +    OVS_VSCTL(add-port br-int hv1-vif$i -- \
>          set interface hv1-vif$i external-ids:iface-id=sw0-p$i \
>          options:tx_pcap=hv1/vif${i}-tx.pcap \
>          options:rxq_pcap=hv1/vif${i}-rx.pcap \
> -        ofport-request=$i
> +        ofport-request=$i)
>  done
> -
> +RUN_OVS_VSCTL
>  
>  check ovn-nbctl ls-add sw0
>  for i in $(seq 1 320); do
> -    check ovn-nbctl lsp-add sw0 sw0-p$i
> -    check ovn-nbctl lsp-set-addresses sw0-p$i "unknown"
> +    OVN_NBCTL(lsp-add sw0 sw0-p$i)
> +    OVN_NBCTL(lsp-set-addresses sw0-p$i "unknown")
>  done
> +RUN_OVN_NBCTL
>  
>  wait_for_ports_up
>  ovn-nbctl --wait=hv sync
> @@ -2715,8 +2716,9 @@ OVS_WAIT_FOR_OUTPUT([as hv1 ovs-ofctl dump-flows br-int table=OFTABLE_LOCAL_OUTP
>  ])
>  
>  for i in $(seq 1 280); do
> -    check ovn-nbctl lsp-del sw0-p$i
> +    OVN_NBCTL(lsp-del sw0-p$i)
>  done
> +RUN_OVN_NBCTL
>  ovn-nbctl --wait=hv sync
>  
>  AT_CHECK([as hv1 ovs-ofctl dump-flows br-int table=OFTABLE_LOCAL_OUTPUT | grep -q controller], [1])
> diff --git a/tests/ovn-macros.at b/tests/ovn-macros.at
> index 84e50d76f..a35c0ff80 100644
> --- a/tests/ovn-macros.at
> +++ b/tests/ovn-macros.at
> @@ -984,6 +984,17 @@ m4_define([RUN_OVN_NBCTL], [
>      unset command
>  ])
>  
> +# OVS_VSCTL(VSCTL_COMMAND) adds VSCTL_COMMAND to list of commands to be run by RUN_OVS_VSCTL().
> +m4_define([OVS_VSCTL], [
> +    command="${command} -- $1"
> +])
> +
> +# RUN_OVS_VSCTL() executes list of commands built by the OVS_VSCTL() macro.
> +m4_define([RUN_OVS_VSCTL], [
> +    check ovs-vsctl ${command}
> +    unset command
> +])

Hi, Xavier.  Not an issue of this particular patch as this thing was
introduced long ago, but...

The shell command 'command' is a way to call a different command ignoring
the defined aliases.  Overloading the 'command' itself in that sense doesn't
seem wise to me and may cause a major headache if we ever hit an issue
involving it.  I'd suggest some other name should be used here.

Best regards, Ilya Maximets.
diff mbox series

Patch

diff --git a/tests/ovn-controller.at b/tests/ovn-controller.at
index 3089aea9d..c10bc155b 100644
--- a/tests/ovn-controller.at
+++ b/tests/ovn-controller.at
@@ -2693,19 +2693,20 @@  ovs-vsctl add-br br-phys
 ovn_attach n1 br-phys 192.168.0.1
 
 for i in $(seq 1 320); do
-    ovs-vsctl -- add-port br-int hv1-vif$i -- \
+    OVS_VSCTL(add-port br-int hv1-vif$i -- \
         set interface hv1-vif$i external-ids:iface-id=sw0-p$i \
         options:tx_pcap=hv1/vif${i}-tx.pcap \
         options:rxq_pcap=hv1/vif${i}-rx.pcap \
-        ofport-request=$i
+        ofport-request=$i)
 done
-
+RUN_OVS_VSCTL
 
 check ovn-nbctl ls-add sw0
 for i in $(seq 1 320); do
-    check ovn-nbctl lsp-add sw0 sw0-p$i
-    check ovn-nbctl lsp-set-addresses sw0-p$i "unknown"
+    OVN_NBCTL(lsp-add sw0 sw0-p$i)
+    OVN_NBCTL(lsp-set-addresses sw0-p$i "unknown")
 done
+RUN_OVN_NBCTL
 
 wait_for_ports_up
 ovn-nbctl --wait=hv sync
@@ -2715,8 +2716,9 @@  OVS_WAIT_FOR_OUTPUT([as hv1 ovs-ofctl dump-flows br-int table=OFTABLE_LOCAL_OUTP
 ])
 
 for i in $(seq 1 280); do
-    check ovn-nbctl lsp-del sw0-p$i
+    OVN_NBCTL(lsp-del sw0-p$i)
 done
+RUN_OVN_NBCTL
 ovn-nbctl --wait=hv sync
 
 AT_CHECK([as hv1 ovs-ofctl dump-flows br-int table=OFTABLE_LOCAL_OUTPUT | grep -q controller], [1])
diff --git a/tests/ovn-macros.at b/tests/ovn-macros.at
index 84e50d76f..a35c0ff80 100644
--- a/tests/ovn-macros.at
+++ b/tests/ovn-macros.at
@@ -984,6 +984,17 @@  m4_define([RUN_OVN_NBCTL], [
     unset command
 ])
 
+# OVS_VSCTL(VSCTL_COMMAND) adds VSCTL_COMMAND to list of commands to be run by RUN_OVS_VSCTL().
+m4_define([OVS_VSCTL], [
+    command="${command} -- $1"
+])
+
+# RUN_OVS_VSCTL() executes list of commands built by the OVS_VSCTL() macro.
+m4_define([RUN_OVS_VSCTL], [
+    check ovs-vsctl ${command}
+    unset command
+])
+
 m4_define([TAG_UNSTABLE], [
     AT_KEYWORDS([unstable])
     AT_SKIP_IF([test X"$SKIP_UNSTABLE" = Xyes])
diff --git a/tests/ovn.at b/tests/ovn.at
index dd3cb4c66..5eaaa76a2 100644
--- a/tests/ovn.at
+++ b/tests/ovn.at
@@ -37245,19 +37245,21 @@  ovn_attach n br-phys 192.168.0.1
 check ovs-vsctl set open . external-ids:ovn-bridge-mappings=phys:br-phys
 
 for i in $(seq 1 320); do
-    check ovs-vsctl -- add-port br-int hv1-vif$i -- \
+    OVS_VSCTL( add-port br-int hv1-vif$i -- \
         set interface hv1-vif$i external-ids:iface-id=sw0-port$i \
         options:tx_pcap=hv1/vif$i-tx.pcap \
-        options:rxq_pcap=hv1/vif$i-rx.pcap
+        options:rxq_pcap=hv1/vif$i-rx.pcap)
 done
+RUN_OVS_VSCTL
 
 check ovn-nbctl ls-add sw0
 
 check ovn-nbctl lsp-add sw0 sw0-port1
 check ovn-nbctl lsp-set-addresses sw0-port1 "50:54:00:00:00:01 10.0.0.2"
 for i in $(seq 2 320); do
-    check ovn-nbctl lsp-add sw0 sw0-port$i -- lsp-set-addresses sw0-port$i "unknown"
+    OVN_NBCTL(lsp-add sw0 sw0-port$i -- lsp-set-addresses sw0-port$i "unknown")
 done
+RUN_OVN_NBCTL
 
 check ovn-nbctl --wait=hv sync
 wait_for_ports_up