8000 Load JSON and TOML grammars before tests in `cli-testers.rs` by nbacquey · Pull Request #779 · tweag/topiary · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Load JSON and TOML grammars before tests in cli-testers.rs #779

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

Merged
merged 1 commit into from
Oct 24, 2024

Conversation

nbacquey
Copy link
Member
@nbacquey nbacquey commented Oct 24, 2024

Description

We need to prefetch JSON and TOML grammars before running the tests, on pain of race condition:
If multiple calls to Topiary are made in parallel and the grammar is missing, they will all try to fetch and build it, thus creating an empty .so file while g++ is running.
If another instance of Topiary starts at this moment, it will mistake the empty .so file for an already built grammar, and try to run with it, resulting in an error.

Closes #767

Checklist

Checklist before merging:

  • CHANGELOG.md updated
  • README.md up-to-date

We need to prefetch JSON and TOML grammars before running the tests, on pain of race condition:
If multiple calls to Topiary are made in parallel and the grammar is missing, they will all try
to fetch and build it, thus creating an empty .so file while g++ is running. If another instance
of Topiary starts at this moment, it will mistake the empty .so file for an already built grammar,
and try to run with it, resulting in an error.
@nbacquey nbacquey force-pushed the nb/test_fetch_grammars_before branch from 3091e22 to 77ae922 Compare October 24, 2024 15:25
@nbacquey nbacquey marked this pull request as ready for review October 24, 2024 15:25
Copy link
Member
@Xophmeister Xophmeister left a comment

Choose a reason for hiding this comment

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

TIL std::sync::Once 👍

@nbacquey nbacquey merged commit f68cfd4 into main Oct 24, 2024
9 checks passed
@nbacquey nbacquey deleted the nb/test_fetch_grammars_before branch October 24, 2024 17:08
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.

cargo test fails when JSON grammar hasn't been fetched
2 participants
0