Skip to content

Conversation

jieyouxu
Copy link
Member

@jieyouxu jieyouxu commented Dec 22, 2024

This PR partially supersedes #128562, and ports the Makefile-based tests/run-make/incr-add-rust-src-component to use rmake.rs infra.

Part of #121876.

This run-make test is a regression test for #70924. It (tries to) checks that if we add the rust-src component in between two incremental compiles, that the compiler doesn't ICE on the second invocation.

However, the Makefile version of this used $SYSROOT/lib/rustlib/src/rust/src/libstd/lib.rs, but that actually got moved around and reorganized over the years. As of Dec 2024, the rust-src component is more like (specific for our purposes):

$SYSROOT/lib/rustlib/src/rust/
    library/std/src/lib.rs
    src/

However, this run-make test is ancient and it exercises incr-comp system logic. I'm not sure if this test would actually catch the original regression.

This PR was co-authored with @Oneirical.

r? incremental

try-job: i686-msvc
try-job: x86_64-mingw-1
try-job: x86_64-msvc
try-job: aarch64-apple

@rustbot rustbot added A-run-make Area: port run-make Makefiles to rmake.rs 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) T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Dec 22, 2024
@jieyouxu

This comment was marked as resolved.

@rustbot rustbot added S-blocked Status: Blocked on something else such as an RFC or other implementation work. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Dec 22, 2024
@jieyouxu jieyouxu force-pushed the migrate-incr-add-rust-src-component branch from 6e2f793 to b9f4dd2 Compare December 22, 2024 15:44
@rustbot rustbot added the A-compiletest Area: The compiletest test runner label Dec 22, 2024
@rust-log-analyzer

This comment has been minimized.

@jieyouxu
Copy link
Member Author

@bors try

bors added a commit to rust-lang-ci/rust that referenced this pull request Dec 22, 2024
…omponent, r=<try>

Migrate `incr-add-rust-src-component` to rmake

**BLOCKED: this PR depends on rust-lang#134659**
**TODO: actually write some useful PR description**

r? `@ghost`

try-job: i686-msvc
try-job: x86_64-mingw-1
try-job: x86_64-msvc
try-job: aarch64-apple
@bors
Copy link
Collaborator

bors commented Dec 22, 2024

⌛ Trying commit b334ba5 with merge 30b610b...

@rust-log-analyzer

This comment has been minimized.

@jieyouxu jieyouxu force-pushed the migrate-incr-add-rust-src-component branch from b334ba5 to 41b2c3d Compare December 22, 2024 18:49
@rust-log-analyzer

This comment was marked as off-topic.

@jieyouxu
Copy link
Member Author

@bors try

@bors
Copy link
Collaborator

bors commented Dec 22, 2024

⌛ Trying commit 41b2c3d with merge c56f737...

bors added a commit to rust-lang-ci/rust that referenced this pull request Dec 22, 2024
…omponent, r=<try>

Migrate `incr-add-rust-src-component` to rmake

**BLOCKED: this PR depends on rust-lang#134659**
**TODO: actually write some useful PR description**

r? `@ghost`

try-job: i686-msvc
try-job: x86_64-mingw-1
try-job: x86_64-msvc
try-job: aarch64-apple
@bors
Copy link
Collaborator

bors commented Dec 22, 2024

☀️ Try build successful - checks-actions
Build commit: c56f737 (c56f737a666ba836105e48d9e405a5a6dfbca35e)

tgross35 added a commit to tgross35/rust that referenced this pull request Dec 23, 2024
…Denton

test-infra: improve compiletest and run-make-support symlink handling

I was trying to implement rust-lang#134656 to port `tests/run-make/incr-add-rust-src-component.rs`, but found some blockers related to symlink handling, so in this PR I tried to resolve them by improving symlink handling in compiletest and run-make-support (particularly for native windows msvc environment).

Key changes:

- I needed to copy symlinks (duplicate a symlink pointing to the same file), so I pulled out the copy symlink logic and re-exposed it as `run_make_support::rfs::copy_symlink`. This helper correctly accounts for the Windows symlink-to-file vs symlink-to-dir distinction (hereafter "Windows symlinks") when copying symlinks.
- `recursive_remove`:
    - I needed a way to remove symlinks themselves (no symlink traversal). `std::fs::remove_dir_all` handles them, but only if the root path is a directory. So I wrapped `std::fs::remove_dir_all` to also handle when the root path is a non-directory entity (e.g. file or symlink). Again, this properly accounts for Windows symlinks.
    - I wanted to use this for both compiletest and run-make-support, so I put the implementation and accompanying tests in `build_helper`.
    - In this sense, it's a reland of rust-lang#129302 with proper test coverage.
    - It's a thin wrapper around `std::fs::remove_dir_all` (`remove_dir_all` correctly handles read-only entries on Windows). The helper has additional permission-setting logic for when the root path is a non-dir entry on Windows to handle read-only non-dir entry.

Fixes rust-lang#126334.
rust-timer added a commit to rust-lang-ci/rust that referenced this pull request Dec 23, 2024
Rollup merge of rust-lang#134659 - jieyouxu:recursive-remove, r=ChrisDenton

test-infra: improve compiletest and run-make-support symlink handling

I was trying to implement rust-lang#134656 to port `tests/run-make/incr-add-rust-src-component.rs`, but found some blockers related to symlink handling, so in this PR I tried to resolve them by improving symlink handling in compiletest and run-make-support (particularly for native windows msvc environment).

Key changes:

- I needed to copy symlinks (duplicate a symlink pointing to the same file), so I pulled out the copy symlink logic and re-exposed it as `run_make_support::rfs::copy_symlink`. This helper correctly accounts for the Windows symlink-to-file vs symlink-to-dir distinction (hereafter "Windows symlinks") when copying symlinks.
- `recursive_remove`:
    - I needed a way to remove symlinks themselves (no symlink traversal). `std::fs::remove_dir_all` handles them, but only if the root path is a directory. So I wrapped `std::fs::remove_dir_all` to also handle when the root path is a non-directory entity (e.g. file or symlink). Again, this properly accounts for Windows symlinks.
    - I wanted to use this for both compiletest and run-make-support, so I put the implementation and accompanying tests in `build_helper`.
    - In this sense, it's a reland of rust-lang#129302 with proper test coverage.
    - It's a thin wrapper around `std::fs::remove_dir_all` (`remove_dir_all` correctly handles read-only entries on Windows). The helper has additional permission-setting logic for when the root path is a non-dir entry on Windows to handle read-only non-dir entry.

Fixes rust-lang#126334.
The Makefile version seems to contain a bug. Over the years, the
directory structure of the `rust-src` component changed as the source
tree directory structure changed. `libstd` is no longer a thing directly
under `root/lib/rustlib/src/rust/src/`, it is moved to
`root/lib/rustlib/src/rust/library/std`.

Co-authored-by: Oneirical <[email protected]>
@jieyouxu jieyouxu force-pushed the migrate-incr-add-rust-src-component branch from 41b2c3d to 7ee5204 Compare December 23, 2024 14:01
@jieyouxu jieyouxu removed the S-blocked Status: Blocked on something else such as an RFC or other implementation work. label Dec 23, 2024
@jieyouxu jieyouxu added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. S-blocked Status: Blocked on something else such as an RFC or other implementation work. labels Dec 23, 2024
@jieyouxu jieyouxu marked this pull request as ready for review December 23, 2024 14:07
Comment on lines +1 to +9
//! Regression test for rust-lang/rust#70924. Check that if we add the `rust-src` component in
//! between two incremental compiles, that the compiler doesn't ICE on the second invocation.
//!
//! This test uses symbolic links to save testing time.
//!
//! The way this test works is that, for every prefix in `root/lib/rustlib/src`, link all of prefix
//! parent content, then remove the prefix, then loop on the next prefix. This way, we basically
//! create a copy of the context around `root/lib/rustlib/src`, and can freely add/remove the src
//! component itself.
Copy link
Member Author

@jieyouxu jieyouxu Dec 23, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Question: ... is this test actually testing what it thinks it's testing? Be it the original Makefile version or this version...

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think so... in either case, your translation appears to preserve the intended behavior of the test (but perhaps that behavior itself isn't entirely correct?)

Comment on lines -7 to -10
# This test uses `ln -s` rather than copying to save testing time, but its
# usage doesn't work on windows. So ignore windows.

# ignore-windows
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remark: by usage of pure rust test file, we're able to expand the test coverage of this to Windows as well. The symlink handling was fixed and improved in #134659.

@jieyouxu jieyouxu removed the S-blocked Status: Blocked on something else such as an RFC or other implementation work. label Dec 23, 2024
Comment on lines +1 to +9
//! Regression test for rust-lang/rust#70924. Check that if we add the `rust-src` component in
//! between two incremental compiles, that the compiler doesn't ICE on the second invocation.
//!
//! This test uses symbolic links to save testing time.
//!
//! The way this test works is that, for every prefix in `root/lib/rustlib/src`, link all of prefix
//! parent content, then remove the prefix, then loop on the next prefix. This way, we basically
//! create a copy of the context around `root/lib/rustlib/src`, and can freely add/remove the src
//! component itself.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think so... in either case, your translation appears to preserve the intended behavior of the test (but perhaps that behavior itself isn't entirely correct?)

@wesleywiser
Copy link
Member

@bors r+ rollup

@bors
Copy link
Collaborator

bors commented Dec 26, 2024

📌 Commit 7ee5204 has been approved by wesleywiser

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 Dec 26, 2024
bors added a commit to rust-lang-ci/rust that referenced this pull request Dec 26, 2024
…llaumeGomez

Rollup of 4 pull requests

Successful merges:

 - rust-lang#134656 (Migrate `incr-add-rust-src-component` to rmake)
 - rust-lang#134664 (Account for removal of multiline span in suggestion)
 - rust-lang#134772 (Improve/cleanup rustdoc code)
 - rust-lang#134781 (Add more `begin_panic` normalizations to panic backtrace tests)

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit c016cd8 into rust-lang:master Dec 26, 2024
6 checks passed
@rustbot rustbot added this to the 1.85.0 milestone Dec 26, 2024
rust-timer added a commit to rust-lang-ci/rust that referenced this pull request Dec 26, 2024
Rollup merge of rust-lang#134656 - jieyouxu:migrate-incr-add-rust-src-component, r=wesleywiser

Migrate `incr-add-rust-src-component` to rmake

This PR partially supersedes rust-lang#128562, and ports the Makefile-based `tests/run-make/incr-add-rust-src-component` to use rmake.rs infra.

Part of rust-lang#121876.

This run-make test is a regression test for rust-lang#70924. It (tries to) checks that if we add the `rust-src` component in between two incremental compiles, that the compiler doesn't ICE on the second invocation.

- Original issue:rust-lang#70924
- Fix PR: rust-lang#72767
- PR adding this regression test: rust-lang#72952

However, the Makefile version of this used `$SYSROOT/lib/rustlib/src/rust/src/libstd/lib.rs`, but that actually got moved around and reorganized over the years. As of Dec 2024, the `rust-src` component is more like (specific for our purposes):

```
$SYSROOT/lib/rustlib/src/rust/
    library/std/src/lib.rs
    src/
```

However, this run-make test is ancient and it exercises incr-comp system logic. I'm not sure if this test would actually catch the original regression.

This PR was co-authored with `@Oneirical.`

r? incremental

try-job: i686-msvc
try-job: x86_64-mingw-1
try-job: x86_64-msvc
try-job: aarch64-apple
@jieyouxu jieyouxu deleted the migrate-incr-add-rust-src-component branch December 27, 2024 09:55
poliorcetics pushed a commit to poliorcetics/rust that referenced this pull request Dec 28, 2024
…-component, r=wesleywiser

Migrate `incr-add-rust-src-component` to rmake

This PR partially supersedes rust-lang#128562, and ports the Makefile-based `tests/run-make/incr-add-rust-src-component` to use rmake.rs infra.

Part of rust-lang#121876.

This run-make test is a regression test for rust-lang#70924. It (tries to) checks that if we add the `rust-src` component in between two incremental compiles, that the compiler doesn't ICE on the second invocation.

- Original issue:rust-lang#70924
- Fix PR: rust-lang#72767
- PR adding this regression test: rust-lang#72952

However, the Makefile version of this used `$SYSROOT/lib/rustlib/src/rust/src/libstd/lib.rs`, but that actually got moved around and reorganized over the years. As of Dec 2024, the `rust-src` component is more like (specific for our purposes):

```
$SYSROOT/lib/rustlib/src/rust/
    library/std/src/lib.rs
    src/
```

However, this run-make test is ancient and it exercises incr-comp system logic. I'm not sure if this test would actually catch the original regression.

This PR was co-authored with `@Oneirical.`

r? incremental

try-job: i686-msvc
try-job: x86_64-mingw-1
try-job: x86_64-msvc
try-job: aarch64-apple
poliorcetics pushed a commit to poliorcetics/rust that referenced this pull request Dec 28, 2024
…llaumeGomez

Rollup of 4 pull requests

Successful merges:

 - rust-lang#134656 (Migrate `incr-add-rust-src-component` to rmake)
 - rust-lang#134664 (Account for removal of multiline span in suggestion)
 - rust-lang#134772 (Improve/cleanup rustdoc code)
 - rust-lang#134781 (Add more `begin_panic` normalizations to panic backtrace tests)

r? `@ghost`
`@rustbot` modify labels: rollup
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-compiletest Area: The compiletest test runner A-run-make Area: port run-make Makefiles to rmake.rs A-testsuite Area: The testsuite used to check the correctness of rustc 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) T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants