Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

compiletest: Add exact-llvm-major-version directive #132995

Merged
merged 2 commits into from
Nov 14, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
1 change: 1 addition & 0 deletions src/tools/compiletest/src/directive-list.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ const KNOWN_DIRECTIVE_NAMES: &[&str] = &[
"dont-check-failure-status",
"edition",
"error-pattern",
"exact-llvm-major-version",
"exec-env",
"failure-status",
"filecheck-flags",
Expand Down
13 changes: 13 additions & 0 deletions src/tools/compiletest/src/header.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1585,6 +1585,19 @@ fn ignore_llvm(config: &Config, line: &str) -> IgnoreDecision {
};
}
}
} else if let Some(version_string) =
config.parse_name_value_directive(line, "exact-llvm-major-version")
{
// Syntax is "only-llvm-major-version: <version>"
Eclips4 marked this conversation as resolved.
Show resolved Hide resolved
let version = extract_llvm_version(&version_string);
if actual_version.major > version.major || actual_version.major < version.major {
Eclips4 marked this conversation as resolved.
Show resolved Hide resolved
return IgnoreDecision::Ignore {
reason: format!(
"ignored when the LLVM major version is {}, but it should be {}",
Eclips4 marked this conversation as resolved.
Show resolved Hide resolved
actual_version.major, version.major
),
};
}
}
}
IgnoreDecision::Continue
Expand Down
9 changes: 9 additions & 0 deletions src/tools/compiletest/src/header/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -284,6 +284,15 @@ fn llvm_version() {

let config: Config = cfg().llvm_version("10.0.0").build();
assert!(!check_ignore(&config, "//@ min-llvm-version: 9.0"));

let config: Config = cfg().llvm_version("10.0.0").build();
assert!(check_ignore(&config, "//@ exact-llvm-major-version: 9.0"));
Eclips4 marked this conversation as resolved.
Show resolved Hide resolved

let config: Config = cfg().llvm_version("9.0.0").build();
assert!(check_ignore(&config, "//@ exact-llvm-major-version: 10.0"));

let config: Config = cfg().llvm_version("10.0.0").build();
assert!(!check_ignore(&config, "//@ exact-llvm-major-version: 10.0"));
}

#[test]
Expand Down
3 changes: 1 addition & 2 deletions tests/codegen/try_question_mark_nop.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@
//@ only-x86_64
// FIXME: Remove the `min-llvm-version`.
//@ revisions: NINETEEN TWENTY
//@[NINETEEN] min-llvm-version: 19
//@[NINETEEN] ignore-llvm-version: 20-99
//@[NINETEEN] exact-llvm-major-version: 19
//@[TWENTY] min-llvm-version: 20
//@ min-llvm-version: 19

Expand Down
Loading