diff mbox series

[ovs-dev,1/2] tests: Fix bad syntax in "test" for waiting.

Message ID 20210305210943.4077065-1-blp@ovn.org
State Accepted
Headers show
Series [ovs-dev,1/2] tests: Fix bad syntax in "test" for waiting. | expand

Commit Message

Ben Pfaff March 5, 2021, 9:09 p.m. UTC
'test "$a"' is always true if $abc is nonempty.
Spaces are necessary to test for equality, e.g. 'test $a = $b'.

Signed-off-by: Ben Pfaff <blp@ovn.org>
---
 tests/ovn-controller.at | 4 ++--
 tests/ovn.at            | 2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)

Comments

Han Zhou March 8, 2021, 10:43 p.m. UTC | #1
On Fri, Mar 5, 2021 at 1:10 PM Ben Pfaff <blp@ovn.org> wrote:
>
> 'test "$a"' is always true if $abc is nonempty.

I guess you meant: 'test "$abc"' is ... :)

Acked-by: Han Zhou <hzhou@ovn.org>

> Spaces are necessary to test for equality, e.g. 'test $a = $b'.
>
> Signed-off-by: Ben Pfaff <blp@ovn.org>
> ---
>  tests/ovn-controller.at | 4 ++--
>  tests/ovn.at            | 2 +-
>  2 files changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/tests/ovn-controller.at b/tests/ovn-controller.at
> index 2cd3e261f2eb..300872aa1852 100644
> --- a/tests/ovn-controller.at
> +++ b/tests/ovn-controller.at
> @@ -165,11 +165,11 @@ OVS_WAIT_UNTIL([check_datapath_type foo])
>  # Change the br-int's datapath type to bar.
>  # It should be reset to foo since ovn-bridge-datapath-type is configured.
>  ovs-vsctl set Bridge br-int datapath-type=bar
> -OVS_WAIT_UNTIL([test foo=`ovs-vsctl get Bridge br-int datapath-type`])
> +OVS_WAIT_UNTIL([test foo = `ovs-vsctl get Bridge br-int datapath-type`])
>  OVS_WAIT_UNTIL([check_datapath_type foo])
>
>  ovs-vsctl set Open_vSwitch . external_ids:ovn-bridge-datapath-type=foobar
> -OVS_WAIT_UNTIL([test foobar=`ovs-vsctl get Bridge br-int datapath-type`])
> +OVS_WAIT_UNTIL([test foobar = `ovs-vsctl get Bridge br-int
datapath-type`])
>  OVS_WAIT_UNTIL([check_datapath_type foobar])
>
>  expected_iface_types=$(ovs-vsctl get Open_vSwitch . iface_types | tr -d
'[[]] ""')
> diff --git a/tests/ovn.at b/tests/ovn.at
> index 39edb6b85526..87579e59d7a5 100644
> --- a/tests/ovn.at
> +++ b/tests/ovn.at
> @@ -11084,7 +11084,7 @@
sent_garp="ffffffffffff0000010102038100000208060001080006040001000001010203c0a80
>
>  OVN_CHECK_PACKETS([hv1/vif1-tx.pcap], [foo1.expout])
>  # Wait until we receive atleast 1 packet
> -OVS_WAIT_UNTIL([test 1=`$PYTHON "$ovs_srcdir/utilities/ovs-pcap.in"
hv2/br-ex_n2-tx.pcap | wc -l`])
> +OVS_WAIT_UNTIL([test 1 = `$PYTHON "$ovs_srcdir/utilities/ovs-pcap.in"
hv2/br-ex_n2-tx.pcap | wc -l`])
>  $PYTHON "$ovs_srcdir/utilities/ovs-pcap.in" hv2/br-ex_n2-tx.pcap | head
-1 > packets
>  echo $sent_garp > expout
>  AT_CHECK([cat packets], [0], [expout])
> --
> 2.29.2
>
> _______________________________________________
> dev mailing list
> dev@openvswitch.org
> https://mail.openvswitch.org/mailman/listinfo/ovs-dev
Ben Pfaff March 9, 2021, 9:17 p.m. UTC | #2
On Mon, Mar 08, 2021 at 02:43:20PM -0800, Han Zhou wrote:
> On Fri, Mar 5, 2021 at 1:10 PM Ben Pfaff <blp@ovn.org> wrote:
> >
> > 'test "$a"' is always true if $abc is nonempty.
> 
> I guess you meant: 'test "$abc"' is ... :)

Yes, thanks, I fixed the commit message here and applied this to master.

> Acked-by: Han Zhou <hzhou@ovn.org>
diff mbox series

Patch

diff --git a/tests/ovn-controller.at b/tests/ovn-controller.at
index 2cd3e261f2eb..300872aa1852 100644
--- a/tests/ovn-controller.at
+++ b/tests/ovn-controller.at
@@ -165,11 +165,11 @@  OVS_WAIT_UNTIL([check_datapath_type foo])
 # Change the br-int's datapath type to bar.
 # It should be reset to foo since ovn-bridge-datapath-type is configured.
 ovs-vsctl set Bridge br-int datapath-type=bar
-OVS_WAIT_UNTIL([test foo=`ovs-vsctl get Bridge br-int datapath-type`])
+OVS_WAIT_UNTIL([test foo = `ovs-vsctl get Bridge br-int datapath-type`])
 OVS_WAIT_UNTIL([check_datapath_type foo])
 
 ovs-vsctl set Open_vSwitch . external_ids:ovn-bridge-datapath-type=foobar
-OVS_WAIT_UNTIL([test foobar=`ovs-vsctl get Bridge br-int datapath-type`])
+OVS_WAIT_UNTIL([test foobar = `ovs-vsctl get Bridge br-int datapath-type`])
 OVS_WAIT_UNTIL([check_datapath_type foobar])
 
 expected_iface_types=$(ovs-vsctl get Open_vSwitch . iface_types | tr -d '[[]] ""')
diff --git a/tests/ovn.at b/tests/ovn.at
index 39edb6b85526..87579e59d7a5 100644
--- a/tests/ovn.at
+++ b/tests/ovn.at
@@ -11084,7 +11084,7 @@  sent_garp="ffffffffffff0000010102038100000208060001080006040001000001010203c0a80
 
 OVN_CHECK_PACKETS([hv1/vif1-tx.pcap], [foo1.expout])
 # Wait until we receive atleast 1 packet
-OVS_WAIT_UNTIL([test 1=`$PYTHON "$ovs_srcdir/utilities/ovs-pcap.in" hv2/br-ex_n2-tx.pcap | wc -l`])
+OVS_WAIT_UNTIL([test 1 = `$PYTHON "$ovs_srcdir/utilities/ovs-pcap.in" hv2/br-ex_n2-tx.pcap | wc -l`])
 $PYTHON "$ovs_srcdir/utilities/ovs-pcap.in" hv2/br-ex_n2-tx.pcap | head -1 > packets
 echo $sent_garp > expout
 AT_CHECK([cat packets], [0], [expout])