-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
Changes from 5 commits
982b9e8
282f238
c78cd0c
b0046c0
70af063
020efe0
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1485,3 +1485,81 @@ fn bench_virtual_manifest_all_implied() { | |
.with_stdout_contains("test bench_bar ... bench: [..]") | ||
.run(); | ||
} | ||
|
||
#[test] | ||
fn json_artifact_includes_executable_for_benchmark() { | ||
if !is_nightly() { | ||
return; | ||
} | ||
|
||
let p = project() | ||
.file("src/main.rs", "fn main() {}") | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This will have the same non-determinism as the other test. There was a problem hiding this comment. Choose a reason for hiding this commentThe 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: There was a problem hiding this comment. Choose a reason for hiding this commentThe 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. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Go crazy. Meanwhile I just trimmed the test. |
||
.file( | ||
"benches/benchmark.rs", | ||
r#" | ||
#![feature(test)] | ||
extern crate test; | ||
|
||
use test::Bencher; | ||
|
||
#[bench] | ||
fn bench_foo(_: &mut Bencher) -> () { () } | ||
"#, | ||
) | ||
.build(); | ||
|
||
p.cargo("bench --no-run --message-format=json") | ||
.with_json(r#" | ||
{ | ||
"executable": "[..]/foo/target/release/foo[EXE]", | ||
"features": [], | ||
"filenames": "{...}", | ||
"fresh": false, | ||
"package_id": "foo 0.0.1 ([..])", | ||
"profile": "{...}", | ||
"reason": "compiler-artifact", | ||
"target": { | ||
"crate_types": [ "bin" ], | ||
"kind": [ "bin" ], | ||
"edition": "2015", | ||
"name": "foo", | ||
"src_path": "[..]/foo/src/main.rs" | ||
} | ||
} | ||
|
||
{ | ||
"executable": "[..]/foo/target/release/foo-[..][EXE]", | ||
"features": [], | ||
"filenames": "{...}", | ||
"fresh": false, | ||
"package_id": "foo 0.0.1 ([..])", | ||
"profile": "{...}", | ||
"reason": "compiler-artifact", | ||
"target": { | ||
"crate_types": [ "bin" ], | ||
"kind": [ "bin" ], | ||
"edition": "2015", | ||
"name": "foo", | ||
"src_path": "[..]/foo/src/main.rs" | ||
} | ||
} | ||
|
||
{ | ||
"executable": "[..]/foo/target/release/benchmark-[..][EXE]", | ||
"features": [], | ||
"filenames": [ "[..]/foo/target/release/benchmark-[..][EXE]" ], | ||
"fresh": false, | ||
"package_id": "foo 0.0.1 ([..])", | ||
"profile": "{...}", | ||
"reason": "compiler-artifact", | ||
"target": { | ||
"crate_types": [ "bin" ], | ||
"kind": [ "bench" ], | ||
"edition": "2015", | ||
"name": "benchmark", | ||
"src_path": "[..]/foo/benches/benchmark.rs" | ||
} | ||
} | ||
"#) | ||
.run(); | ||
} |
There was a problem hiding this comment.
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"?There was a problem hiding this comment.
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.