Previously python/semanage/test-semanage.py returned 0 even when there was a fail in some test and `make test` didn't indicate any problem. Fixes: $ make test ... Ran 10 tests in 110.854s FAILED (failures=4) $ echo $? 0 Signed-off-by: Petr Lautrbach <plautrba@xxxxxxxxxx> --- python/semanage/test-semanage.py | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/python/semanage/test-semanage.py b/python/semanage/test-semanage.py index c8f6ec231fc2..d99e3fdaa211 100644 --- a/python/semanage/test-semanage.py +++ b/python/semanage/test-semanage.py @@ -233,7 +233,7 @@ def semanage_custom_suite(test_list): def semanage_run_test(suite): - unittest.TextTestRunner(verbosity=2).run(suite) + return unittest.TextTestRunner(verbosity=2).run(suite).wasSuccessful() class CheckTest(argparse.Action): @@ -255,9 +255,9 @@ def semanage_args(args): for i in semanage_test_list: print(i) if args.all: - semanage_run_test(semanage_suite()) + return semanage_run_test(semanage_suite()) if args.test: - semanage_run_test(semanage_custom_suite(args.test)) + return semanage_run_test(semanage_custom_suite(args.test)) def gen_semanage_test_args(parser): @@ -281,8 +281,10 @@ if __name__ == "__main__": gen_semanage_test_args(parser) try: args = parser.parse_args() - args.func(args) - sys.exit(0) + if args.func(args): + sys.exit(0) + else: + sys.exit(1) except ValueError as e: sys.stderr.write("%s: %s\n" % (e.__class__.__name__, str(e))) sys.exit(1) -- 2.26.2