diff mbox series

[ovs-dev] treewide: Don't use non-portable '==' with test command.

Message ID 20230105141229.1583736-1-i.maximets@ovn.org
State Accepted
Commit 461ab419ead100ef38a3f596151e826ca3dd131d
Headers show
Series [ovs-dev] treewide: Don't use non-portable '==' with test command. | expand

Checks

Context Check Description
ovsrobot/apply-robot success apply and check: success
ovsrobot/github-robot-_Build_and_Test success github build: passed
ovsrobot/intel-ovs-compilation success test: success

Commit Message

Ilya Maximets Jan. 5, 2023, 2:12 p.m. UTC
'==' is not defined by POSIX and not supported by some shells.
This is causing test failures and potential other issues:

  ./tests/testsuite: 54: test: X2: unexpected operator
  ./tests/testsuite: 54: test: X157: unexpected operator
  ./tests/testsuite: 54: test: X116: unexpected operator

Reported-at: https://mail.openvswitch.org/pipermail/ovs-discuss/2022-December/052157.html
Signed-off-by: Ilya Maximets <i.maximets@ovn.org>
---
 acinclude.m4           |  2 +-
 tests/ovsdb-cluster.at | 14 +++++++-------
 tests/ovsdb-server.at  |  2 +-
 utilities/ovs-sim.in   |  6 +++---
 4 files changed, 12 insertions(+), 12 deletions(-)

Comments

David Marchand Jan. 6, 2023, 9:46 a.m. UTC | #1
On Thu, Jan 5, 2023 at 3:12 PM Ilya Maximets <i.maximets@ovn.org> wrote:
>
> '==' is not defined by POSIX and not supported by some shells.
> This is causing test failures and potential other issues:
>
>   ./tests/testsuite: 54: test: X2: unexpected operator
>   ./tests/testsuite: 54: test: X157: unexpected operator
>   ./tests/testsuite: 54: test: X116: unexpected operator
>
> Reported-at: https://mail.openvswitch.org/pipermail/ovs-discuss/2022-December/052157.html
> Signed-off-by: Ilya Maximets <i.maximets@ovn.org>

Reviewed-by: David Marchand <david.marchand@redhat.com>
Eelco Chaudron Jan. 6, 2023, 9:49 a.m. UTC | #2
On 5 Jan 2023, at 15:12, Ilya Maximets wrote:

> '==' is not defined by POSIX and not supported by some shells.
> This is causing test failures and potential other issues:
>
>   ./tests/testsuite: 54: test: X2: unexpected operator
>   ./tests/testsuite: 54: test: X157: unexpected operator
>   ./tests/testsuite: 54: test: X116: unexpected operator
>
> Reported-at: https://mail.openvswitch.org/pipermail/ovs-discuss/2022-December/052157.html
> Signed-off-by: Ilya Maximets <i.maximets@ovn.org>

Tested on my build setup and it works without any problem.

Acked-by: Eelco Chaudron <echaudro@redhat.com>

Cheers,

Eelco
Ilya Maximets Jan. 6, 2023, 5:21 p.m. UTC | #3
On 1/6/23 10:49, Eelco Chaudron wrote:
> 
> 
> On 5 Jan 2023, at 15:12, Ilya Maximets wrote:
> 
>> '==' is not defined by POSIX and not supported by some shells.
>> This is causing test failures and potential other issues:
>>
>>   ./tests/testsuite: 54: test: X2: unexpected operator
>>   ./tests/testsuite: 54: test: X157: unexpected operator
>>   ./tests/testsuite: 54: test: X116: unexpected operator
>>
>> Reported-at: https://mail.openvswitch.org/pipermail/ovs-discuss/2022-December/052157.html
>> Signed-off-by: Ilya Maximets <i.maximets@ovn.org>
> 
> Tested on my build setup and it works without any problem.
> 
> Acked-by: Eelco Chaudron <echaudro@redhat.com>

Thanks, Eelco and David!

Applied and backported down to 2.17.

Best regards, Ilya Maximets.
Giovanni Tataranni Jan. 11, 2023, 2:46 p.m. UTC | #4
Thanks, confirming it works also on my side.


From: Ilya Maximets <i.maximets@ovn.org>
Sent: 06 January 2023 18:21
To: Eelco Chaudron <echaudro@redhat.com>; David Marchand <david.marchand@redhat.com>
Cc: i.maximets@ovn.org <i.maximets@ovn.org>; ovs-dev@openvswitch.org <ovs-dev@openvswitch.org>; Giovanni Tataranni <gtataranni@open-systems.com>
Subject: Re: [ovs-dev] [PATCH] treewide: Don't use non-portable '==' with test command. 
 
On 1/6/23 10:49, Eelco Chaudron wrote:
> 
> 
> On 5 Jan 2023, at 15:12, Ilya Maximets wrote:
> 
>> '==' is not defined by POSIX and not supported by some shells.
>> This is causing test failures and potential other issues:
>>
>>   ./tests/testsuite: 54: test: X2: unexpected operator
>>   ./tests/testsuite: 54: test: X157: unexpected operator
>>   ./tests/testsuite: 54: test: X116: unexpected operator
>>
>> Reported-at: https://mail.openvswitch.org/pipermail/ovs-discuss/2022-December/052157.html?mc_phishing_protection_id=45408-ces5h59eg2bocu4r0o9g
>> Signed-off-by: Ilya Maximets <i.maximets@ovn.org>
> 
> Tested on my build setup and it works without any problem.
> 
> Acked-by: Eelco Chaudron <echaudro@redhat.com>

Thanks, Eelco and David!

Applied and backported down to 2.17.

Best regards, Ilya Maximets.
Ilya Maximets Jan. 11, 2023, 4:39 p.m. UTC | #5
On 1/11/23 15:46, Giovanni Tataranni wrote:
> Thanks, confirming it works also on my side.

Good to know.  Thanks for checking!

Best regards, Ilya Maximets.

> 
> 
> From: Ilya Maximets <i.maximets@ovn.org>
> Sent: 06 January 2023 18:21
> To: Eelco Chaudron <echaudro@redhat.com>; David Marchand <david.marchand@redhat.com>
> Cc: i.maximets@ovn.org <i.maximets@ovn.org>; ovs-dev@openvswitch.org <ovs-dev@openvswitch.org>; Giovanni Tataranni <gtataranni@open-systems.com>
> Subject: Re: [ovs-dev] [PATCH] treewide: Don't use non-portable '==' with test command. 
>  
> On 1/6/23 10:49, Eelco Chaudron wrote:
>>
>>
>> On 5 Jan 2023, at 15:12, Ilya Maximets wrote:
>>
>>> '==' is not defined by POSIX and not supported by some shells.
>>> This is causing test failures and potential other issues:
>>>
>>>    ./tests/testsuite: 54: test: X2: unexpected operator
>>>    ./tests/testsuite: 54: test: X157: unexpected operator
>>>    ./tests/testsuite: 54: test: X116: unexpected operator
>>>
>>> Reported-at: https://mail.openvswitch.org/pipermail/ovs-discuss/2022-December/052157.html?mc_phishing_protection_id=45408-ces5h59eg2bocu4r0o9g
>>> Signed-off-by: Ilya Maximets <i.maximets@ovn.org>
>>
>> Tested on my build setup and it works without any problem.
>>
>> Acked-by: Eelco Chaudron <echaudro@redhat.com>
> 
> Thanks, Eelco and David!
> 
> Applied and backported down to 2.17.
> 
> Best regards, Ilya Maximets.
diff mbox series

Patch

diff --git a/acinclude.m4 b/acinclude.m4
index 8aecfb63d..ac1eab790 100644
--- a/acinclude.m4
+++ b/acinclude.m4
@@ -263,7 +263,7 @@  AC_DEFUN([OVS_CHECK_LINUX_AF_XDP], [
     [enable_afxdp=auto])
 
   AC_MSG_CHECKING([whether AF_XDP is enabled])
-  if test "$enable_afxdp" == no; then
+  if test "$enable_afxdp" = no; then
     AC_MSG_RESULT([no])
     AF_XDP_ENABLE=false
   else
diff --git a/tests/ovsdb-cluster.at b/tests/ovsdb-cluster.at
index 920b833b7..9fbf5dc89 100644
--- a/tests/ovsdb-cluster.at
+++ b/tests/ovsdb-cluster.at
@@ -8,7 +8,7 @@  ovsdb_check_cluster () {
     $schema_func > schema
     schema=`ovsdb-tool schema-name schema`
     AT_CHECK([ovsdb-tool '-vPATTERN:console:%c|%p|%m' create-cluster s1.db schema unix:s1.raft], [0], [], [stderr])
-    if test X$local_config == X"yes"; then
+    if test X$local_config = X"yes"; then
         for i in `seq $n`; do
             AT_CHECK([ovsdb-tool create c$i.db $top_srcdir/ovsdb/local-config.ovsschema], [0], [], [stderr])
             local ctxn="[[\"Local_Config\",
@@ -30,7 +30,7 @@  ovsdb_check_cluster () {
     for i in `seq $n`; do
         local remote=punix:s$i.ovsdb
         local config_db=
-        if test X$local_config == X"yes"; then
+        if test X$local_config = X"yes"; then
             remote=db:Local_Config,Config,connections
             config_db=c$i.db
         fi
@@ -129,7 +129,7 @@  ovsdb_test_cluster_disconnect () {
     # When a node is disconnected from the cluster, the IDL should disconnect
     # and retry even if it uses a single remote, because the remote IP can be
     # a VIP on a load-balance. So we use single remote to test here.
-    if test $leader_or_follower == "leader"; then
+    if test $leader_or_follower = "leader"; then
         target=1
         shutdown=`seq $(($n/2 + 1)) $n`
         cleanup=`seq $(($n/2))`
@@ -188,13 +188,13 @@  ovsdb_test_cluster_disconnect () {
     count_old=`grep "raft_is_connected: true" raft_is_connected.log | wc -l`
     echo count_old $count_old
 
-    if test X$check_flapping == X"yes"; then
+    if test X$check_flapping = X"yes"; then
         sleep 10
     fi
     # Make sure raft_is_connected didn't flap from false to true.
     count_new=`grep "raft_is_connected: true" raft_is_connected.log | wc -l`
     echo count_new $count_new
-    AT_CHECK([test $count_new == $count_old])
+    AT_CHECK([test $count_new = $count_old])
 
     for i in $cleanup; do
         OVS_APP_EXIT_AND_WAIT_BY_TARGET([`pwd`/s$i], [s$i.pid])
@@ -493,7 +493,7 @@  ovsdb_cluster_failure_test () {
     remote_2=$2
     crash_node=$3
     crash_command=$4
-    if test "$crash_node" == "1"; then
+    if test "$crash_node" = "1"; then
         new_leader=$5
     fi
     log_grep=$6
@@ -536,7 +536,7 @@  ovsdb_cluster_failure_test () {
     # To ensure $new_leader node the new leader, we delay election timer for
     # the other follower.
     if test -n "$new_leader"; then
-        if test "$new_leader" == "2"; then
+        if test "$new_leader" = "2"; then
             delay_election_node=3
         else
             delay_election_node=2
diff --git a/tests/ovsdb-server.at b/tests/ovsdb-server.at
index c7b2fe3ae..0828e6d04 100644
--- a/tests/ovsdb-server.at
+++ b/tests/ovsdb-server.at
@@ -1270,7 +1270,7 @@  dnl a case where there is only one transaction in a history.
 get_memory_value () {
     n=$(ovs-appctl -t ovsdb-server memory/show dnl
             | tr ' ' '\n' | grep "^$1:" | cut -d ':' -f 2)
-    if test X"$n" == "X"; then
+    if test X"$n" = "X"; then
         n=0
     fi
     echo $n
diff --git a/utilities/ovs-sim.in b/utilities/ovs-sim.in
index 08957bdf4..779ea60ae 100755
--- a/utilities/ovs-sim.in
+++ b/utilities/ovs-sim.in
@@ -131,7 +131,7 @@  EOF
 export -f as
 
 sim_add() {
-    if test "$1" == --help; then
+    if test "$1" = --help; then
         cat <<EOF
 $FUNCNAME: create a new sandboxed Open vSwitch instance
 usage: $FUNCNAME SANDBOX
@@ -178,7 +178,7 @@  EOF
 export -f sim_add
 
 net_add() {
-    if test "$1" == --help; then
+    if test "$1" = --help; then
         cat <<EOF
 $FUNCNAME: create a new interconnection network
 usage: $FUNCNAME NETWORK
@@ -198,7 +198,7 @@  EOF
 export -f net_add
 
 net_attach() {
-    if test "$1" == --help; then
+    if test "$1" = --help; then
         cat <<EOF
 $FUNCNAME: attach the default sandbox to an interconnection network
 usage: $FUNCNAME NETWORK BRIDGE