Skip to content

Commit 49fb660

Browse files
committed
[build] Build the foundation tests in debug mode instead
1 parent aeeeb81 commit 49fb660

File tree

6 files changed

+27
-2
lines changed

6 files changed

+27
-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

+7
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,10 @@ 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+
default=None,
963+
help='build the Foundation tests in a certain variant (Debug builds much faster)')
964+
958965
option('--debug-libdispatch', store('libdispatch_build_variant'),
959966
const='Debug',
960967
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,
@@ -486,6 +487,8 @@ class BuildScriptImplOption(_BaseOption):
486487
SetOption('--debug-cmark', dest='cmark_build_variant', value='Debug'),
487488
SetOption('--debug-foundation',
488489
dest='foundation_build_variant', value='Debug'),
490+
SetOption('--foundation-tests-build-type',
491+
dest='foundation_tests_build_variant', value='Debug'),
489492
SetOption('--debug-libdispatch',
490493
dest='libdispatch_build_variant', value='Debug'),
491494
SetOption('--debug-libxml2', dest='libxml2_build_variant', value='Debug'),

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)