]> git.ipfire.org Git - thirdparty/iptables.git/commitdiff
tests: xlate: Print failing command line
authorPhil Sutter <phil@nwl.cc>
Sun, 19 Nov 2023 10:23:09 +0000 (11:23 +0100)
committerPhil Sutter <phil@nwl.cc>
Thu, 23 Nov 2023 16:59:42 +0000 (17:59 +0100)
If the command segfaults, 'error' variable is empty and the resulting
error message is even misleading as the called program may not have been
iptables-translate.

Signed-off-by: Phil Sutter <phil@nwl.cc>
xlate-test.py

index ddd68b91d3a7eb2be01e97a234c8aa1442414ca4..b6a78bb250e27d4091b7b9648285938fbd9da590 100755 (executable)
@@ -41,9 +41,10 @@ def green(string):
 
 
 def test_one_xlate(name, sourceline, expected, result):
-    rc, output, error = run_proc([xtables_nft_multi] + shlex.split(sourceline))
+    cmd = [xtables_nft_multi] + shlex.split(sourceline)
+    rc, output, error = run_proc(cmd)
     if rc != 0:
-        result.append(name + ": " + red("Error: ") + "iptables-translate failure")
+        result.append(name + ": " + red("Error: ") + "Call failed: " + " ".join(cmd))
         result.append(error)
         return False