Skip to content

Commit 79be7fa

Browse files
committed
OS-independent paths in compile tests
1 parent 74f596d commit 79be7fa

File tree

1 file changed

+22
-2
lines changed

1 file changed

+22
-2
lines changed

tests/compile_tests.rs

+22-2
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,28 @@ use std::path::PathBuf;
66
fn run_mode(mode: &'static str) {
77
let mut config = compiletest::Config::default();
88
config.mode = mode.parse().expect("Invalid mode");
9-
config.src_base = PathBuf::from(format!("tests/{}", mode));
10-
config.target_rustcflags = Some("-L target/debug".to_string());
9+
config.src_base = ["tests", mode].iter().collect();
10+
// Create linker paths
11+
let debug_path: PathBuf = ["target", "debug"].iter().collect();
12+
let mut deps_path: PathBuf = debug_path.clone();
13+
deps_path.push("deps");
14+
15+
// Convert linker paths to string representation
16+
let mut target_rustcflags = "".to_string();
17+
for x in [debug_path, deps_path].iter() {
18+
if let Some(s) = x.to_str() {
19+
target_rustcflags.push_str(&format!("-L {} ", s))
20+
}
21+
}
22+
23+
// Save linker flags
24+
config.target_rustcflags = if target_rustcflags.len() > 0 {
25+
Some(target_rustcflags)
26+
} else {
27+
None
28+
};
29+
30+
config.verbose = true;
1131

1232
compiletest::run_tests(&config);
1333
}

0 commit comments

Comments
 (0)