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: Introduce remove_and_create_dir_all() helper #122786

Merged
merged 2 commits into from
Mar 21, 2024

Conversation

Enselic
Copy link
Member

@Enselic Enselic commented Mar 20, 2024

The code

let _ = fs::remove_dir_all(&dir);
create_dir_all(&dir).unwrap();

is duplicated in 7 places. Let's introduce a helper.

@rustbot
Copy link
Collaborator

rustbot commented Mar 20, 2024

r? @onur-ozkan

rustbot has assigned @onur-ozkan.
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 Mar 20, 2024
@rustbot
Copy link
Collaborator

rustbot commented Mar 20, 2024

Some changes occurred in src/tools/compiletest

cc @jieyouxu

@@ -2987,8 +2987,7 @@ impl<'test> TestCx<'test> {
self.safe_revision().map_or("nightly".into(), |path| path.to_owned() + "-nightly");
let compare_dir = output_base_dir(self.config, self.testpaths, Some(&suffix));
// Don't give an error if the directory didn't already exist
Copy link
Contributor

Choose a reason for hiding this comment

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

This comment can probably be removed/moved to the function

Copy link
Member Author

Choose a reason for hiding this comment

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

Good catch. Let's remove it since it doesn't add much.

Copy link
Member

@onur-ozkan onur-ozkan left a comment

Choose a reason for hiding this comment

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

feel free to r=me with or without the suggestion above

The code

    let _ = fs::remove_dir_all(&dir);
    create_dir_all(&dir).unwrap();

is duplicated in 7 places. Let's introduce a helper.
@Enselic
Copy link
Member Author

Enselic commented Mar 20, 2024

@onur-ozkan Thanks! But you'll need to @bors delegate=Enselic me first.

@bors
Copy link
Contributor

bors commented Mar 20, 2024

@Enselic: 🔑 Insufficient privileges: Not in reviewers

@onur-ozkan
Copy link
Member

oops

@bors r+ rollup

@bors
Copy link
Contributor

bors commented Mar 20, 2024

📌 Commit c3cc6c1 has been approved by onur-ozkan

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 Mar 20, 2024
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request Mar 20, 2024
… r=onur-ozkan

compiletest: Introduce `remove_and_create_dir_all()` helper

The code

    let _ = fs::remove_dir_all(&dir);
    create_dir_all(&dir).unwrap();

is duplicated in 7 places. Let's introduce a helper.
bors added a commit to rust-lang-ci/rust that referenced this pull request Mar 20, 2024
…iaskrgr

Rollup of 10 pull requests

Successful merges:

 - rust-lang#122545 (Ignore paths from expansion in `unused_qualifications`)
 - rust-lang#122644 (pattern analysis: add a custom test harness)
 - rust-lang#122696 (Add bare metal riscv32 target.)
 - rust-lang#122729 (Relax SeqCst ordering in standard library.)
 - rust-lang#122740 (use more accurate terminology)
 - rust-lang#122749 (make `type_flags(ReError) & HAS_ERROR`)
 - rust-lang#122764 (coverage: Remove incorrect assertions from counter allocation)
 - rust-lang#122765 (Add `usize::MAX` arg tests for Vec)
 - rust-lang#122776 (Rename `hir::Let` into `hir::LetExpr`)
 - rust-lang#122786 (compiletest: Introduce `remove_and_create_dir_all()` helper)

r? `@ghost`
`@rustbot` modify labels: rollup
bors added a commit to rust-lang-ci/rust that referenced this pull request Mar 21, 2024
Rollup of 8 pull requests

Successful merges:

 - rust-lang#122545 (Ignore paths from expansion in `unused_qualifications`)
 - rust-lang#122729 (Relax SeqCst ordering in standard library.)
 - rust-lang#122740 (use more accurate terminology)
 - rust-lang#122749 (make `type_flags(ReError) & HAS_ERROR`)
 - rust-lang#122764 (coverage: Remove incorrect assertions from counter allocation)
 - rust-lang#122765 (Add `usize::MAX` arg tests for Vec)
 - rust-lang#122776 (Rename `hir::Let` into `hir::LetExpr`)
 - rust-lang#122786 (compiletest: Introduce `remove_and_create_dir_all()` helper)

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit f25397a into rust-lang:master Mar 21, 2024
11 checks passed
rust-timer added a commit to rust-lang-ci/rust that referenced this pull request Mar 21, 2024
Rollup merge of rust-lang#122786 - Enselic:remove_and_create_dir_all, r=onur-ozkan

compiletest: Introduce `remove_and_create_dir_all()` helper

The code

    let _ = fs::remove_dir_all(&dir);
    create_dir_all(&dir).unwrap();

is duplicated in 7 places. Let's introduce a helper.
@rustbot rustbot added this to the 1.79.0 milestone Mar 21, 2024
@Enselic Enselic deleted the remove_and_create_dir_all branch March 21, 2024 04:30
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