1 use super::RPathConfig;
2 use super::{get_rpath_relative_to_output, minimize_rpaths, rpaths_to_flags};
3 use std::path::{Path, PathBuf};
6 fn test_rpaths_to_flags() {
7 let flags = rpaths_to_flags(&["path1".to_string(), "path2".to_string()]);
8 assert_eq!(flags, ["-Wl,-rpath,path1", "-Wl,-rpath,path2"]);
13 let res = minimize_rpaths(&["rpath1".to_string(), "rpath2".to_string(), "rpath1".to_string()]);
14 assert!(res == ["rpath1", "rpath2",]);
19 let res = minimize_rpaths(&[
31 assert!(res == ["1a", "2", "4a", "3",]);
35 fn test_rpath_relative() {
36 if cfg!(target_os = "macos") {
37 let config = &mut RPathConfig {
42 out_filename: PathBuf::from("bin/rustc"),
44 let res = get_rpath_relative_to_output(config, Path::new("lib/libstd.so"));
45 assert_eq!(res, "@loader_path/../lib");
47 let config = &mut RPathConfig {
49 out_filename: PathBuf::from("bin/rustc"),
54 let res = get_rpath_relative_to_output(config, Path::new("lib/libstd.so"));
55 assert_eq!(res, "$ORIGIN/../lib");
61 let args = rpaths_to_flags(&["a/normal/path".to_string(), "a,comma,path".to_string()]);
66 "-Wl,-rpath,a/normal/path".to_string(),
67 "-Wl,-rpath".to_string(),
68 "-Xlinker".to_string(),
69 "a,comma,path".to_string()