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

Don't write test snapshot if no thread name #1155

Merged
merged 1 commit into from Nov 15, 2023

Conversation

brson
Copy link
Contributor

@brson brson commented Nov 15, 2023

What

When dropping Env, if there is no thread name, don't write a snapshot file (and don't panic).

Why

The current code for writing test snapshots under testutils assumes the Env has been constructed as part of a unit test, but this is not the case for e.g. fuzz tests.

A fuzz test runs on the main thread and does not configure a thread name, but the test snapshot writer panics if there is no thread name.

This patch adds a (very crude) heuristic to decide that it is not running as part of a unit test and it is ok to not write the test snapshot. I looked for more reliable ways to determine if code was running as part of a unit test but did not find one.

Known limitations

This heuristic may be inaccurate for other unanticipated scenarios.

@leighmcculloch leighmcculloch added this pull request to the merge queue Nov 15, 2023
@leighmcculloch
Copy link
Member

Thanks for making this change. This is better. 👍

Merged via the queue into stellar:main with commit ea6e543 Nov 15, 2023
14 checks passed
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.

None yet

2 participants