mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-25 04:02:41 +01:00
[lit] Attempt for fix tests failing because of 'warning: non-portable path to file'
This is an attempt to fix clang test failures due to 'nonportable-include-path' warnings on Windows when a path to llvm-project's base directory contains some uppercase letters (excluding a drive letter). The issue originates from 2 problems: * discovery.py loads site config in lower case causing all the paths based on __file__ and requested within the config file to be in lowercase as well, * neither os.path.abspath() nor os.path.realpath() (both used to obtain paths of config files, sources, object directories, etc) do not return paths in the correct case for Windows (at least consistently for all python versions). As os.path library doesn't seem to provide any relaible way to restore the case for paths on Windows, this patch proposes to use pathlib.resolve(). pathlib is a part of Python 3.4 while llvm lit requires Python 3.6. Reviewed By: Meinersbur Differential Revision: https://reviews.llvm.org/D103014
This commit is contained in:
parent
f2662d35c8
commit
175bc341a3
@ -1566,9 +1566,10 @@ endfunction()
|
||||
# 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
|
||||
|
@ -53,8 +53,7 @@ def getTestSuite(item, litConfig, cache):
|
||||
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
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user