diff mbox series

[ovs-dev,v5,4/8] tests: Allow more arguments to wait_for_row_count(), wait_column().

Message ID 20201112014559.1494128-5-blp@ovn.org
State Accepted
Headers show
Series Add DDlog implementation of ovn-northd | expand

Commit Message

Ben Pfaff Nov. 12, 2020, 1:45 a.m. UTC
These only supported three condition arguments but an upcoming patch
wants more.

I had to rename $d in ovs_wait() because shell isn't very good about
variable name scoping.

Signed-off-by: Ben Pfaff <blp@ovn.org>
---
 tests/ovn-macros.at | 10 +++++-----
 tests/ovs-macros.at |  8 ++++----
 2 files changed, 9 insertions(+), 9 deletions(-)

Comments

Dumitru Ceara Nov. 12, 2020, 9:02 a.m. UTC | #1
On 11/12/20 2:45 AM, Ben Pfaff wrote:
> These only supported three condition arguments but an upcoming patch
> wants more.
> 
> I had to rename $d in ovs_wait() because shell isn't very good about
> variable name scoping.
> 
> Signed-off-by: Ben Pfaff <blp@ovn.org>
> ---

Acked-by: Dumitru Ceara <dceara@redhat.com>

Thanks,
Dumitru
Ben Pfaff Nov. 12, 2020, 5:56 p.m. UTC | #2
On Thu, Nov 12, 2020 at 10:02:46AM +0100, Dumitru Ceara wrote:
> On 11/12/20 2:45 AM, Ben Pfaff wrote:
> > These only supported three condition arguments but an upcoming patch
> > wants more.
> > 
> > I had to rename $d in ovs_wait() because shell isn't very good about
> > variable name scoping.
> > 
> > Signed-off-by: Ben Pfaff <blp@ovn.org>
> > ---
> 
> Acked-by: Dumitru Ceara <dceara@redhat.com>

Thanks, applied.
diff mbox series

Patch

diff --git a/tests/ovn-macros.at b/tests/ovn-macros.at
index 105ad0ab7f7f..44c0e20cfdc5 100644
--- a/tests/ovn-macros.at
+++ b/tests/ovn-macros.at
@@ -373,10 +373,10 @@  check_row_count() {
 wait_row_count() {
     local db=$(parse_db $1) table=$(parse_table $1); shift
     local count=$1; shift
-    local a=$1 b=$2 c=$3
+    local a=$1 b=$2 c=$3 d=$4 e=$5
     echo "Waiting until $count rows in $db $table${1+ with $*}..."
-    OVS_WAIT_UNTIL([test $count = $(count_rows $db:$table $a $b $c)],[
-      echo "$db table $table has the following rows. $(count_rows $db:$table $a $b $c) rows match instead of expected $count:"
+    OVS_WAIT_UNTIL([test $count = $(count_rows $db:$table $a $b $c $d $e)],[
+      echo "$db table $table has the following rows. $(count_rows $db:$table $a $b $c $d $e) rows match instead of expected $count:"
       ovn-${db}ctl list $table])
 }
 
@@ -425,12 +425,12 @@  check_column() {
 wait_column() {
     local expected=$(for d in $1; do echo $d; done | sort)
     local db=$(parse_db $2) table=$(parse_table $2) column=${3-_uuid}; shift; shift; shift
-    local a=$1 b=$2 c=$3
+    local a=$1 b=$2 c=$3 d=$4 e=$5
 
     echo
     echo "Waiting until $column in $db $table${1+ with $*} is $expected..."
     OVS_WAIT_UNTIL([
-      found=$(ovn-${db}ctl --bare --columns $column find $table $a $b $c)
+      found=$(ovn-${db}ctl --bare --columns $column find $table $a $b $c $d $e)
       found=$(for d in $found; do echo $d; done | sort)
       test "$expected" = "$found"
     ], [
diff --git a/tests/ovs-macros.at b/tests/ovs-macros.at
index 843811d8c972..7e9e8c034041 100644
--- a/tests/ovs-macros.at
+++ b/tests/ovs-macros.at
@@ -217,13 +217,13 @@  ovs_wait () {
     if ovs_wait_cond; then echo "$1: wait succeeded quickly" >&AS_MESSAGE_LOG_FD; return 0; fi
 
     # Then wait up to OVS_CTL_TIMEOUT seconds.
-    local d
-    for d in `seq 1 "$OVS_CTL_TIMEOUT"`; do
+    local timer
+    for timer in `seq 1 "$OVS_CTL_TIMEOUT"`; do
         sleep 1
-        if ovs_wait_cond; then echo "$1: wait succeeded after $d seconds" >&AS_MESSAGE_LOG_FD; return 0; fi
+        if ovs_wait_cond; then echo "$1: wait succeeded after $timer seconds" >&AS_MESSAGE_LOG_FD; return 0; fi
     done
 
-    echo "$1: wait failed after $d seconds" >&AS_MESSAGE_LOG_FD
+    echo "$1: wait failed after $timer seconds" >&AS_MESSAGE_LOG_FD
     ovs_wait_failed
     AT_FAIL_IF([:])
 }