Support //@ skip-filecheck in codegen and assembly tests

Skipping FileCheck in codegen/assembly tests is normally not very useful, but a
small number of existing tests were using `//@ build-pass` to do so anyway, so
it's clearer for them to explicitly use `//@ skip-filecheck` instead.
This commit is contained in:
Zalathar
2026-04-21 22:40:00 +10:00
parent eb6eed4ba7
commit 1e8cd1f7a6
7 changed files with 16 additions and 15 deletions
@@ -327,7 +327,7 @@ The following directives affect how certain command-line tools are invoked, in
test suites that use those tools:
- `skip-filecheck` avoids running LLVM's `FileCheck` tool in tests that would normally run it to check output.
- Used by mir-opt tests.
- Used by codegen tests, assembly tests, and mir-opt tests.
- `filecheck-flags` adds extra flags when running LLVM's `FileCheck` tool.
- Used by [codegen tests](compiletest.md#codegen-tests),
[assembly tests](compiletest.md#assembly-tests), and
-1
View File
@@ -442,7 +442,6 @@ fn update_pass_mode(&mut self, ln: &DirectiveLine<'_>, config: &Config) {
let check_no_run = |s| match (config.mode, s) {
(TestMode::Ui, _) => (),
(TestMode::Crashes, _) => (),
(TestMode::Codegen, "build-pass") => (),
(mode, _) => panic!("`{s}` directive is not supported in `{mode}` tests"),
};
let pass_mode = if config.parse_name_directive(ln, "check-pass") {
@@ -316,7 +316,7 @@ fn make_directive_handlers_map() -> HashMap<&'static str, Handler> {
let directive_name = ln.name;
// FIXME(Zalathar): Someday we should add unified support for declaring
// and checking which modes are supported by each directive.
if !matches!(config.mode, TestMode::MirOpt) {
if !matches!(config.mode, TestMode::Assembly | TestMode::Codegen | TestMode::MirOpt) {
panic!(
"directive `//@ {directive_name}` is not supported by this test suite (mode: {mode:?})",
mode = config.mode
@@ -13,9 +13,11 @@ pub(super) fn run_assembly_test(&self) {
self.fatal_proc_rec("compilation failed!", &proc_res);
}
let proc_res = self.verify_with_filecheck(&output_path);
if !proc_res.status.success() {
self.fatal_proc_rec("verification with 'FileCheck' failed", &proc_res);
if !self.props.skip_filecheck {
let proc_res = self.verify_with_filecheck(&output_path);
if !proc_res.status.success() {
self.fatal_proc_rec("verification with 'FileCheck' failed", &proc_res);
}
}
}
+6 -7
View File
@@ -1,4 +1,4 @@
use super::{PassMode, TestCx};
use super::TestCx;
impl TestCx<'_> {
pub(super) fn run_codegen_test(&self) {
@@ -11,12 +11,11 @@ pub(super) fn run_codegen_test(&self) {
self.fatal_proc_rec("compilation failed!", &proc_res);
}
if let Some(PassMode::Build) = self.pass_mode() {
return;
}
let proc_res = self.verify_with_filecheck(&output_path);
if !proc_res.status.success() {
self.fatal_proc_rec("verification with 'FileCheck' failed", &proc_res);
if !self.props.skip_filecheck {
let proc_res = self.verify_with_filecheck(&output_path);
if !proc_res.status.success() {
self.fatal_proc_rec("verification with 'FileCheck' failed", &proc_res);
}
}
}
}
@@ -1,4 +1,5 @@
//@ build-pass
// FIXME: The FileCheck directives in this test are unchecked and probably broken.
//@ skip-filecheck
//@ only-aarch64
#![crate_type = "lib"]
#![allow(incomplete_features, internal_features)]
+1 -1
View File
@@ -3,7 +3,7 @@
//@ edition: 2021
//@ only-x86_64
//@ [mir-opt3]compile-flags: -Zmir-opt-level=3
//@ [mir-opt3]build-pass
//@ [mir-opt3] skip-filecheck
// mir-opt3 is a regression test for https://github.com/rust-lang/rust/issues/98016