Skip to content

compiletest: Introduce remove_and_create_dir_all() helper#122786

Merged
bors merged 2 commits into
rust-lang:masterfrom
Enselic:remove_and_create_dir_all
Mar 21, 2024
Merged

compiletest: Introduce remove_and_create_dir_all() helper#122786
bors merged 2 commits into
rust-lang:masterfrom
Enselic:remove_and_create_dir_all

Conversation

@Enselic

@Enselic Enselic commented Mar 20, 2024

Copy link
Copy Markdown
Member

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 commented Mar 20, 2024

Copy link
Copy Markdown
Collaborator

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

rustbot commented Mar 20, 2024

Copy link
Copy Markdown
Collaborator

Some changes occurred in src/tools/compiletest

cc @jieyouxu

Comment thread src/tools/compiletest/src/runtest.rs Outdated
@@ -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
Copy Markdown
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
Copy Markdown
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.

@onur-ozkan onur-ozkan left a comment

Copy link
Copy Markdown
Contributor

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 Enselic force-pushed the remove_and_create_dir_all branch from 64df8d3 to c3cc6c1 Compare March 20, 2024 19:28
@Enselic

Enselic commented Mar 20, 2024

Copy link
Copy Markdown
Member Author

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

@bors

bors commented Mar 20, 2024

Copy link
Copy Markdown
Collaborator

@Enselic: 🔑 Insufficient privileges: Not in reviewers

@onur-ozkan

Copy link
Copy Markdown
Contributor

oops

@bors r+ rollup

@bors

bors commented Mar 20, 2024

Copy link
Copy Markdown
Collaborator

📌 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
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