diff options
author | Joel E. Denny <jdenny.ornl@gmail.com> | 2023-10-20 11:53:18 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-10-20 11:53:18 -0400 |
commit | 080fb3e5b73bcfd90f11335ff3d175cf3199f814 (patch) | |
tree | 47a74680d4c583a7e290a6e08c748a8c8fa011c9 /clang/lib/Lex/ModuleMap.cpp | |
parent | 6795bfce4ded6abf2403db62a5fec89a8bcb256a (diff) | |
download | llvm-080fb3e5b73bcfd90f11335ff3d175cf3199f814.zip llvm-080fb3e5b73bcfd90f11335ff3d175cf3199f814.tar.gz llvm-080fb3e5b73bcfd90f11335ff3d175cf3199f814.tar.bz2 |
[lit] Clean up internal shell parse errors with ScriptFatal (#68496)
Without this patch, the functions `executeScriptInternal` and thus
`runOnce` in `llvm/utils/lit/lit/TestRunner.py` return either a tuple like
`(out, err, exitCode, timeoutInfo)` or a `lit.Test.Result` object. They
return the latter only when there's a lit internal shell parse error in
a RUN line. In my opinion, a more straight-forward way to handle
exceptional cases like that is to use python exceptions.
For that purpose, this patch introduces `ScriptFatal`. Thus, this patch
changes `executeScriptInternal` to always either return the tuple or
raise the `ScriptFatal` exception. It updates `runOnce` and
`libcxx/utils/libcxx/test/format.py` to catch the exception rather than
check for the special return type.
This patch also changes `runOnce` to convert the exception to a
`Test.UNRESOLVED` result instead of `TEST.FAIL`. The former is the
proper result for such a malformed test, for which a rerun (given an
`ALLOW_RETRIES:`) serves no purpose. There are at least two benefits
from this change. First, `_runShTest` no longer has to specially and
cryptically handle this case to avoid unnecessary reruns. Second, an
`XFAIL:` directive no longer hides such a failure [as we saw
previously](https://reviews.llvm.org/D154987#4501125).
To facilitate the `_runShTest` change, this patch inserts the internal
shell parse error diagnostic into the format of the test's normal debug
output rather than suppressing the latter entirely. That change is also
important for [D154987](https://reviews.llvm.org/D154987), which
proposes to reuse `ScriptFatal` for python compile errors in PYTHON
lines or in `config.prologue`. In that case, the diagnostic might follow
debugging output from the test's previous RUN or PYTHON lines, so
suppressing the normal debug output would lose information.
Diffstat (limited to 'clang/lib/Lex/ModuleMap.cpp')
0 files changed, 0 insertions, 0 deletions