diff --git a/tests/std/CMakeLists.txt b/tests/std/CMakeLists.txt index 92f04c1fb61..5aa4a346bf9 100644 --- a/tests/std/CMakeLists.txt +++ b/tests/std/CMakeLists.txt @@ -3,8 +3,6 @@ set(STD_EXPECTED_RESULTS "${CMAKE_CURRENT_SOURCE_DIR}/expected_results.txt") set(STD_TEST_OUTPUT_DIR "${STL_TEST_OUTPUT_DIR}/std") -set(STD_TEST_SUBDIRS_FILE "${CMAKE_CURRENT_SOURCE_DIR}/test.lst") -set(STD_TEST_SUBDIRS_ROOT "${CMAKE_CURRENT_SOURCE_DIR}") configure_file( ${CMAKE_CURRENT_SOURCE_DIR}/lit.site.cfg.in diff --git a/tests/std/lit.site.cfg.in b/tests/std/lit.site.cfg.in index 9a2de0aa09b..6455f31677a 100644 --- a/tests/std/lit.site.cfg.in +++ b/tests/std/lit.site.cfg.in @@ -25,9 +25,7 @@ lit_config.expected_results[config.name] = stl.test.file_parsing.parse_result_fi lit_config.include_dirs[config.name] = \ ['@STL_TESTED_HEADERS_DIR@', '@LIBCXX_SOURCE_DIR@/test/support', '@STL_SOURCE_DIR@/tests/std/include'] lit_config.library_dirs[config.name] = ['@CMAKE_LIBRARY_OUTPUT_DIRECTORY@', '@TOOLSET_LIB@'] -lit_config.test_subdirs[config.name] = \ - [os.path.normpath(os.path.join('@STD_TEST_SUBDIRS_ROOT@', path)) for \ - path in stl.test.file_parsing.parse_commented_file('@STD_TEST_SUBDIRS_FILE@')] +lit_config.test_subdirs[config.name] = ['@CMAKE_CURRENT_SOURCE_DIR@/tests'] lit_config.cxx_headers = '@STL_TESTED_HEADERS_DIR@' lit_config.cxx_runtime = '@CMAKE_RUNTIME_OUTPUT_DIRECTORY@' diff --git a/tests/std/tests/GH_000639_nvcc_include_all/env.lst b/tests/std/tests/GH_000639_nvcc_include_all/env.lst new file mode 100644 index 00000000000..633ab107731 --- /dev/null +++ b/tests/std/tests/GH_000639_nvcc_include_all/env.lst @@ -0,0 +1,7 @@ +# Copyright (c) Microsoft Corporation. +# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception + +PM_COMPILER="nvcc" PM_CL="--x cu -Xcompiler -Od,-EHsc,-nologo,-W4,-WX,-openmp" +RUNALL_CROSSLIST +PM_CL="-Xcompiler -MT" +PM_CL="--debug -Xcompiler -MTd" diff --git a/tests/std/tests/GH_000639_nvcc_include_all/test.compile.pass.cpp b/tests/std/tests/GH_000639_nvcc_include_all/test.compile.pass.cpp new file mode 100644 index 00000000000..3141bc208ce --- /dev/null +++ b/tests/std/tests/GH_000639_nvcc_include_all/test.compile.pass.cpp @@ -0,0 +1,6 @@ +// Copyright (c) Microsoft Corporation. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception + +#define _MSVC_TESTING_NVCC + +#include <__msvc_all_public_headers.hpp> diff --git a/tests/tr1/CMakeLists.txt b/tests/tr1/CMakeLists.txt index 4658f3e34e0..b09e61bbf06 100644 --- a/tests/tr1/CMakeLists.txt +++ b/tests/tr1/CMakeLists.txt @@ -3,8 +3,6 @@ set(TR1_EXPECTED_RESULTS "${CMAKE_CURRENT_SOURCE_DIR}/expected_results.txt") set(TR1_TEST_OUTPUT_DIR "${STL_TEST_OUTPUT_DIR}/tr1") -set(TR1_TEST_SUBDIRS_FILE "${CMAKE_CURRENT_SOURCE_DIR}/test.lst") -set(TR1_TEST_SUBDIRS_ROOT "${CMAKE_CURRENT_SOURCE_DIR}") configure_file( ${CMAKE_CURRENT_SOURCE_DIR}/lit.site.cfg.in diff --git a/tests/tr1/lit.site.cfg.in b/tests/tr1/lit.site.cfg.in index 979944d0d5c..8e6afee6d49 100644 --- a/tests/tr1/lit.site.cfg.in +++ b/tests/tr1/lit.site.cfg.in @@ -25,9 +25,7 @@ lit_config.expected_results[config.name] = stl.test.file_parsing.parse_result_fi lit_config.include_dirs[config.name] = \ ['@STL_TESTED_HEADERS_DIR@', '@STL_SOURCE_DIR@/tests/tr1/include', '@STL_SOURCE_DIR@/tests/std/include'] lit_config.library_dirs[config.name] = ['@CMAKE_LIBRARY_OUTPUT_DIRECTORY@', '@TOOLSET_LIB@'] -lit_config.test_subdirs[config.name] = \ - [os.path.normpath(os.path.join('@TR1_TEST_SUBDIRS_ROOT@', path)) for \ - path in stl.test.file_parsing.parse_commented_file('@TR1_TEST_SUBDIRS_FILE@')] +lit_config.test_subdirs[config.name] = ['@CMAKE_CURRENT_SOURCE_DIR@/tests'] lit_config.cxx_runtime = '@CMAKE_RUNTIME_OUTPUT_DIRECTORY@' lit_config.target_arch = '@VCLIBS_TARGET_ARCHITECTURE@' diff --git a/tests/utils/stl/test/config.py b/tests/utils/stl/test/config.py index a02e8038c68..335855c3934 100644 --- a/tests/utils/stl/test/config.py +++ b/tests/utils/stl/test/config.py @@ -40,8 +40,8 @@ def configure(parameters, features, config, lit_config): lit_config.flags[config.name] = [] lit_config.compile_flags[config.name] = \ - ['/I' + os.path.normpath(dir) for dir in lit_config.include_dirs[config.name]] + ['-I' + os.path.normpath(dir) for dir in lit_config.include_dirs[config.name]] lit_config.link_flags[config.name] = \ - ['/LIBPATH:' + os.path.normpath(dir) for dir in lit_config.library_dirs[config.name]] + ['-LIBPATH:' + os.path.normpath(dir) for dir in lit_config.library_dirs[config.name]] lit_config.test_env = {'PATH' : os.path.normpath(lit_config.cxx_runtime)} diff --git a/tests/utils/stl/test/format.py b/tests/utils/stl/test/format.py index 2526a4f43aa..85fa6ff80bd 100644 --- a/tests/utils/stl/test/format.py +++ b/tests/utils/stl/test/format.py @@ -171,20 +171,20 @@ def getBuildSteps(self, test, litConfig, shared): shouldFail = TestType.FAIL in test.testType if TestType.COMPILE in test.testType: - cmd = [test.cxx, '/c', test.getSourcePath(), *test.flags, *test.compileFlags] + cmd = [test.cxx, '-c', test.getSourcePath(), *test.flags, *test.compileFlags] yield TestStep(cmd, shared.execDir, shared.env, shouldFail) elif TestType.LINK in test.testType: objFile = tmpBase + '.o' - cmd = [test.cxx, '/c', test.getSourcePath(), *test.flags, *test.compileFlags, '/Fo' + objFile] + cmd = [test.cxx, '-c', test.getSourcePath(), *test.flags, *test.compileFlags, '-Fo' + objFile] yield TestStep(cmd, shared.execDir, shared.env, False) exeFile = tmpBase + '.exe' - cmd = [test.cxx, objFile, *test.flags, '/Fe' + exeFile, '/link', *test.linkFlags] + cmd = [test.cxx, objFile, *test.flags, '-Fe' + exeFile, '-link', *test.linkFlags] yield TestStep(cmd, shared.execDir, shared.env, shouldFail) elif TestType.RUN in test.testType: shared.execFile = tmpBase + '.exe' cmd = [test.cxx, test.getSourcePath(), *test.flags, *test.compileFlags, - '/Fe' + shared.execFile, '/link', *test.linkFlags] + '-Fe' + shared.execFile, '-link', *test.linkFlags] yield TestStep(cmd, shared.execDir, shared.env, False) def getTestSetupSteps(self, test, litConfig, shared): diff --git a/tests/utils/stl/test/tests.py b/tests/utils/stl/test/tests.py index 90757f2b13a..3fda56ede3d 100644 --- a/tests/utils/stl/test/tests.py +++ b/tests/utils/stl/test/tests.py @@ -48,7 +48,10 @@ def configureTest(self, litConfig): if result: return result - self._handleEnvlst(litConfig) + result = self._handleEnvlst(litConfig) + if result: + return result + self._parseTest() self._parseFlags() @@ -171,18 +174,20 @@ def _handleEnvlst(self, litConfig): envCompiler = self.envlstEntry.getEnvVal('PM_COMPILER', 'cl') cxx = None - if not os.path.isfile(envCompiler): + if os.path.isfile(envCompiler): + cxx = envCompiler + else: cxx = _compilerPathCache.get(envCompiler, None) - if cxx is None: + if not cxx: searchPaths = self.config.environment['PATH'] cxx = shutil.which(envCompiler, path=searchPaths) _compilerPathCache[envCompiler] = cxx - else: - cxx = envCompiler if not cxx: - litConfig.fatal('Could not find: %r' % envCompiler) + litConfig.warning('Could not find: %r' % envCompiler) + return Result(SKIPPED, 'This test was skipped because the compiler, "' + + envCompiler + '", could not be found') self.flags = copy.deepcopy(litConfig.flags[self.config.name]) self.compileFlags = copy.deepcopy(litConfig.compile_flags[self.config.name]) @@ -198,7 +203,12 @@ def _handleEnvlst(self, litConfig): elif (targetArch == 'x86'.casefold()): self.compileFlags.append('-m32') + if ('nvcc'.casefold() in os.path.basename(cxx).casefold()): + # nvcc only supports targeting x64 + self.requires.append('x64') + self.cxx = os.path.normpath(cxx) + return None def _parseFlags(self): foundStd = False