]>
git.proxmox.com Git - rustc.git/blob - vendor/cc-1.0.79/tests/cc_env.rs
2 use std
::ffi
::OsString
;
6 use crate::support
::Test
;
21 let test
= Test
::gnu();
23 env
::set_var("CC", "ccache cc");
24 let compiler
= test
.gcc().file("foo.c").get_compiler();
26 assert_eq
!(compiler
.path(), Path
::new("cc"));
30 let test
= Test
::gnu();
33 env
::set_var("CC", "ccache cc");
34 let compiler
= test
.gcc().file("foo.c").get_compiler();
35 assert_eq
!(compiler
.path(), Path
::new("cc"));
39 let test
= Test
::gnu();
42 env
::set_var("CC", "distcc cc");
43 let compiler
= test
.gcc().file("foo.c").get_compiler();
44 assert_eq
!(compiler
.path(), Path
::new("cc"));
47 fn ccache_env_flags() {
48 let test
= Test
::gnu();
51 env
::set_var("CC", "ccache lol-this-is-not-a-compiler");
52 let compiler
= test
.gcc().file("foo.c").get_compiler();
53 assert_eq
!(compiler
.path(), Path
::new("lol-this-is-not-a-compiler"));
56 OsString
::from("ccache lol-this-is-not-a-compiler")
71 .contains(" lol-this-is-not-a-compiler")
75 env
::set_var("CC", "");
79 let test
= Test
::gnu();
82 env
::set_var("CC", " test ");
83 let compiler
= test
.gcc().file("foo.c").get_compiler();
84 assert_eq
!(compiler
.path(), Path
::new("test"));
86 env
::set_var("CC", "");
90 let test
= Test
::gnu();
93 env
::set_var("CC", "ccache cc -m32");
94 let compiler
= test
.gcc().file("foo.c").get_compiler();
95 assert_eq
!(compiler
.path(), Path
::new("cc"));
99 let test
= Test
::gnu();
102 env
::set_var("CC", "/path/to/ccache.exe cc -m32");
103 let compiler
= test
.gcc().file("foo.c").get_compiler();
104 assert_eq
!(compiler
.path(), Path
::new("cc"));
107 OsString
::from("/path/to/ccache.exe cc -m32"),
112 let test
= Test
::gnu();
115 env
::set_var("CC", "cc -m32");
116 let compiler
= test
.gcc().file("foo.c").get_compiler();
117 assert_eq
!(compiler
.path(), Path
::new("cc"));