Swiftpack.co - Package - apple/swift-stress-tester
Swift logo

Swift Stress Tester

This project aims to provide stress testing utilities to help find reproducible crashes and other failures in tools that process Swift source code, such as the Swift compiler and SourceKit. These utilities will ideally be written in Swift and make use the SwiftSyntax and/or SwiftLang libraries to parse, generate and modify Swift source inputs.

Current tools

| Tool | Description | build-script Flag | Package Name | | --------- | ----------- | ----------------- | ----------------- | sk‑stress‑test | a utility for exercising a range of SourceKit functionality, such as code completion and local refactorings, at all applicable locations in a set of Swift source files. | --skstresstester | SourceKitStressTester | swift‑evolve | a utility to randomly modify Swift source files in ways libraries are permitted to evolve without breaking ABI compatibility. | --swiftevolve | SwiftEvolve |


The tools in this repository can be built in several different ways:

Using Swift's build-script

If you want to build the tools to use a locally built sourcekitd and SwiftLang, use the Swift repository's build-script to build and test the stress tester by passing --swiftsyntax and the desired tools' flags as extra options. To build and run tests, for example, you would run:

$ ./utils/build-script -t --swiftsyntax --skstresstester

For local development

For local development you'll first need to download and install a recent swift.org development snapshot toolchain. You'll also need to have the Swift and SwiftSyntax repositories checked out adjacent to the swift-stress-tester repository in the structure shown below:


Also make sure you've checked out the branch corresponding to the development snapshot you installed (e.g. master for trunk, or swift-5.0-branch for Swift 5.0) in all of these repositories.

Via Xcode

To generate an Xcode project that's set up correctly, run build-script-helper.py, passing the path to the swiftc executable in the downloaded toolchain via the --swiftc-exec option, the tool's package name in the --package-dir option, and the generate-xcodeproj action:

$ ./build-script-helper.py --package-dir SourceKitStressTester --swiftc-exec $TOOLCHAIN_DIR/usr/bin/swiftc generate-xcodeproj

This will generate SourceKitStressTester/SourceKitStressTester.xcodeproj. Open it and select the toolchain you installed from the Xcode > Toolchains menu, before building the SourceKitStressTester-Package scheme.

Via command line

To build, run build-script-helper.py, passing the path to the swiftc executable in the downloaded toolchain via the --swiftc-exec option and the tool's package name in the --package-dir option:

$ ./build-script-helper.py --package-dir SourceKitStressTester --swiftc-exec $TOOLCHAIN_DIR/usr/bin/swiftc

To run the tests, repeat the above command, but additionally pass the test action:

$ ./Utilities/build-script-helper.py --package-dir SourceKitStressTester --swiftc-exec $TOOLCHAIN_DIR/usr/bin/swiftc test


Building will create either one or two executables, depending on the package you build. These will be in the package directory's .build/debug sudbirectory if building on the command line or via the Swift repo's build-script, and under Products/Debug in the Xcode project's DerivedData directory if building there. They are also available in the usr/bin directory of recent trunk and swift 5.0 development toolchains from swift.org, if you're just interested in running them, rather than building them locally.

See the individual packages' README files for information about how to run and use their executables.


Copyright © 2014 - 2018 Apple Inc. and the Swift project authors. Licensed under Apache License v2.0 with Runtime Library Exception.

See http://swift.org/LICENSE.txt for license information.


Stars: 64
Help us keep the lights on


Used By

Total: 0