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

Include executable in JSON output. #6363

Merged
merged 6 commits into from
Dec 3, 2018

Conversation

dwijnand
Copy link
Member

Fixes #5426
Rebase of @patriksvensson's #5517
CC @matklad

I didn't really get into the issue or the code, I just interatively rebased Patrik's branch and then massaged and cleaned up the code until the tests passed. So please double check it for code correctness, test case correctness and test case coverage.

Particularly the branch changed an if condition according to this suggestion by Aleksey. I rolled that back because at one point it helped fix a series of tests. But let me know if that should be included here.

Copy link
Member

@matklad matklad left a comment

Choose a reason for hiding this comment

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

LGTM!

Also, the new testing infra looks absolutely awesome, the tests are a joy to review! :)

src/cargo/util/machine_message.rs Show resolved Hide resolved
@dwijnand dwijnand force-pushed the add-executable-in-json-output branch from bdae64e to 816ff27 Compare November 30, 2018 22:08
@dwijnand dwijnand force-pushed the add-executable-in-json-output branch from 816ff27 to 282f238 Compare November 30, 2018 22:12
Apparently on Windows it creates an .exe & a .pdb.
tests/testsuite/test.rs Outdated Show resolved Hide resolved
}

let p = project()
.file("src/main.rs", "fn main() {}")
Copy link
Contributor

Choose a reason for hiding this comment

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

This will have the same non-determinism as the other test.

Copy link
Member

Choose a reason for hiding this comment

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

I’d say we should add with_json_unordered , like we do for stderr:
https://github.com/rust-lang/cargo/blob/master/tests/testsuite/support/mod.rs#L660

Copy link
Contributor

Choose a reason for hiding this comment

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

I would not be opposed, I have wanted it in the past. However, you have to be careful when writing unordered tests because the current code does not do "longest match", so it is easy to create non-deterministic tests (or tests that fail in a confusing way). Just be careful that one entry is not a prefix of another.

Copy link
Member Author

Choose a reason for hiding this comment

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

Go crazy. Meanwhile I just trimmed the test.

@dwijnand
Copy link
Member Author

dwijnand commented Dec 3, 2018

@bors: r=matklad

@bors
Copy link
Contributor

bors commented Dec 3, 2018

📌 Commit 020efe0 has been approved by matklad

bors added a commit that referenced this pull request Dec 3, 2018
Include executable in JSON output.

Fixes #5426
Rebase of @patriksvensson's #5517
CC @matklad

I didn't really get into the issue or the code, I just interatively rebased Patrik's branch and then massaged and cleaned up the code until the tests passed.  So please double check it for code correctness, test case correctness and test case coverage.

Particularly the branch changed an if condition according to [this suggestion](#5517 (comment)) by Aleksey.  I rolled that back because at one point it helped fix a series of tests.  But let me know if that should be included here.
@bors
Copy link
Contributor

bors commented Dec 3, 2018

⌛ Testing commit 020efe0 with merge bfd6618...

@@ -49,6 +49,16 @@ pub struct OutputFile {
pub flavor: FileFlavor,
}

impl OutputFile {
/// Gets the hardlink if present. Otherwise returns the path.
pub fn bindst(&self) -> &PathBuf {
Copy link
Member

Choose a reason for hiding this comment

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

Perhaps a _ in the middle to separate "bin" and "dst"?

Copy link
Member Author

Choose a reason for hiding this comment

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

I'll follow-up PR.

@alexcrichton
Copy link
Member

Oops, a few minutes too late! (no worries)

@bors
Copy link
Contributor

bors commented Dec 3, 2018

☀️ Test successful - status-appveyor, status-travis
Approved by: matklad
Pushing bfd6618 to master...

@bors bors merged commit 020efe0 into rust-lang:master Dec 3, 2018
@dwijnand dwijnand deleted the add-executable-in-json-output branch December 3, 2018 19:28
@ehuss ehuss added this to the 1.33.0 milestone Feb 6, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

--message-format=json should indicate which produced files are executables
5 participants