Skip to content

Commit 02359f4

Browse files
committed
test: Improve error messages in Swift feature usage verification script
* Place 'error: ' after file name. * Be more clear about what's wrong and where.
1 parent 64dcce3 commit 02359f4

File tree

1 file changed

+19
-4
lines changed

1 file changed

+19
-4
lines changed

test/Misc/verify-swift-feature-testing.test-sh

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -93,12 +93,24 @@ def check_test_file(test_file, existing_swift_features):
9393

9494
for feature in enabled_features.difference(existing_swift_features):
9595
enabled_features.remove(feature)
96-
print(f"error: {test_file}: Unknown feature in RUN line: {feature}")
96+
97+
# Be careful to not use RUN with a colon after it or Lit will pick
98+
# it up.
99+
print(
100+
f"{test_file}: error: unknown feature '{feature}' enabled in 'RUN"
101+
+ ":' line"
102+
)
97103
had_error = True
98104

99105
for feature in required_features.difference(existing_swift_features):
100106
required_features.remove(feature)
101-
print(f"error: {test_file}: Unknown feature in REQUIRES line: {feature}")
107+
108+
# Be careful to not use REQUIRES with a colon after it or Lit will pick
109+
# it up.
110+
print(
111+
f"{test_file}: error: unknown feature '{feature}' in 'REQUIRES"
112+
+ f":' line: swift_feature_{feature}"
113+
)
102114
had_error = True
103115

104116
# If the sets are equal, we're fine.
@@ -110,12 +122,15 @@ def check_test_file(test_file, existing_swift_features):
110122
for feature in enabled_features.difference(required_features):
111123
# Be careful to not use REQUIRES with a colon after it or Lit will pick
112124
# it up.
113-
print(f"error: {test_file}: Missing 'REQUIRES" + f": swift_feature_{feature}'")
125+
print(
126+
f"{test_file}: error: file enables '{feature}' but is missing '// REQUIRES"
127+
+ f": swift_feature_{feature}'"
128+
)
114129
had_error = True
115130

116131
for feature in required_features.difference(enabled_features):
117132
print(
118-
f"error: {test_file}: Missing '-enable-(experimental|upcoming)-feature: {feature}'"
133+
f"{test_file}: error: file requires 'swift_feature_{feature}' but does not enable '{feature}'"
119134
)
120135
had_error = True
121136

0 commit comments

Comments
 (0)