Skip to content

Commit 4192293

Browse files
committed
Fix ./x check bootstrap by moving shared_helpers::tests
1 parent 0b63477 commit 4192293

File tree

4 files changed

+14
-3
lines changed

4 files changed

+14
-3
lines changed

src/bootstrap/src/utils/mod.rs

+2
Original file line numberDiff line numberDiff line change
@@ -14,3 +14,5 @@ pub(crate) mod metrics;
1414
pub(crate) mod render_tests;
1515
pub(crate) mod shared_helpers;
1616
pub(crate) mod tarball;
17+
#[cfg(test)]
18+
mod tests;

src/bootstrap/src/utils/shared_helpers.rs

+3-2
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,9 @@ use std::io::Write;
1313
use std::process::Command;
1414
use std::str::FromStr;
1515

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

1920
/// Returns the environment variable which the dynamic library lookup path
2021
/// resides in for this platform.

src/bootstrap/src/utils/tests/mod.rs

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
mod shared_helpers_tests;

src/bootstrap/src/utils/shared_helpers/tests.rs renamed to src/bootstrap/src/utils/tests/shared_helpers_tests.rs

+8-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,11 @@
1-
use super::parse_value_from_args;
1+
//! The `shared_helpers` module can't have its own tests submodule, because
2+
//! that would cause problems for the shim binaries that include it via
3+
//! `#[path]`, so instead those unit tests live here.
4+
//!
5+
//! To prevent tidy from complaining about this file not being named `tests.rs`,
6+
//! it lives inside a submodule directory named `tests`.
7+
8+
use crate::utils::shared_helpers::parse_value_from_args;
29

310
#[test]
411
fn test_parse_value_from_args() {

0 commit comments

Comments
 (0)