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 <Gilles.Peskine@arm.com>
This commit is contained in:
Gilles Peskine 2024-09-13 15:33:57 +02:00
parent ae5a35fc30
commit c07bedae56
2 changed files with 11 additions and 6 deletions

View File

@ -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.

View File

@ -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(