Skip to content

Commit b654668

Browse files
committed
compiletest: cleanup dylib name calculation
1 parent 3d68afc commit b654668

File tree

1 file changed

+7
-9
lines changed

1 file changed

+7
-9
lines changed

src/tools/compiletest/src/runtest.rs

+7-9
Original file line numberDiff line numberDiff line change
@@ -82,24 +82,22 @@ fn disable_error_reporting<F: FnOnce() -> R, R>(f: F) -> R {
8282
}
8383

8484
/// The platform-specific library name
85-
fn get_lib_name(lib: &str, aux_type: AuxType) -> Option<String> {
85+
fn get_lib_name(name: &str, aux_type: AuxType) -> Option<String> {
8686
match aux_type {
8787
AuxType::Bin => None,
8888
// In some cases (e.g. MUSL), we build a static
8989
// library, rather than a dynamic library.
9090
// In this case, the only path we can pass
9191
// with '--extern-meta' is the '.rlib' file
92-
AuxType::Lib => Some(format!("lib{}.rlib", lib)),
93-
AuxType::Dylib => Some(if cfg!(windows) {
94-
format!("{}.dll", lib)
95-
} else if cfg!(target_vendor = "apple") {
96-
format!("lib{}.dylib", lib)
97-
} else {
98-
format!("lib{}.so", lib)
99-
}),
92+
AuxType::Lib => Some(format!("lib{name}.rlib")),
93+
AuxType::Dylib => Some(dylib_name(name)),
10094
}
10195
}
10296

97+
fn dylib_name(name: &str) -> String {
98+
format!("{}{name}.{}", std::env::consts::DLL_PREFIX, std::env::consts::DLL_EXTENSION)
99+
}
100+
103101
pub fn run(config: Arc<Config>, testpaths: &TestPaths, revision: Option<&str>) {
104102
match &*config.target {
105103
"arm-linux-androideabi"

0 commit comments

Comments
 (0)