don't pass -L .../auxiliary unless it exists

this avoids warnings from macOS ld
This commit is contained in:
jyn 2024-01-27 19:15:10 -05:00 committed by jyn
parent f1e5b365f0
commit 675f447d88

View file

@ -1096,6 +1096,10 @@ impl<'test> TestCx<'test> {
self.config.target.contains("vxworks") && !self.is_vxworks_pure_static()
}
fn has_aux_dir(&self) -> bool {
!self.props.aux.builds.is_empty() || !self.props.aux.crates.is_empty()
}
fn aux_output_dir(&self) -> PathBuf {
let aux_dir = self.aux_output_dir_name();
@ -1649,7 +1653,11 @@ impl<'test> TestCx<'test> {
}
if let LinkToAux::Yes = link_to_aux {
rustc.arg("-L").arg(self.aux_output_dir_name());
// if we pass an `-L` argument to a directory that doesn't exist,
// macOS ld emits warnings which disrupt the .stderr files
if self.has_aux_dir() {
rustc.arg("-L").arg(self.aux_output_dir_name());
}
}
rustc.args(&self.props.compile_flags);