From c07bedae568eb9650c6f02ba71fe30ce496e1b53 Mon Sep 17 00:00:00 2001 From: Gilles Peskine Date: Fri, 13 Sep 2024 15:33:57 +0200 Subject: [PATCH] generate_tls13_compat_tests: change default mode to all With no options, update the output file (former behavior with -a). Pass -1 to generate a single test case. Also have the intended output file location as the default. This way, you can just run the script after updating it, without having to know the details of the directory structure. Signed-off-by: Gilles Peskine --- tests/opt-testcases/tls13-compat.sh | 2 +- tests/scripts/generate_tls13_compat_tests.py | 15 ++++++++++----- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/tests/opt-testcases/tls13-compat.sh b/tests/opt-testcases/tls13-compat.sh index fdd02f9366..85eb50f80e 100644 --- a/tests/opt-testcases/tls13-compat.sh +++ b/tests/opt-testcases/tls13-compat.sh @@ -1,6 +1,6 @@ # TLS 1.3 interoperability test cases (equivalent of compat.sh for TLS 1.3). # They are generated by -# `tests/scripts/generate_tls13_compat_tests.py -a -o ./tests/opt-testcases/tls13-compat.sh`. +# `tests/scripts/generate_tls13_compat_tests.py`. # # PLEASE DO NOT EDIT THIS FILE. IF NEEDED, PLEASE MODIFY `generate_tls13_compat_tests.py` # AND REGENERATE THIS FILE. diff --git a/tests/scripts/generate_tls13_compat_tests.py b/tests/scripts/generate_tls13_compat_tests.py index 6dc0be3170..4165f74b4b 100755 --- a/tests/scripts/generate_tls13_compat_tests.py +++ b/tests/scripts/generate_tls13_compat_tests.py @@ -545,11 +545,16 @@ def main(): """ parser = argparse.ArgumentParser() - parser.add_argument('-o', '--output', nargs='?', - default=None, help='Output file path if `-a` was set') + parser.add_argument('-o', '--output', + default='tests/opt-testcases/tls13-compat.sh', + help='Output file path (not used with -1)') - parser.add_argument('-a', '--generate-all-tls13-compat-tests', action='store_true', - default=False, help='Generate all available tls13 compat tests') + parser.add_argument('-1', '--single', action='store_true', + help='Print a single test case') + # Single mode used to be the default. + parser.add_argument('-a', '--generate-all-tls13-compat-tests', + action='store_false', dest='single', + help='Generate all test cases (negates -1) (default)') parser.add_argument('--list-ciphers', action='store_true', default=False, help='List supported ciphersuites') @@ -612,7 +617,7 @@ def main(): server_named_group=server_named_group, cert_sig_alg="ecdsa_secp256r1_sha256") - if args.generate_all_tls13_compat_tests: + if not args.single: if args.output: with open(args.output, 'w', encoding="utf-8") as f: f.write(SSL_OUTPUT_HEADER.format(