Skip to content

Commit adbd96b

Browse files
committed
[build-script] Move building skstresstester to swift_build_support
1 parent 76a5896 commit adbd96b

File tree

6 files changed

+76
-70
lines changed

6 files changed

+76
-70
lines changed

utils/build-script

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -305,7 +305,6 @@ class BuildScriptInvocation(object):
305305
"--xctest-build-type", args.build_variant,
306306
"--swiftpm-build-type", args.build_variant,
307307
"--swiftsyntax-build-type", args.build_variant,
308-
"--skstresstester-build-type", args.build_variant,
309308
"--swiftevolve-build-type", args.build_variant,
310309
"--llbuild-build-type", args.build_variant,
311310
"--swift-enable-assertions", str(args.swift_assertions).lower(),
@@ -437,8 +436,6 @@ class BuildScriptInvocation(object):
437436
impl_args += ["--skip-build-swiftpm"]
438437
if not args.build_swiftsyntax:
439438
impl_args += ["--skip-build-swiftsyntax"]
440-
if not args.build_skstresstester:
441-
impl_args += ["--skip-build-skstresstester"]
442439
if not args.build_swiftevolve:
443440
impl_args += ["--skip-build-swiftevolve"]
444441
if not args.build_playgroundsupport:
@@ -485,7 +482,6 @@ class BuildScriptInvocation(object):
485482
"--skip-test-llbuild",
486483
"--skip-test-swiftpm",
487484
"--skip-test-swiftsyntax",
488-
"--skip-test-skstresstester",
489485
"--skip-test-swiftevolve",
490486
"--skip-test-xctest",
491487
"--skip-test-foundation",

utils/build-script-impl

Lines changed: 8 additions & 65 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,6 @@ KNOWN_SETTINGS=(
8383
# When this flag is set, the build-script will only build/install the swift-syntax parser
8484
# This is a temporary workaround of having a separate build product for swift-syntax parser
8585
skip-swiftsyntax-swiftside "" "skip building/installing the swift side of swiftsyntax"
86-
skstresstester-build-type "Debug" "the build variant for the SourceKit stress tester"
8786
swiftevolve-build-type "Debug" "the build variant for the swift-evolve tool"
8887
llbuild-enable-assertions "1" "enable assertions in llbuild"
8988
enable-asan "" "enable Address Sanitizer"
@@ -129,7 +128,6 @@ KNOWN_SETTINGS=(
129128
skip-build-libcxx "" "set to skip building libcxx"
130129
skip-build-swiftpm "" "set to skip building swiftpm"
131130
skip-build-swiftsyntax "" "set to skip building swiftSyntax"
132-
skip-build-skstresstester "" "set to skip building the SourceKit stress tester"
133131
skip-build-swiftevolve "" "set to skip building the swift-evolve tool"
134132
skip-build-xctest "" "set to skip building xctest"
135133
skip-build-foundation "" "set to skip building foundation"
@@ -145,7 +143,6 @@ KNOWN_SETTINGS=(
145143
skip-test-llbuild "" "set to skip testing llbuild"
146144
skip-test-swiftpm "" "set to skip testing swiftpm"
147145
skip-test-swiftsyntax "" "set to skip testing swiftSyntax"
148-
skip-test-skstresstester "" "set to skip testing the SourceKit stress tester"
149146
skip-test-swiftevolve "" "set to skip testing the swift-evolve tool"
150147
skip-test-xctest "" "set to skip testing xctest"
151148
skip-test-foundation "" "set to skip testing foundation"
@@ -206,7 +203,6 @@ KNOWN_SETTINGS=(
206203
install-swiftpm "" "whether to install swiftpm"
207204
install-swiftsyntax "" "whether to install swiftsyntax"
208205
skip-install-swiftsyntax-module "" "set to skip installing swiftsyntax modules"
209-
install-skstresstester "" "whether to install the SourceKit stress tester"
210206
install-swiftevolve "" "whether to install the swift-evolve tool"
211207
install-xctest "" "whether to install xctest"
212208
install-foundation "" "whether to install foundation"
@@ -1200,7 +1196,6 @@ LLBUILD_SOURCE_DIR="${WORKSPACE}/llbuild"
12001196
SWIFTPM_SOURCE_DIR="${WORKSPACE}/swiftpm"
12011197
SWIFTSYNTAX_SOURCE_DIR="${WORKSPACE}/swift-syntax"
12021198
STRESSTEST_PACKAGE_DIR="${WORKSPACE}/swift-stress-tester"
1203-
SKSTRESSTESTER_SOURCE_DIR="${STRESSTEST_PACKAGE_DIR}/SourceKitStressTester"
12041199
SWIFTEVOLVE_SOURCE_DIR="${STRESSTEST_PACKAGE_DIR}/SwiftEvolve"
12051200
XCTEST_SOURCE_DIR="${WORKSPACE}/swift-corelibs-xctest"
12061201
FOUNDATION_SOURCE_DIR="${WORKSPACE}/swift-corelibs-foundation"
@@ -1254,9 +1249,8 @@ PRODUCTS=("${PRODUCTS[@]}" swift)
12541249
if [[ ! "${SKIP_BUILD_LLDB}" ]] ; then
12551250
PRODUCTS=("${PRODUCTS[@]}" lldb)
12561251
fi
1257-
# LLBuild, SwiftPM, SwiftSyntax, the SourceKit stress tester and XCTest are
1258-
# dependent on Foundation, so Foundation must be added to the list of build
1259-
# products first.
1252+
# LLBuild, SwiftPM, SwiftSyntax and XCTest are dependent on Foundation, so
1253+
# Foundation must be added to the list of build products first.
12601254
if [[ ! "${SKIP_BUILD_LIBDISPATCH}" ]] ; then
12611255
PRODUCTS=("${PRODUCTS[@]}" libdispatch)
12621256
if [[ -z "${SKIP_BUILD_SWIFT_STATIC_LIBDISPATCH}" ]] ; then
@@ -1275,24 +1269,21 @@ fi
12751269
if [[ ! "${SKIP_BUILD_PLAYGROUNDSUPPORT}" ]] ; then
12761270
PRODUCTS=("${PRODUCTS[@]}" playgroundsupport)
12771271
fi
1278-
# SwiftPM, SwiftSyntax and the SourceKit stress tester are dependent on XCTest,
1279-
# so XCTest must be added to the list of build products first.
1272+
# SwiftPM and SwiftSyntax are dependent on XCTest, so XCTest must be added to
1273+
# the list of build products first.
12801274
if [[ ! "${SKIP_BUILD_XCTEST}" ]] ; then
12811275
PRODUCTS=("${PRODUCTS[@]}" xctest)
12821276
fi
1283-
# SwiftSyntax and the SourceKit stress tester are dependent on SwiftPM, so
1284-
# SwiftPM must be added to the list of build products first.
1277+
# SwiftSyntax is dependent on SwiftPM, so SwiftPM must be added to the list of
1278+
# build products first.
12851279
if [[ ! "${SKIP_BUILD_SWIFTPM}" ]] ; then
12861280
PRODUCTS=("${PRODUCTS[@]}" swiftpm)
12871281
fi
1288-
# The SourceKit stress tester and swift-evolve are dependent on SwiftSyntax, so
1289-
# it must be added to the list of build products first.
1282+
# swift-evolve is dependent on SwiftSyntax, so it must be added to the list of
1283+
# build products first.
12901284
if [[ ! "${SKIP_BUILD_SWIFTSYNTAX}" ]] ; then
12911285
PRODUCTS=("${PRODUCTS[@]}" swiftsyntax)
12921286
fi
1293-
if [[ ! "${SKIP_BUILD_SKSTRESSTESTER}" ]] ; then
1294-
PRODUCTS=("${PRODUCTS[@]}" skstresstester)
1295-
fi
12961287
if [[ ! "${SKIP_BUILD_SWIFTEVOLVE}" ]] ; then
12971288
PRODUCTS=("${PRODUCTS[@]}" swiftevolve)
12981289
fi
@@ -1604,9 +1595,6 @@ function build_directory_bin() {
16041595
swiftsyntax)
16051596
echo "${root}/${SWIFTSYNTAX_BUILD_TYPE}/bin"
16061597
;;
1607-
skstresstester)
1608-
echo "${root}/${SKSTRESSTESTER_BUILD_TYPE}/bin"
1609-
;;
16101598
swiftevolve)
16111599
echo "${root}/${SWIFTEVOLVE_BUILD_TYPE}/bin"
16121600
;;
@@ -1755,9 +1743,6 @@ function cmake_config_opt() {
17551743
swiftsyntax)
17561744
echo "--config ${SWIFTSYNTAX_BUILD_TYPE}"
17571745
;;
1758-
skstresstester)
1759-
echo "--config ${SKSTRESSTESTER_BUILD_TYPE}"
1760-
;;
17611746
swiftevolve)
17621747
echo "--config ${SWIFTEVOLVE_BUILD_TYPE}"
17631748
;;
@@ -1922,11 +1907,6 @@ function set_stresstester_build_script_helper_command() {
19221907
--config="${config}")
19231908
}
19241909

1925-
function set_skstresstester_build_command() {
1926-
set_stresstester_build_script_helper_command SourceKitStressTester "${SKSTRESSTESTER_BUILD_TYPE}" "$(build_directory ${host} skstresstester)"
1927-
skstresstester_build_command=("${stresstester_build_script_helper_command[@]}")
1928-
}
1929-
19301910
function set_swiftevolve_build_command() {
19311911
set_stresstester_build_script_helper_command SwiftEvolve "${SWIFTEVOLVE_BUILD_TYPE}" "$(build_directory ${host} swiftevolve)"
19321912
swiftevolve_build_command=("${stresstester_build_script_helper_command[@]}")
@@ -2583,16 +2563,6 @@ for host in "${ALL_HOSTS[@]}"; do
25832563
set_swiftsyntax_build_command
25842564
call "${swiftsyntax_build_command[@]}"
25852565

2586-
continue
2587-
;;
2588-
skstresstester)
2589-
if [[ "$(uname -s)" != "Darwin" ]]; then
2590-
echo "error: unable to build swift-stress-tester on this platform"
2591-
continue
2592-
fi
2593-
set_skstresstester_build_command
2594-
call "${skstresstester_build_command[@]}"
2595-
25962566
continue
25972567
;;
25982568
swiftevolve)
@@ -3117,15 +3087,6 @@ for host in "${ALL_HOSTS[@]}"; do
31173087
# As swiftSyntax tests itself, we break early here.
31183088
continue
31193089
;;
3120-
skstresstester)
3121-
if [[ "${SKIP_TEST_SKSTRESSTESTER}" ]]; then
3122-
continue
3123-
fi
3124-
echo "--- Running tests for ${product} ---"
3125-
set_skstresstester_build_command
3126-
call "${skstresstester_build_command[@]}" test
3127-
continue
3128-
;;
31293090
swiftevolve)
31303091
if [[ "${SKIP_TEST_SWIFTEVOLVE}" ]]; then
31313092
continue
@@ -3491,24 +3452,6 @@ for host in "${ALL_HOSTS[@]}"; do
34913452
call "${swiftsyntax_build_command[@]}" --dylib-dir="${DYLIB_DIR}" --install
34923453
fi
34933454

3494-
continue
3495-
;;
3496-
skstresstester)
3497-
if [[ -z "${INSTALL_SKSTRESSTESTER}" ]] ; then
3498-
continue
3499-
fi
3500-
if [[ -z "${INSTALL_DESTDIR}" ]] ; then
3501-
echo "--install-destdir is required to install products."
3502-
exit 1
3503-
fi
3504-
if [[ -z "${INSTALL_SWIFTSYNTAX}" ]] ; then
3505-
echo "--install-swiftsyntax is required to install the SourceKit stress tester"
3506-
exit 1
3507-
fi
3508-
3509-
echo "--- Installing ${product} ---"
3510-
set_skstresstester_build_command
3511-
call "${skstresstester_build_command[@]}" --prefix="${host_install_destdir}${host_install_prefix}" install
35123455
continue
35133456
;;
35143457
swiftevolve)

utils/build_swift/driver_arguments.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -205,6 +205,7 @@ def _apply_default_arguments(args):
205205
args.test_android = False
206206
args.test_indexstoredb = False
207207
args.test_sourcekitlsp = False
208+
args.test_skstresstester = False
208209

209210
# --skip-test-ios is merely a shorthand for host and simulator tests.
210211
if not args.test_ios:
@@ -568,6 +569,8 @@ def create_argument_parser():
568569
help='build SourceKitLSP')
569570
option(['--install-sourcekit-lsp'], toggle_true('install_sourcekitlsp'),
570571
help='install SourceKitLSP')
572+
option(['--install-skstresstester'], toggle_true('install_skstresstester'),
573+
help='install the SourceKit stress tester')
571574
option(['--toolchain-benchmarks'],
572575
toggle_true('build_toolchainbenchmarks'),
573576
help='build Swift Benchmarks using swiftpm against the just built '
@@ -955,6 +958,8 @@ def create_argument_parser():
955958
help='skip testing indexstore-db')
956959
option('--skip-test-sourcekit-lsp', toggle_false('test_sourcekitlsp'),
957960
help='skip testing sourcekit-lsp')
961+
option('--skip-test-skstresstester', toggle_false('test_skstresstester'),
962+
help='skip testing the SourceKit Stress tester')
958963

959964
# -------------------------------------------------------------------------
960965
in_group('Build settings specific for LLVM')

utils/build_swift/tests/expected_options.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,7 @@
8989
'build_indexstoredb': False,
9090
'build_sourcekitlsp': False,
9191
'install_sourcekitlsp': False,
92+
'install_skstresstester': False,
9293
'build_toolchainbenchmarks': False,
9394
'build_tvos': True,
9495
'build_tvos_device': False,
@@ -205,6 +206,7 @@
205206
'test_watchos_simulator': False,
206207
'test_indexstoredb': False,
207208
'test_sourcekitlsp': False,
209+
'test_skstresstester': False,
208210
'tvos': False,
209211
'tvos_all': False,
210212
'validation_test': None,
@@ -464,6 +466,7 @@ class IgnoreOption(_BaseOption):
464466
EnableOption('--indexstore-db', dest='build_indexstoredb'),
465467
EnableOption('--sourcekit-lsp', dest='build_sourcekitlsp'),
466468
EnableOption('--install-sourcekit-lsp', dest='install_sourcekitlsp'),
469+
EnableOption('--install-skstresstester', dest='install_skstresstester'),
467470
EnableOption('--toolchain-benchmarks', dest='build_toolchainbenchmarks'),
468471
EnableOption('--tsan-libdispatch-test'),
469472
EnableOption('--long-test'),
@@ -520,6 +523,7 @@ class IgnoreOption(_BaseOption):
520523
dest='test_watchos_simulator'),
521524
DisableOption('--skip-test-indexstore-db', dest='test_indexstoredb'),
522525
DisableOption('--skip-test-sourcekit-lsp', dest='test_sourcekitlsp'),
526+
DisableOption('--skip-test-skstresstester', dest='test_skstresstester'),
523527

524528
ChoicesOption('--android-ndk-gcc-version',
525529
choices=['4.8', '4.9']),

utils/swift_build_support/swift_build_support/products/skstresstester.py

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,12 @@
1010
#
1111
# ----------------------------------------------------------------------------
1212

13+
import os
14+
import platform
15+
1316
from . import product
17+
from .. import shell
18+
from .. import targets
1419

1520

1621
class SKStressTester(product.Product):
@@ -21,3 +26,56 @@ def product_source_name(cls):
2126
The name of the source code directory of this product.
2227
"""
2328
return "swift-stress-tester"
29+
30+
def run_build_script_helper(self, action, additional_params=[]):
31+
script_path = os.path.join(
32+
self.source_dir, 'build-script-helper.py')
33+
34+
toolchain_path = targets.toolchain_path(self.args.install_destdir,
35+
self.args.install_prefix)
36+
37+
configuration = 'debug' if self.args.build_variant == 'Debug' else \
38+
'release'
39+
40+
helper_cmd = [
41+
script_path,
42+
action,
43+
'--package-dir', 'SourceKitStressTester',
44+
'--toolchain', toolchain_path,
45+
'--config', configuration,
46+
'--build-dir', self.build_dir,
47+
]
48+
if self.args.verbose_build:
49+
helper_cmd.append('--verbose')
50+
helper_cmd.extend(additional_params)
51+
52+
shell.call(helper_cmd)
53+
54+
@classmethod
55+
def is_build_script_impl_product(cls):
56+
return False
57+
58+
def should_build(self, host_target):
59+
return True
60+
61+
def build(self, host_target):
62+
if platform.system() != 'Darwin':
63+
raise RuntimeError("Unable to build swift-stress-tester on a "
64+
"platform other than Darwin")
65+
66+
self.run_build_script_helper('build')
67+
68+
def should_test(self, host_target):
69+
return self.args.test_skstresstester
70+
71+
def test(self, host_target):
72+
self.run_build_script_helper('test')
73+
74+
def should_install(self, host_target):
75+
return self.args.install_skstresstester
76+
77+
def install(self, host_target):
78+
install_prefix = self.args.install_destdir + self.args.install_prefix
79+
self.run_build_script_helper('install', [
80+
'--prefix', install_prefix
81+
])

utils/swift_build_support/swift_build_support/products/swiftevolve.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# swift_build_support/products/skstresstester.py -----------------*- python -*-
1+
# swift_build_support/products/swiftevolve.py --------------------*- python -*-
22
#
33
# This source file is part of the Swift.org open source project
44
#

0 commit comments

Comments
 (0)