Skip to content

Commit

Permalink
Include all kinds of auxiliary crates in the up-to-date timestamp
Browse files Browse the repository at this point in the history
This was previously only including ordinary `aux-build` crates, and not files
associated with the other three kinds of auxiliary crate.
  • Loading branch information
Zalathar committed Oct 11, 2024
1 parent 188f7ce commit ec662b9
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
16 changes: 16 additions & 0 deletions src/tools/compiletest/src/header/auxiliary.rs
Original file line number Diff line number Diff line change
@@ -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};

Expand All @@ -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) {
Expand Down
2 changes: 1 addition & 1 deletion src/tools/compiletest/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit ec662b9

Please sign in to comment.