From 325584889d9e8c2ac78f2bdbe212d43781b262d9 Mon Sep 17 00:00:00 2001 From: Gilles Peskine Date: Tue, 3 Dec 2019 19:03:35 +0100 Subject: [PATCH] Add option to show what values are tested This is useful to inspect what the script does manually, in particular to check that expected values do get tested. --keep-c provides the same information but in a way that's harder to access. --- tests/scripts/test_psa_constant_names.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/tests/scripts/test_psa_constant_names.py b/tests/scripts/test_psa_constant_names.py index 482932137..585f9decc 100755 --- a/tests/scripts/test_psa_constant_names.py +++ b/tests/scripts/test_psa_constant_names.py @@ -389,6 +389,8 @@ class Tests: outputs = output.decode('ascii').strip().split('\n') self.count += len(expressions) for expr, value, output in zip(expressions, values, outputs): + if self.options.show: + sys.stdout.write('{} {}\t{}\n'.format(type_word, value, output)) if normalize(expr) != normalize(output): self.errors.append(self.Error(type=type_word, expression=expr, @@ -434,6 +436,12 @@ def main(): parser.add_argument('--program', default='programs/psa/psa_constant_names', help='Program to test') + parser.add_argument('--show', + action='store_true', + help='Keep the intermediate C file') + parser.add_argument('--no-show', + action='store_false', dest='show', + help='Don\'t show tested values (default)') options = parser.parse_args() headers = [os.path.join(options.include[0], h) for h in HEADERS] inputs = gather_inputs(headers, TEST_SUITES)