Include all kinds of auxiliary crates in the up-to-date timestamp

This was previously only including ordinary `aux-build` crates, and not files
associated with the other three kinds of auxiliary crate.
This commit is contained in:
Zalathar 2024-10-11 20:05:12 +11:00
parent 188f7ce91b
commit ec662b9c09
2 changed files with 17 additions and 1 deletions

View File

@ -1,6 +1,8 @@
//! Code for dealing with test directives that request an "auxiliary" crate to
//! be built and made available to the test in some way.
use std::iter;
use crate::common::Config;
use crate::header::directives::{AUX_BIN, AUX_BUILD, AUX_CODEGEN_BACKEND, AUX_CRATE};
@ -20,6 +22,20 @@ pub(crate) struct AuxProps {
pub(crate) codegen_backend: Option<String>,
}
impl AuxProps {
/// Yields all of the paths (relative to `./auxiliary/`) that have been
/// specified in `aux-*` directives for this test.
pub(crate) fn all_aux_path_strings(&self) -> impl Iterator<Item = &str> {
let Self { builds, bins, crates, codegen_backend } = self;
iter::empty()
.chain(builds.iter().map(String::as_str))
.chain(bins.iter().map(String::as_str))
.chain(crates.iter().map(|(_, path)| path.as_str()))
.chain(codegen_backend.iter().map(String::as_str))
}
}
/// If the given test directive line contains an `aux-*` directive, parse it
/// and update [`AuxProps`] accordingly.
pub(super) fn parse_and_update_aux(config: &Config, ln: &str, aux: &mut AuxProps) {

View File

@ -862,7 +862,7 @@ fn files_related_to_test(
related.push(testpaths.file.clone());
}
for aux in &props.aux.builds {
for aux in props.aux.all_aux_path_strings() {
// FIXME(Zalathar): Perform all `auxiliary` path resolution in one place.
let path = testpaths.file.parent().unwrap().join("auxiliary").join(aux);
related.push(path);