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

Refactor fake_file() away from cargo_command tests #9767

Merged
merged 1 commit into from
Aug 6, 2021

Conversation

nipunn1313
Copy link
Contributor

There are already similar preexisting test helpers which
also work on windows. Port over the executable-creation
helper into the file() helper and things appear to pass.

Was inspired to do this when trying to add tests to solve a separate issue.

@rust-highfive
Copy link

r? @alexcrichton

(rust-highfive has picked a reviewer for you, use r? to override)

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Aug 6, 2021
@alexcrichton
Copy link
Member

Seems reasonable to me! I think there's some failures on CI though to fix first

@nipunn1313
Copy link
Contributor Author

yep - booting up windows to figure out what's up over there.

fn mk(&self) {
fn mk(&mut self) {
if self.executable {
self.path.set_extension(env::consts::EXE_EXTENSION);
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Had to use EXE_EXTENSION instead of EXE_SUFFIX. Was getting "cargo-1..exe" instead of "cargo-1.exe"

There are already similar preexisting test helpers which
also work on windows. Port over the executable-creation
helper into the file() helper and things appear to pass.
self.dirname().mkdir_p();
if self.src_is_dir {
t!(os::windows::fs::symlink_dir(&self.dst, &self.src));
} else {
if let Some(ext) = self.dst.extension() {
if ext == env::consts::EXE_EXTENSION {
self.src.set_extension(ext);
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Had to propagate the .exe to the src from the dst here as intended by the callsite.

@@ -114,19 +63,11 @@ fn list_command_looks_at_path() {
);
}

// Windows and symlinks don't currently mix well.
#[cfg(unix)]
Copy link
Contributor Author

Choose a reason for hiding this comment

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

woohoo coverage! They mix!

@alexcrichton
Copy link
Member

@bors: r+

Thanks!

@bors
Copy link
Contributor

bors commented Aug 6, 2021

📌 Commit dde290e has been approved by alexcrichton

@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 Aug 6, 2021
@bors
Copy link
Contributor

bors commented Aug 6, 2021

⌛ Testing commit dde290e with merge 32b1ed1...

@bors
Copy link
Contributor

bors commented Aug 6, 2021

☀️ Test successful - checks-actions
Approved by: alexcrichton
Pushing 32b1ed1 to master...

@bors bors merged commit 32b1ed1 into rust-lang:master Aug 6, 2021
@nipunn1313 nipunn1313 deleted the refactor branch August 6, 2021 18:00
JohnTitor added a commit to JohnTitor/rust that referenced this pull request Aug 11, 2021
Update cargo

9 commits in cc17afbb0067b1f57d8882640f63b2168d5b7624..b51439fd8b505d4800a257acfecf3c69f81e35cf
2021-08-02 20:28:08 +0000 to 2021-08-09 18:40:05 +0000
- Deduplicate entries in cargo --list (rust-lang/cargo#9773)
- Include aliases with other commands (rust-lang/cargo#9764)
- Add a profile option to select the codegen backend (rust-lang/cargo#9118)
- remove useless conversions (rust-lang/cargo#9617)
- collapse nested if blocks (rust-lang/cargo#9613)
- Refactor fake_file() away from cargo_command tests (rust-lang/cargo#9767)
- Update cargo-platform to 0.1.2 (rust-lang/cargo#9762)
- Bump to the latest jobserver dependency (rust-lang/cargo#9760)
- Fix semver check for rust 1.54.0 (rust-lang/cargo#9763)
JohnTitor added a commit to JohnTitor/rust that referenced this pull request Aug 11, 2021
Update cargo

9 commits in cc17afbb0067b1f57d8882640f63b2168d5b7624..b51439fd8b505d4800a257acfecf3c69f81e35cf
2021-08-02 20:28:08 +0000 to 2021-08-09 18:40:05 +0000
- Deduplicate entries in cargo --list (rust-lang/cargo#9773)
- Include aliases with other commands (rust-lang/cargo#9764)
- Add a profile option to select the codegen backend (rust-lang/cargo#9118)
- remove useless conversions (rust-lang/cargo#9617)
- collapse nested if blocks (rust-lang/cargo#9613)
- Refactor fake_file() away from cargo_command tests (rust-lang/cargo#9767)
- Update cargo-platform to 0.1.2 (rust-lang/cargo#9762)
- Bump to the latest jobserver dependency (rust-lang/cargo#9760)
- Fix semver check for rust 1.54.0 (rust-lang/cargo#9763)
JohnTitor added a commit to JohnTitor/rust that referenced this pull request Aug 12, 2021
Update cargo

9 commits in cc17afbb0067b1f57d8882640f63b2168d5b7624..b51439fd8b505d4800a257acfecf3c69f81e35cf
2021-08-02 20:28:08 +0000 to 2021-08-09 18:40:05 +0000
- Deduplicate entries in cargo --list (rust-lang/cargo#9773)
- Include aliases with other commands (rust-lang/cargo#9764)
- Add a profile option to select the codegen backend (rust-lang/cargo#9118)
- remove useless conversions (rust-lang/cargo#9617)
- collapse nested if blocks (rust-lang/cargo#9613)
- Refactor fake_file() away from cargo_command tests (rust-lang/cargo#9767)
- Update cargo-platform to 0.1.2 (rust-lang/cargo#9762)
- Bump to the latest jobserver dependency (rust-lang/cargo#9760)
- Fix semver check for rust 1.54.0 (rust-lang/cargo#9763)
@ehuss ehuss added this to the 1.56.0 milestone Feb 6, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
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