diff options
| author | Phil Sutter <phil@nwl.cc> | 2023-08-31 12:44:55 +0200 |
|---|---|---|
| committer | Phil Sutter <phil@nwl.cc> | 2025-09-11 18:11:53 +0200 |
| commit | 15c01d744a6b8f428e785a36687e7ecdbc3e7a15 (patch) | |
| tree | 7e2743318b6e5dd314d5db04c45d4cc38ada6256 /tests/py/nft-test.py | |
| parent | 2c10b95fc96239e6ca8a328bb76c93cadafa9318 (diff) | |
tests: Prepare exit codes for automake
Make the test suite runners exit 77 when requiring root and running as
regular user, exit 99 for internal errors (unrelated to test cases) and
exit 1 (or any free non-zero value) to indicate test failures.
Signed-off-by: Phil Sutter <phil@nwl.cc>
Diffstat (limited to 'tests/py/nft-test.py')
| -rwxr-xr-x | tests/py/nft-test.py | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/tests/py/nft-test.py b/tests/py/nft-test.py index 12c6174b..35b29fc9 100755 --- a/tests/py/nft-test.py +++ b/tests/py/nft-test.py @@ -1527,7 +1527,7 @@ def main(): if os.getuid() != 0: print("You need to be root to run this, sorry") - return + return 77 if not args.no_netns and not spawn_netns(): print_warning("cannot run in own namespace, connectivity might break") @@ -1546,11 +1546,11 @@ def main(): if check_lib_path and not os.path.exists(args.library): print("The nftables library at '%s' does not exist. " "You need to build the project." % args.library) - return + return 99 if args.enable_schema and not args.enable_json: print_error("Option --schema requires option --json") - return + return 99 global nftables nftables = Nftables(sofile = args.library) @@ -1563,7 +1563,7 @@ def main(): print_info("Log will be available at %s" % LOGFILE) except IOError: print_error("Cannot open log file %s" % LOGFILE) - return + return 99 file_list = [] if args.filenames: @@ -1609,5 +1609,7 @@ def main(): print("%d test files, %d files passed, %d unit tests, " % (test_files, files_ok, tests)) print("%d error, %d warning" % (errors, warnings)) + return errors != 0 + if __name__ == '__main__': - main() + sys.exit(main()) |
