Skip to content

Commit 6cb38ed

Browse files
authored
Merge pull request #83622 from kavon/kavon/test-opaque-values
test: provide an opaque-values testing mode
2 parents 723e1d9 + c3e0ce5 commit 6cb38ed

File tree

7 files changed

+30
-0
lines changed

7 files changed

+30
-0
lines changed

test/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -348,6 +348,7 @@ set(profdata_merge_worker
348348

349349
set(TEST_MODES
350350
optimize_none optimize optimize_unchecked optimize_size
351+
optimize_none_with_opaque_values
351352
optimize_none_with_implicit_dynamic
352353
optimize_with_implicit_dynamic
353354
only_executable only_non_executable

test/lit.cfg

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -925,6 +925,11 @@ if swift_test_mode == 'optimize_none':
925925
# optimize mode for a cpu.
926926
config.available_features.add("swift_test_mode_optimize_none_" + run_cpu)
927927
swift_execution_tests_extra_flags = ''
928+
elif swift_test_mode == 'optimize_none_with_opaque_values':
929+
config.available_features.add("executable_test")
930+
config.limit_to_features.add("executable_test")
931+
config.available_features.add("swift_test_mode_optimize_none_with_opaque_values")
932+
swift_execution_tests_extra_flags = '-Xfrontend -enable-sil-opaque-values'
928933
elif swift_test_mode == 'optimize_none_with_implicit_dynamic':
929934
config.available_features.add("executable_test")
930935
config.limit_to_features.add("executable_test")

utils/build_swift/build_swift/driver_arguments.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -203,6 +203,9 @@ def _apply_default_arguments(args):
203203
if args.test_optimize_none_with_implicit_dynamic:
204204
args.test = True
205205

206+
if args.test_optimize_none_with_opaque_values:
207+
args.test = True
208+
206209
# If none of tests specified skip swift stdlib test on all platforms
207210
if not args.test and not args.validation_test and not args.long_test:
208211
args.test_linux = False
@@ -1149,6 +1152,12 @@ def create_argument_parser():
11491152
help='run the test suite in optimize none with implicit dynamic'
11501153
'mode too (implies --test)')
11511154

1155+
# NOTE: this mode is meant to aid the bring-up of opaque values
1156+
# and once its enabled by default, we can remove this.
1157+
option('--test-optimize-none-with-opaque-values', toggle_true,
1158+
help='run the executable tests again, compiling them with '
1159+
'-enable-sil-opaque-values (implies --test)')
1160+
11521161
option('--long-test', toggle_true,
11531162
help='run the long test suite')
11541163

utils/build_swift/tests/build_swift/test_driver_arguments.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -605,6 +605,11 @@ def test_implied_defaults_test_optimize_none_with_implicit_dynamic(self):
605605
['--test-optimize-none-with-implicit-dynamic'])
606606
self.assertTrue(namespace.test)
607607

608+
def test_implied_defaults_test_optimize_none_with_opaque_values(self):
609+
namespace = self.parse_default_args(
610+
['--test-optimize-none-with-opaque-values'])
611+
self.assertTrue(namespace.test)
612+
608613
def test_implied_defaults_skip_all_tests(self):
609614
namespace = self.parse_default_args([
610615
'--test', '0',

utils/build_swift/tests/expected_options.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -314,6 +314,7 @@
314314
'test_linux_static': False,
315315
'test_optimize_for_size': None,
316316
'test_optimize_none_with_implicit_dynamic': None,
317+
'test_optimize_none_with_opaque_values': False,
317318
'test_optimized': None,
318319
'test_osx': False,
319320
'test_paths': [],
@@ -545,6 +546,8 @@ class BuildScriptImplOption(_BaseOption):
545546
SetOption('-s', dest='test_optimize_for_size', value=True),
546547
SetOption('-y',
547548
dest='test_optimize_none_with_implicit_dynamic', value=True),
549+
SetOption('--test-optimize-none-with-opaque-values',
550+
dest='test_optimize_none_with_opaque_values', value=True),
548551
SetOption('-t', dest='test', value=True),
549552
SetOption('-a', dest='assertions', value=True),
550553

@@ -709,6 +712,7 @@ class BuildScriptImplOption(_BaseOption):
709712
EnableOption('--test'),
710713
EnableOption('--test-optimize-for-size'),
711714
EnableOption('--test-optimize-none-with-implicit-dynamic'),
715+
EnableOption('--test-optimize-none-with-opaque-values'),
712716
EnableOption('--test-optimized'),
713717
EnableOption('--tvos'),
714718
EnableOption('--validation-test'),

utils/run-test

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ TEST_MODES = [
2525
'optimize_none',
2626
'optimize',
2727
'optimize_unchecked',
28+
'optimize_none_with_opaque_values',
2829
'only_executable',
2930
'only_non_executable',
3031
]

utils/swift_build_support/swift_build_support/host_specific_configuration.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -215,6 +215,11 @@ def __init__(self, host_target, args, stage_dependent_args=None):
215215
self.swift_test_run_targets.append(
216216
"check-swift{}-optimize_none_with_implicit_dynamic-{}"
217217
.format(subset_suffix, name))
218+
if args.test_optimize_none_with_opaque_values and \
219+
not test_host_only:
220+
self.swift_test_run_targets.append(
221+
"check-swift{}-optimize_none_with_opaque_values-{}"
222+
.format(subset_suffix, name))
218223

219224
# Only pull in these flags when cross-compiling with
220225
# --cross-compile-hosts.

0 commit comments

Comments
 (0)