[Tests] Improve stack-trace pattern-matching #1300
Merged
+4
−2
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Context: I had observed when working on the pybind11 -> nanobind conversions in the MLIR python binding (#1187) that the
test_pipeline_error
test fails on some platforms because it asserts that the string"Trace"
(with a capital "T") is in the error message, but it is not, even though the stack trace was printed. Normally, it would match the string"Trace"
in the first line of the stack trace, which contains"llvm::sys::PrintStackTrace"
. For whatever reason, this line is not always printed out. We can make this test more robust by matching a string not contained within the stack trace itself, but one immediately preceding it, which should always be part of the error message. I've chosen"diagnostic emitted with trace"
for this purpose (but I'm happy to take other suggestions).Description of the Change: Change test from
to
and similarly when asserting that there is no stack trace in the error message.
Benefits: More robust test; unblocks #1187.