[PATCH] D103014: [lit] Attempt for fix tests failing because of 'warning: non-portable path to file'

Kristina Bessonova via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sat Jun 12 02:59:31 PDT 2021


krisb updated this revision to Diff 351646.
krisb added a comment.

Make path() resolving once.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D103014/new/

https://reviews.llvm.org/D103014

Files:
  llvm/cmake/modules/AddLLVM.cmake
  llvm/utils/lit/lit/discovery.py


Index: llvm/utils/lit/lit/discovery.py
===================================================================
--- llvm/utils/lit/lit/discovery.py
+++ llvm/utils/lit/lit/discovery.py
@@ -53,8 +53,7 @@
         config_map = litConfig.params.get('config_map')
         if config_map:
             cfgpath = os.path.realpath(cfgpath)
-            cfgpath = os.path.normcase(cfgpath)
-            target = config_map.get(cfgpath)
+            target = config_map.get(os.path.normcase(cfgpath))
             if target:
                 cfgpath = target
 
Index: llvm/cmake/modules/AddLLVM.cmake
===================================================================
--- llvm/cmake/modules/AddLLVM.cmake
+++ llvm/cmake/modules/AddLLVM.cmake
@@ -1566,9 +1566,10 @@
 # use it and can't be in a lit module. Use with make_paths_relative().
 string(CONCAT LLVM_LIT_PATH_FUNCTION
   "# Allow generated file to be relocatable.\n"
+  "from pathlib import Path\n"
   "def path(p):\n"
   "    if not p: return ''\n"
-  "    return os.path.join(os.path.dirname(os.path.abspath(__file__)), p)\n"
+  "    return str((Path(__file__).parent / p).resolve())\n"
   )
 
 # This function provides an automatic way to 'configure'-like generate a file


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D103014.351646.patch
Type: text/x-patch
Size: 1218 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210612/9bc8d1bc/attachment.bin>


More information about the llvm-commits mailing list