diff options
| author | Zalathar <Zalathar@users.noreply.github.com> | 2024-12-29 20:29:49 +1100 |
|---|---|---|
| committer | Zalathar <Zalathar@users.noreply.github.com> | 2024-12-29 20:49:03 +1100 |
| commit | 4192293b4d546a20dcd25ad344ef9fbc84e8f2a9 (patch) | |
| tree | d7c0e5f2fa4dbc289ee09f6c5e5e77d4e90f8199 | |
| parent | 0b63477350d8b5d49b86e4f4aedf066b0a5846c0 (diff) | |
| download | rust-4192293b4d546a20dcd25ad344ef9fbc84e8f2a9.tar.gz rust-4192293b4d546a20dcd25ad344ef9fbc84e8f2a9.zip | |
Fix `./x check bootstrap` by moving `shared_helpers::tests`
| -rw-r--r-- | src/bootstrap/src/utils/mod.rs | 2 | ||||
| -rw-r--r-- | src/bootstrap/src/utils/shared_helpers.rs | 5 | ||||
| -rw-r--r-- | src/bootstrap/src/utils/tests/mod.rs | 1 | ||||
| -rw-r--r-- | src/bootstrap/src/utils/tests/shared_helpers_tests.rs (renamed from src/bootstrap/src/utils/shared_helpers/tests.rs) | 9 |
4 files changed, 14 insertions, 3 deletions
diff --git a/src/bootstrap/src/utils/mod.rs b/src/bootstrap/src/utils/mod.rs index 53b41f15780..b5f5e2ba6dc 100644 --- a/src/bootstrap/src/utils/mod.rs +++ b/src/bootstrap/src/utils/mod.rs @@ -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; diff --git a/src/bootstrap/src/utils/shared_helpers.rs b/src/bootstrap/src/utils/shared_helpers.rs index 6d3c276cc05..7b206c3ffe8 100644 --- a/src/bootstrap/src/utils/shared_helpers.rs +++ b/src/bootstrap/src/utils/shared_helpers.rs @@ -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. diff --git a/src/bootstrap/src/utils/tests/mod.rs b/src/bootstrap/src/utils/tests/mod.rs new file mode 100644 index 00000000000..0791f7a6e20 --- /dev/null +++ b/src/bootstrap/src/utils/tests/mod.rs @@ -0,0 +1 @@ +mod shared_helpers_tests; diff --git a/src/bootstrap/src/utils/shared_helpers/tests.rs b/src/bootstrap/src/utils/tests/shared_helpers_tests.rs index da7924276f7..6c47e7f2438 100644 --- a/src/bootstrap/src/utils/shared_helpers/tests.rs +++ b/src/bootstrap/src/utils/tests/shared_helpers_tests.rs @@ -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() { |
