Skip to content

Conversation

jieyouxu
Copy link
Member

@jieyouxu jieyouxu commented Dec 28, 2024

Reverts validate --skip and --exclude paths #134209.

Reopens #134198.

Unfortunately, the present logic is not quite right because Steps are allowed to register arbitrary aliases (e.g. library/test is aliased to test), which means that we incorrectly warn on

./x test --exclude test

producing

WARNING: '/home/joe/repos/rust/test' does not exist.

even though this alias (test) is indeed a known and handled --exclude filter.

A proper fix will need to do something like "collect all eligible Steps then check should_run(exclude)" in order to determine if the exclude filter will trigger for the steps. (Courtesy of jyn pointing this out.)

I don't quite have the time to investigate the proper fix atm, so I am posting a revert for now (unless someone wants to look at it).

This reverts commit 6cf13b0, reversing changes made to 2846699.

r? @onur-ozkan

…s, r=jieyouxu"

Unfortunately, the present logic is not quite right because `Step`s are
allowed to register arbitrary *aliases* (e.g. `library/test` is aliases
to `test`), which means that we incorrectly warn on

```
./x test --exclude test
```

producing

```
WARNING: '/home/joe/repos/rust/test' does not exist.
```

even though this alias (`test`) is indeed a known and handled
`--exclude` filter.

A proper fix will need to do something like "collect all eligible
`Step`s then check `should_run(exclude)`" in order to determine if the
exclude filter will trigger for the steps. (Courtesy of jyn pointing
this out.)

This reverts commit 6cf13b0, reversing
changes made to 2846699.
@rustbot rustbot added 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 Dec 28, 2024
@rustbot
Copy link
Collaborator

rustbot commented Dec 28, 2024

This PR modifies src/bootstrap/src/core/config.

If appropriate, please update CONFIG_CHANGE_HISTORY in src/bootstrap/src/utils/change_tracker.rs.

@jyn514
Copy link
Member

jyn514 commented Dec 28, 2024

even though this alias (test) is indeed a known and handled --exclude filter.

in case it helps, this is not actually specific to the Step - bootstrap allows doing this for arbitrary steps

p.path.ends_with(needle) || p.path.starts_with(needle)

@jieyouxu
Copy link
Member Author

Right...

@onur-ozkan
Copy link
Member

onur-ozkan commented Dec 28, 2024

There is no problem other than printing warning, right? I was aware of this already (see #134209 (comment)). It's a warning info not error message, if we think it doesn't make sense we can remove it or print that in verbose mode only.

Comment on lines -1341 to -1345
// Never return top-level path here as it would break `--skip`
// logic on rustc's internal test framework which is utilized
// by compiletest.
p
})
Copy link
Member

Choose a reason for hiding this comment

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

This is exactly why we don't include top-level paths here.

Copy link
Member Author

Choose a reason for hiding this comment

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

I think the issue is that --exclude also works for non-compiletest managed test suites, like library/test or library/core.

Anyway, I'll have to look at this a bit more, because I think there's a distinction between how tests/* suites are matched versus how e.g. library/test is matched in --exclude logic...

@jieyouxu
Copy link
Member Author

Closing because we can probably just drop the warning

@rust-lang rust-lang locked and limited conversation to collaborators Dec 28, 2024
@rust-lang rust-lang unlocked this conversation Dec 28, 2024
@jieyouxu jieyouxu closed this Dec 28, 2024
@jieyouxu jieyouxu deleted the revert-skip-exclude branch December 28, 2024 09:45
bors added a commit to rust-lang-ci/rust that referenced this pull request Dec 28, 2024
…zkan

bootstrap: drop warning for top-level test suite path check due to false positives

The current top-level test suite directory does not exist warning logic doesn't quite handle the more exotic path suffix matches that test filters seem to accept (e.g. `library/test` can be matched with `--exclude test`), so avoid warning on non-existent top-level test suites for now. To avoid false positives, we probably need to query test `Step`s for their `should_run(exclude_filter)` logic.

This retains the fix for the Windows path handling (unlike rust-lang#134843).

r? `@onur-ozkan`
poliorcetics pushed a commit to poliorcetics/rust that referenced this pull request Dec 28, 2024
…zkan

bootstrap: drop warning for top-level test suite path check due to false positives

The current top-level test suite directory does not exist warning logic doesn't quite handle the more exotic path suffix matches that test filters seem to accept (e.g. `library/test` can be matched with `--exclude test`), so avoid warning on non-existent top-level test suites for now. To avoid false positives, we probably need to query test `Step`s for their `should_run(exclude_filter)` logic.

This retains the fix for the Windows path handling (unlike rust-lang#134843).

r? `@onur-ozkan`
@onur-ozkan onur-ozkan removed their assignment Jan 24, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
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)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants