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

[nexus-test-utils] replace build.rs with a new setup script #4150

Conversation

sunshowers
Copy link
Contributor

Nextest now has support for setup scripts, which means that we can
replace the existing build.rs with a small binary.

I also took the liberty of switching some of the related code over to
camino.

Supersedes #4056.

Created using spr 1.3.4
Created using spr 1.3.4
Copy link
Collaborator

@smklein smklein left a comment

Choose a reason for hiding this comment

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

Looks great, thanks for doing this!

Comment on lines 23 to 24
// TODO: replace with temp dir written out by nextest
// Use "out/" for now.
Copy link
Collaborator

Choose a reason for hiding this comment

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

Isn't this happening already?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Isn't this happening already?

Yes, lol. Will fix.

&ConfigLogging::StderrTerminal { level: ConfigLoggingLevel::Info },
);
let dir = ensure_seed_directory_exists(&logctx.log).await;
if let Ok(env_path) = std::env::var("NEXTEST_ENV") {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Out of curiosity, what sets this environment variable?

Also, if this environment variable cannot be found, should we throw an error?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Out of curiosity, what sets this environment variable?

Nextest does -- it's the way setup scripts can communicate with nextest.

Also, if this environment variable cannot be found, should we throw an error?

I figured folks might want to run the script by hand. Maybe we should warn in that case.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Gotcha. So someone could run this binary manually, and it would create the seed dir, but not pass the necessary info to nextest.

That makes sense -- I'm okay with this structure as-is, I just wanted to make sure it would be clear "where things went wrong" if the environment variable from nextest was not provided.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I added some more logging and a warning message to make this clearer.

Comment on lines 28 to 32
// If the directory didn't exist when we started, try to create it.
//
// Note that this may be executed concurrently by many tests, so
// we should consider it possible for another caller to create this
// seed directory before we finish setting it up ourselves.
Copy link
Collaborator

Choose a reason for hiding this comment

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

Is this still true, or will nextest prevent the concurrent execution of this function?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Nextest will execute it once, but it's possible that the user spins up two instances of nextest at the same time. I'll update the comment.

Created using spr 1.3.4
@sunshowers sunshowers enabled auto-merge (squash) September 27, 2023 20:55
Copy link
Contributor

@jordanhendricks jordanhendricks left a comment

Choose a reason for hiding this comment

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

This is great! Thanks!

@sunshowers sunshowers merged commit 41f22f3 into main Sep 27, 2023
22 checks passed
@sunshowers sunshowers deleted the sunshowers/spr/nexus-test-utils-replace-buildrs-with-a-new-setup-script branch September 27, 2023 23:07
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