From c03d469fe382a2e7377b935173fcc1ce5795a1f2 Mon Sep 17 00:00:00 2001 From: Alvin Wong Date: Sat, 15 Oct 2022 18:59:34 +0800 Subject: [PATCH 1/6] Rename CI workflow --- .github/workflows/{msvc.yml => ci.yml} | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) rename .github/workflows/{msvc.yml => ci.yml} (95%) diff --git a/.github/workflows/msvc.yml b/.github/workflows/ci.yml similarity index 95% rename from .github/workflows/msvc.yml rename to .github/workflows/ci.yml index 31cc53512..bb5b3a50e 100644 --- a/.github/workflows/msvc.yml +++ b/.github/workflows/ci.yml @@ -1,4 +1,4 @@ -name: MSVC Tests +name: CI Tests on: push: pull_request: @@ -6,7 +6,8 @@ on: - master jobs: - test-cppwinrt: + test-msvc-cppwinrt: + name: 'MSVC: Tests' strategy: matrix: arch: [x86, x64, arm64] @@ -47,6 +48,7 @@ jobs: } build-nuget: + name: Build nuget package with MSVC runs-on: windows-latest steps: - uses: actions/checkout@v3 From fd5479ad1d0c3cfc294cae0c249955c735ba0ebd Mon Sep 17 00:00:00 2001 From: Alvin Wong Date: Sun, 16 Oct 2022 16:15:39 +0800 Subject: [PATCH 2/6] CI: Improve error reporting --- .github/workflows/ci.yml | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index bb5b3a50e..abcd8fd2e 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -22,7 +22,7 @@ jobs: - name: Test all run: | $VSDevCmd = & "${env:ProgramFiles(x86)}\Microsoft Visual Studio\Installer\vswhere" -latest -find Common7\tools\VSDevCmd.bat - if (!$VSDevCmd) { return 1 } + if (!$VSDevCmd) { exit 1 } echo "Using VSDevCmd: ${VSDevCmd}" cmd /c "${VSDevCmd}" "&" build_test_all.cmd ${{ matrix.arch }} ${{ matrix.config }} @@ -38,13 +38,13 @@ jobs: run: | if (Test-Path "test_failures.txt") { Get-Content "test_failures.txt" | ForEach-Object { - Write-Error "error: Test '$_' failed!" + echo "::error::Test '$_' failed!" } - return 1 + exit 1 } if (!(Test-Path "*_results.txt")) { - Write-Error "error: No test output found!" - return 1 + echo "::error::No test output found!" + exit 1 } build-nuget: @@ -56,13 +56,13 @@ jobs: - name: Package run: | $VSDevCmd = & "${env:ProgramFiles(x86)}\Microsoft Visual Studio\Installer\vswhere" -latest -find Common7\tools\VSDevCmd.bat - if (!$VSDevCmd) { return 1 } + if (!$VSDevCmd) { exit 1 } echo "Using VSDevCmd: ${VSDevCmd}" cmd /c "${VSDevCmd}" "&" nuget.exe restore cppwinrt.sln cmd /c "${VSDevCmd}" "&" build_nuget.cmd if (!(Test-Path "*.nupkg")) { - Write-Error "error: Output nuget package not found!" - return 1 + echo "::error::Output nuget package not found!" + exit 1 } - name: Upload nuget package artifact From 8753d4a1294575e16a771a3511c9be45f93b5e4d Mon Sep 17 00:00:00 2001 From: Alvin Wong Date: Thu, 13 Oct 2022 17:23:21 +0800 Subject: [PATCH 3/6] test: Use std::suspend_never if c++20 is available --- test/old_tests/UnitTests/async.cpp | 14 ++++++++++---- test/test/async_auto_cancel.cpp | 16 +++++++++++----- test/test/async_cancel_callback.cpp | 14 ++++++++++---- test/test/async_check_cancel.cpp | 14 ++++++++++---- test/test/async_ref_result.cpp | 12 +++++++++--- test/test/notify_awaiter.cpp | 4 ++++ test/test/when.cpp | 8 +++++++- test/test_win7/async_auto_cancel.cpp | 14 ++++++++++---- test/test_win7/async_cancel_callback.cpp | 14 ++++++++++---- test/test_win7/async_check_cancel.cpp | 14 ++++++++++---- 10 files changed, 91 insertions(+), 33 deletions(-) diff --git a/test/old_tests/UnitTests/async.cpp b/test/old_tests/UnitTests/async.cpp index 4452e6db4..817226c6d 100644 --- a/test/old_tests/UnitTests/async.cpp +++ b/test/old_tests/UnitTests/async.cpp @@ -14,6 +14,12 @@ using namespace std::chrono; namespace { +#ifdef __cpp_lib_coroutine + using std::suspend_never; +#else + using std::experimental::suspend_never; +#endif + IAsyncAction NoSuspend_IAsyncAction() { co_await 0s; @@ -1032,7 +1038,7 @@ namespace { signal_done d{ go }; co_await resume_on_signal(go); - co_await std::experimental::suspend_never{}; + co_await suspend_never{}; REQUIRE(false); } @@ -1040,7 +1046,7 @@ namespace { signal_done d{ go }; co_await resume_on_signal(go); - co_await std::experimental::suspend_never{}; + co_await suspend_never{}; REQUIRE(false); } @@ -1048,7 +1054,7 @@ namespace { signal_done d{ go }; co_await resume_on_signal(go); - co_await std::experimental::suspend_never{}; + co_await suspend_never{}; REQUIRE(false); co_return 0; } @@ -1057,7 +1063,7 @@ namespace { signal_done d{ go }; co_await resume_on_signal(go); - co_await std::experimental::suspend_never{}; + co_await suspend_never{}; REQUIRE(false); co_return 0; } diff --git a/test/test/async_auto_cancel.cpp b/test/test/async_auto_cancel.cpp index 2b1fdc728..bb49a9f5b 100644 --- a/test/test/async_auto_cancel.cpp +++ b/test/test/async_auto_cancel.cpp @@ -5,6 +5,12 @@ using namespace Windows::Foundation; namespace { +#ifdef __cpp_lib_coroutine + using std::suspend_never; +#else + using std::experimental::suspend_never; +#endif + // // Checks that the coroutine is automatically canceled when reaching a suspension point. // @@ -12,21 +18,21 @@ namespace IAsyncAction Action(HANDLE event) { co_await resume_on_signal(event); - co_await std::experimental::suspend_never(); + co_await suspend_never(); REQUIRE(false); } IAsyncActionWithProgress ActionWithProgress(HANDLE event) { co_await resume_on_signal(event); - co_await std::experimental::suspend_never(); + co_await suspend_never(); REQUIRE(false); } IAsyncOperation Operation(HANDLE event) { co_await resume_on_signal(event); - co_await std::experimental::suspend_never(); + co_await suspend_never(); REQUIRE(false); co_return 1; } @@ -34,7 +40,7 @@ namespace IAsyncOperationWithProgress OperationWithProgress(HANDLE event) { co_await resume_on_signal(event); - co_await std::experimental::suspend_never(); + co_await suspend_never(); REQUIRE(false); co_return 1; } @@ -48,7 +54,7 @@ namespace auto cancel = co_await get_cancellation_token(); cancel.callback(nullptr); - co_await std::experimental::suspend_never(); + co_await suspend_never(); REQUIRE(false); } diff --git a/test/test/async_cancel_callback.cpp b/test/test/async_cancel_callback.cpp index a69575a88..45699142b 100644 --- a/test/test/async_cancel_callback.cpp +++ b/test/test/async_cancel_callback.cpp @@ -5,6 +5,12 @@ using namespace Windows::Foundation; namespace { +#ifdef __cpp_lib_coroutine + using std::suspend_never; +#else + using std::experimental::suspend_never; +#endif + // // Checks that the cancellation callback is invoked. // @@ -23,7 +29,7 @@ namespace }(); co_await resume_on_signal(event); - co_await std::experimental::suspend_never(); + co_await suspend_never(); REQUIRE(false); } @@ -38,7 +44,7 @@ namespace }); co_await resume_on_signal(event); - co_await std::experimental::suspend_never(); + co_await suspend_never(); REQUIRE(false); } @@ -53,7 +59,7 @@ namespace }); co_await resume_on_signal(event); - co_await std::experimental::suspend_never(); + co_await suspend_never(); REQUIRE(false); co_return 1; } @@ -69,7 +75,7 @@ namespace }); co_await resume_on_signal(event); - co_await std::experimental::suspend_never(); + co_await suspend_never(); REQUIRE(false); co_return 1; } diff --git a/test/test/async_check_cancel.cpp b/test/test/async_check_cancel.cpp index 38d21f48b..7ec697927 100644 --- a/test/test/async_check_cancel.cpp +++ b/test/test/async_check_cancel.cpp @@ -5,6 +5,12 @@ using namespace Windows::Foundation; namespace { +#ifdef __cpp_lib_coroutine + using std::suspend_never; +#else + using std::experimental::suspend_never; +#endif + // // Checks that manual cancellation checks work. // @@ -20,7 +26,7 @@ namespace canceled = true; } - co_await std::experimental::suspend_never(); + co_await suspend_never(); REQUIRE(false); } @@ -35,7 +41,7 @@ namespace canceled = true; } - co_await std::experimental::suspend_never(); + co_await suspend_never(); REQUIRE(false); } @@ -50,7 +56,7 @@ namespace canceled = true; } - co_await std::experimental::suspend_never(); + co_await suspend_never(); REQUIRE(false); co_return 1; } @@ -66,7 +72,7 @@ namespace canceled = true; } - co_await std::experimental::suspend_never(); + co_await suspend_never(); REQUIRE(false); co_return 1; } diff --git a/test/test/async_ref_result.cpp b/test/test/async_ref_result.cpp index 015bb7b31..31cd1ce29 100644 --- a/test/test/async_ref_result.cpp +++ b/test/test/async_ref_result.cpp @@ -5,6 +5,12 @@ using namespace Windows::Foundation; namespace { +#ifdef __cpp_lib_coroutine + using std::suspend_never; +#else + using std::experimental::suspend_never; +#endif + // // Checks that references returned by awaitables // are not accidentally decayed. @@ -12,14 +18,14 @@ namespace // This test "runs" at compile time via static_assert. template - struct awaitable : std::experimental::suspend_never + struct awaitable : suspend_never { std::decay_t value; T await_resume() { return static_cast(value); } }; template - struct awaitable_member_awaiter : std::experimental::suspend_never + struct awaitable_member_awaiter : suspend_never { decltype(auto) get_awaiter() { return *this; } std::decay_t value; @@ -27,7 +33,7 @@ namespace }; template - struct awaitable_free_awaiter : std::experimental::suspend_never + struct awaitable_free_awaiter : suspend_never { std::decay_t value; T await_resume() { return static_cast(value); } diff --git a/test/test/notify_awaiter.cpp b/test/test/notify_awaiter.cpp index dd936928a..de2c5f1ab 100644 --- a/test/test/notify_awaiter.cpp +++ b/test/test/notify_awaiter.cpp @@ -5,7 +5,11 @@ using namespace Windows::Foundation; namespace { +#ifdef __cpp_lib_coroutine + using std::suspend_never; +#else using std::experimental::suspend_never; +#endif // Never suspends. // Allows copying, but asserts if you try. diff --git a/test/test/when.cpp b/test/test/when.cpp index 86edc6c77..35c9287a8 100644 --- a/test/test/when.cpp +++ b/test/test/when.cpp @@ -5,7 +5,13 @@ using namespace concurrency; using namespace winrt; using namespace Windows::Foundation; -struct CommaStruct : std::experimental::suspend_never +#ifdef __cpp_lib_coroutine +using std::suspend_never; +#else +using std::experimental::suspend_never; +#endif + +struct CommaStruct : suspend_never { // If the comma operator is invoked, we will get a build failure. CommaStruct operator,(CommaStruct) = delete; diff --git a/test/test_win7/async_auto_cancel.cpp b/test/test_win7/async_auto_cancel.cpp index 45ff30fcf..e5e3dd776 100644 --- a/test/test_win7/async_auto_cancel.cpp +++ b/test/test_win7/async_auto_cancel.cpp @@ -5,6 +5,12 @@ using namespace Windows::Foundation; namespace { +#ifdef __cpp_lib_coroutine + using std::suspend_never; +#else + using std::experimental::suspend_never; +#endif + // // Checks that the coroutine is automatically canceled when reaching a suspension point. // @@ -12,21 +18,21 @@ namespace IAsyncAction Action(HANDLE event) { co_await resume_on_signal(event); - co_await std::experimental::suspend_never(); + co_await suspend_never(); REQUIRE(false); } IAsyncActionWithProgress ActionWithProgress(HANDLE event) { co_await resume_on_signal(event); - co_await std::experimental::suspend_never(); + co_await suspend_never(); REQUIRE(false); } IAsyncOperation Operation(HANDLE event) { co_await resume_on_signal(event); - co_await std::experimental::suspend_never(); + co_await suspend_never(); REQUIRE(false); co_return 1; } @@ -34,7 +40,7 @@ namespace IAsyncOperationWithProgress OperationWithProgress(HANDLE event) { co_await resume_on_signal(event); - co_await std::experimental::suspend_never(); + co_await suspend_never(); REQUIRE(false); co_return 1; } diff --git a/test/test_win7/async_cancel_callback.cpp b/test/test_win7/async_cancel_callback.cpp index 0ab5b6bb1..8e20d01ec 100644 --- a/test/test_win7/async_cancel_callback.cpp +++ b/test/test_win7/async_cancel_callback.cpp @@ -5,6 +5,12 @@ using namespace Windows::Foundation; namespace { +#ifdef __cpp_lib_coroutine + using std::suspend_never; +#else + using std::experimental::suspend_never; +#endif + // // Checks that the cancellation callback is invoked. // @@ -20,7 +26,7 @@ namespace }); co_await resume_on_signal(event); - co_await std::experimental::suspend_never(); + co_await suspend_never(); REQUIRE(false); } @@ -35,7 +41,7 @@ namespace }); co_await resume_on_signal(event); - co_await std::experimental::suspend_never(); + co_await suspend_never(); REQUIRE(false); } @@ -50,7 +56,7 @@ namespace }); co_await resume_on_signal(event); - co_await std::experimental::suspend_never(); + co_await suspend_never(); REQUIRE(false); co_return 1; } @@ -66,7 +72,7 @@ namespace }); co_await resume_on_signal(event); - co_await std::experimental::suspend_never(); + co_await suspend_never(); REQUIRE(false); co_return 1; } diff --git a/test/test_win7/async_check_cancel.cpp b/test/test_win7/async_check_cancel.cpp index 38d21f48b..7ec697927 100644 --- a/test/test_win7/async_check_cancel.cpp +++ b/test/test_win7/async_check_cancel.cpp @@ -5,6 +5,12 @@ using namespace Windows::Foundation; namespace { +#ifdef __cpp_lib_coroutine + using std::suspend_never; +#else + using std::experimental::suspend_never; +#endif + // // Checks that manual cancellation checks work. // @@ -20,7 +26,7 @@ namespace canceled = true; } - co_await std::experimental::suspend_never(); + co_await suspend_never(); REQUIRE(false); } @@ -35,7 +41,7 @@ namespace canceled = true; } - co_await std::experimental::suspend_never(); + co_await suspend_never(); REQUIRE(false); } @@ -50,7 +56,7 @@ namespace canceled = true; } - co_await std::experimental::suspend_never(); + co_await suspend_never(); REQUIRE(false); co_return 1; } @@ -66,7 +72,7 @@ namespace canceled = true; } - co_await std::experimental::suspend_never(); + co_await suspend_never(); REQUIRE(false); co_return 1; } From 84a6a8c0e8269f8e9e8748caa8ab2b8c05fece24 Mon Sep 17 00:00:00 2001 From: Alvin Wong Date: Sat, 15 Oct 2022 18:22:50 +0800 Subject: [PATCH 4/6] test: Don't use FAIL macro with wchar literals The overload `ostream << wchar_t*` is deleted in C++20, and previously would print a pointer value instead of the string. --- test/old_tests/UnitTests/Errors.cpp | 20 ++++++++++---------- test/old_tests/UnitTests/array.cpp | 6 +++--- test/old_tests/UnitTests/hresult_error.cpp | 18 +++++++++--------- test/test/error_info.cpp | 10 +++++----- test/test/hresult_class_not_registered.cpp | 4 ++-- 5 files changed, 29 insertions(+), 29 deletions(-) diff --git a/test/old_tests/UnitTests/Errors.cpp b/test/old_tests/UnitTests/Errors.cpp index 85a2d2a60..000e93851 100644 --- a/test/old_tests/UnitTests/Errors.cpp +++ b/test/old_tests/UnitTests/Errors.cpp @@ -93,7 +93,7 @@ TEST_CASE("Errors") try { init_apartment(apartment_type::single_threaded); - FAIL(L"Previous line should throw"); + FAIL("Previous line should throw"); } catch (hresult_error const & e) { @@ -104,7 +104,7 @@ TEST_CASE("Errors") try { Uri uri(L"BAD"); - FAIL(L"Previous line should throw"); + FAIL("Previous line should throw"); } catch (hresult_invalid_argument const & e) // catching specific exception type { @@ -115,7 +115,7 @@ TEST_CASE("Errors") try { Uri uri(L"BAD"); - FAIL(L"Previous line should throw"); + FAIL("Previous line should throw"); } catch (hresult_error const& e) { @@ -128,7 +128,7 @@ TEST_CASE("Errors") { Errors errors; errors.Propagate(); - FAIL(L"Previous line should throw"); + FAIL("Previous line should throw"); } catch (hresult_invalid_argument const & e) // catching specific exception type { @@ -140,7 +140,7 @@ TEST_CASE("Errors") { Errors errors; errors.Fail(L"Failure message"); - FAIL(L"Previous line should throw"); + FAIL("Previous line should throw"); } catch (hresult_not_implemented const& e) { @@ -158,7 +158,7 @@ TEST_CASE("Errors") { Errors errors; errors.std_out_of_range(); - FAIL(L"Previous line should throw"); + FAIL("Previous line should throw"); } catch (hresult_out_of_bounds const& e) { @@ -169,7 +169,7 @@ TEST_CASE("Errors") { Errors errors; errors.std_invalid_argument(); - FAIL(L"Previous line should throw"); + FAIL("Previous line should throw"); } catch (hresult_invalid_argument const& e) { @@ -180,7 +180,7 @@ TEST_CASE("Errors") { Errors errors; errors.std_exception(); - FAIL(L"Previous line should throw"); + FAIL("Previous line should throw"); } catch (hresult_error const& e) { @@ -207,7 +207,7 @@ TEST_CASE("Errors") try { check_win32(ERROR_NO_NETWORK); - FAIL(L"Previous line should throw"); + FAIL("Previous line should throw"); } catch (hresult_error const& e) { @@ -220,7 +220,7 @@ TEST_CASE("Errors") try { check_nt(STATUS_STACK_OVERFLOW); - FAIL(L"Previous line should throw"); + FAIL("Previous line should throw"); } catch (hresult_error const& e) { diff --git a/test/old_tests/UnitTests/array.cpp b/test/old_tests/UnitTests/array.cpp index bb3901564..3fc499bec 100644 --- a/test/old_tests/UnitTests/array.cpp +++ b/test/old_tests/UnitTests/array.cpp @@ -344,7 +344,7 @@ TEST_CASE("array,at,throw") try { a.at(3); - FAIL(L"Previous line should throw"); + FAIL("Previous line should throw"); } catch (std::out_of_range const & e) { @@ -357,7 +357,7 @@ TEST_CASE("array,at,throw") try { test_array_ref_at_throw({ 1, 2, 3 }); - FAIL(L"Previous line should throw"); + FAIL("Previous line should throw"); } catch (std::out_of_range const & e) { @@ -372,7 +372,7 @@ TEST_CASE("array,at,throw") try { a.at(5); - FAIL(L"Previous line should throw"); + FAIL("Previous line should throw"); } catch (std::out_of_range const & e) { diff --git a/test/old_tests/UnitTests/hresult_error.cpp b/test/old_tests/UnitTests/hresult_error.cpp index b9db219f4..1acac1565 100644 --- a/test/old_tests/UnitTests/hresult_error.cpp +++ b/test/old_tests/UnitTests/hresult_error.cpp @@ -23,7 +23,7 @@ TEST_CASE("hresult,S_FALSE") try { check_hresult(S_FALSE); - FAIL(L"Previous line should throw"); + FAIL("Previous line should throw"); } catch (hresult_error const & e) { @@ -40,7 +40,7 @@ TEST_CASE("hresult,init_apartment") try { init_apartment(apartment_type::single_threaded); - FAIL(L"Previous line should throw"); + FAIL("Previous line should throw"); } catch (hresult_error const & e) { @@ -55,7 +55,7 @@ TEST_CASE("hresult,restricted,consuming") try { Uri uri(L"BAD"); - FAIL(L"Previous line should throw"); + FAIL("Previous line should throw"); } catch (hresult_invalid_argument const & e) // catching specific exception type { @@ -66,7 +66,7 @@ TEST_CASE("hresult,restricted,consuming") try { Uri uri(L"BAD"); - FAIL(L"Previous line should throw"); + FAIL("Previous line should throw"); } catch (hresult_error const & e) // catching generic exception type { @@ -501,7 +501,7 @@ TEST_CASE("hresult, std abi support") }; handler(nullptr, 0); - FAIL(L"Previous line should throw"); + FAIL("Previous line should throw"); } catch (hresult_error const& e) { @@ -517,7 +517,7 @@ TEST_CASE("hresult, std abi support") }; handler(nullptr, 0); - FAIL(L"Previous line should throw"); + FAIL("Previous line should throw"); } catch (std::bad_alloc const&) { @@ -531,7 +531,7 @@ TEST_CASE("hresult, std abi support") }; handler(nullptr, 0); - FAIL(L"Previous line should throw"); + FAIL("Previous line should throw"); } catch (hresult_out_of_bounds const& e) { @@ -547,7 +547,7 @@ TEST_CASE("hresult, std abi support") }; handler(nullptr, 0); - FAIL(L"Previous line should throw"); + FAIL("Previous line should throw"); } catch (hresult_invalid_argument const& e) { @@ -575,4 +575,4 @@ TEST_CASE("hresult, to_message") { REQUIRE(to_message() == L"oh no, invalid handle"); } -} \ No newline at end of file +} diff --git a/test/test/error_info.cpp b/test/test/error_info.cpp index 5b312c451..96e2b2731 100644 --- a/test/test/error_info.cpp +++ b/test/test/error_info.cpp @@ -35,7 +35,7 @@ TEST_CASE("error_info") try { check_hresult(winrt_error_info()); - FAIL(L"Previous line should throw"); + FAIL("Previous line should throw"); } catch (hresult_invalid_argument const& e) { @@ -45,7 +45,7 @@ TEST_CASE("error_info") try { check_hresult(com_error_info()); - FAIL(L"Previous line should throw"); + FAIL("Previous line should throw"); } catch (hresult_invalid_argument const& e) { @@ -55,7 +55,7 @@ TEST_CASE("error_info") try { check_hresult(no_error_info()); - FAIL(L"Previous line should throw"); + FAIL("Previous line should throw"); } catch (hresult_invalid_argument const& e) { @@ -66,7 +66,7 @@ TEST_CASE("error_info") { // This API reports using WinRT error info. Windows::Foundation::Uri(L"bad"); - FAIL(L"Previous line should throw"); + FAIL("Previous line should throw"); } catch (hresult_invalid_argument const& e) { @@ -78,7 +78,7 @@ TEST_CASE("error_info") // This API reports using COM error info. Windows::Data::Xml::Dom::XmlDocument doc; doc.LoadXml(L"bad"); - FAIL(L"Previous line should throw"); + FAIL("Previous line should throw"); } catch (hresult_error const& e) { diff --git a/test/test/hresult_class_not_registered.cpp b/test/test/hresult_class_not_registered.cpp index d1717569a..78223030a 100644 --- a/test/test/hresult_class_not_registered.cpp +++ b/test/test/hresult_class_not_registered.cpp @@ -20,11 +20,11 @@ TEST_CASE("hresult_class_not_registered") try { Async().get(); - FAIL(L"Previous line should throw"); + FAIL("Previous line should throw"); } catch (hresult_class_not_registered const& e) { REQUIRE(e.message() == L"test message"); REQUIRE(e.code() == REGDB_E_CLASSNOTREG); } -} \ No newline at end of file +} From 884866dce2f5f40f76aa7442a7a8e096f4558ead Mon Sep 17 00:00:00 2001 From: Alvin Wong Date: Sun, 16 Oct 2022 15:56:44 +0800 Subject: [PATCH 5/6] Fix multi_threaded_map test --- test/test/multi_threaded_map.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/test/multi_threaded_map.cpp b/test/test/multi_threaded_map.cpp index 2f81d3789..b2b143f11 100644 --- a/test/test/multi_threaded_map.cpp +++ b/test/test/multi_threaded_map.cpp @@ -63,7 +63,7 @@ namespace } else { - return static_cast>(winrt::make>(std::move(values))); + return static_cast>(winrt::make>(std::move(values))); } } @@ -171,7 +171,7 @@ namespace auto hook = raw.hook; // Convert the raw_map into the desired Windows Runtime map interface. - auto m = make_threaded_map(std::move(raw)); + auto m = make_threaded_map(std::move(raw)); auto race = [&](collection_action action, auto&& background, auto&& foreground) { From 0e43c52da14a25e8c7bc5339bd7069aab75abd74 Mon Sep 17 00:00:00 2001 From: Alvin Wong Date: Sun, 16 Oct 2022 06:15:50 +0800 Subject: [PATCH 6/6] Handle abnormal termination in all tests --- test/test_cpp20/main.cpp | 1 + test/test_fast/main.cpp | 1 + test/test_fast_fwd/main.cpp | 1 + test/test_module_lock_custom/main.cpp | 1 + test/test_module_lock_none/main.cpp | 1 + test/test_slow/main.cpp | 1 + 6 files changed, 6 insertions(+) diff --git a/test/test_cpp20/main.cpp b/test/test_cpp20/main.cpp index 7873e4ee7..7c55cbbed 100644 --- a/test/test_cpp20/main.cpp +++ b/test/test_cpp20/main.cpp @@ -7,6 +7,7 @@ using namespace winrt; int main(int const argc, char** argv) { init_apartment(); + std::set_terminate([] { reportFatal("Abnormal termination"); ExitProcess(1); }); return Catch::Session().run(argc, argv); } diff --git a/test/test_fast/main.cpp b/test/test_fast/main.cpp index 7873e4ee7..7c55cbbed 100644 --- a/test/test_fast/main.cpp +++ b/test/test_fast/main.cpp @@ -7,6 +7,7 @@ using namespace winrt; int main(int const argc, char** argv) { init_apartment(); + std::set_terminate([] { reportFatal("Abnormal termination"); ExitProcess(1); }); return Catch::Session().run(argc, argv); } diff --git a/test/test_fast_fwd/main.cpp b/test/test_fast_fwd/main.cpp index f9b9c73d2..2ddbfe115 100644 --- a/test/test_fast_fwd/main.cpp +++ b/test/test_fast_fwd/main.cpp @@ -10,6 +10,7 @@ using namespace winrt; int main(int const argc, char** argv) { init_apartment(); + std::set_terminate([] { reportFatal("Abnormal termination"); ExitProcess(1); }); return Catch::Session().run(argc, argv); } diff --git a/test/test_module_lock_custom/main.cpp b/test/test_module_lock_custom/main.cpp index 1372f2554..5f9a7913e 100644 --- a/test/test_module_lock_custom/main.cpp +++ b/test/test_module_lock_custom/main.cpp @@ -60,5 +60,6 @@ TEST_CASE("module_lock_custom") int main(int const argc, char** argv) { + std::set_terminate([] { reportFatal("Abnormal termination"); ExitProcess(1); }); return Catch::Session().run(argc, argv); } diff --git a/test/test_module_lock_none/main.cpp b/test/test_module_lock_none/main.cpp index 6fb4d379f..f34ece5ab 100644 --- a/test/test_module_lock_none/main.cpp +++ b/test/test_module_lock_none/main.cpp @@ -65,5 +65,6 @@ TEST_CASE("module_lock_none") int main(int const argc, char** argv) { + std::set_terminate([] { reportFatal("Abnormal termination"); ExitProcess(1); }); return Catch::Session().run(argc, argv); } diff --git a/test/test_slow/main.cpp b/test/test_slow/main.cpp index 7873e4ee7..7c55cbbed 100644 --- a/test/test_slow/main.cpp +++ b/test/test_slow/main.cpp @@ -7,6 +7,7 @@ using namespace winrt; int main(int const argc, char** argv) { init_apartment(); + std::set_terminate([] { reportFatal("Abnormal termination"); ExitProcess(1); }); return Catch::Session().run(argc, argv); }