[swift-dev] How do you run individual tests?

Mark Lacey mark.lacey at apple.com
Sat Dec 5 19:58:37 CST 2015


> On Dec 5, 2015, at 4:56 PM, Michael Buckley via swift-dev <swift-dev at swift.org> wrote:
> 
> Hi,
> 
> I have successfully run the swift test suites by passing the -T flag to utils/build_script, and I am wondering if there is any way to run an individual test by name, or even just run a single file.
> 
> Forgive me if the answer to this question is already documented somewhere. I have read through all the documentation I could find in the git repository, and checked out the lit documentation on llvm.org <http://llvm.org/>.

docs/Testing.rst line 95 shows the way that I use lit to run individual tests or tests under a directory:

    % ${LLVM_SOURCE_ROOT}/utils/lit/lit.py -sv --param swift_site_config=${SWIFT_BUILD_ROOT}/test-iphonesimulator-i386/lit.site.cfg ${SWIFT_SOURCE_ROOT}/test/Parse/

For example, if you build with build-script -r you should be able to run test/SILPasses/mem2reg.sil with:

../llvm/utils/lit/lit.py -sv --param swift_site_config=../build/Ninja-RelWithDebInfoAssert/swift-macosx-x86_64/test-macosx-x86_64/lit.site.cfg test/SILPasses/mem2reg.sil

As you can imagine this is quite long so I have an alias set up to provide the initial arguments to lit.py (in particular pointing to the swift_site_config).

Mark

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-dev/attachments/20151205/ca152587/attachment.html>


More information about the swift-dev mailing list