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

Add assert redactions #14054

Merged
merged 6 commits into from
Jun 12, 2024
Merged

Add assert redactions #14054

merged 6 commits into from
Jun 12, 2024

Conversation

Muscraft
Copy link
Member

@Muscraft Muscraft commented Jun 12, 2024

This was split out from #14048 so that the test changes in that PR do not block the redactions.

This adds auto-redactions for:

  • A new [HASH] for /<file>-<16 char hash>
  • [HOST_TARGET]
  • [ALT_TARGET]
    • Only added if cross-compilation is allowed for the target
  • [AVG_ELAPSED]
    • For bench output
  • [JITTER]
    • For bench output

This also moves all common redactions to a function that assert_e2e and assert_ui call to reduce the amount of duplicate code and makes it so we only compile regex redactions once.

@rustbot
Copy link
Collaborator

rustbot commented Jun 12, 2024

r? @epage

rustbot has assigned @epage.
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-testing-cargo-itself Area: cargo's tests S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Jun 12, 2024
@@ -165,6 +165,11 @@ fn add_common_redactions(subs: &mut snapbox::Redactions) {
regex::Regex::new("home/\\.cargo/registry/src/-(?<redacted>[a-z0-9]+)").unwrap(),
)
.unwrap();
subs.insert(
"[HASH]",
regex::Regex::new(r"[a-z0-9\-_]+-(?<redacted>[0-9a-f]{16})").unwrap(),
Copy link
Member

Choose a reason for hiding this comment

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

This doesn't work with -C metadata=<hash>.

Copy link
Contributor

Choose a reason for hiding this comment

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

Technically, this is trying to cover other cases so that would be another entry to cover that which wouldn't be a blocker for this PR but a nice to have

Copy link
Member

Choose a reason for hiding this comment

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

Is there a way to forced regenerate existing snapshots, so we can add and remove redactions more freely, and won't bother forgetting to update some overly omitted snapshots?

Copy link
Contributor

Choose a reason for hiding this comment

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

Not at this time. If we remove a redaction, it'll require an update anyways.

crates/cargo-test-support/src/compare.rs Show resolved Hide resolved
@Muscraft Muscraft force-pushed the add-assert-redactions branch from b90ba01 to 190ef86 Compare June 12, 2024 19:44
@epage
Copy link
Contributor

epage commented Jun 12, 2024

@bors r+

@bors
Copy link
Contributor

bors commented Jun 12, 2024

📌 Commit 190ef86 has been approved by epage

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

bors commented Jun 12, 2024

⌛ Testing commit 190ef86 with merge 00ea165...

@bors
Copy link
Contributor

bors commented Jun 12, 2024

☀️ Test successful - checks-actions
Approved by: epage
Pushing 00ea165 to master...

@bors bors merged commit 00ea165 into rust-lang:master Jun 12, 2024
24 checks passed
@Muscraft Muscraft deleted the add-assert-redactions branch June 12, 2024 21:14
bors added a commit to rust-lang-ci/rust that referenced this pull request Jun 15, 2024
Update cargo

13 commits in 4dcbca118ab7f9ffac4728004c983754bc6a04ff..a1f47ec3f7cd076986f1bfcd7061f2e8cb1a726e
2024-06-11 16:27:02 +0000 to 2024-06-15 01:10:07 +0000
- Change verification order during packaging. (rust-lang/cargo#14074)
- Update git2 for libgit2 1.8.1 (rust-lang/cargo#14067)
- Fix some documentation misspellings (rust-lang/cargo#14066)
- chore(deps): update msrv (1 version) to v1.79 (rust-lang/cargo#14063)
- test: Redact conditional compile-fail warning (rust-lang/cargo#14064)
- Migrate a few test files to snapbox (rust-lang/cargo#14048)
- docs(contrib): Improve triage instructions (rust-lang/cargo#14052)
- chore(ci): Upgrade cargo-semver-checks (rust-lang/cargo#14062)
- Revert rust-lang/cargo#13630 as rustc ignores `-C strip` on MSVC (rust-lang/cargo#14061)
- test: migrate features_are_quoted to snapbox (rust-lang/cargo#14051)
- Add assert redactions (rust-lang/cargo#14054)
- test: migrate build_script_env to snapbox (rust-lang/cargo#14044)
- docs: Iterate on --breaking docs (rust-lang/cargo#14047)

r? ghost
@rustbot rustbot added this to the 1.81.0 milestone Jun 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-testing-cargo-itself Area: cargo's tests S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants