Skip to content

Conversation

Enselic
Copy link
Member

@Enselic Enselic commented Sep 13, 2025

This fix only changes the behavior when using --exact test filtering, which
was quite broken. Before this fix, the following runs 0 tests:

$ ./x test tests/run-make/crate-loading -- --exact
running 0 tests
test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 431 filtered out; finished in 24.95µs

With the fix the desired test is run:

$ ./x test tests/run-make/crate-loading -- --exact
running 1 tests
test [run-make] tests/run-make/crate-loading ... ok

Without --exact the set of run tests is unchanged. This still runs "too many" (cc #134341) tests

$ ./x test tests/run-make/crate-loading
running 3 tests
test [run-make] tests/run-make/crate-loading-crate-depends-on-itself ... ok
test [run-make] tests/run-make/crate-loading-multiple-candidates ... ok
test [run-make] tests/run-make/crate-loading ... ok

This still runs the one and only right test

$ ./x test tests/ui/lint/unused/unused-allocation.rs
running 1 tests
test [ui] tests/ui/lint/unused/unused-allocation.rs ... ok

Notes

  • I have not verified this on Windows which treats paths differently (but I see no reason why it should not work since my code should be platform agnostic).

@rustbot
Copy link
Collaborator

rustbot commented Sep 13, 2025

Some changes occurred in src/tools/compiletest

cc @jieyouxu

@rustbot rustbot added A-compiletest Area: The compiletest test runner 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 Sep 13, 2025
@rustbot
Copy link
Collaborator

rustbot commented Sep 13, 2025

r? @Mark-Simulacrum

rustbot has assigned @Mark-Simulacrum.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

@rust-log-analyzer

This comment has been minimized.

This fix only changes the behavior when using `--exact` test filtering,
which was quite broken. Before this fix, the following runs 0 tests:

    $ ./x test tests/run-make/crate-loading -- --exact
    running 0 tests
    test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 431 filtered out; finished in 24.95µs

With the fix the desired test is run:

    $ ./x test tests/run-make/crate-loading -- --exact
    running 1 tests
    test [run-make] tests/run-make/crate-loading ... ok

Without `--exact` the set of run tests is unchanged. This still runs
"too many" tests

    $ ./x test tests/run-make/crate-loading
    running 3 tests
    test [run-make] tests/run-make/crate-loading-crate-depends-on-itself ... ok
    test [run-make] tests/run-make/crate-loading-multiple-candidates ... ok
    test [run-make] tests/run-make/crate-loading ... ok

This still runs the one and only right test:

    $ ./x test tests/ui/lint/unused/unused-allocation.rs
    running 1 tests
    test [ui] tests/ui/lint/unused/unused-allocation.rs ... ok
@Mark-Simulacrum
Copy link
Member

@bors r+

@bors
Copy link
Collaborator

bors commented Sep 14, 2025

📌 Commit a48c8e3 has been approved by Mark-Simulacrum

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 Sep 14, 2025
bors added a commit that referenced this pull request Sep 15, 2025
Rollup of 8 pull requests

Successful merges:

 - #143314 (add reference id to test, and fix filename)
 - #146284 (Remove `div_rem` from `core::num::bignum`)
 - #146416 (Tidy dependency checks cleanups + QoL)
 - #146471 (bootstrap: Show target in "No such target exists" message)
 - #146478 (Improve `core::fmt` coverage)
 - #146480 (tests: update new test to accept new lifetime format)
 - #146488 (Improve `core::ptr` coverage)
 - #146501 (compiletest: Fix `--exact` test filtering)

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit 0a14ae0 into rust-lang:master Sep 15, 2025
10 checks passed
rust-timer added a commit that referenced this pull request Sep 15, 2025
Rollup merge of #146501 - Enselic:x-test-filter, r=Mark-Simulacrum

compiletest: Fix `--exact` test filtering

This fix only changes the behavior when using `--exact` test filtering, which
was quite broken. Before this fix, the following runs 0 tests:

    $ ./x test tests/run-make/crate-loading -- --exact
    running 0 tests
    test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 431 filtered out; finished in 24.95µs

With the fix the desired test is run:

    $ ./x test tests/run-make/crate-loading -- --exact
    running 1 tests
    test [run-make] tests/run-make/crate-loading ... ok

Without `--exact` the set of run tests is unchanged. This still runs "too many" (cc #134341) tests

    $ ./x test tests/run-make/crate-loading
    running 3 tests
    test [run-make] tests/run-make/crate-loading-crate-depends-on-itself ... ok
    test [run-make] tests/run-make/crate-loading-multiple-candidates ... ok
    test [run-make] tests/run-make/crate-loading ... ok

This still runs the one and only right test

    $ ./x test tests/ui/lint/unused/unused-allocation.rs
    running 1 tests
    test [ui] tests/ui/lint/unused/unused-allocation.rs ... ok

### Notes

- I have not verified this on Windows which treats paths differently (but I see no reason why it should not work since my code should be platform agnostic).
@rustbot rustbot added this to the 1.92.0 milestone Sep 15, 2025
@lqd
Copy link
Member

lqd commented Sep 15, 2025

This seems to have broken test filtering when not using --exact, for example via --test-args $path, on master:

> ./x test tests/ui --keep-stage 1 --test-args tests/ui --force-rerun

running 0 tests
test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 19788 filtered out; finished in 23.01µs

@Enselic
Copy link
Member Author

Enselic commented Sep 15, 2025

Thanks for the ping. Looking into it right now. Expecting the fix to be easy. I'll keep you updated.

@Enselic
Copy link
Member Author

Enselic commented Sep 15, 2025

Seems fixed by #146601. I'll do some more testing while PR CI runs.

Edit: That PR seems ok according to my testing.

Zalathar added a commit to Zalathar/rust that referenced this pull request Sep 16, 2025
…lacrum

compiletest: Make `./x test --test-args ...` work again

It accidentally broke with  rust-lang#146501. The intention of that PR was to keep existing behavior if `--exact` is not used, but it had a bug. This PR fixes that bug.
rust-timer added a commit that referenced this pull request Sep 16, 2025
Rollup merge of #146601 - Enselic:fix-test-args, r=Mark-Simulacrum

compiletest: Make `./x test --test-args ...` work again

It accidentally broke with  #146501. The intention of that PR was to keep existing behavior if `--exact` is not used, but it had a bug. This PR fixes that bug.
github-actions bot pushed a commit to rust-lang/miri that referenced this pull request Sep 17, 2025
compiletest: Make `./x test --test-args ...` work again

It accidentally broke with  rust-lang/rust#146501. The intention of that PR was to keep existing behavior if `--exact` is not used, but it had a bug. This PR fixes that bug.
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-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)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants