summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPhil Sutter <phil@nwl.cc>2022-03-30 17:54:13 +0200
committerPhil Sutter <phil@nwl.cc>2022-03-31 10:45:11 +0200
commit24fff5d7de02ac4dcd288565f1527028a797fad5 (patch)
tree2ec426a03a9cba9babf92038c5d3bbd187242346
parentac4c84cc63d3cc021ca532692885a644fcde4518 (diff)
xlate-test: Fix for empty source line on failure
The code overwrites 'line' before checking expected output. Save it in a temporary variable. Fixes: 62828a6aff231 ("tests: xlate-test: support multiline expectation") Signed-off-by: Phil Sutter <phil@nwl.cc>
-rwxr-xr-xxlate-test.py3
1 files changed, 2 insertions, 1 deletions
diff --git a/xlate-test.py b/xlate-test.py
index d78e8648..03bef7e2 100755
--- a/xlate-test.py
+++ b/xlate-test.py
@@ -42,6 +42,7 @@ def run_test(name, payload):
line = payload.readline()
while line:
if line.startswith(keywords):
+ sourceline = line
tests += 1
process = Popen([ xtables_nft_multi ] + shlex.split(line), stdout=PIPE, stderr=PIPE)
(output, error) = process.communicate()
@@ -58,7 +59,7 @@ def run_test(name, payload):
test_passed = False
failed += 1
result.append(name + ": " + red("Fail"))
- result.append(magenta("src: ") + line.rstrip(" \n"))
+ result.append(magenta("src: ") + sourceline.rstrip(" \n"))
result.append(magenta("exp: ") + expected)
result.append(magenta("res: ") + translation + "\n")
else: