diff --git a/azure-devops/run-build.yml b/azure-devops/run-build.yml index 3d4258ec860..767b5c77bfe 100644 --- a/azure-devops/run-build.yml +++ b/azure-devops/run-build.yml @@ -19,12 +19,50 @@ jobs: displayName: 'Setup TMP Directory' - checkout: self clean: true - submodules: true + submodules: false + - task: PowerShell@2 + displayName: 'Get submodule SHAs' + timeoutInMinutes: 1 + inputs: + targetType: inline + script: | + cd $(Build.SourcesDirectory) + $regexSubmoduleSHA = '^[ \-+]([0-9a-f]+) .*$' + $llvmSHA = git submodule status --cached llvm-project | %{$_ -replace $regexSubmoduleSHA, '$1'} + Write-Host "##vso[task.setvariable variable=llvmSHA;]$llvmSHA" + $vcpkgSHA = git submodule status --cached vcpkg | %{$_ -replace $regexSubmoduleSHA, '$1'} + Write-Host "##vso[task.setvariable variable=vcpkgSHA;]$vcpkgSHA" + - script: | + cd $(Build.SourcesDirectory) + if not exist "llvm-project" ( + mkdir llvm-project + ) + cd llvm-project + git init + git remote add llvm https://github.com/llvm/llvm-project + git config --local extensions.partialClone llvm + git fetch --filter=tree:0 --depth=1 llvm $(llvmSHA) + git reset --quiet $(llvmSHA) + git sparse-checkout init --cone + git sparse-checkout set libcxx/test libcxx/utils/libcxx llvm/utils/lit + displayName: "Checkout LLVM source" + - script: | + cd $(Build.SourcesDirectory) + if not exist "vcpkg" ( + mkdir vcpkg + ) + cd vcpkg + git init + git remote add vcpkg https://github.com/Microsoft/vcpkg + git config --local extensions.partialClone vcpkg + git fetch --filter=tree:0 --depth=1 vcpkg $(vcpkgSHA) + git checkout $(vcpkgSHA) + displayName: "Checkout vcpkg source" - task: Cache@2 displayName: vcpkg/installed Caching timeoutInMinutes: 10 inputs: - key: '"${{ parameters.targetPlatform }}" | $(Build.SourcesDirectory)/.git/modules/vcpkg/HEAD | "2020-03-01.01"' + key: '"${{ parameters.targetPlatform }}" | "$(vcpkgSHA)" | "2020-03-01.01"' path: '$(vcpkgLocation)/installed' cacheHitVar: CACHE_RESTORED - task: run-vcpkg@0 @@ -49,7 +87,7 @@ jobs: env: { TMP: $(tmpDir), TEMP: $(tmpDir) } - task: PowerShell@2 displayName: 'Get Test Parallelism' - timeoutInMinutes: 2 + timeoutInMinutes: 1 inputs: targetType: inline script: | diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 19d66b1622c..3fa907668b9 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -6,7 +6,7 @@ variables: tmpDir: 'D:\Temp' -pool: 'StlBuild-2020-12-08' +pool: 'StlBuild-2020-12-08-1' stages: - stage: Code_Format diff --git a/stl/inc/ranges b/stl/inc/ranges index c007010263b..1720c95babd 100644 --- a/stl/inc/ranges +++ b/stl/inc/ranges @@ -1515,9 +1515,12 @@ namespace ranges { template friend class _Sentinel; - using _Base_Ty = _Maybe_const<_Const, _Vw>; - using _Base_sentinel = _Maybe_wrapped<_Wrapped, sentinel_t<_Base_Ty>>; - using _Counted_Iter = counted_iterator<_Maybe_wrapped<_Wrapped, iterator_t<_Base_Ty>>>; + using _Base_t = _Maybe_const<_Const, _Vw>; + using _Base_sentinel = _Maybe_wrapped<_Wrapped, sentinel_t<_Base_t>>; + template + using _Base_iterator = _Maybe_wrapped<_Wrapped, iterator_t<_Maybe_const<_OtherConst, _Vw>>>; + template + using _Counted_iter = counted_iterator<_Base_iterator<_OtherConst>>; _Base_sentinel _Last{}; @@ -1540,7 +1543,16 @@ namespace ranges { return _Last; } - _NODISCARD friend constexpr bool operator==(const _Counted_Iter& _Left, const _Sentinel& _Right) { + _NODISCARD friend constexpr bool operator==(const _Counted_iter<_Const>& _Left, const _Sentinel& _Right) { + return _Left.count() == 0 || _Left.base() == _Right._Last; + } + + // clang-format off + template + requires sentinel_for<_Base_sentinel, _Base_iterator<_OtherConst>> + _NODISCARD friend constexpr bool operator==( + const _Counted_iter<_OtherConst>& _Left, const _Sentinel& _Right) { + // clang-format on return _Left.count() == 0 || _Left.base() == _Right._Last; } @@ -1548,17 +1560,17 @@ namespace ranges { // clang-format off _NODISCARD constexpr auto _Unwrapped() const& - requires _Wrapped && _Unwrappable_v&> { + requires _Wrapped && _Unwrappable_v&> { // clang-format on return _Sentinel<_Const, false>{_Get_unwrapped(_Last)}; } // clang-format off - _NODISCARD constexpr auto _Unwrapped() && requires _Wrapped && _Unwrappable_v> { + _NODISCARD constexpr auto _Unwrapped() && requires _Wrapped && _Unwrappable_v> { // clang-format on return _Sentinel<_Const, false>{_Get_unwrapped(_STD move(_Last))}; } - static constexpr bool _Unwrap_when_unverified = _Do_unwrap_when_unverified_v>; + static constexpr bool _Unwrap_when_unverified = _Do_unwrap_when_unverified_v>; constexpr void _Seek_to(const _Sentinel<_Const, false>& _That) requires _Wrapped { _Seek_wrapped(_Last, _That._Last); @@ -1753,9 +1765,9 @@ namespace ranges { template friend class _Sentinel; - using _Base_Ty = _Maybe_const<_Const, _Vw>; - using _Base_iterator = _Maybe_wrapped<_Wrapped, iterator_t<_Base_Ty>>; - using _Base_sentinel = _Maybe_wrapped<_Wrapped, sentinel_t<_Base_Ty>>; + using _Base_t = _Maybe_const<_Const, _Vw>; + using _Base_iterator = _Maybe_wrapped<_Wrapped, iterator_t<_Base_t>>; + using _Base_sentinel = _Maybe_wrapped<_Wrapped, sentinel_t<_Base_t>>; template using _Maybe_const_iter = _Maybe_wrapped<_Wrapped, iterator_t<_Maybe_const<_OtherConst, _Vw>>>; @@ -1799,17 +1811,17 @@ namespace ranges { // clang-format off _NODISCARD constexpr auto _Unwrapped() const& - requires _Wrapped && _Unwrappable_v&> { + requires _Wrapped && _Unwrappable_v&> { // clang-format on return _Sentinel<_Const, false>{_Get_unwrapped(_Last), _Pred}; } // clang-format off - _NODISCARD constexpr auto _Unwrapped() && requires _Wrapped && _Unwrappable_v> { + _NODISCARD constexpr auto _Unwrapped() && requires _Wrapped && _Unwrappable_v> { // clang-format on return _Sentinel<_Const, false>{_Get_unwrapped(_STD move(_Last)), _Pred}; } - static constexpr bool _Unwrap_when_unverified = _Do_unwrap_when_unverified_v>; + static constexpr bool _Unwrap_when_unverified = _Do_unwrap_when_unverified_v>; constexpr void _Seek_to(const _Sentinel<_Const, false>& _That) requires _Wrapped { _Seek_wrapped(_Last, _That._Last); diff --git a/stl/inc/regex b/stl/inc/regex index 56e10e4a6a4..32ef9439b46 100644 --- a/stl/inc/regex +++ b/stl/inc/regex @@ -3688,19 +3688,23 @@ _BidIt _Matcher<_BidIt, _Elem, _RxTraits, _It>::_Skip(_BidIt _First_arg, _BidIt case _N_class: { // check for string match for (; _First_arg != _Last; ++_First_arg) { // look for starting match + using _Uelem = typename _RxTraits::_Uelem; bool _Found; - auto _Ch = static_cast(*_First_arg); + auto _Ch = static_cast<_Uelem>(*_First_arg); _Node_class<_Elem, _RxTraits>* _Node = static_cast<_Node_class<_Elem, _RxTraits>*>(_Nx); _It _Next = _First_arg; ++_Next; + if (_Sflags & regex_constants::icase) { + _Ch = static_cast<_Uelem>(_Traits.translate_nocase(static_cast<_Elem>(_Ch))); + } + if (_Node->_Coll && _Lookup_coll(_First_arg, _Next, _Node->_Coll) != _First_arg) { _Found = true; } else if (_Node->_Ranges - && (_Lookup_range( - static_cast( - _Sflags & regex_constants::collate ? _Traits.translate(static_cast<_Elem>(_Ch)) - : static_cast<_Elem>(_Ch)), + && (_Lookup_range(static_cast<_Uelem>(_Sflags & regex_constants::collate + ? _Traits.translate(static_cast<_Elem>(_Ch)) + : static_cast<_Elem>(_Ch)), _Node->_Ranges))) { _Found = true; } else if (_Ch < _Bmp_max) { 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/include/test_regex_support.hpp b/tests/std/include/test_regex_support.hpp index c4a5802c831..5d9531d6f39 100644 --- a/tests/std/include/test_regex_support.hpp +++ b/tests/std/include/test_regex_support.hpp @@ -240,3 +240,64 @@ class test_regex { } } }; + +class test_wregex { + regex_fixture* const fixture; + const std::wstring pattern; + const std::regex_constants::syntax_option_type syntax; + const std::wregex r; + +public: + test_wregex(regex_fixture* fixture, const std::wstring& pattern, + std::regex_constants::syntax_option_type syntax = std::regex_constants::ECMAScript) + : fixture(fixture), pattern(pattern), syntax(syntax), r(pattern, syntax) {} + + test_wregex(const test_wregex&) = delete; + test_wregex& operator=(const test_wregex&) = delete; + + void should_search_match(const std::wstring& subject, const std::wstring& expected, + const std::regex_constants::match_flag_type match_flags = std::regex_constants::match_default) const { + std::wsmatch mr; + try { + const bool search_result = std::regex_search(subject, mr, r, match_flags); + if (!search_result || mr[0] != expected) { + wprintf(LR"(Expected regex_search("%s", regex("%s", 0x%X), 0x%X) to find "%s", )", subject.c_str(), + pattern.c_str(), static_cast(syntax), static_cast(match_flags), + expected.c_str()); + if (search_result) { + wprintf(LR"(but it matched "%s")" + "\n", + mr.str().c_str()); + } else { + puts("but it failed to match"); + } + + fixture->fail_regex(); + } + } catch (const std::regex_error& e) { + wprintf(LR"(Failed to regex_search("%s", regex("%s", 0x%X), 0x%X): regex_error: )", subject.c_str(), + pattern.c_str(), static_cast(syntax), static_cast(match_flags)); + printf("\"%s\"\n", e.what()); + fixture->fail_regex(); + } + } + + void should_search_fail(const std::wstring& subject, + const std::regex_constants::match_flag_type match_flags = std::regex_constants::match_default) const { + std::wsmatch mr; + try { + if (std::regex_search(subject, mr, r, match_flags)) { + wprintf(LR"(Expected regex_search("%s", regex("%s", 0x%X), 0x%X) to not match, but it found "%s")" + "\n", + subject.c_str(), pattern.c_str(), static_cast(syntax), + static_cast(match_flags), mr.str().c_str()); + fixture->fail_regex(); + } + } catch (const std::regex_error& e) { + wprintf(LR"(Failed to regex_search("%s", regex("%s", 0x%X), 0x%X): regex_error: )", subject.c_str(), + pattern.c_str(), static_cast(syntax), static_cast(match_flags)); + printf("\"%s\"\n", e.what()); + fixture->fail_regex(); + } + } +}; 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/Dev11_0748972_function_crash_out_of_memory/test.cpp b/tests/std/tests/Dev11_0748972_function_crash_out_of_memory/test.cpp index fc5793ba34c..6a33ce1099f 100644 --- a/tests/std/tests/Dev11_0748972_function_crash_out_of_memory/test.cpp +++ b/tests/std/tests/Dev11_0748972_function_crash_out_of_memory/test.cpp @@ -76,6 +76,7 @@ void test(const int num) { vector v(10, 1729); long long a = 0, b = 0, c = 0, d = 0, e = 0; auto big_lambda = [v, a, b, c, d, e] { + (void) v; (void) a; (void) b; (void) c; 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/std/tests/P0896R4_views_take/test.cpp b/tests/std/tests/P0896R4_views_take/test.cpp index ea8c453739c..27ccb1b7cc3 100644 --- a/tests/std/tests/P0896R4_views_take/test.cpp +++ b/tests/std/tests/P0896R4_views_take/test.cpp @@ -282,15 +282,25 @@ constexpr bool test_one(Rng&& rng, Expected&& expected) { } STATIC_ASSERT(CanEnd == range); if (!is_empty) { - same_as> auto i = r.end(); + same_as> auto s = r.end(); if constexpr (bidirectional_range && common_range) { - assert(*prev(i) == *prev(end(expected))); + assert(*prev(s) == *prev(end(expected))); } if constexpr (range) { - same_as> auto i2 = as_const(r).end(); + same_as> auto sc = as_const(r).end(); if constexpr (bidirectional_range && common_range) { - assert(*prev(i2) == *prev(end(expected))); + assert(*prev(sc) == *prev(end(expected))); + } + + if (forward_range) { // intentionally not if constexpr + // Compare with const / non-const iterators + const same_as> auto i = r.begin(); + const same_as> auto ic = as_const(r).begin(); + assert(s != i); + assert(s != ic); + assert(sc != i); + assert(sc != ic); } } } diff --git a/tests/std/tests/P1502R1_standard_library_header_units/custom_format.py b/tests/std/tests/P1502R1_standard_library_header_units/custom_format.py index 3c7acccbe55..9c5c3858e9f 100644 --- a/tests/std/tests/P1502R1_standard_library_header_units/custom_format.py +++ b/tests/std/tests/P1502R1_standard_library_header_units/custom_format.py @@ -98,19 +98,21 @@ def getBuildSteps(self, test, litConfig, shared): test.flags.remove('/BE') test.compileFlags.remove('/BE') + exportHeaderOptions = ['/exportHeader', '/Fo', '/MP'] headerUnitOptions = [] for header in stlHeaders: - headerObjPath = os.path.join(outputDir, header + '.obj') + headerAbsolutePath = os.path.join(litConfig.cxx_headers, header) + + exportHeaderOptions.append(headerAbsolutePath) headerUnitOptions.append('/headerUnit') - headerUnitOptions.append('{0}/{1}={1}.ifc'.format(litConfig.cxx_headers, header)) + headerUnitOptions.append('{0}={1}.ifc'.format(headerAbsolutePath, header)) if not compileTestCppWithEdg: - headerUnitOptions.append(headerObjPath) + headerUnitOptions.append(os.path.join(outputDir, header + '.obj')) - cmd = [test.cxx, *test.flags, *test.compileFlags, - '/exportHeader', '<{}>'.format(header), '/Fo{}'.format(headerObjPath)] - yield TestStep(cmd, shared.execDir, shared.env, False) + cmd = [test.cxx, *test.flags, *test.compileFlags, *exportHeaderOptions] + yield TestStep(cmd, shared.execDir, shared.env, False) if compileTestCppWithEdg: test.compileFlags.append('/BE') diff --git a/tests/std/tests/P1502R1_standard_library_header_units/custombuild.pl b/tests/std/tests/P1502R1_standard_library_header_units/custombuild.pl index 403af1be04b..b0b03595c17 100644 --- a/tests/std/tests/P1502R1_standard_library_header_units/custombuild.pl +++ b/tests/std/tests/P1502R1_standard_library_header_units/custombuild.pl @@ -88,18 +88,19 @@ () "version", ); + my $export_header_options = "/exportHeader /Fo /MP"; my $header_unit_options = ""; foreach (@stl_headers) { + $export_header_options .= " $stl_include_dir/$_"; + $header_unit_options .= " /headerUnit"; $header_unit_options .= " $stl_include_dir/$_=$_.ifc"; $header_unit_options .= " $_.obj"; - - # TRANSITION, remove /DMSVC_INTERNAL_TESTING after all compiler bugs are fixed - Run::ExecuteCL("/DMSVC_INTERNAL_TESTING /exportHeader \"<$_>\" /Fo$_.obj"); } # TRANSITION, remove /DMSVC_INTERNAL_TESTING after all compiler bugs are fixed + Run::ExecuteCL("/DMSVC_INTERNAL_TESTING $export_header_options"); Run::ExecuteCL("/DMSVC_INTERNAL_TESTING test.cpp /Fe$cwd.exe $header_unit_options"); } 1 diff --git a/tests/std/tests/VSO_0000000_regex_use/test.cpp b/tests/std/tests/VSO_0000000_regex_use/test.cpp index 29e993dc431..fe202ca392a 100644 --- a/tests/std/tests/VSO_0000000_regex_use/test.cpp +++ b/tests/std/tests/VSO_0000000_regex_use/test.cpp @@ -546,6 +546,40 @@ void test_VSO_226914_word_boundaries() { aWordAny.should_search_fail("aa", match_not_bow | match_not_eow); } +void test_GH_993_regex_character_class_case_insensitive_search() { + { + const wstring subject = L" Copyright"; + const test_wregex case_regex(&g_regexTester, LR"([a-z][a-z])", ECMAScript); + const test_wregex icase_regex(&g_regexTester, LR"([a-z][a-z])", ECMAScript | icase); + + case_regex.should_search_match(subject, L"op"); + icase_regex.should_search_match(subject, L"Co"); + } + + { + const wstring subject = L"blahZblah"; + const test_wregex Z_case_regex(&g_regexTester, LR"([Z])", ECMAScript); + const test_wregex Z_icase_regex(&g_regexTester, LR"([Z])", ECMAScript | icase); + const test_wregex z_case_regex(&g_regexTester, LR"([z])", ECMAScript); + const test_wregex z_icase_regex(&g_regexTester, LR"([z])", ECMAScript | icase); + + Z_case_regex.should_search_match(subject, L"Z"); + Z_icase_regex.should_search_match(subject, L"Z"); + z_icase_regex.should_search_match(subject, L"Z"); + + z_case_regex.should_search_fail(subject); + z_case_regex.should_search_fail(subject, match_not_bow); + z_case_regex.should_search_fail(subject, match_not_eow); + z_case_regex.should_search_fail(subject, match_not_bow | match_not_eow); + + const wstring lowercase_subject = L"hungry_zombies"; + Z_case_regex.should_search_fail(lowercase_subject); + Z_icase_regex.should_search_match(lowercase_subject, L"z"); + z_case_regex.should_search_match(lowercase_subject, L"z"); + z_icase_regex.should_search_match(lowercase_subject, L"z"); + } +} + int main() { test_dev10_449367_case_insensitivity_should_work(); test_dev11_462743_regex_collate_should_not_disable_regex_icase(); @@ -572,6 +606,7 @@ int main() { test_VSO_225160_match_bol_flag(); test_VSO_225160_match_eol_flag(); test_VSO_226914_word_boundaries(); + test_GH_993_regex_character_class_case_insensitive_search(); return g_regexTester.result(); } 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