Skip to content

Conversation

@Zalathar
Copy link
Member

@Zalathar Zalathar commented Nov 3, 2025

This PR adds a suite of snapshot tests for how bootstrap translates command-line “paths” (which are not necessarily actual paths) into a set of top-level steps to execute.

Unlike the existing suite of snapshot tests (for transitive step logging), I decided to use .snap files over inline snapshots, because I find that inline snapshots quickly make test files impossible to navigate. Instead, I set up a macro that makes it relatively easy to add or modify test cases.

Using .snap files also means that the tests can be blessed by setting INSTA_UPDATE=always, without necessarily needing the cargo insta tool installed, though the tool can still be used instead if desired.

These snapshot tests capture current behavior, to prevent unintended changes or regressions. If the current behavior is wrong or undersirable, then any fix will necessarily have to re-bless the affected tests!

r? Kobzol

@rustbot rustbot added A-testsuite Area: The testsuite used to check the correctness of rustc S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) labels Nov 3, 2025
@rust-log-analyzer

This comment has been minimized.

@rust-log-analyzer

This comment has been minimized.

@Zalathar
Copy link
Member Author

Zalathar commented Nov 3, 2025

It’s worrying that CI sees different snapshots.

I wonder if the “real” host/target is bleeding through somehow?

@Zalathar
Copy link
Member Author

Zalathar commented Nov 3, 2025

Oh gross, x test includes bootstrap only when a CI environment is detected.

Still not sure what's going on with the rustdoc JS tests; perhaps something is detecting that I don't have the requisite paths set on my machine?

@Zalathar
Copy link
Member Author

Zalathar commented Nov 3, 2025

Yeah, looks like those steps auto-skip themselves when build.nodejs is not set and fails to resolve to an ambient tool in the current PATH.

@rust-log-analyzer

This comment has been minimized.

@Kobzol
Copy link
Member

Kobzol commented Nov 11, 2025

Thanks for working on this! This looks great. I wonder if we should just use out-of-band snap files also for the "normal" snapshot tests? It seems a bit weird to have two systems (in-band and out-of-band) in bootstrap.

Yeah, looks like those steps auto-skip themselves when build.nodejs is not set and fails to resolve to an ambient tool in the current PATH.

That's a problem, right? Because if someone does/doesn't have node available might make those tests to fail locally. That might be annoying especially when they have to be re-blessed locally.

@Zalathar
Copy link
Member Author

Right, that’s why the test overwrites build.config.nodejs after creating the builder, to pretend that node was successfully discovered even if it wasn’t actually found on the system that’s running the tests.

(E.g. I currently don’t have node on my path, which is why I had to add that override, so that my machine would generate the same snapshots as a CI machine that does have node installed.)

@Kobzol
Copy link
Member

Kobzol commented Nov 11, 2025

Sorry, I didn't realize that you overwrite it after parsing the config, that makes sense.

The paths will probably have to be blessed from time to time when e.g. rustc crates change, but that's not that common, I suppose.

In general, I like this approach. You can r=me, unless you want to e.g. add more tests in this PR, or something.

@Zalathar
Copy link
Member Author

Adding more tests later is pretty easy, so I'm happy to get the plumbing and current tests merged for now.

@bors r=Kobzol

@bors
Copy link
Collaborator

bors commented Nov 11, 2025

📌 Commit bb05869 has been approved by Kobzol

It is now in the queue for this repository.

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Nov 11, 2025
@jieyouxu
Copy link
Member

Very cool 👍

Zalathar added a commit to Zalathar/rust that referenced this pull request Nov 11, 2025
bootstrap: Add snapshot tests for path-to-step handling

This PR adds a suite of snapshot tests for how bootstrap translates command-line “paths” (which are not necessarily actual paths) into a set of top-level steps to execute.

Unlike the existing suite of snapshot tests (for transitive step logging), I decided to use `.snap` files over inline snapshots, because I find that inline snapshots quickly make test files impossible to navigate. Instead, I set up a macro that makes it relatively easy to add or modify test cases.

Using `.snap` files also means that the tests can be blessed by setting `INSTA_UPDATE=always`, without necessarily needing the `cargo insta` tool installed, though the tool can still be used instead if desired.

These snapshot tests capture _current_ behavior, to prevent unintended changes or regressions. If the current behavior is wrong or undersirable, then any fix will necessarily have to re-bless the affected tests!

r? Kobzol
Zalathar added a commit to Zalathar/rust that referenced this pull request Nov 11, 2025
bootstrap: Add snapshot tests for path-to-step handling

This PR adds a suite of snapshot tests for how bootstrap translates command-line “paths” (which are not necessarily actual paths) into a set of top-level steps to execute.

Unlike the existing suite of snapshot tests (for transitive step logging), I decided to use `.snap` files over inline snapshots, because I find that inline snapshots quickly make test files impossible to navigate. Instead, I set up a macro that makes it relatively easy to add or modify test cases.

Using `.snap` files also means that the tests can be blessed by setting `INSTA_UPDATE=always`, without necessarily needing the `cargo insta` tool installed, though the tool can still be used instead if desired.

These snapshot tests capture _current_ behavior, to prevent unintended changes or regressions. If the current behavior is wrong or undersirable, then any fix will necessarily have to re-bless the affected tests!

r? Kobzol
bors added a commit that referenced this pull request Nov 12, 2025
Rollup of 12 pull requests

Successful merges:

 - #146627 (Simplify `jemalloc` setup)
 - #147753 (Suggest add bounding value for RangeTo)
 - #147974 (Improve diagnostics for buffer reuse with borrowed references)
 - #148080 ([rustdoc] Fix invalid jump to def macro link generation)
 - #148424 (bootstrap: Add snapshot tests for path-to-step handling)
 - #148500 (Update git index before running diff-index)
 - #148536 (cmse: add test for `async` and `const` functions)
 - #148770 (implement `feature(c_variadic_naked_functions)`)
 - #148819 (Remove specialized warning for removed target)
 - #148830 (miri subtree update)
 - #148833 (Update rustbook dependencies)
 - #148841 (Remove more `#[must_use]` from portable-simd)

r? `@ghost`
`@rustbot` modify labels: rollup
@Zalathar
Copy link
Member Author

Failed in rollup: #148845 (comment)

@bors r-

@bors bors added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels Nov 12, 2025
@rustbot
Copy link
Collaborator

rustbot commented Nov 12, 2025

This PR was rebased onto a different main commit. Here's a range-diff highlighting what actually changed.

Rebasing is a normal part of keeping PRs up to date, so no action is needed—this note is just to help reviewers.

@Zalathar
Copy link
Member Author

I added some quick-and-dirty backslash normalization to avoid failures on Windows, and also added a handful of extra tests related to library.

@bors try jobs=x86_64-msvc-2,test-various

@rust-bors

This comment has been minimized.

rust-bors bot added a commit that referenced this pull request Nov 12, 2025
bootstrap: Add snapshot tests for path-to-step handling

try-job: x86_64-msvc-2
try-job: test-various
@rust-bors
Copy link

rust-bors bot commented Nov 12, 2025

☀️ Try build successful (CI)
Build commit: 3c7eea9 (3c7eea994e6ee0660391247b643d5db65e88fc76, parent: 11339a0ef5ed586bb7ea4f85a9b7287880caac3a)

@Zalathar
Copy link
Member Author

@rustbot ready

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Nov 12, 2025
@Kobzol
Copy link
Member

Kobzol commented Nov 12, 2025

@bors r+

@bors
Copy link
Collaborator

bors commented Nov 12, 2025

📌 Commit 2412e15 has been approved by Kobzol

It is now in the queue for this repository.

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Nov 12, 2025
@bors
Copy link
Collaborator

bors commented Nov 12, 2025

⌛ Testing commit 2412e15 with merge 95aeb46...

@bors
Copy link
Collaborator

bors commented Nov 12, 2025

☀️ Test successful - checks-actions
Approved by: Kobzol
Pushing 95aeb46 to main...

@bors bors added the merged-by-bors This PR was explicitly merged by bors. label Nov 12, 2025
@bors bors merged commit 95aeb46 into rust-lang:main Nov 12, 2025
13 checks passed
@rustbot rustbot added this to the 1.93.0 milestone Nov 12, 2025
@github-actions
Copy link
Contributor

What is this? This is an experimental post-merge analysis report that shows differences in test outcomes between the merged PR and its parent PR.

Comparing 0b329f8 (parent) -> 95aeb46 (this PR)

Test differences

Show 39 test diffs

Stage 0

  • core::builder::cli_paths::tests::no_unused_snapshots: [missing] -> pass (J0)
  • core::builder::cli_paths::tests::x_build: [missing] -> pass (J0)
  • core::builder::cli_paths::tests::x_build_compiler: [missing] -> pass (J0)
  • core::builder::cli_paths::tests::x_build_compiletest: [missing] -> pass (J0)
  • core::builder::cli_paths::tests::x_build_library: [missing] -> pass (J0)
  • core::builder::cli_paths::tests::x_build_llvm: [missing] -> pass (J0)
  • core::builder::cli_paths::tests::x_build_rustc: [missing] -> pass (J0)
  • core::builder::cli_paths::tests::x_build_rustc_llvm: [missing] -> pass (J0)
  • core::builder::cli_paths::tests::x_build_rustdoc: [missing] -> pass (J0)
  • core::builder::cli_paths::tests::x_build_sysroot: [missing] -> pass (J0)
  • core::builder::cli_paths::tests::x_check: [missing] -> pass (J0)
  • core::builder::cli_paths::tests::x_check_bootstrap: [missing] -> pass (J0)
  • core::builder::cli_paths::tests::x_check_compiler: [missing] -> pass (J0)
  • core::builder::cli_paths::tests::x_check_compiletest: [missing] -> pass (J0)
  • core::builder::cli_paths::tests::x_check_compiletest_include_default_paths: [missing] -> pass (J0)
  • core::builder::cli_paths::tests::x_check_library: [missing] -> pass (J0)
  • core::builder::cli_paths::tests::x_check_rustc: [missing] -> pass (J0)
  • core::builder::cli_paths::tests::x_check_rustdoc: [missing] -> pass (J0)
  • core::builder::cli_paths::tests::x_dist: [missing] -> pass (J0)
  • core::builder::cli_paths::tests::x_test: [missing] -> pass (J0)
  • core::builder::cli_paths::tests::x_test_coverage: [missing] -> pass (J0)
  • core::builder::cli_paths::tests::x_test_coverage_map: [missing] -> pass (J0)
  • core::builder::cli_paths::tests::x_test_coverage_run: [missing] -> pass (J0)
  • core::builder::cli_paths::tests::x_test_coverage_skip_coverage_run: [missing] -> pass (J0)
  • core::builder::cli_paths::tests::x_test_debuginfo: [missing] -> pass (J0)
  • core::builder::cli_paths::tests::x_test_library: [missing] -> pass (J0)
  • core::builder::cli_paths::tests::x_test_librustdoc: [missing] -> pass (J0)
  • core::builder::cli_paths::tests::x_test_librustdoc_rustdoc: [missing] -> pass (J0)
  • core::builder::cli_paths::tests::x_test_rustdoc: [missing] -> pass (J0)
  • core::builder::cli_paths::tests::x_test_skip_coverage: [missing] -> pass (J0)
  • core::builder::cli_paths::tests::x_test_skip_tests: [missing] -> pass (J0)
  • core::builder::cli_paths::tests::x_test_skip_tests_etc: [missing] -> pass (J0)
  • core::builder::cli_paths::tests::x_test_tests: [missing] -> pass (J0)
  • core::builder::cli_paths::tests::x_test_tests_skip_coverage: [missing] -> pass (J0)
  • core::builder::cli_paths::tests::x_test_tests_ui: [missing] -> pass (J0)
  • core::builder::cli_paths::tests::x_test_tidy: [missing] -> pass (J0)
  • core::builder::cli_paths::tests::x_test_tidyselftest: [missing] -> pass (J0)
  • core::builder::cli_paths::tests::x_test_ui: [missing] -> pass (J0)

Additionally, 1 doctest diff were found. These are ignored, as they are noisy.

Job group index

Test dashboard

Run

cargo run --manifest-path src/ci/citool/Cargo.toml -- \
    test-dashboard 95aeb4696545eb4c9cbb68516f2912770e3846ea --output-dir test-dashboard

And then open test-dashboard/index.html in your browser to see an overview of all executed tests.

Job duration changes

  1. aarch64-apple: 9312.2s -> 6779.1s (-27.2%)
  2. pr-check-1: 1975.3s -> 1499.8s (-24.1%)
  3. x86_64-gnu-aux: 6977.9s -> 5756.6s (-17.5%)
  4. x86_64-gnu-llvm-21-2: 6155.0s -> 5139.3s (-16.5%)
  5. x86_64-gnu-tools: 3923.1s -> 3341.2s (-14.8%)
  6. x86_64-rust-for-linux: 3094.9s -> 2658.8s (-14.1%)
  7. x86_64-gnu-llvm-20: 2899.6s -> 2492.7s (-14.0%)
  8. x86_64-gnu-llvm-21-1: 3747.7s -> 3270.4s (-12.7%)
  9. i686-gnu-2: 6324.2s -> 5520.6s (-12.7%)
  10. x86_64-gnu-miri: 5227.5s -> 4576.1s (-12.5%)
How to interpret the job duration changes?

Job durations can vary a lot, based on the actual runner instance
that executed the job, system noise, invalidated caches, etc. The table above is provided
mostly for t-infra members, for simpler debugging of potential CI slow-downs.

@Zalathar Zalathar deleted the tests branch November 12, 2025 10:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-testsuite Area: The testsuite used to check the correctness of rustc merged-by-bors This PR was explicitly merged by bors. S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants