tools: allow selecting test subsystems with numbers in their names

Previously, selecting subsystems with numbers in their names, like
http2, weren't matched due to a restrictive regex:

```
$ tools/test.py http2
No tests to run.
```

The regex now allows digits, so these tests run as expected:

```
$ tools/test.py http2
[00:17|% 100|+ 286|-   0]: Done

All tests passed.
```

Signed-off-by: Darshan Sen <raisinten@gmail.com>
PR-URL: https://github.com/nodejs/node/pull/59242
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Marco Ippolito <marcoippolito54@gmail.com>
This commit is contained in:
Darshan Sen 2025-07-29 18:54:35 +05:30 committed by GitHub
parent e55e0a7a98
commit cde8f275ad
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -1605,7 +1605,7 @@ def ArgsToTestPaths(test_root, args, suites):
if len(args) == 0 or 'default' in args:
def_suites = [s for s in suites if s not in IGNORED_SUITES]
args = [a for a in args if a != 'default'] + def_suites
subsystem_regex = re.compile(r'^[a-zA-Z-]*$')
subsystem_regex = re.compile(r'^[a-zA-Z0-9-]*$')
check = lambda arg: subsystem_regex.match(arg) and (arg not in suites)
mapped_args = ["*/test*-%s-*" % arg if check(arg) else arg for arg in args]
paths = [SplitPath(NormalizePath(a)) for a in mapped_args]