summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPhil Sutter <phil@nwl.cc>2021-08-12 19:11:59 +0200
committerPhil Sutter <phil@nwl.cc>2021-09-13 17:00:51 +0200
commitfcbe454bf0d05612a8484723fd3e9299d4ee836f (patch)
treee1199864365c286457cf46d64dbcea4994a92fd8
parent61e85e3192deaff3b9dd1eb9270863acc7a26311 (diff)
tests: iptables-test: Fix missing chain case
If a chain line was really missing, Python complained about reference before assignment of 'chain_array' variable. While being at it, reuse print_error() function for reporting and allow to continue with the next input file instead of exiting. Signed-off-by: Phil Sutter <phil@nwl.cc>
-rwxr-xr-xiptables-test.py7
1 files changed, 5 insertions, 2 deletions
diff --git a/iptables-test.py b/iptables-test.py
index 90e07fee..01966f91 100755
--- a/iptables-test.py
+++ b/iptables-test.py
@@ -215,6 +215,7 @@ def run_test_file(filename, netns):
tests = 0
passed = 0
table = ""
+ chain_array = []
total_test_passed = True
if netns:
@@ -249,8 +250,10 @@ def run_test_file(filename, netns):
continue
if len(chain_array) == 0:
- print("broken test, missing chain, leaving")
- sys.exit()
+ print_error("broken test, missing chain",
+ filename = filename, lineno = lineno)
+ total_test_passed = False
+ break
test_passed = True
tests += 1