Skip to content

bootstrap: Fix ./x check bootstrap by moving shared_helpers::tests #134883

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
Dec 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/bootstrap/src/utils/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,5 @@ pub(crate) mod metrics;
pub(crate) mod render_tests;
pub(crate) mod shared_helpers;
pub(crate) mod tarball;
#[cfg(test)]
mod tests;
5 changes: 3 additions & 2 deletions src/bootstrap/src/utils/shared_helpers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,9 @@ use std::io::Write;
use std::process::Command;
use std::str::FromStr;

#[cfg(test)]
mod tests;
// If we were to declare a tests submodule here, the shim binaries that include this
// module via `#[path]` would fail to find it, which breaks `./x check bootstrap`.
// So instead the unit tests for this module are in `super::tests::shared_helpers_tests`.

/// Returns the environment variable which the dynamic library lookup path
/// resides in for this platform.
Expand Down
1 change: 1 addition & 0 deletions src/bootstrap/src/utils/tests/mod.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
mod shared_helpers_tests;
Original file line number Diff line number Diff line change
@@ -1,4 +1,11 @@
use super::parse_value_from_args;
//! The `shared_helpers` module can't have its own tests submodule, because
//! that would cause problems for the shim binaries that include it via
//! `#[path]`, so instead those unit tests live here.
//!
//! To prevent tidy from complaining about this file not being named `tests.rs`,
//! it lives inside a submodule directory named `tests`.

use crate::utils::shared_helpers::parse_value_from_args;

#[test]
fn test_parse_value_from_args() {
Expand Down
Loading