'==' 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 <[email protected]>
---
 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(-)

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
-- 
2.38.1

_______________________________________________
dev mailing list
[email protected]
https://mail.openvswitch.org/mailman/listinfo/ovs-dev

Reply via email to