Skip to content

Commit 1e8cd1f

Browse files
committed
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.
1 parent eb6eed4 commit 1e8cd1f

7 files changed

Lines changed: 16 additions & 15 deletions

File tree

src/doc/rustc-dev-guide/src/tests/directives.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -327,7 +327,7 @@ The following directives affect how certain command-line tools are invoked, in
327327
test suites that use those tools:
328328

329329
- `skip-filecheck` avoids running LLVM's `FileCheck` tool in tests that would normally run it to check output.
330-
- Used by mir-opt tests.
330+
- Used by codegen tests, assembly tests, and mir-opt tests.
331331
- `filecheck-flags` adds extra flags when running LLVM's `FileCheck` tool.
332332
- Used by [codegen tests](compiletest.md#codegen-tests),
333333
[assembly tests](compiletest.md#assembly-tests), and

src/tools/compiletest/src/directives.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -442,7 +442,6 @@ impl TestProps {
442442
let check_no_run = |s| match (config.mode, s) {
443443
(TestMode::Ui, _) => (),
444444
(TestMode::Crashes, _) => (),
445-
(TestMode::Codegen, "build-pass") => (),
446445
(mode, _) => panic!("`{s}` directive is not supported in `{mode}` tests"),
447446
};
448447
let pass_mode = if config.parse_name_directive(ln, "check-pass") {

src/tools/compiletest/src/directives/handlers.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -316,7 +316,7 @@ fn make_directive_handlers_map() -> HashMap<&'static str, Handler> {
316316
let directive_name = ln.name;
317317
// FIXME(Zalathar): Someday we should add unified support for declaring
318318
// and checking which modes are supported by each directive.
319-
if !matches!(config.mode, TestMode::MirOpt) {
319+
if !matches!(config.mode, TestMode::Assembly | TestMode::Codegen | TestMode::MirOpt) {
320320
panic!(
321321
"directive `//@ {directive_name}` is not supported by this test suite (mode: {mode:?})",
322322
mode = config.mode

src/tools/compiletest/src/runtest/assembly.rs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,11 @@ impl TestCx<'_> {
1313
self.fatal_proc_rec("compilation failed!", &proc_res);
1414
}
1515

16-
let proc_res = self.verify_with_filecheck(&output_path);
17-
if !proc_res.status.success() {
18-
self.fatal_proc_rec("verification with 'FileCheck' failed", &proc_res);
16+
if !self.props.skip_filecheck {
17+
let proc_res = self.verify_with_filecheck(&output_path);
18+
if !proc_res.status.success() {
19+
self.fatal_proc_rec("verification with 'FileCheck' failed", &proc_res);
20+
}
1921
}
2022
}
2123

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
use super::{PassMode, TestCx};
1+
use super::TestCx;
22

33
impl TestCx<'_> {
44
pub(super) fn run_codegen_test(&self) {
@@ -11,12 +11,11 @@ impl TestCx<'_> {
1111
self.fatal_proc_rec("compilation failed!", &proc_res);
1212
}
1313

14-
if let Some(PassMode::Build) = self.pass_mode() {
15-
return;
16-
}
17-
let proc_res = self.verify_with_filecheck(&output_path);
18-
if !proc_res.status.success() {
19-
self.fatal_proc_rec("verification with 'FileCheck' failed", &proc_res);
14+
if !self.props.skip_filecheck {
15+
let proc_res = self.verify_with_filecheck(&output_path);
16+
if !proc_res.status.success() {
17+
self.fatal_proc_rec("verification with 'FileCheck' failed", &proc_res);
18+
}
2019
}
2120
}
2221
}

tests/codegen-llvm/scalable-vectors/tuple-intrinsics.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
//@ build-pass
1+
// FIXME: The FileCheck directives in this test are unchecked and probably broken.
2+
//@ skip-filecheck
23
//@ only-aarch64
34
#![crate_type = "lib"]
45
#![allow(incomplete_features, internal_features)]

tests/codegen-llvm/simd/simd-wide-sum.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
//@ edition: 2021
44
//@ only-x86_64
55
//@ [mir-opt3]compile-flags: -Zmir-opt-level=3
6-
//@ [mir-opt3]build-pass
6+
//@ [mir-opt3] skip-filecheck
77

88
// mir-opt3 is a regression test for https://github.com/rust-lang/rust/issues/98016
99

0 commit comments

Comments
 (0)