[llvm-branch-commits] [libcxx] [libc++][modules] Adds module testing. (PR #76246)
Louis Dionne via llvm-branch-commits
llvm-branch-commits at lists.llvm.org
Tue Jan 9 09:33:52 PST 2024
================
@@ -131,13 +138,65 @@ def parseScript(test, preamble):
script += preamble
script += scriptInTest
+ has_std_module = False
+ has_std_compat_module = False
+ for module in modules:
+ if module == "std":
+ has_std_module = True
+ elif module == "std.compat":
+ has_std_compat_module = True
+ else:
+ script.insert(
+ 0,
+ f"echo \"The module '{module}' is not valid, use 'std' or 'std.compat'\"",
+ )
+ script.insert(1, "false")
+ return script
----------------
ldionne wrote:
This has the downside that we'll only notice the incorrect `MODULES: <...>` entry when *running* the test, and it will appear as a test failure. I'd expect it to be some kind of configuration failure instead. I would suggest this:
```
def _validateModuleDependencies(modules):
for m in modules:
if m not in ('std', 'std.compat'):
raise RuntimeError(f"Invalid module dependency '{m}', only 'std' and 'std.compat' are valid")
```
Then in here you say
```
_validateModuleDependencies(modules)
has_std_module = 'std' in modules
has_std_compat_module = 'std.compat' in modules
```
Or maybe you don't need the `has_foo_module` variables anymore.
https://github.com/llvm/llvm-project/pull/76246
More information about the llvm-branch-commits
mailing list