Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable --check-cfg by default in UI tests #124345

Merged
merged 3 commits into from May 4, 2024

Conversation

Urgau
Copy link
Contributor

@Urgau Urgau commented Apr 24, 2024

This PR enables-by-default --check-cfg in UI tests, now that it has become stable.

To do so this PR does 2 main things:

  • it introduce the no-auto-check-cfg directive to compiletest, to prevent any --check-cfg args (only to be used for --check-cfg tests)
  • it updates the remaining1 UI tests by either:
    • allowing the lint when neither expecting the lint nor giving the check-cfg args make sense
    • give the appropriate check-cfg args
    • or expect the lint, when it useful

I highly recommend reviewing this PR commit-by-commit.

r? @jieyouxu

Footnotes

  1. some preparation work was done in Do some preparation work for compiletest check-cfg #123577 Further cleanup cfgs in the UI test suite #123702

@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) T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Apr 24, 2024
@rustbot
Copy link
Collaborator

rustbot commented Apr 24, 2024

Some changes occurred in src/tools/compiletest

cc @jieyouxu

Copy link
Contributor

@jieyouxu jieyouxu left a comment

Choose a reason for hiding this comment

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

The code changes generally look good to me. Just one question about revision normalization and some doc requests.

src/tools/compiletest/src/runtest.rs Show resolved Hide resolved
Comment on lines +1042 to +1047
// Generate `cfg(FALSE, REV1, ..., REVN)` (for all possible revisions)
//
// For compatibility reason we consider the `FALSE` cfg to be expected
// since it is extensively used in the testsuite.
check_cfg.push_str("cfg(FALSE");
Copy link
Contributor

@jieyouxu jieyouxu Apr 24, 2024

Choose a reason for hiding this comment

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

Do we have any documentation for this special case? If not, could you please document this behavior in the dev-guide so that the knowledge of FALSE being "special" exists somewhere? Or rather, if it's recommended to be used stylistically for configuring something out, can that be documented too?

Copy link
Contributor Author

@Urgau Urgau Apr 24, 2024

Choose a reason for hiding this comment

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

I'm not aware, nor was I able to find any documentation regarding FALSE being a de-facto cfg that will eval to false.

could you please document this behavior in the dev-guide

Sure, I will send a PR for that.

EDIT: forget to send it, sorry

Copy link
Contributor Author

Choose a reason for hiding this comment

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

rustc-dev-guide PR is up rust-lang/rustc-dev-guide#1966

src/tools/compiletest/src/header.rs Show resolved Hide resolved
src/tools/compiletest/src/header.rs Outdated Show resolved Hide resolved
@rust-log-analyzer

This comment has been minimized.

@jieyouxu
Copy link
Contributor

Thanks!

@bors r+ rollup

@bors
Copy link
Contributor

bors commented Apr 24, 2024

📌 Commit b6ed813 has been approved by jieyouxu

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 Apr 24, 2024
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request Apr 25, 2024
…youxu

Enable `--check-cfg` by default in UI tests

This PR enables-by-default `--check-cfg` in UI tests, now that it has become stable.

To do so this PR does 2 main things:
 - it introduce the `no-auto-check-cfg` directive to `compiletest`, to prevent any `--check-cfg` args (only to be used for `--check-cfg` tests)
 - it updates the _remaining_[^1] UI tests by either:
     - allowing the lint when neither expecting the lint nor giving the check-cfg args make sense
     - give the appropriate check-cfg args
     - or expect the lint, when it useful

[^1]: some preparation work was done in rust-lang#123577 rust-lang#123702

I highly recommend reviewing this PR commit-by-commit.

r? `@jieyouxu`
bors added a commit to rust-lang-ci/rust that referenced this pull request Apr 25, 2024
…iaskrgr

Rollup of 4 pull requests

Successful merges:

 - rust-lang#124257 (Rewrite the `no-input-file.stderr` test in Rust and support diff)
 - rust-lang#124324 (Minor AST cleanups)
 - rust-lang#124327 (CI: implement job skipping in Python matrix calculation)
 - rust-lang#124345 (Enable `--check-cfg` by default in UI tests)

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

@bors r-
#124358 (comment)

@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 Apr 25, 2024
@Urgau
Copy link
Contributor Author

Urgau commented Apr 25, 2024

#124358 (comment)

Hum, apparently the ui-fulldeps test suite is run with stage0, which doesn't yet know that --check-cfg has been stabilized.

Fortunately the branching of master should happen tomorrow (the 26th) and the update of stage0 sometime next week, so I think the best course of action is just to wait a couple days.

@jieyouxu
Copy link
Contributor

jieyouxu commented May 1, 2024

@rustbot blocked waiting for stage0 update

@rustbot rustbot added S-blocked Status: Marked as blocked ❌ on something else such as an RFC or other implementation work. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels May 1, 2024
@Urgau
Copy link
Contributor Author

Urgau commented May 2, 2024

stage0 was updated in #124521, I rebase over it and tested it locally

@rustbot labels -S-blocked +S-waiting-on-review

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-blocked Status: Marked as blocked ❌ on something else such as an RFC or other implementation work. labels May 2, 2024
@jieyouxu
Copy link
Contributor

jieyouxu commented May 2, 2024

Thanks!

@bors r+ rollup

@Urgau
Copy link
Contributor Author

Urgau commented May 3, 2024

Sorry this has failed in yet another rollup: #124633 (comment)

No worries. The issue was in the tests/ui/instrument-coverage/on-values.rs test which is ignored by default (requires profiler support). Fixed the test, CI passes, let's try again.

@bors r=@jieyouxu

@bors
Copy link
Contributor

bors commented May 3, 2024

📌 Commit 34dbfc3 has been approved by jieyouxu

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-author Status: This is awaiting some action (such as code changes or more information) from the author. labels May 3, 2024
bors added a commit to rust-lang-ci/rust that referenced this pull request May 4, 2024
Enable `--check-cfg` by default in UI tests

This PR enables-by-default `--check-cfg` in UI tests, now that it has become stable.

To do so this PR does 2 main things:
 - it introduce the `no-auto-check-cfg` directive to `compiletest`, to prevent any `--check-cfg` args (only to be used for `--check-cfg` tests)
 - it updates the _remaining_[^1] UI tests by either:
     - allowing the lint when neither expecting the lint nor giving the check-cfg args make sense
     - give the appropriate check-cfg args
     - or expect the lint, when it useful

[^1]: some preparation work was done in rust-lang#123577 rust-lang#123702

I highly recommend reviewing this PR commit-by-commit.

r? `@jieyouxu`
@bors
Copy link
Contributor

bors commented May 4, 2024

⌛ Testing commit 34dbfc3 with merge 97fd97b...

@rust-log-analyzer

This comment has been minimized.

@bors
Copy link
Contributor

bors commented May 4, 2024

💔 Test failed - checks-actions

@bors bors added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels May 4, 2024
@Urgau
Copy link
Contributor Author

Urgau commented May 4, 2024

Issue with two other tests, they were again ignored by-default, fixed them; and did a grep against the repo for similar issue and didn't find anything else. CI passes, let's try again.

@bors r=@jieyouxu

@bors
Copy link
Contributor

bors commented May 4, 2024

📌 Commit d4e26fb has been approved by jieyouxu

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 May 4, 2024
@bors
Copy link
Contributor

bors commented May 4, 2024

⌛ Testing commit d4e26fb with merge 7dd170f...

@bors
Copy link
Contributor

bors commented May 4, 2024

☀️ Test successful - checks-actions
Approved by: jieyouxu
Pushing 7dd170f to master...

@bors bors added the merged-by-bors This PR was explicitly merged by bors. label May 4, 2024
@bors bors merged commit 7dd170f into rust-lang:master May 4, 2024
7 checks passed
@rustbot rustbot added this to the 1.80.0 milestone May 4, 2024
@Urgau Urgau deleted the compiletest-check-cfg branch May 4, 2024 12:41
@rust-timer
Copy link
Collaborator

Finished benchmarking commit (7dd170f): comparison URL.

Overall result: no relevant changes - no action needed

@rustbot label: -perf-regression

Instruction count

This benchmark run did not return any relevant results for this metric.

Max RSS (memory usage)

Results

This is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.

mean range count
Regressions ❌
(primary)
- - 0
Regressions ❌
(secondary)
5.6% [5.6%, 5.6%] 1
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) - - 0

Cycles

Results

This is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.

mean range count
Regressions ❌
(primary)
- - 0
Regressions ❌
(secondary)
2.5% [1.9%, 3.1%] 5
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) - - 0

Binary size

This benchmark run did not return any relevant results for this metric.

Bootstrap: 675.105s -> 676.427s (0.20%)
Artifact size: 315.89 MiB -> 315.91 MiB (0.01%)

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) 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.

None yet

8 participants