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

compiletest: Stricter parsing of //@ normalize-* headers #126370

Merged
merged 2 commits into from
Jun 13, 2024

Conversation

Zalathar
Copy link
Contributor

I noticed some problems with the existing parser for these headers:

  • It is extremely lax, and basically ignores everything other than the text between two pairs of double-quote characters.
    • Unlike other name-value headers, it doesn't even check for a colon after the header name, so the test suite contains a mixture of with-colon and without-colon normalization rules.
  • If parsing fails, the header is silently ignored.

The latter is especially bad for platform-specific normalization rules, because the lack of normalization probably won't be noticed until the test mysteriously fails in one of the full CI jobs.

@rustbot
Copy link
Collaborator

rustbot commented Jun 13, 2024

r? @oli-obk

rustbot has assigned @oli-obk.
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

@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 Jun 13, 2024
@rustbot
Copy link
Collaborator

rustbot commented Jun 13, 2024

Some changes occurred in src/tools/compiletest

cc @jieyouxu

@jieyouxu
Copy link
Member

jieyouxu commented Jun 13, 2024

Yes, apparently some directives require the colon or else it silently fails cc #123760. If you notice compiletest directive handling related wonkiness, please do file specific issues and tag them with A-compiletest so at least it can be tracked and we are aware that certain footguns exist.

@oli-obk
Copy link
Contributor

oli-obk commented Jun 13, 2024

@bors r+ rollup

@bors
Copy link
Contributor

bors commented Jun 13, 2024

📌 Commit e09eedb has been approved by oli-obk

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 Jun 13, 2024
bors added a commit to rust-lang-ci/rust that referenced this pull request Jun 13, 2024
Rollup of 6 pull requests

Successful merges:

 - rust-lang#126347 (Simplify `try_*`'s signature on `Iterator`)
 - rust-lang#126348 (Improve error message if dependency installation in tidy fails)
 - rust-lang#126366 (Add a new trait to retrieve StableMir definition Ty)
 - rust-lang#126370 (compiletest: Stricter parsing of `//@ normalize-*` headers)
 - rust-lang#126379 (interpret: update doc comment for find_closest_untracked_caller_location)
 - rust-lang#126384 (add tracking issue for is_none_or)

Failed merges:

 - rust-lang#126388 (const-eval: make lint scope computation consistent)

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit 2b5c672 into rust-lang:master Jun 13, 2024
6 checks passed
@rustbot rustbot added this to the 1.81.0 milestone Jun 13, 2024
rust-timer added a commit to rust-lang-ci/rust that referenced this pull request Jun 13, 2024
Rollup merge of rust-lang#126370 - Zalathar:normalize, r=oli-obk

compiletest: Stricter parsing of `//@ normalize-*` headers

I noticed some problems with the existing parser for these headers:

- It is extremely lax, and basically ignores everything other than the text between two pairs of double-quote characters.
  - Unlike other name-value headers, it doesn't even check for a colon after the header name, so the test suite contains a mixture of with-colon and without-colon normalization rules.
- If parsing fails, the header is silently ignored.

The latter is especially bad for platform-specific normalization rules, because the lack of normalization probably won't be noticed until the test mysteriously fails in one of the full CI jobs.
@Zalathar Zalathar deleted the normalize branch June 13, 2024 14:17
bors added a commit to rust-lang-ci/rust that referenced this pull request Jul 10, 2024
Require a colon in `//@ normalize-*:` test headers

The previous parser for `//@ normalize-*` headers (before rust-lang#126370) was so lax that it did not require `:` after the header name. As a result, the test suite contained a mix of with-colon and without-colon normalize headers, both numbering in the hundreds.

This PR updates the without-colon headers to add a colon (matching the style used by other headers), and then updates the parser to make the colon mandatory.

(Because the normalization parser only runs *after* the header system identifies a normalize header, this will detect and issue an error for relevant headers that lack the colon.)

Addresses one of the points of rust-lang#126372.
bors added a commit to rust-lang-ci/rust that referenced this pull request Jul 11, 2024
Require a colon in `//@ normalize-*:` test headers

The previous parser for `//@ normalize-*` headers (before rust-lang#126370) was so lax that it did not require `:` after the header name. As a result, the test suite contained a mix of with-colon and without-colon normalize headers, both numbering in the hundreds.

This PR updates the without-colon headers to add a colon (matching the style used by other headers), and then updates the parser to make the colon mandatory.

(Because the normalization parser only runs *after* the header system identifies a normalize header, this will detect and issue an error for relevant headers that lack the colon.)

Addresses one of the points of rust-lang#126372.
bors added a commit to rust-lang-ci/rust that referenced this pull request Jul 11, 2024
Require a colon in `//@ normalize-*:` test headers

The previous parser for `//@ normalize-*` headers (before rust-lang#126370) was so lax that it did not require `:` after the header name. As a result, the test suite contained a mix of with-colon and without-colon normalize headers, both numbering in the hundreds.

This PR updates the without-colon headers to add a colon (matching the style used by other headers), and then updates the parser to make the colon mandatory.

(Because the normalization parser only runs *after* the header system identifies a normalize header, this will detect and issue an error for relevant headers that lack the colon.)

Addresses one of the points of rust-lang#126372.
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 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.

5 participants