Skip to contentSkip to conversation

tests: shell: sets/reset_command_0: Fix drop_seconds()

PATCH In review Phil Sutter 1 participant 2 messages Sep 29, 2023 netfilter

lore
Share & tools
lore

Phil Sutter

author reviewer
#0 lore raw

PATCH 1/1 tests: shell: sets/reset_command_0: Fix drop_seconds()

The function print_times() skips any time elements which are zero, so output may lack the ms part. Adjust the sed call dropping anything but the minutes value to not fail in that case.

Fixes 255ec36a11525 ("tests: shell: Stabilize sets/reset_command_0 test")
---
 tests/shell/testcases/sets/reset_command_0 | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tests/shell/testcases/sets/reset_command_0 +1 -1
index 5e769fe66d684..e663dac831f8c 100755
@@ -32,7 +32,7 @@ $NFT -f - <<< "$RULESET"
 echo OK
 
 drop_seconds() {
-	sed 's/m[0-9]*s[0-9]*ms/m/g'
+	sed 's/[0-9]\+m\?s//g'
 }
 expires_minutes() {
 	sed -n 's/.*expires \([0-9]*\)m.*/\1/p'
Signature · 1 line
2.41.0
author reviewer
#1 lore raw
Quoted 7 lines · Phil Sutter

The function print_times() skips any time elements which are zero, so output may lack the ms part. Adjust the sed call dropping anything but the minutes value to not fail in that case.

Fixes 255ec36a11525 ("tests: shell: Stabilize sets/reset_command_0 test")

Patch applied.