Skip to content

Commit

Permalink
Merge pull request #1537 from microsoft/master
Browse files Browse the repository at this point in the history
feature/spaceship: Merge CI update
  • Loading branch information
StephanTLavavej authored Dec 17, 2020
2 parents 939b933 + 04369fc commit 8d2841f
Show file tree
Hide file tree
Showing 19 changed files with 236 additions and 57 deletions.
44 changes: 41 additions & 3 deletions azure-devops/run-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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: |
Expand Down
2 changes: 1 addition & 1 deletion azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
variables:
tmpDir: 'D:\Temp'

pool: 'StlBuild-2020-12-08'
pool: 'StlBuild-2020-12-08-1'

stages:
- stage: Code_Format
Expand Down
38 changes: 25 additions & 13 deletions stl/inc/ranges
Original file line number Diff line number Diff line change
Expand Up @@ -1515,9 +1515,12 @@ namespace ranges {
template <bool, bool>
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 <bool _OtherConst>
using _Base_iterator = _Maybe_wrapped<_Wrapped, iterator_t<_Maybe_const<_OtherConst, _Vw>>>;
template <bool _OtherConst>
using _Counted_iter = counted_iterator<_Base_iterator<_OtherConst>>;

_Base_sentinel _Last{};

Expand All @@ -1540,25 +1543,34 @@ 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 <bool _OtherConst = _Const>
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;
}

using _Prevent_inheriting_unwrap = _Sentinel;

// clang-format off
_NODISCARD constexpr auto _Unwrapped() const&
requires _Wrapped && _Unwrappable_v<const iterator_t<_Base_Ty>&> {
requires _Wrapped && _Unwrappable_v<const iterator_t<_Base_t>&> {
// clang-format on
return _Sentinel<_Const, false>{_Get_unwrapped(_Last)};
}
// clang-format off
_NODISCARD constexpr auto _Unwrapped() && requires _Wrapped && _Unwrappable_v<iterator_t<_Base_Ty>> {
_NODISCARD constexpr auto _Unwrapped() && requires _Wrapped && _Unwrappable_v<iterator_t<_Base_t>> {
// clang-format on
return _Sentinel<_Const, false>{_Get_unwrapped(_STD move(_Last))};
}

static constexpr bool _Unwrap_when_unverified = _Do_unwrap_when_unverified_v<iterator_t<_Base_Ty>>;
static constexpr bool _Unwrap_when_unverified = _Do_unwrap_when_unverified_v<iterator_t<_Base_t>>;

constexpr void _Seek_to(const _Sentinel<_Const, false>& _That) requires _Wrapped {
_Seek_wrapped(_Last, _That._Last);
Expand Down Expand Up @@ -1753,9 +1765,9 @@ namespace ranges {
template <bool, bool>
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 <bool _OtherConst>
using _Maybe_const_iter = _Maybe_wrapped<_Wrapped, iterator_t<_Maybe_const<_OtherConst, _Vw>>>;
Expand Down Expand Up @@ -1799,17 +1811,17 @@ namespace ranges {

// clang-format off
_NODISCARD constexpr auto _Unwrapped() const&
requires _Wrapped && _Unwrappable_v<const iterator_t<_Base_Ty>&> {
requires _Wrapped && _Unwrappable_v<const iterator_t<_Base_t>&> {
// clang-format on
return _Sentinel<_Const, false>{_Get_unwrapped(_Last), _Pred};
}
// clang-format off
_NODISCARD constexpr auto _Unwrapped() && requires _Wrapped && _Unwrappable_v<iterator_t<_Base_Ty>> {
_NODISCARD constexpr auto _Unwrapped() && requires _Wrapped && _Unwrappable_v<iterator_t<_Base_t>> {
// clang-format on
return _Sentinel<_Const, false>{_Get_unwrapped(_STD move(_Last)), _Pred};
}

static constexpr bool _Unwrap_when_unverified = _Do_unwrap_when_unverified_v<iterator_t<_Base_Ty>>;
static constexpr bool _Unwrap_when_unverified = _Do_unwrap_when_unverified_v<iterator_t<_Base_t>>;

constexpr void _Seek_to(const _Sentinel<_Const, false>& _That) requires _Wrapped {
_Seek_wrapped(_Last, _That._Last);
Expand Down
14 changes: 9 additions & 5 deletions stl/inc/regex
Original file line number Diff line number Diff line change
Expand Up @@ -3973,19 +3973,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<typename _RxTraits::_Uelem>(*_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<typename _RxTraits::_Uelem>(
_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) {
Expand Down
2 changes: 0 additions & 2 deletions tests/std/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
61 changes: 61 additions & 0 deletions tests/std/include/test_regex_support.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<unsigned int>(syntax), static_cast<unsigned int>(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<unsigned int>(syntax), static_cast<unsigned int>(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<unsigned int>(syntax),
static_cast<unsigned int>(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<unsigned int>(syntax), static_cast<unsigned int>(match_flags));
printf("\"%s\"\n", e.what());
fixture->fail_regex();
}
}
};
4 changes: 1 addition & 3 deletions tests/std/lit.site.cfg.in
Original file line number Diff line number Diff line change
Expand Up @@ -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@'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ void test(const int num) {
vector<int> 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;
Expand Down
7 changes: 7 additions & 0 deletions tests/std/tests/GH_000639_nvcc_include_all/env.lst
Original file line number Diff line number Diff line change
@@ -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"
Original file line number Diff line number Diff line change
@@ -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>
18 changes: 14 additions & 4 deletions tests/std/tests/P0896R4_views_take/test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -282,15 +282,25 @@ constexpr bool test_one(Rng&& rng, Expected&& expected) {
}
STATIC_ASSERT(CanEnd<const R&> == range<const V>);
if (!is_empty) {
same_as<sentinel_t<R>> auto i = r.end();
same_as<sentinel_t<R>> auto s = r.end();
if constexpr (bidirectional_range<R> && common_range<R>) {
assert(*prev(i) == *prev(end(expected)));
assert(*prev(s) == *prev(end(expected)));
}

if constexpr (range<const V>) {
same_as<sentinel_t<const R>> auto i2 = as_const(r).end();
same_as<sentinel_t<const R>> auto sc = as_const(r).end();
if constexpr (bidirectional_range<const R> && common_range<const R>) {
assert(*prev(i2) == *prev(end(expected)));
assert(*prev(sc) == *prev(end(expected)));
}

if (forward_range<V>) { // intentionally not if constexpr
// Compare with const / non-const iterators
const same_as<iterator_t<R>> auto i = r.begin();
const same_as<iterator_t<const R>> auto ic = as_const(r).begin();
assert(s != i);
assert(s != ic);
assert(sc != i);
assert(sc != ic);
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Loading

0 comments on commit 8d2841f

Please sign in to comment.