[Lldb-commits] [PATCH] D70622: [cmake][lit] Follow symlinks when looking for lit tests & reconfigure lldb's tests.

Jordan Rupprecht via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Fri Nov 22 15:01:44 PST 2019

rupprecht created this revision.
rupprecht added reviewers: JDevlieghere, labath.
Herald added subscribers: llvm-commits, lldb-commits, mgorny.
Herald added projects: LLDB, LLVM.

The lldb tree contains a symlink directory, `lldb/test/API/testcases`, which points to the tests in `../../packages/Python/lldbsuite/test`. Because the `add_lit_testsuites()` cmake rule does not follow symlinks, it doesn't find the nested directory tree to create make/ninja rules for.

Also, because the lldb lit config points the source root directly into the testcases tree, the `check-lldb-api-testcases` rule fails to find the `testcases` directory, and therefore finds no tests. Changing the source root to the containing lit file, like most lit configs do, fixes this.

After this patch, `ninja check-lldb-api-testcases-linux` works, and runs only the test cases in `lldb/packages/Python/lldbsuite/test/linux`.

  rG LLVM Github Monorepo



Index: llvm/cmake/modules/AddLLVM.cmake
--- llvm/cmake/modules/AddLLVM.cmake
+++ llvm/cmake/modules/AddLLVM.cmake
@@ -1488,7 +1488,8 @@
     # Search recursively for test directories by assuming anything not
     # in a directory called Inputs contains tests.
-    file(GLOB_RECURSE to_process LIST_DIRECTORIES true ${directory}/*)
+    # Follow symlinks as some tests in lldb are structured that way.
+    file(GLOB_RECURSE to_process FOLLOW_SYMLINKS LIST_DIRECTORIES true ${directory}/*)
     foreach(lit_suite ${to_process})
       if(NOT IS_DIRECTORY ${lit_suite})
Index: lldb/test/API/lit.cfg.py
--- lldb/test/API/lit.cfg.py
+++ lldb/test/API/lit.cfg.py
@@ -17,8 +17,7 @@
 # test_source_root: The root path where tests are located.
 # test_exec_root: The root path where tests should be run.
-config.test_source_root = os.path.join(config.lldb_src_root, 'packages',
-                                       'Python', 'lldbsuite', 'test')
+config.test_source_root = os.path.dirname(__file__)
 config.test_exec_root = config.test_source_root
 if 'Address' in config.llvm_use_sanitizer:

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D70622.230731.patch
Type: text/x-patch
Size: 1250 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20191122/8ff69f72/attachment.bin>

More information about the lldb-commits mailing list