Skip to content

Commit 247f2ba

Browse files
author
Nathan Hawes
committed
Add run_sk_stress_test script to run the stress tester over the source compatibility suite
The run_sk_stress_test script invokes runner.py passing sk-swiftc-wrapper to --swiftc. This wrapper invokes swiftc, forwarding its own arguments, and if it succeeds, additionally invokes sk-stress-test, which stress tests SourceKit on all the .swift files in the passed compiler arguments. As invoking swiftc and the stress tester takes significantly longer than swiftc alone, the script tries to bring down the runtime without sacrificing too much coverage by: 1. only running over the latest swift compatibilty version supported by each repo 2. only running over one of each set of platform-specific build actions (e.g. just RxSwift-macOS, rather than that + RxSwift-iOs, RxSift-tvOS, etc.) 3. only building generic/iOS actions for arm64, rather than arm64 and armv7 This patch also adds: - an addition option to override the default timeout for common.check_execute() and related helper methods - an optional 'tags' field on some actions that's used in combination with --include-acions to select the subset of actions to use in both a 'full' stress tester run, and the further reduced set for PR testing
1 parent 7706980 commit 247f2ba

File tree

7 files changed

+1757
-59
lines changed

7 files changed

+1757
-59
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,3 +14,4 @@ swift-corelibs-foundation/
1414
swift-corelibs-libdispatch/
1515
swift-corelibs-xctest/
1616
swiftpm/
17+
swift-stress-tester/

cleanup

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ def main():
5252
'swift-corelibs-foundation',
5353
'swift-corelibs-libdispatch',
5454
'swift-corelibs-xctest',
55+
'swift-stress-tester'
5556
]
5657

5758
if args.cleanup_cache:

common.py

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,12 @@ def set_swift_branch(branch):
143143
swift_branch = branch
144144

145145

146+
def set_default_execute_timeout(timeout):
147+
"""Override the default execute timeout"""
148+
global DEFAULT_EXECUTE_TIMEOUT
149+
DEFAULT_EXECUTE_TIMEOUT = timeout
150+
151+
146152
def clone_repos():
147153
"""Clone Swift and dependencies in parallel.
148154
@@ -299,14 +305,16 @@ def __str__(self):
299305
self.returncode))
300306

301307

302-
def execute(command, timeout=DEFAULT_EXECUTE_TIMEOUT,
308+
def execute(command, timeout=None,
303309
stdout=sys.stdout, stderr=sys.stderr,
304310
**kwargs):
305311
"""Execute a given command with an optional timeout in seconds.
306312
307313
>>> execute(['echo', 'Hello, World!'])
308314
0
309315
"""
316+
if timeout is None:
317+
timeout = DEFAULT_EXECUTE_TIMEOUT
310318
shell_debug_print(command, stderr=stderr)
311319
returncode = 124 # timeout return code
312320
try:
@@ -320,13 +328,15 @@ def execute(command, timeout=DEFAULT_EXECUTE_TIMEOUT,
320328
return returncode
321329

322330

323-
def check_execute_output(command, timeout=DEFAULT_EXECUTE_TIMEOUT,
331+
def check_execute_output(command, timeout=None,
324332
stdout=sys.stdout, stderr=sys.stderr, **kwargs):
325333
"""Check execute a given command and return its output.
326334
327335
>>> check_execute_output(['echo', 'Hello, World!'])
328336
'Hello, World!\\n'
329337
"""
338+
if timeout is None:
339+
timeout = DEFAULT_EXECUTE_TIMEOUT
330340
shell_debug_print(command, stderr=stderr)
331341
try:
332342
with Timeout(timeout):
@@ -339,7 +349,7 @@ def check_execute_output(command, timeout=DEFAULT_EXECUTE_TIMEOUT,
339349
return output
340350

341351

342-
def check_execute(command, timeout=DEFAULT_EXECUTE_TIMEOUT,
352+
def check_execute(command, timeout=None,
343353
sandbox_profile=None, max_retries=1,
344354
stdout=sys.stdout, stderr=sys.stderr,
345355
**kwargs):
@@ -348,6 +358,8 @@ def check_execute(command, timeout=DEFAULT_EXECUTE_TIMEOUT,
348358
>>> check_execute(['echo', 'Hello, World!'])
349359
0
350360
"""
361+
if timeout is None:
362+
timeout = DEFAULT_EXECUTE_TIMEOUT
351363
if sandbox_profile:
352364
if platform.system() == 'Darwin':
353365
command = ['sandbox-exec', '-f', sandbox_profile] + command

0 commit comments

Comments
 (0)