Index: utils/lit/tests/CMakeLists.txt =================================================================== --- utils/lit/tests/CMakeLists.txt +++ utils/lit/tests/CMakeLists.txt @@ -18,6 +18,12 @@ add_lit_testsuite(check-lit "Running lit's tests" ${CMAKE_CURRENT_BINARY_DIR} DEPENDS "FileCheck" "not" + # Visual Studio allows the build configuration to be set at *build* time, + # and it does not make use of CMAKE_BUILD_TYPE. As a result, the location + # of the FileCheck/not executables, which lit's test suite depends upon, + # is not known until build time. To inform lit's test suite of where to + # find these executables, pass --build_configuration as a --param. + PARAMS build_configuration=$ ) # For IDEs Index: utils/lit/tests/lit.cfg =================================================================== --- utils/lit/tests/lit.cfg +++ utils/lit/tests/lit.cfg @@ -61,11 +61,19 @@ lit_config.warning('Could not import psutil. Some tests will be skipped and' ' the --timeout command line argument will not work.') -if sys.platform.startswith('win') or sys.platform.startswith('cygwin'): +is_windows = sys.platform.startswith('win') or sys.platform.startswith('cygwin') +if is_windows: config.available_features.add('windows') # Add llvm tools directory if this config is being loaded indirectly llvm_tools_dir = getattr(config, 'llvm_tools_dir', None) if llvm_tools_dir != None: + build_configuration = lit_config.params.get('build_configuration', None) + if is_windows and build_configuration is not None: + # When using a Visual Studio CMake generator, at the time that lit.site.cfg.in + # is configured, CMake variables such as LLVM_TOOLS_BINARY_DIR are set using + # a path that contains a placeholder value: "$(Configuration)". Here at build + # time, replace the placeholder with the actual configuration value. + llvm_tools_dir = llvm_tools_dir.replace('$(Configuration)', build_configuration) path = os.path.pathsep.join((llvm_tools_dir, config.environment['PATH'])) config.environment['PATH'] = path