Skip to contentSkip to conversation

tests: xlate: Properly split input in replay mode

PATCH In review Phil Sutter 1 participant 3 messages Feb 17, 2023 netfilter

lore
Share & tools
lore

Phil Sutter

author reviewer
#0 lore raw

PATCH 1/2 tests: xlate: Properly split input in replay mode

Source command may contain quotes, using shlex.split() does the right thing there.

Fixes 7705b2daa3bdc ("tests: xlate: Use --check to verify replay")
---
 xlate-test.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
xlate-test.py +1 -1
index 1b544600aa242..09e3b67a853df 100755
@@ -64,7 +64,7 @@ xtables_nft_multi = 'xtables-nft-multi'
     if sourceline.find(';') >= 0:
         sourceline, searchline = sourceline.split(';')
 
-    srcwords = sourceline.split()
+    srcwords = shlex.split(sourceline)
 
     srccmd = srcwords[0]
     ipt = srccmd.split('-')[0]
Signature · 1 line
2.38.0
author reviewer
#1 lore raw

PATCH 2/2 tests: xlate: Print file names even if specified

Since the script now supports running for multiple files given on command line, do not skip printing a status line for each.

---
 xlate-test.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
xlate-test.py +1 -1
index 09e3b67a853df..6a11659868479 100755
@@ -176,7 +176,7 @@ xtables_nft_multi = 'xtables-nft-multi'
                 result.append(name + ": " + red("Fail"))
                 result.append("nft flush ruleset call failed: " + error)
 
-    if (passed == tests) and not args.test:
+    if (passed == tests):
         print(name + ": " + green("OK"))
     if not test_passed:
         print("\n".join(result), file=sys.stderr)
Signature · 1 line
2.38.0