diff --git a/scripts/lib/mlkem_test.py b/scripts/lib/mlkem_test.py index 60b12fb4f..590dabac9 100644 --- a/scripts/lib/mlkem_test.py +++ b/scripts/lib/mlkem_test.py @@ -447,9 +447,8 @@ def bench( def all(self, func: bool, kat: bool, nistkat: bool): config_logger(self.verbose) - exit_code = 0 - def all(opt: bool): + code = 0 if self.compile: compiles = [ *([self._func.compile] if func else []), @@ -461,7 +460,7 @@ def all(opt: bool): try: f(opt) except SystemExit as e: - exit_code = exit_code or e + code = code or e sys.stdout.flush() @@ -474,15 +473,18 @@ def all(opt: bool): for f in runs: try: - f(opt) + code = code or int(f(opt)) except SystemExit as e: - exit_code = exit_code or e + code = code or e sys.stdout.flush() + return code + + exit_code = 0 if self.opt.lower() == "all" or self.opt.lower() == "no_opt": - all(False) + exit_code = exit_code or all(False) if self.opt.lower() == "all" or self.opt.lower() == "opt": - all(True) + exit_code = exit_code or all(True) exit(exit_code) diff --git a/scripts/lib/util.py b/scripts/lib/util.py index 993ec4ff1..d92efe4af 100644 --- a/scripts/lib/util.py +++ b/scripts/lib/util.py @@ -159,7 +159,9 @@ def add_summaries(fn, title, summaries): def config_logger(verbose): - logging.basicConfig(format="%(levelname)-5s > %(name)-40s %(message)s") + logging.basicConfig( + stream=sys.stdout, format="%(levelname)-5s > %(name)-40s %(message)s" + ) logger = logging.getLogger()