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

syntax: tweak the "no stack overflow" test #968

Merged
merged 1 commit into from Mar 21, 2023

Conversation

BurntSushi
Copy link
Member

This test works by spinning up a thread with an atypically small stack size, parsing a regex into an Ast and then dropping it. We use a small stack size such that if the Ast didn't have a custom Drop impl, then its default recursive Drop impl would overflow the stack. (If we don't use a smaller stack size, then the default on some platforms is usually quite large and might require a much larger Ast to provoke a failure.)

It turns out that the stack size we were using was quite tiny, and too tiny for some platforms such as FreeBSD. We therefore increase it a little bit, but not too much.

We do the same for the corresponding test for the custom Drop impl for Hir.

Fixes #967

This test works by spinning up a thread with an atypically small stack
size, parsing a regex into an Ast and then dropping it. We use a small
stack size such that *if the Ast didn't have a custom Drop impl*, then
its default recursive Drop impl would overflow the stack. (If we don't
use a smaller stack size, then the default on some platforms is usually
quite large and might require a much larger Ast to provoke a failure.)

It turns out that the stack size we were using was quite tiny, and too
tiny for some platforms such as FreeBSD. We therefore increase it a
little bit, but not too much.

We do the same for the corresponding test for the custom Drop impl for
Hir.

Fixes #967
@BurntSushi BurntSushi merged commit d8e22dd into master Mar 21, 2023
10 checks passed
@BurntSushi BurntSushi deleted the ag/fix-stack-overflow-test branch March 21, 2023 14:12
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.

no_stack_overflow_on_drop tests fail on FreeBSD
1 participant