Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions src/tools/compiletest/src/header.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1281,6 +1281,7 @@ fn expand_variables(mut value: String, config: &Config) -> String {
const BUILD_BASE: &str = "{{build-base}}";
const SYSROOT_BASE: &str = "{{sysroot-base}}";
const TARGET_LINKER: &str = "{{target-linker}}";
const TARGET: &str = "{{target}}";

if value.contains(CWD) {
let cwd = env::current_dir().unwrap();
Expand All @@ -1303,6 +1304,10 @@ fn expand_variables(mut value: String, config: &Config) -> String {
value = value.replace(TARGET_LINKER, config.target_linker.as_deref().unwrap_or(""));
}

if value.contains(TARGET) {
value = value.replace(TARGET, &config.target);
}

value
}

Expand Down
6 changes: 3 additions & 3 deletions src/tools/tidy/src/target_specific_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,9 @@ pub fn check(path: &Path, bad: &mut bool) {
} else if directive.starts_with(COMPILE_FLAGS_HEADER) {
let compile_flags = &directive[COMPILE_FLAGS_HEADER.len()..];
if let Some((_, v)) = compile_flags.split_once("--target") {
if let Some((arch, _)) =
v.trim_start_matches(|c| c == ' ' || c == '=').split_once("-")
{
let v = v.trim_start_matches(|c| c == ' ' || c == '=');
let v = if v == "{{target}}" { Some((v, v)) } else { v.split_once("-") };
if let Some((arch, _)) = v {
Comment on lines +56 to +58
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This just puts {{target}} into arch, probably not ideal but currently the arch string is not used anyways so it's unclear what would be the best thing to do here for now until things do get validated.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did you consider adding a new field to RevisionInfo? Since target_arch is an Option, we can leave it as None for {{target}} values.

let info = header_map.entry(revision).or_insert(RevisionInfo::default());
info.target_arch.replace(arch);
} else {
Expand Down