Skip to content

Commit

Permalink
test(cfg): parse rustc --print=target-spec-json
Browse files Browse the repository at this point in the history
  • Loading branch information
harmou01 committed Jul 3, 2024
1 parent a60fb6c commit 478399a
Showing 1 changed file with 42 additions and 2 deletions.
44 changes: 42 additions & 2 deletions tests/testsuite/cfg.rs
Original file line number Diff line number Diff line change
Expand Up @@ -387,6 +387,17 @@ fn bad_cfg_discovery() {
}
};
if mode == "no-target-spec-json" {
return;
}
loop {
let line = lines.next().unwrap();
println!("{line}");
if line == "}" {
break;
}
}
if mode != "bad-cfg" {
panic!("unexpected");
}
Expand Down Expand Up @@ -471,10 +482,34 @@ command was: `[..]compiler[..]--crate-type [..]`

p.cargo("check")
.env("RUSTC", &funky_rustc)
.env("FUNKY_MODE", "bad-cfg")
.env("FUNKY_MODE", "no-target-spec-json")
.with_status(101)
.with_stderr(
"\
[ERROR] output of --print=target-spec-json missing when learning about target-specific information from rustc
command was: `[..]compiler[..]--crate-type [..]`
--- stdout
[..]___[..]
[..]___[..]
[..]___[..]
[..]___[..]
[..]___[..]
[..]___[..]
[..]
[..]
___
",
)
.run();

p.cargo("check")
.env("RUSTC", &funky_rustc)
.env("FUNKY_MODE", "bad-cfg")
.with_status(101)
.with_stderr_contains(
"\
[ERROR] failed to parse the cfg from `rustc --print=cfg`, got:
[..]___[..]
[..]___[..]
Expand All @@ -483,8 +518,13 @@ command was: `[..]compiler[..]--crate-type [..]`
[..]___[..]
[..]___[..]
[..]
[..],[..]
[..]
___
{
",
)
.with_stderr_contains(
"\
123
Expand Down

0 comments on commit 478399a

Please sign in to comment.