-
Notifications
You must be signed in to change notification settings - Fork 497
/
Copy pathrustflags.rs
31 lines (29 loc) · 1012 Bytes
/
rustflags.rs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#[cfg(not(windows))]
use crate::support::Test;
mod support;
/// This test is in its own module because it modifies the environment and would affect other tests
/// when run in parallel with them.
#[test]
#[cfg(not(windows))]
fn inherits_rustflags() {
// Sanity check - no flags
std::env::set_var("CARGO_ENCODED_RUSTFLAGS", "");
let test = Test::gnu();
test.gcc().file("foo.c").compile("foo");
test.cmd(0)
.must_not_have("-fno-omit-frame-pointer")
.must_not_have("-mcmodel=small")
.must_not_have("-msoft-float");
// Correctly inherits flags from rustc
std::env::set_var(
"CARGO_ENCODED_RUSTFLAGS",
"-Cforce-frame-pointers=true\u{1f}-Ccode-model=small\u{1f}-Csoft-float\u{1f}-Cdwarf-version=5",
);
let test = Test::gnu();
test.gcc().file("foo.c").compile("foo");
test.cmd(0)
.must_have("-fno-omit-frame-pointer")
.must_have("-mcmodel=small")
.must_have("-msoft-float")
.must_have("-gdwarf-5");
}