From 3c215220e321b85763bb242d47184711919b951e Mon Sep 17 00:00:00 2001 From: Yann Collet Date: Wed, 25 Jan 2023 16:29:34 -0800 Subject: [PATCH] modify cli-test logic : ignore stderr message by default Previously, cli-test would, by default, check that a stderr output is strictly identical to a saved outcome. When there was no instructions on how to interpret stderr, it would default to requiring it to be empty. There are many tests cases though where stderr content doesn't matter, and we are mainly interested in the return code of the cli. For these cases, it was possible to set a .ignore document, which would instruct to ignore stderr content. This PR update the logic, to make .ignore the default. When willing to check that stderr content is empty, one must now add an empty .strict file. This will allow status message to evolve without triggering many cli-tests errors. This is especially important when some of these status include compression results, which may change as a result of compression optimizations. It also makes it easier to add new tests which only care about the CLI's return code. --- tests/cli-tests/run.py | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/tests/cli-tests/run.py b/tests/cli-tests/run.py index 8b4e21a53..45af5124b 100755 --- a/tests/cli-tests/run.py +++ b/tests/cli-tests/run.py @@ -395,12 +395,10 @@ class TestCase: return self._check_output_exact(out_name, read_file(exact_name), exact_name) elif os.path.exists(glob_name): return self._check_output_glob(out_name, read_file(glob_name)) - elif os.path.exists(ignore_name): + else: check_name = f"check_{out_name}" self._success[check_name] = True self._message[check_name] = f"{out_name} ignored!" - else: - return self._check_output_exact(out_name, bytes(), exact_name) def _check_stderr(self) -> None: """Checks the stderr output against the expectation.""" @@ -738,4 +736,3 @@ if __name__ == "__main__": sys.exit(0) else: sys.exit(1) - -- 2.47.2