Skip to content

Commit 48415c9

Browse files
authored
Merge pull request #76740 from drodriguez/test-swift-features
[test] Improve testing of Swift features
2 parents 3eabc0b + 2f62bf4 commit 48415c9

File tree

733 files changed

+1268
-297
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

733 files changed

+1268
-297
lines changed

docs/Testing.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -549,6 +549,27 @@ FIXME: full list.
549549
* ``XFAIL: linux``: tests that need to be adapted for Linux, for example parts
550550
that depend on Objective-C interop need to be split out.
551551

552+
#### Features ``REQUIRES: swift_feature_...``
553+
554+
Each of the Swift compiler features defined in `include/swift/Basic/Features.def`
555+
will get a LLVM Lit feature prefixing `swift_feature_` to the feature name
556+
automatically. The LLVM Lit features will be available only in those
557+
configurations where the compiler supports the given feature, and will not be
558+
available when the compiler does not support the feature. This means that
559+
standard language features and upcoming features will always be available,
560+
while experimental features will only be available when the compiler supports
561+
them.
562+
563+
For every test that uses `--enable-experimental-feature` or
564+
`--enable-upcoming-feature` add a `REQUIRES: swift_feature_...` for each of the
565+
used features. The `Misc/verify-swift-feature-testing.test-sh` will check that
566+
every test with those command line arguments have the necessary `REQUIRES:` and
567+
fail otherwise.
568+
569+
Do NOT add `REQUIRES: asserts` for experimental features anymore. The correct
570+
usage of `REQUIRES: swift_feature_...` will take care of testing the feature as
571+
it evolves from experimental, to upcoming, to language feature.
572+
552573
#### Feature ``REQUIRES: executable_test``
553574

554575
This feature marks an executable test. The test harness makes this feature

test/ASTGen/attrs.swift

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,8 @@
1212

1313
// REQUIRES: executable_test
1414
// REQUIRES: swift_swift_parser
15+
// REQUIRES: swift_feature_ParserASTGen
1516

16-
// -enable-experimental-feature requires an asserts build
17-
// REQUIRES: asserts
1817
// rdar://116686158
1918
// UNSUPPORTED: asan
2019

test/ASTGen/decls.swift

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,10 @@
1313

1414
// REQUIRES: executable_test
1515
// REQUIRES: swift_swift_parser
16+
// REQUIRES: swift_feature_ParserASTGen
17+
// REQUIRES: swift_feature_SwiftParser
18+
// REQUIRES: swift_feature_ValueGenerics
1619

17-
// -enable-experimental-feature requires an asserts build
18-
// REQUIRES: asserts
1920
// rdar://116686158
2021
// UNSUPPORTED: asan
2122

test/ASTGen/diagnostics.swift

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,7 @@
1212
// RUN: %target-typecheck-verify-swift -disable-availability-checking -enable-bare-slash-regex -enable-experimental-feature ParserASTGen
1313

1414
// REQUIRES: swift_swift_parser
15-
// -enable-experimental-feature requires an asserts build
16-
// REQUIRES: asserts
15+
// REQUIRES: swift_feature_ParserASTGen
1716
// rdar://116686158
1817
// UNSUPPORTED: asan
1918

test/ASTGen/do_expr.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@
1212
// RUN: %target-typecheck-verify-swift -disable-availability-checking -enable-experimental-feature DoExpressions -enable-experimental-feature ParserASTGen
1313

1414
// REQUIRES: swift_swift_parser
15-
// -enable-experimental-feature requires an asserts build
16-
// REQUIRES: asserts
15+
// REQUIRES: swift_feature_DoExpressions
16+
// REQUIRES: swift_feature_ParserASTGen
1717
// rdar://116686158
1818
// UNSUPPORTED: asan
1919

test/ASTGen/exprs.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,9 @@
1313

1414
// REQUIRES: executable_test
1515
// REQUIRES: swift_swift_parser
16+
// REQUIRES: swift_feature_ParserASTGen
17+
// REQUIRES: swift_feature_SwiftParser
1618

17-
// -enable-experimental-feature requires an asserts build
18-
// REQUIRES: asserts
1919
// rdar://116686158
2020
// UNSUPPORTED: asan
2121

test/ASTGen/if_config.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// RUN: %target-typecheck-verify-swift -enable-experimental-feature ParserASTGen -DDISCARDABLE -DNONSENDABLE -swift-version 6
2-
/// -enable-experimental-feature requires an asserts build
3-
// REQUIRES: asserts
2+
3+
// REQUIRES: swift_feature_ParserASTGen
44

55
#if NOT_SET
66
func f { } // expected-error{{expected parameter clause in function signature}}

test/ASTGen/if_config_expr.swift

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
// RUN: %target-typecheck-verify-swift -enable-experimental-feature ParserASTGen -D CONDITION_1
22

3-
// -enable-experimental-feature requires an asserts build
4-
// REQUIRES: asserts
53
// REQUIRES: swift_swift_parser
4+
// REQUIRES: swift_feature_ParserASTGen
65

76
postfix operator ++
87
postfix func ++ (_: Int) -> Int { 0 }

test/ASTGen/macros.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
// REQUIRES: swift_swift_parser, asserts
2+
// REQUIRES: swift_feature_ParserASTGen
23

34
// RUN: %empty-directory(%t)
45

test/ASTGen/regex.swift

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,8 @@
1111
// RUN: %target-typecheck-verify-swift -enable-experimental-feature ParserASTGen -enable-bare-slash-regex -disable-availability-checking
1212

1313
// REQUIRES: swift_swift_parser
14+
// REQUIRES: swift_feature_ParserASTGen
1415

15-
// -enable-experimental-feature requires an asserts build
16-
// REQUIRES: asserts
1716
// rdar://116686158
1817
// UNSUPPORTED: asan
1918

0 commit comments

Comments
 (0)