Skip to content

Commit 3fcbe0d

Browse files
Preliminary refactor of multissltests.py, TODO migrate to classes
1 parent a104f8a commit 3fcbe0d

1 file changed

Lines changed: 34 additions & 40 deletions

File tree

Tools/ssl/multissltests.py

Lines changed: 34 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -86,33 +86,19 @@
8686
parser.add_argument(
8787
'--disable-ancient',
8888
action='store_true',
89-
help="Don't test OpenSSL and LibreSSL versions without upstream support",
89+
help="Don't test SSL versions without upstream support",
9090
)
9191
parser.add_argument(
92-
'--openssl',
93-
nargs='+',
94-
default=(),
95-
help=(
96-
"OpenSSL versions, defaults to '{}' (ancient: '{}') if no "
97-
"OpenSSL and LibreSSL versions are given."
98-
).format(OPENSSL_RECENT_VERSIONS, OPENSSL_OLD_VERSIONS)
99-
)
100-
parser.add_argument(
101-
'--libressl',
102-
nargs='+',
103-
default=(),
104-
help=(
105-
"LibreSSL versions, defaults to '{}' (ancient: '{}') if no "
106-
"OpenSSL and LibreSSL versions are given."
107-
).format(LIBRESSL_RECENT_VERSIONS, LIBRESSL_OLD_VERSIONS)
92+
'--ssl',
93+
choices=['openssl', 'awslc', 'libressl'],
94+
default=None,
95+
help="Which SSL lib to test. If not specified, all are tested.",
10896
)
10997
parser.add_argument(
110-
'--awslc',
98+
'--ssl-versions',
11199
nargs='+',
112-
default=(),
113-
help=(
114-
"AWS-LC versions, defaults to '{}' if no crypto library versions are given."
115-
).format(AWSLC_RECENT_VERSIONS)
100+
default=None,
101+
help="SSL lib version(s), default depends on value passed to --ssl",
116102
)
117103
parser.add_argument(
118104
'--tests',
@@ -507,19 +493,6 @@ def configure_make():
507493

508494
def main():
509495
args = parser.parse_args()
510-
if not args.openssl and not args.libressl and not args.awslc:
511-
args.openssl = list(OPENSSL_RECENT_VERSIONS)
512-
args.libressl = list(LIBRESSL_RECENT_VERSIONS)
513-
args.awslc = list(AWSLC_RECENT_VERSIONS)
514-
if not args.disable_ancient:
515-
args.openssl.extend(OPENSSL_OLD_VERSIONS)
516-
args.libressl.extend(LIBRESSL_OLD_VERSIONS)
517-
518-
logging.basicConfig(
519-
level=logging.DEBUG if args.debug else logging.INFO,
520-
format="*** %(levelname)s %(message)s"
521-
)
522-
523496
start = datetime.now()
524497

525498
if args.steps in {'modules', 'tests'}:
@@ -535,13 +508,34 @@ def main():
535508
# check for configure and run make
536509
configure_make()
537510

511+
logging.basicConfig(
512+
level=logging.DEBUG if args.debug else logging.INFO,
513+
format="*** %(levelname)s %(message)s"
514+
)
515+
516+
ssl_libs = {
517+
"openssl": [
518+
BuildOpenSSL, OPENSSL_OLD_VERSIONS, OPENSSL_RECENT_VERSIONS, []
519+
],
520+
"libressl": [
521+
BuildLibreSSL, LIBRESSL_OLD_VERSIONS, LIBRESSL_RECENT_VERSIONS, []
522+
],
523+
"awslc": [BuildAWSLC, [], AWSLC_RECENT_VERSIONS, []],
524+
}
525+
if args.ssl and args.ssl_versions:
526+
ssl_libs[args.ssl][3] += args.ssl_versions
527+
elif args.ssl:
528+
ssl_libs[args.ssl][3] += ssl_libs[args.ssl][2]
529+
else:
530+
ssl_libs["openssl"][3] += ssl_libs["openssl"][2]
531+
ssl_libs["libressl"][3] += ssl_libs["libressl"][2]
532+
ssl_libs["awslc"][3] += ssl_libs["awslc"][2]
533+
if not args.disable_ancient:
534+
ssl_libs["openssl"][3] += ssl_libs["openssl"][1]
535+
ssl_libs["libressl"][3] += ssl_libs["libressl"][1]
538536
# download and register builder
539537
builds = []
540-
for build_class, versions in [
541-
(BuildOpenSSL, args.openssl),
542-
(BuildLibreSSL, args.libressl),
543-
(BuildAWSLC, args.awslc),
544-
]:
538+
for build_class, _, _, versions in ssl_libs.values():
545539
for version in versions:
546540
build = build_class(version, args)
547541
build.install()

0 commit comments

Comments
 (0)