]> git.ipfire.org Git - thirdparty/iptables.git/commitdiff
tests: xlate-test: Print errors to stderr
authorPhil Sutter <phil@nwl.cc>
Thu, 12 Aug 2021 13:12:30 +0000 (15:12 +0200)
committerPhil Sutter <phil@nwl.cc>
Mon, 13 Sep 2021 15:00:51 +0000 (17:00 +0200)
Return code is always zero, so grepping for output on stderr is a
simple way to detect testsuite failures.

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

index 1fa5eca3e07643db0b5e96de3db4626c358f6bd2..bb7a447dc799ed22d03fc8499046dbbe2c985dbc 100755 (executable)
@@ -75,7 +75,7 @@ def run_test(name, payload):
     if (passed == tests) and not args.test:
         print(name + ": " + green("OK"))
     if not test_passed:
-        print("\n".join(result))
+        print("\n".join(result), file=sys.stderr)
     if args.test:
         print("1 test file, %d tests, %d tests passed, %d tests failed, %d errors" % (tests, passed, failed, errors))
     else:
@@ -111,7 +111,7 @@ def main():
             with open(args.test, "r") as payload:
                 run_test(args.test, payload)
         except IOError:
-            print(red("Error: ") + "test file does not exist")
+            print(red("Error: ") + "test file does not exist", file=sys.stderr)
     else:
         load_test_files()