|
| 1 | +#[test] |
| 2 | +fn main() { |
| 3 | + let cfg = cc_with_target("i586-pc-nto-qnx700"); |
| 4 | + assert_eq!(cfg.get_archiver().get_program(), "ntox86-ar"); |
| 5 | + |
| 6 | + let cfg = cc_with_target("x86_64-unknown-linux-gnu"); |
| 7 | + assert_eq!(cfg.get_archiver().get_program(), "ar"); |
| 8 | + |
| 9 | + let cfg = cc_with_target("x86_64-unknown-linux-musl"); |
| 10 | + assert_eq!(cfg.get_archiver().get_program(), "ar"); |
| 11 | + |
| 12 | + let cfg = cc_with_target("riscv64gc-unknown-openbsd"); |
| 13 | + assert_eq!(cfg.get_archiver().get_program(), "ar"); |
| 14 | + |
| 15 | + let cfg = cc_with_target("i686-wrs-vxworks"); |
| 16 | + assert_eq!(cfg.get_archiver().get_program(), "wr-ar"); |
| 17 | + |
| 18 | + let cfg = cc_with_target("i586-pc-nto-qnx700"); |
| 19 | + assert_eq!(cfg.get_archiver().get_program(), "ntox86-ar"); |
| 20 | + |
| 21 | + let cfg = cc_with_target("aarch64-unknown-nto-qnx700"); |
| 22 | + assert_eq!(cfg.get_archiver().get_program(), "ntoaarch64-ar"); |
| 23 | + |
| 24 | + let cfg = cc_with_target("x86_64-pc-nto-qnx710"); |
| 25 | + assert_eq!(cfg.get_archiver().get_program(), "ntox86_64-ar"); |
| 26 | + |
| 27 | + let cfg = cc_with_target("wasm32-wasip1"); |
| 28 | + // This usually returns an absolute path, so using `assert_eq` might make the test flaky. |
| 29 | + assert!(cfg |
| 30 | + .get_archiver() |
| 31 | + .get_program() |
| 32 | + .to_str() |
| 33 | + .unwrap() |
| 34 | + .ends_with("llvm-ar")); |
| 35 | + |
| 36 | + let cfg = cc_with_target("riscv64-linux-android"); |
| 37 | + assert_eq!(cfg.get_archiver().get_program(), "llvm-ar"); |
| 38 | +} |
| 39 | + |
| 40 | +fn cc_with_target(target: &'static str) -> cc::Build { |
| 41 | + let mut cfg = cc::Build::new(); |
| 42 | + cfg.host("x86_64-unknown-linux-gnu").target(target); |
| 43 | + cfg |
| 44 | +} |
0 commit comments