Skip to contentSkip to conversation

tests: shell: Join arithmetic statements in maps/vmap_timeout

PATCH In review Phil Sutter 2 participants 3 messages Oct 11, 2024 netfilter

lore
Share & tools
lore

Phil Sutter

author reviewer
#0 lore raw

PATCH 1/1 tests: shell: Join arithmetic statements in maps/vmap_timeout

In light of the recent typo fix, go an extra step and merge the modulo and offset adjustment in a single term.

---
 tests/shell/testcases/maps/vmap_timeout | 9 +++------
 1 file changed, 3 insertions(+), 6 deletions(-)
tests/shell/testcases/maps/vmap_timeout +3 -6
index 6d73f3cc9ae24..8ac7e8e7684ab 100755
@@ -9,8 +9,7 @@ $NFT -f $dumpfile
 
 port=23
 for i in $(seq 1 100) ; do
-	timeout=$((RANDOM%5))
-	timeout=$((timeout+1))
+	timeout=$((RANDOM % 5 + 1))
 	expire=$((RANDOM%timeout))
 	j=1
 
@@ -28,11 +27,9 @@ for i in $(seq 1 100) ; do
 
 	port=$((port + 1))
 	for j in $(seq 2 400); do
-		timeout=$((RANDOM%5))
-		timeout=$((timeout+1))
+		timeout=$((RANDOM % 5 + 1))
 		expire=$((RANDOM%timeout))
-		utimeout=$((RANDOM%5))
-		utimeout=$((utimeout+1))
+		utimeout=$((RANDOM % 5 + 1))
 
 		timeout_str="timeout ${timeout}s"
 		expire_str=""
Signature · 1 line
2.43.0
#1 lore raw
Quoted 2 lines · Phil Sutter

In light of the recent typo fix, go an extra step and merge the modulo and offset adjustment in a single term.

LGTM.

Quoted 36 lines
---
 tests/shell/testcases/maps/vmap_timeout | 9 +++------
 1 file changed, 3 insertions(+), 6 deletions(-)
tests/shell/testcases/maps/vmap_timeout +3 -6
index 6d73f3cc9ae24..8ac7e8e7684ab 100755
@@ -9,8 +9,7 @@ $NFT -f $dumpfile
 
 port=23
 for i in $(seq 1 100) ; do
-	timeout=$((RANDOM%5))
-	timeout=$((timeout+1))
+	timeout=$((RANDOM % 5 + 1))
 	expire=$((RANDOM%timeout))
 	j=1
 
@@ -28,11 +27,9 @@ for i in $(seq 1 100) ; do
 
 	port=$((port + 1))
 	for j in $(seq 2 400); do
-		timeout=$((RANDOM%5))
-		timeout=$((timeout+1))
+		timeout=$((RANDOM % 5 + 1))
 		expire=$((RANDOM%timeout))
-		utimeout=$((RANDOM%5))
-		utimeout=$((utimeout+1))
+		utimeout=$((RANDOM % 5 + 1))
 
 		timeout_str="timeout ${timeout}s"
 		expire_str=""
Signature · 1 line
2.43.0
author reviewer
#2 lore raw
Quoted 5 lines · Pablo Neira Ayuso
Quoted 2 lines · Phil Sutter

In light of the recent typo fix, go an extra step and merge the modulo and offset adjustment in a single term.

LGTM.

Patch applied, thanks guys!

Cheers, Phil