]> git.ipfire.org Git - thirdparty/iptables.git/commitdiff
xlate-test: Print full path if testing all files
authorPhil Sutter <phil@nwl.cc>
Sat, 6 Nov 2021 20:10:45 +0000 (21:10 +0100)
committerPhil Sutter <phil@nwl.cc>
Mon, 8 Nov 2021 11:22:44 +0000 (12:22 +0100)
Lines won't become too long and it's more clear to users where test
input comes from this way.

Signed-off-by: Phil Sutter <phil@nwl.cc>
Tested-by: Pablo Neira Ayuso <pablo@netfilter.org>
xlate-test.py

index 4a56e798b9587afa30e5c93260506c241e81cce7..d78e864869318dca96abe577eba79b83fa4b959a 100755 (executable)
@@ -80,15 +80,15 @@ def run_test(name, payload):
 
 def load_test_files():
     test_files = total_tests = total_passed = total_error = total_failed = 0
-    for test in sorted(os.listdir("extensions")):
-        if test.endswith(".txlate"):
-            with open("extensions/" + test, "r") as payload:
-                tests, passed, failed, errors = run_test(test, payload)
-                test_files += 1
-                total_tests += tests
-                total_passed += passed
-                total_failed += failed
-                total_error += errors
+    tests = sorted(os.listdir("extensions"))
+    for test in ['extensions/' + f for f in tests if f.endswith(".txlate")]:
+        with open(test, "r") as payload:
+            tests, passed, failed, errors = run_test(test, payload)
+            test_files += 1
+            total_tests += tests
+            total_passed += passed
+            total_failed += failed
+            total_error += errors
     return (test_files, total_tests, total_passed, total_failed, total_error)