Skip to content

Commit

Permalink
test: ensure clang --driver-mode=cl is MSVC- and clang-cl-like
Browse files Browse the repository at this point in the history
  • Loading branch information
ErichDonGubler committed Feb 4, 2025
1 parent e8948c6 commit 8139264
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions tests/cc_env.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ fn main() {
extra_flags();
path_to_ccache();
more_spaces();
clang_cl();
}

fn ccache() {
Expand Down Expand Up @@ -110,3 +111,18 @@ fn more_spaces() {
let compiler = test.gcc().file("foo.c").get_compiler();
assert_eq!(compiler.path(), Path::new("cc"));
}

fn clang_cl() {
for exe_suffix in ["", ".exe"] {
let test = Test::clang();
let bin = format!("clang{exe_suffix}");
env::set_var("CC", &format!("{bin} --driver-mode=cl"));
let test_compiler = |build: cc::Build| {
let compiler = build.get_compiler();
assert_eq!(compiler.path(), Path::new(&*bin));
assert!(compiler.is_like_msvc());
assert!(compiler.is_like_clang_cl());
};
test_compiler(test.gcc());
}
}

0 comments on commit 8139264

Please sign in to comment.