[PATCH] D78211: [lit] lit.site.cfg.py: support symlinked lit.site.cfg.py files
Milian Wolff via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Apr 15 08:44:31 PDT 2020
milianw created this revision.
milianw added reviewers: thakis, hans.
Herald added a subscriber: mgorny.
Herald added a project: LLVM.
milianw updated this revision to Diff 257732.
milianw added a comment.
milianw edited the summary of this revision.
fixup commit message
Use `os.path.realpath(__file__)` instead of `os.path.abspath(__file__)`
to get an absolute path pointing to the lit.site.cfg.py in the
build directory. That way one can symlink the generated
lit.site.cfg.py file into the source directory and run lit seamlessly
on individual files.
Before:
$ ln -s .../build/llvm-project/tools/clang/test/lit.site.cfg.py
$ lit --debug Index/cxx17-structured-binding.cpp
lit: .../lit/discovery.py:63: note: loading suite config '.../src/llvm-project/clang/test/lit.site.cfg.py'
...
lit: .../lit/LitConfig.py:115: note: load_config from '.../llvm-project/clang/test/lit.cfg.py'
lit: .../lit/TestingConfig.py:100: fatal: unable to parse config file '.../src/llvm-project/clang/test/lit.site.cfg.py', traceback: Traceback (most recent call last):
File ".../lit/TestingConfig.py", line 89, in load_from_path
exec(compile(data, path, 'exec'), cfg_globals, None)
File ".../src/llvm-project/clang/test/lit.site.cfg.py", line 64, in <module>
lit_config.load_config(
File ".../lit/LitConfig.py", line 116, in load_config
config.load_from_path(path, self)
File ".../lit/TestingConfig.py", line 76, in load_from_path
f = open(path)
FileNotFoundError: [Errno 2] No such file or directory: '.../src/llvm-project/clang/test/lit.cfg.py'
After:
$ ln -s .../build/llvm-project/tools/clang/test/lit.site.cfg.py
$ lit --debug Index/cxx17-structured-binding.cpp
lit: .../lit/discovery.py:63: note: loading suite config '.../src/llvm-project/clang/test/lit.site.cfg.py'
...
lit: .../lit/llvm/config.py:342: note: using clang: .../build/llvm-project/bin/clang
...
-- Testing: 1 tests, 1 workers --
...
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D78211
Files:
llvm/cmake/modules/AddLLVM.cmake
Index: llvm/cmake/modules/AddLLVM.cmake
===================================================================
--- llvm/cmake/modules/AddLLVM.cmake
+++ llvm/cmake/modules/AddLLVM.cmake
@@ -1431,7 +1431,7 @@
"# Allow generated file to be relocatable.\n"
"def path(p):\n"
" if not p: return ''\n"
- " p = os.path.join(os.path.dirname(os.path.abspath(__file__)), p)\n"
+ " p = os.path.join(os.path.dirname(os.path.realpath(__file__)), p)\n"
" p = os.path.normpath(p).replace(os.sep, '/')\n"
" if os.name == 'nt' and os.path.isabs(p): return p[0].upper() + p[1:]\n"
" return p\n"
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D78211.257732.patch
Type: text/x-patch
Size: 599 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200415/d0062e0a/attachment.bin>
More information about the llvm-commits
mailing list