Skip to content

Commit ddf0e13

Browse files
authored
Merge pull request swiftlang#82278 from edymtt/edymtt/add-llvmtestingsupport-only-when-available
[build-script] build LLVMTestingSupport only if target is generated
2 parents c78ed1c + 1218df3 commit ddf0e13

File tree

4 files changed

+17
-8
lines changed

4 files changed

+17
-8
lines changed

utils/build-script-impl

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,6 @@ KNOWN_SETTINGS=(
175175
skip-clean-xctest "0" "skip cleaning the xctest build"
176176

177177
## Test Options
178-
llvm-include-tests "1" "Set to true to generate testing targets for LLVM. Set to true by default."
179178
long-test "0" "set to run the long test suite"
180179
only-executable-test "" "only run the executable variant of the swift lit tests"
181180
stress-test "0" "set to run the stress test suite"

utils/build_swift/build_swift/driver_arguments.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1421,8 +1421,14 @@ def create_argument_parser():
14211421
'Can be called multiple times '
14221422
'to add multiple such options.')
14231423

1424-
option('--no-llvm-include-tests', toggle_false('llvm_include_tests'),
1425-
help='do not generate testing targets for LLVM')
1424+
with mutually_exclusive_group():
1425+
set_defaults(llvm_include_tests=True)
1426+
1427+
option('--no-llvm-include-tests', toggle_false('llvm_include_tests'),
1428+
help='do not generate testing targets for LLVM')
1429+
1430+
option('--llvm-include-tests', toggle_true('llvm_include_tests'),
1431+
help='generate testing targets for LLVM')
14261432

14271433
option('--llvm-cmake-options', append,
14281434
type=argparse.ShellSplitType(),

utils/build_swift/tests/expected_options.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -557,7 +557,8 @@ class BuildScriptImplOption(_BaseOption):
557557
SetOption('--no-swift-stdlib-strict-availability',
558558
dest='swift_stdlib_strict_availability', value=False),
559559

560-
SetFalseOption('--no-llvm-include-tests', dest='llvm_include_tests'),
560+
DisableOption('--no-llvm-include-tests', dest='llvm_include_tests'),
561+
EnableOption('--llvm-include-tests', dest='llvm_include_tests'),
561562

562563
SetTrueOption('--install-back-deploy-concurrency',
563564
dest='install_backdeployconcurrency'),

utils/swift_build_support/swift_build_support/products/llvm.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -271,10 +271,7 @@ def build(self, host_target):
271271
'llvm-size'
272272
])
273273
else:
274-
# We build LLVMTestingSupport unconditionally
275-
# to support scenarios where tests are run
276-
# outside of `build-script` (e.g. with `run-test`)
277-
build_targets = ['all', 'LLVMTestingSupport']
274+
build_targets = ['all']
278275

279276
if self.args.llvm_ninja_targets_for_cross_compile_hosts and \
280277
self.is_cross_compile_target(host_target):
@@ -422,6 +419,12 @@ def build(self, host_target):
422419
llvm_cmake_options.define('LLVM_INCLUDE_TESTS', 'NO')
423420
llvm_cmake_options.define('CLANG_INCLUDE_TESTS', 'NO')
424421

422+
if ("-DLLVM_INCLUDE_TESTS=NO" not in llvm_cmake_options
423+
and "-DLLVM_INCLUDE_TESTS:BOOL=FALSE" not in llvm_cmake_options):
424+
# This supports scenarios where tests are run
425+
# outside of `build-script` (e.g. with `run-test`)
426+
build_targets.append('LLVMTestingSupport')
427+
425428
build_root = os.path.dirname(self.build_dir)
426429
host_machine_target = targets.StdlibDeploymentTarget.host_target().name
427430
host_build_dir = os.path.join(build_root, 'llvm-{}'.format(

0 commit comments

Comments
 (0)