Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Tests] Improve stack-trace pattern-matching #1300

Merged
merged 1 commit into from
Nov 13, 2024

Conversation

joeycarter
Copy link
Contributor

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

assert "Trace" in e.value.args[0]

to

assert "diagnostic emitted with trace" in e.value.args[0]

and similarly when asserting that there is no stack trace in the error message.

Benefits: More robust test; unblocks #1187.

@joeycarter joeycarter requested a review from a team November 13, 2024 14:36
Copy link
Contributor

Hello. You may have forgotten to update the changelog!
Please edit doc/releases/changelog-dev.md on your branch with:

  • A one-to-two sentence description of the change. You may include a small working example for new features.
  • A link back to this PR.
  • Your name (or GitHub username) in the contributors section.

Copy link
Contributor

@rmoyard rmoyard left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you!

@joeycarter joeycarter merged commit d535377 into main Nov 13, 2024
45 checks passed
@joeycarter joeycarter deleted the joeycarter/update-test-test-pipeline-error branch November 13, 2024 15:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants