Skip to content

Commit c58de78

Browse files
committed
[build-script] Add an option to build the Foundation tests in another mode
Use it in the linux CI presets to set them to Debug mode and speed up the linux CI, plus add a new preset which keeps building them in Release mode.
1 parent a8111e4 commit c58de78

File tree

6 files changed

+28
-2
lines changed

6 files changed

+28
-2
lines changed

utils/build-presets.ini

+8
Original file line numberDiff line numberDiff line change
@@ -913,6 +913,7 @@ indexstore-db
913913
sourcekit-lsp
914914
swiftdocc
915915
lit-args=-v --time-tests
916+
foundation-tests-build-type=Debug
916917

917918
# rdar://problem/31454823
918919
lldb-test-swift-only
@@ -935,6 +936,11 @@ mixin-preset=
935936

936937
skip-test-swiftdocc
937938

939+
[preset: buildbot_linux,release_foundation_tests]
940+
mixin-preset=buildbot_linux
941+
942+
foundation-tests-build-type=Release
943+
938944
[preset: buildbot_linux_crosscompile_wasm]
939945
mixin-preset=buildbot_linux
940946

@@ -1094,6 +1100,7 @@ install-swiftformat
10941100
reconfigure
10951101
test-optimized
10961102
skip-test-swiftdocc
1103+
foundation-tests-build-type=Debug
10971104

10981105
# gcc version on amazon linux 2 is too old to configure and build tablegen.
10991106
# Use the clang that we install in the path for macros
@@ -1202,6 +1209,7 @@ swiftsyntax
12021209
swiftformat
12031210
indexstore-db
12041211
sourcekit-lsp
1212+
foundation-tests-build-type=Debug
12051213

12061214
install-llvm
12071215
install-static-linux-config

utils/build_swift/build_swift/driver_arguments.py

+8
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,9 @@ def _apply_default_arguments(args):
9494
if args.foundation_build_variant is None:
9595
args.foundation_build_variant = args.build_variant
9696

97+
if args.foundation_tests_build_variant is None:
98+
args.foundation_tests_build_variant = args.build_variant
99+
97100
if args.libdispatch_build_variant is None:
98101
args.libdispatch_build_variant = args.build_variant
99102

@@ -955,6 +958,11 @@ def create_argument_parser():
955958
const='Debug',
956959
help='build the Debug variant of Foundation')
957960

961+
option('--foundation-tests-build-type', store('foundation_tests_build_variant'),
962+
choices=['Debug','Release'],
963+
default=None,
964+
help='build the Foundation tests in a certain variant (Debug builds much faster)')
965+
958966
option('--debug-libdispatch', store('libdispatch_build_variant'),
959967
const='Debug',
960968
help='build the Debug variant of libdispatch')

utils/build_swift/tests/build_swift/test_driver_arguments.py

+1
Original file line numberDiff line numberDiff line change
@@ -542,6 +542,7 @@ def test_implied_defaults_build_variant(self):
542542

543543
self.assertEqual(namespace.cmark_build_variant, 'Debug')
544544
self.assertEqual(namespace.foundation_build_variant, 'Debug')
545+
self.assertEqual(namespace.foundation_tests_build_variant, 'Debug')
545546
self.assertEqual(namespace.libdispatch_build_variant, 'Debug')
546547
self.assertEqual(namespace.lldb_build_variant, 'Debug')
547548
self.assertEqual(namespace.llvm_build_variant, 'Debug')

utils/build_swift/tests/expected_options.py

+3
Original file line numberDiff line numberDiff line change
@@ -201,6 +201,7 @@
201201
'swift_debuginfo_non_lto_args': None,
202202
'force_optimized_typechecker': False,
203203
'foundation_build_variant': 'Debug',
204+
'foundation_tests_build_variant': 'Debug',
204205
'host_cc': None,
205206
'host_cxx': None,
206207
'host_libtool': None,
@@ -782,6 +783,8 @@ class BuildScriptImplOption(_BaseOption):
782783
choices=['false', 'not-merged', 'merged']),
783784
ChoicesOption('--android-arch',
784785
choices=['armv7', 'aarch64', 'x86_64']),
786+
ChoicesOption('--foundation-tests-build-type',
787+
dest='foundation_tests_build_variant', choices=['Debug', 'Release']),
785788

786789
StrOption('--android-api-level'),
787790
StrOption('--build-args'),

utils/swift_build_support/swift_build_support/products/foundationtests.py

+4-1
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,10 @@ def should_test(self, host_target):
5353
return self.args.test_foundation
5454

5555
def configuration(self):
56-
return 'release' if self.is_release() else 'debug'
56+
if self.args.foundation_tests_build_variant in ['Release', 'RelWithDebInfo']:
57+
return 'release'
58+
else:
59+
return 'debug'
5760

5861
def test(self, host_target):
5962
swift_exec = os.path.join(

utils/swift_build_support/swift_build_support/products/swiftfoundationtests.py

+4-1
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,10 @@ def should_test(self, host_target):
5353
return self.args.test_foundation
5454

5555
def configuration(self):
56-
return 'release' if self.is_release() else 'debug'
56+
if self.args.foundation_tests_build_variant in ['Release', 'RelWithDebInfo']:
57+
return 'release'
58+
else:
59+
return 'debug'
5760

5861
def test(self, host_target):
5962
swift_exec = os.path.join(

0 commit comments

Comments
 (0)