How to manually run swift-lldb tests?

I wonder how to manually run swift-lldb tests?

After finding this reply, I tried the following (after building swift via update-checkout and build-script) and got an error:

# Invoked within Swift build directory.
$ lldb/test/dotest.py testcases/lang/swift
WARNING:root:No valid FileCheck executable; some tests may fail...
WARNING:root:(Double-check the --filecheck argument to dotest.py)
The 'lldb' executable cannot be located.  Some of the tests may not be run as a result.

./lldb-dotest -p <TESTNAME> should do it.
If this doesn't work, please let me know.

lldb-dotest works!

How can I use it to run specific tests?

I tried the following with no success:

# Example: trying to run lldb/test/testcases/lang/swift/swiftieformatting.

$ build/buildbot_linux/lldb-linux-x86_64/bin/lldb-dotest lldb/test/testcases/lang/swift/swiftieformatting
LLDB library dir: /home/danielzheng/swift-merge/build/buildbot_linux/lldb-linux-x86_64/bin
LLDB import library dir: /home/danielzheng/swift-merge/build/buildbot_linux/lldb-linux-x86_64/bin
lldb version 7.0.0 (git@github.com:dan-zheng/swift-lldb.git revision 8d59bb65cc7da10f34e0c7d1053a8688d1b88355)
Swift version 5.0-dev (LLVM 082dec2e22, Swift 3298d217df)
Skipping following debug info categories: ['dsym', 'gmodules']

Session logs for test failures/errors/unexpected successes will go into directory '/home/danielzheng/swift-merge/build/buildbot_linux/lldb-linux-x86_64/lldb-test-traces'
Command invoked: /home/danielzheng/swift-merge/lldb/test/dotest.py -q --arch= -s /home/danielzheng/swift-merge/build/buildbot_linux/lldb-linux-x86_64/lldb-test-traces --build-dir /home/danielzheng/swift-merge/build/buildbot_linux/lldb-linux-x86_64/lldb-test-build.noindex -S nm -u CXXFLAGS -u CFLAGS --executable /home/danielzheng/swift-merge/build/buildbot_linux/lldb-linux-x86_64/./bin/lldb --dsymutil /home/danielzheng/swift-merge/build/buildbot_linux/llvm-linux-x86_64/./bin/dsymutil --filecheck /home/danielzheng/swift-merge/build/buildbot_linux/llvm-linux-x86_64/./bin/FileCheck -C /home/danielzheng/swift-merge/build/buildbot_linux/llvm-linux-x86_64/bin/clang --swift-compiler /home/danielzheng/swift-merge/build/buildbot_linux/swift-linux-x86_64/bin/swiftc --swift-library /home/danielzheng/swift-merge/build/buildbot_linux/swift-linux-x86_64/lib/swift --env ARCHIVER=/usr/bin/ar --env OBJCOPY=/usr/bin/objcopy lldb/test/testcases/lang/swift/swiftieformatting
FAIL: LLDB (-) :: setUpClass (TestSwiftieFormatting.TestSwiftieFormatting)
======================================================================
ERROR: setUpClass (TestSwiftieFormatting.TestSwiftieFormatting)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/danielzheng/swift-merge/lldb/packages/Python/lldbsuite/test/lldbtest.py", line 538, in setUpClass
    os.chdir(full_dir)
OSError: [Errno 2] No such file or directory: '/home/danielzheng/swift-merge/lldb/packages/Python/lldbsuite/test/ieformatting'

----------------------------------------------------------------------
Ran 0 tests in 0.001s

RESULT: FAILED (0 passes, 0 failures, 1 errors, 0 skipped, 0 expected failures, 0 unexpected successes)

Have you tried to cd into the bin directory and run
./lldb-dotest -p TestSwiftieFormatting ? [also see previous reply for a generalization]/

1 Like

cd'ing into bin and running ./lldb-dotest -p TestSwiftieFormatting worked, thanks!