Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit c5e81ea

Browse files
authored
Rollup merge of #144445 - jieyouxu:revert-shared_helpers_tests, r=Kobzol
Fix `./x check bootstrap` (again) Redoes #134883 and reverts 40c2ca9 from #142416. Unfortunately I missed this during review. - Commit 1: Reverts 40c2ca9 and re-applies #134883. - Commit 2: Check `./x check bootstrap` in `pr-check-1` to catch "obvious" problems like this. r? Kobzol
2 parents ba4a691 + 430f4f5 commit c5e81ea

File tree

4 files changed

+23
-11
lines changed

4 files changed

+23
-11
lines changed

‎src/bootstrap/src/utils/shared_helpers.rs‎

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,25 @@
11
//! This module serves two purposes:
2-
//! 1. It is part of the `utils` module and used in other parts of bootstrap.
3-
//! 2. It is embedded inside bootstrap shims to avoid a dependency on the bootstrap library.
4-
//! Therefore, this module should never use any other bootstrap module. This reduces binary
5-
//! size and improves compilation time by minimizing linking time.
2+
//!
3+
//! 1. It is part of the `utils` module and used in other parts of bootstrap.
4+
//! 2. It is embedded inside bootstrap shims to avoid a dependency on the bootstrap library.
5+
//! Therefore, this module should never use any other bootstrap module. This reduces binary size
6+
//! and improves compilation time by minimizing linking time.
7+
8+
// # Note on tests
9+
//
10+
// If we were to declare a tests submodule here, the shim binaries that include this module via
11+
// `#[path]` would fail to find it, which breaks `./x check bootstrap`. So instead the unit tests
12+
// for this module are in `super::tests::shared_helpers_tests`.
613

714
#![allow(dead_code)]
815

9-
#[cfg(test)]
10-
mod tests;
11-
1216
use std::env;
1317
use std::ffi::OsString;
1418
use std::fs::OpenOptions;
1519
use std::io::Write;
1620
use std::process::Command;
1721
use std::str::FromStr;
1822

19-
// If we were to declare a tests submodule here, the shim binaries that include this
20-
// module via `#[path]` would fail to find it, which breaks `./x check bootstrap`.
21-
// So instead the unit tests for this module are in `super::tests::shared_helpers_tests`.
22-
2323
/// Returns the environment variable which the dynamic library lookup path
2424
/// resides in for this platform.
2525
pub fn dylib_path_var() -> &'static str {

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,10 @@ use crate::{Build, Config, Flags, t};
1212

1313
pub mod git;
1414

15+
// Note: tests for `shared_helpers` is separate here, as otherwise shim binaries that include the
16+
// `shared_helpers` via `#[path]` would fail to find it, breaking `./x check bootstrap`.
17+
mod shared_helpers_tests;
18+
1519
/// Holds temporary state of a bootstrap test.
1620
/// Right now it is only used to redirect the build directory of the bootstrap
1721
/// invocation, in the future it would be great if we could actually execute

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

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

310
#[test]

‎src/ci/docker/host-x86_64/pr-check-1/Dockerfile‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ COPY host-x86_64/pr-check-1/validate-toolstate.sh /scripts/
4040
# We disable optimized compiler built-ins because that requires a C toolchain for the target.
4141
# We also skip the x86_64-unknown-linux-gnu target as it is well-tested by other jobs.
4242
ENV SCRIPT \
43+
python3 ../x.py check bootstrap && \
4344
/scripts/check-default-config-profiles.sh && \
4445
python3 ../x.py build src/tools/build-manifest && \
4546
python3 ../x.py test --stage 0 src/tools/compiletest && \

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /