diff --git a/llvm/cmake/modules/AddLLVM.cmake b/llvm/cmake/modules/AddLLVM.cmake --- a/llvm/cmake/modules/AddLLVM.cmake +++ b/llvm/cmake/modules/AddLLVM.cmake @@ -1549,9 +1549,11 @@ # 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" + " abs = Path(__file__).resolve().parent / p\n" + " return str(abs.resolve())\n" ) # This function provides an automatic way to 'configure'-like generate a file diff --git a/llvm/utils/lit/lit/discovery.py b/llvm/utils/lit/lit/discovery.py --- a/llvm/utils/lit/lit/discovery.py +++ b/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