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"),
43 get_install_prefix_lib_path
: &mut || panic
!(),
45 let res
= get_rpath_relative_to_output(config
, Path
::new("lib/libstd.so"));
46 assert_eq
!(res
, "@loader_path/../lib");
48 let config
= &mut RPathConfig
{
50 out_filename
: PathBuf
::from("bin/rustc"),
51 get_install_prefix_lib_path
: &mut || panic
!(),
56 let res
= get_rpath_relative_to_output(config
, Path
::new("lib/libstd.so"));
57 assert_eq
!(res
, "$ORIGIN/../lib");
63 let args
= rpaths_to_flags(&["a/normal/path".to_string(), "a,comma,path".to_string()]);
68 "-Wl,-rpath,a/normal/path".to_string(),
69 "-Wl,-rpath".to_string(),
70 "-Xlinker".to_string(),
71 "a,comma,path".to_string()