Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit b978498

Browse files
Rollup merge of #134463 - jieyouxu:filecheck-prefix, r=Zalathar
compiletest: don't register predefined `MSVC`/`NONMSVC` FileCheck prefixes This was fragile as it was based on host target passed to compiletest, but the user could cross-compile and run test for a different target (e.g. cross from linux to msvc, but msvc won't be set on the target). Furthermore, it was also very surprising as normally revision names (other than `CHECK`) was accepted as FileCheck prefixes. This partially reverts the `MSVC`/`NONMSVC` predefined FileCheck prefix registration introduced historically for some codegen tests. This makes some codegen tests more verbose since they now need to explicitly introduce `MSVC`/`NONMSVC` revisions, but I think that's less surprising, e.g.: ```rs //@ revisions: MSVC NONMSVC //`@[MSVC]` only-msvc //`@[NONMSVC]` ignore-msvc ``` Note that revisions are not *only* FileCheck prefixes in FileCheck-based test suites, as they also can be used to conditionally apply certain compiletest directives. r? `@Zalathar` (or reroll a `r/? compiletest` reviewer) try-job: x86_64-msvc try-job: i686-msvc try-job: x86_64-mingw-1 try-job: i686-mingw
2 parents 3bf62cc + 5415f06 commit b978498

File tree

13 files changed

+86
-67
lines changed

13 files changed

+86
-67
lines changed

‎src/tools/compiletest/src/runtest.rs‎

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1958,23 +1958,23 @@ impl<'test> TestCx<'test> {
19581958
let mut filecheck = Command::new(self.config.llvm_filecheck.as_ref().unwrap());
19591959
filecheck.arg("--input-file").arg(output).arg(&self.testpaths.file);
19601960

1961-
// FIXME: Consider making some of these prefix flags opt-in per test,
1962-
// via `filecheck-flags` or by adding new header directives.
1963-
19641961
// Because we use custom prefixes, we also have to register the default prefix.
19651962
filecheck.arg("--check-prefix=CHECK");
19661963

1967-
// Some tests use the current revision name as a check prefix.
1964+
// FIXME(#134510): auto-registering revision names as check prefix is a bit sketchy, and
1965+
// that having to pass `--allow-unused-prefix` is an unfortunate side-effect of not knowing
1966+
// whether the test author actually wanted revision-specific check prefixes or not.
1967+
//
1968+
// TL;DR We may not want to conflate `compiletest` revisions and `FileCheck` prefixes.
1969+
1970+
// HACK: tests are allowed to use a revision name as a check prefix.
19681971
if let Some(rev) = self.revision {
19691972
filecheck.arg("--check-prefix").arg(rev);
19701973
}
19711974

1972-
// Some tests also expect either the MSVC or NONMSVC prefix to be defined.
1973-
let msvc_or_not = if self.config.target.contains("msvc") { "MSVC" } else { "NONMSVC" };
1974-
filecheck.arg("--check-prefix").arg(msvc_or_not);
1975-
1976-
// The filecheck tool normally fails if a prefix is defined but not used.
1977-
// However, we define several prefixes globally for all tests.
1975+
// HACK: the filecheck tool normally fails if a prefix is defined but not used. However,
1976+
// sometimes revisions are used to specify *compiletest* directives which are not FileCheck
1977+
// concerns.
19781978
filecheck.arg("--allow-unused-prefixes");
19791979

19801980
// Provide more context on failures.

‎tests/codegen/async-fn-debug-awaitee-field.rs‎

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,12 @@
1-
// This test makes sure that the coroutine field capturing the awaitee in a `.await` expression
2-
// is called "__awaitee" in debuginfo. This name must not be changed since debuggers and debugger
3-
// extensions rely on the field having this name.
4-
51
// ignore-tidy-linelength
2+
//! This test makes sure that the coroutine field capturing the awaitee in a `.await` expression
3+
//! is called `__awaitee` in debuginfo. This name must not be changed since debuggers and debugger
4+
//! extensions rely on the field having this name.
5+
6+
//@ revisions: MSVC NONMSVC
7+
//@[MSVC] only-msvc
8+
//@[NONMSVC] ignore-msvc
9+
610
//@ compile-flags: -C debuginfo=2 --edition=2018 -Copt-level=0
711

812
#![crate_type = "lib"]

‎tests/codegen/debug-accessibility/crate-enum.rs‎

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
1-
//@ compile-flags: -C debuginfo=2
21
// ignore-tidy-linelength
2+
//! Checks that visibility information is present in the debuginfo for crate-visibility enums.
33
4-
#![allow(dead_code)]
4+
//@ revisions: MSVC NONMSVC
5+
//@[MSVC] only-msvc
6+
//@[NONMSVC] ignore-msvc
57

6-
// Checks that visibility information is present in the debuginfo for crate-visibility enums.
8+
//@ compile-flags: -C debuginfo=2
79

810
mod module {
911
use std::hint::black_box;

‎tests/codegen/debug-accessibility/private-enum.rs‎

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
1-
//@ compile-flags: -C debuginfo=2
21
// ignore-tidy-linelength
2+
//! Checks that visibility information is present in the debuginfo for private enums.
33
4-
#![allow(dead_code)]
5-
6-
// Checks that visibility information is present in the debuginfo for private enums.
4+
//@ revisions: MSVC NONMSVC
5+
//@[MSVC] only-msvc
6+
//@[NONMSVC] ignore-msvc
7+
//@ compile-flags: -C debuginfo=2
78

89
use std::hint::black_box;
910

‎tests/codegen/debug-accessibility/public-enum.rs‎

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
1-
//@ compile-flags: -C debuginfo=2
21
// ignore-tidy-linelength
2+
//! Checks that visibility information is present in the debuginfo for types and their fields.
33
4-
#![allow(dead_code)]
4+
//@ revisions: MSVC NONMSVC
5+
//@[MSVC] only-msvc
6+
//@[NONMSVC] ignore-msvc
57

6-
// Checks that visibility information is present in the debuginfo for types and their fields.
8+
//@ compile-flags: -C debuginfo=2
79

810
use std::hint::black_box;
911

‎tests/codegen/debug-accessibility/super-enum.rs‎

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
1-
//@ compile-flags: -C debuginfo=2
21
// ignore-tidy-linelength
2+
//! Checks that visibility information is present in the debuginfo for super-visibility enums.
33
4-
#![allow(dead_code)]
5-
6-
// Checks that visibility information is present in the debuginfo for super-visibility enums.
4+
//@ revisions: MSVC NONMSVC
5+
//@[MSVC] only-msvc
6+
//@[NONMSVC] ignore-msvc
7+
//@ compile-flags: -C debuginfo=2
78

89
mod module {
910
use std::hint::black_box;

‎tests/codegen/debug-vtable.rs‎

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,17 @@
1-
// This test checks the debuginfo for the expected 3 vtables is generated for correct names and number
2-
// of entries.
1+
// ignore-tidy-linelength
2+
//! This test checks the debuginfo for the expected 3 vtables is generated for correct names and
3+
//! number of entries.
4+
5+
//@ revisions: MSVC NONMSVC
6+
//@[MSVC] only-msvc
7+
//@[NONMSVC] ignore-msvc
38

49
// Use the v0 symbol mangling scheme to codegen order independent of rustc version.
510
// Unnamed items like shims are generated in lexicographical order of their symbol name and in the
611
// legacy mangling scheme rustc version and generic parameters are both hashed into a single part
712
// of the name, thus randomizing item order with respect to rustc version.
813

914
//@ compile-flags: -Cdebuginfo=2 -Copt-level=0 -Csymbol-mangling-version=v0
10-
// ignore-tidy-linelength
1115

1216
// Make sure that vtables don't have the unnamed_addr attribute when debuginfo is enabled.
1317
// This helps debuggers more reliably map from dyn pointer to concrete type.

‎tests/codegen/debuginfo-generic-closure-env-names.rs‎

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,17 @@
1-
// This test checks that we get proper type names for closure environments and
2-
// async-fn environments in debuginfo, especially making sure that generic arguments
3-
// of the enclosing functions don't get lost.
4-
//
5-
// Unfortunately, the order that debuginfo gets emitted into LLVM IR becomes a bit hard
6-
// to predict once async fns are involved, so DAG allows any order.
7-
//
8-
// Note that the test does not check async-fns when targeting MSVC because debuginfo for
9-
// those does not follow the enum-fallback encoding yet and thus is incomplete.
10-
111
// ignore-tidy-linelength
2+
//! This test checks that we get proper type names for closure environments and
3+
//! async-fn environments in debuginfo, especially making sure that generic arguments
4+
//! of the enclosing functions don't get lost.
5+
//!
6+
//! Unfortunately, the order that debuginfo gets emitted into LLVM IR becomes a bit hard
7+
//! to predict once async fns are involved, so DAG allows any order.
8+
//!
9+
//! Note that the test does not check async-fns when targeting MSVC because debuginfo for
10+
//! those does not follow the enum-fallback encoding yet and thus is incomplete.
11+
12+
//@ revisions: MSVC NONMSVC
13+
//@[MSVC] only-msvc
14+
//@[NONMSVC] ignore-msvc
1215

1316
// Use the v0 symbol mangling scheme to codegen order independent of rustc version.
1417
// Unnamed items like shims are generated in lexicographical order of their symbol name and in the

‎tests/codegen/issues/issue-98678-async.rs‎

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
1-
// This test verifies the accuracy of emitted file and line debuginfo metadata for async blocks and
2-
// async functions.
3-
//
1+
// ignore-tidy-linelength
2+
//! This test verifies the accuracy of emitted file and line debuginfo metadata for async blocks and
3+
//! async functions.
4+
5+
//@ revisions: MSVC NONMSVC
6+
//@[MSVC] only-msvc
7+
//@[NONMSVC] ignore-msvc
48
//@ edition:2021
59
//@ compile-flags: --crate-type=lib -Copt-level=0 -Cdebuginfo=2 -Zdebug-info-type-line-numbers=true
610

7-
// ignore-tidy-linelength
8-
911
// NONMSVC-DAG: ![[#FILE:]] = !DIFile({{.*}}filename:{{.*[/\\]}}issue-98678-async.rs{{".*}})
1012
// MSVC: ![[#FILE:]] = !DIFile({{.*}}filename:{{.*}}\\issue-98678-async.rs{{".*}})
1113

‎tests/codegen/issues/issue-98678-closure-coroutine.rs‎

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,13 @@
1-
// This test verifies the accuracy of emitted file and line debuginfo metadata for closures and
2-
// coroutines.
3-
//
4-
//@ compile-flags: --crate-type=lib -Copt-level=0 -Cdebuginfo=2 -Zdebug-info-type-line-numbers=true
1+
// ignore-tidy-linelength
2+
//! This test verifies the accuracy of emitted file and line debuginfo metadata for closures and
3+
//! coroutines.
4+
55
#![feature(coroutines, stmt_expr_attributes)]
66

7-
// ignore-tidy-linelength
7+
//@ revisions: MSVC NONMSVC
8+
//@[MSVC] only-msvc
9+
//@[NONMSVC] ignore-msvc
10+
//@ compile-flags: --crate-type=lib -Copt-level=0 -Cdebuginfo=2 -Zdebug-info-type-line-numbers=true
811

912
// NONMSVC-DAG: ![[#FILE:]] = !DIFile({{.*}}filename:{{.*[/\\]}}issue-98678-closure-coroutine.rs{{".*}})
1013
// MSVC-DAG: ![[#FILE:]] = !DIFile({{.*}}filename:{{.*}}\\issue-98678-closure-coroutine.rs{{".*}})

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /