diff options
author | Phil Sutter <phil@nwl.cc> | 2023-07-26 19:43:20 +0200 |
---|---|---|
committer | Phil Sutter <phil@nwl.cc> | 2023-08-10 14:11:42 +0200 |
commit | 5412ccba55b2318160d32efec3b8aad162608af9 (patch) | |
tree | b6e8a04ee30c4186820bcd4ff3ea4eae215cd094 /iptables-test.py | |
parent | 7304f1982d619e19860106bc74b9cf3d05ddb113 (diff) |
tests: iptables-test: Fix command segfault reports
Logging produced a stack trace due to undefined variable 'cmd'.
Fixes: 0e80cfea3762b ("tests: iptables-test: Implement fast test mode")
Signed-off-by: Phil Sutter <phil@nwl.cc>
Diffstat (limited to 'iptables-test.py')
-rwxr-xr-x | iptables-test.py | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/iptables-test.py b/iptables-test.py index ef0a35d3..6f63cdbe 100755 --- a/iptables-test.py +++ b/iptables-test.py @@ -136,7 +136,7 @@ def run_test(iptables, rule, rule_save, res, filename, lineno, netns): # check for segfaults # if proc.returncode == -11: - reason = "iptables-save segfaults: " + cmd + reason = command + " segfaults!" print_error(reason, filename, lineno) delete_rule(iptables, rule, filename, lineno, netns) return -1 @@ -333,8 +333,11 @@ def run_test_file_fast(iptables, filename, netns): out, err = proc.communicate(input = restore_data) if proc.returncode == -11: - reason = iptables + "-restore segfaults: " + cmd + reason = iptables + "-restore segfaults!" print_error(reason, filename, lineno) + msg = [iptables + "-restore segfault from:"] + msg.extend(["input: " + l for l in restore_data.split("\n")]) + print("\n".join(msg), file=log_file) return -1 if proc.returncode != 0: @@ -355,7 +358,7 @@ def run_test_file_fast(iptables, filename, netns): out, err = proc.communicate() if proc.returncode == -11: - reason = iptables + "-save segfaults: " + cmd + reason = iptables + "-save segfaults!" print_error(reason, filename, lineno) return -1 |