diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 7f99be8fb..c3f3bf26a 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -97,7 +97,7 @@ jobs: compiler: [MSVC, clang-cl] arch: [x86, x64, arm64] config: [Debug, Release] - test_exe: [test, test_cpp20, test_cpp20_no_sourcelocation, test_fast, test_slow, test_old, test_module_lock_custom, test_module_lock_none] + test_exe: [test, test_cpp20, test_cpp20_no_sourcelocation, test_fast, test_slow, test_old, test_module_lock_custom, test_module_lock_none, stress_test] exclude: - arch: arm64 config: Debug diff --git a/.gitignore b/.gitignore index 9493fdad5..8a95a64fa 100644 --- a/.gitignore +++ b/.gitignore @@ -8,6 +8,7 @@ *.nupkg test*.xml test*_results.txt +stress_test_results.txt test_failures.txt build packages diff --git a/build_test_all.cmd b/build_test_all.cmd index 4372acfd5..b3f2c229e 100644 --- a/build_test_all.cmd +++ b/build_test_all.cmd @@ -36,5 +36,6 @@ call msbuild /m /p:Configuration=%target_configuration%,Platform=%target_platfor call msbuild /m /p:Configuration=%target_configuration%,Platform=%target_platform%,CppWinRTBuildVersion=%target_version% cppwinrt.sln /t:test\test_module_lock_none call msbuild /m /p:Configuration=%target_configuration%,Platform=%target_platform%,CppWinRTBuildVersion=%target_version% cppwinrt.sln /t:test\test_module_lock_none call msbuild /m /p:Configuration=%target_configuration%,Platform=%target_platform%,CppWinRTBuildVersion=%target_version% cppwinrt.sln /t:test\old_tests\test_old +call msbuild /m /p:Configuration=%target_configuration%,Platform=%target_platform%,CppWinRTBuildVersion=%target_version% cppwinrt.sln /t:test\stress_test call run_tests.cmd %target_platform% %target_configuration% diff --git a/cppwinrt.sln b/cppwinrt.sln index 5964f976b..0c0482f61 100644 --- a/cppwinrt.sln +++ b/cppwinrt.sln @@ -132,6 +132,12 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution run_tests.cmd = run_tests.cmd EndProjectSection EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "stress_test", "test\stress_test\stress_test.vcxproj", "{FF5FDA08-F84A-4AB1-9D8C-0EC78EA5A08C}" + ProjectSection(ProjectDependencies) = postProject + {A91B8BF3-28E4-4D9E-8DBA-64B70E4F0270} = {A91B8BF3-28E4-4D9E-8DBA-64B70E4F0270} + {D613FB39-5035-4043-91E2-BAB323908AF4} = {D613FB39-5035-4043-91E2-BAB323908AF4} + EndProjectSection +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|ARM64 = Debug|ARM64 @@ -394,6 +400,18 @@ Global {D4C8F881-84D5-4A7B-8BDE-AB4E34A05374}.Release|x64.Build.0 = Release|x64 {D4C8F881-84D5-4A7B-8BDE-AB4E34A05374}.Release|x86.ActiveCfg = Release|Win32 {D4C8F881-84D5-4A7B-8BDE-AB4E34A05374}.Release|x86.Build.0 = Release|Win32 + {FF5FDA08-F84A-4AB1-9D8C-0EC78EA5A08C}.Debug|ARM64.ActiveCfg = Debug|ARM64 + {FF5FDA08-F84A-4AB1-9D8C-0EC78EA5A08C}.Debug|ARM64.Build.0 = Debug|ARM64 + {FF5FDA08-F84A-4AB1-9D8C-0EC78EA5A08C}.Debug|x64.ActiveCfg = Debug|x64 + {FF5FDA08-F84A-4AB1-9D8C-0EC78EA5A08C}.Debug|x64.Build.0 = Debug|x64 + {FF5FDA08-F84A-4AB1-9D8C-0EC78EA5A08C}.Debug|x86.ActiveCfg = Debug|Win32 + {FF5FDA08-F84A-4AB1-9D8C-0EC78EA5A08C}.Debug|x86.Build.0 = Debug|Win32 + {FF5FDA08-F84A-4AB1-9D8C-0EC78EA5A08C}.Release|ARM64.ActiveCfg = Release|ARM64 + {FF5FDA08-F84A-4AB1-9D8C-0EC78EA5A08C}.Release|ARM64.Build.0 = Release|ARM64 + {FF5FDA08-F84A-4AB1-9D8C-0EC78EA5A08C}.Release|x64.ActiveCfg = Release|x64 + {FF5FDA08-F84A-4AB1-9D8C-0EC78EA5A08C}.Release|x64.Build.0 = Release|x64 + {FF5FDA08-F84A-4AB1-9D8C-0EC78EA5A08C}.Release|x86.ActiveCfg = Release|Win32 + {FF5FDA08-F84A-4AB1-9D8C-0EC78EA5A08C}.Release|x86.Build.0 = Release|Win32 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -417,6 +435,7 @@ Global {08C40663-B6A3-481E-8755-AE32BAD99501} = {3C7EA5F8-6E8C-4376-B499-2CAF596384B0} {5FF6CD6C-515A-4D55-97B6-62AD9BCB77EA} = {3C7EA5F8-6E8C-4376-B499-2CAF596384B0} {D4C8F881-84D5-4A7B-8BDE-AB4E34A05374} = {3C7EA5F8-6E8C-4376-B499-2CAF596384B0} + {FF5FDA08-F84A-4AB1-9D8C-0EC78EA5A08C} = {3C7EA5F8-6E8C-4376-B499-2CAF596384B0} EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution SolutionGuid = {2783B8FD-EA3B-4D6B-9F81-662D289E02AA} diff --git a/run_tests.cmd b/run_tests.cmd index 77d883642..49ad986f2 100644 --- a/run_tests.cmd +++ b/run_tests.cmd @@ -16,6 +16,7 @@ call :run_test test_slow call :run_test test_old call :run_test test_module_lock_custom call :run_test test_module_lock_none +call :run_test stress_test goto :eof :run_test diff --git a/strings/base_macros.h b/strings/base_macros.h index d9e19547e..5f7cdf0c3 100644 --- a/strings/base_macros.h +++ b/strings/base_macros.h @@ -17,10 +17,10 @@ #ifdef _MSC_VER // Note: this is a workaround for a false-positive warning produced by the Visual C++ 15.9 compiler. -#pragma warning(disable : 5046) +//#pragma warning(disable : 5046) // Note: this is a workaround for a false-positive warning produced by the Visual C++ 16.3 compiler. -#pragma warning(disable : 4268) +//#pragma warning(disable : 4268) #endif #if defined(__cpp_lib_coroutine) || defined(__cpp_coroutines) || defined(_RESUMABLE_FUNCTIONS_SUPPORTED) diff --git a/test/stress_test/GeneratePrecompiledHeader.ps1 b/test/stress_test/GeneratePrecompiledHeader.ps1 new file mode 100644 index 000000000..0d91b994c --- /dev/null +++ b/test/stress_test/GeneratePrecompiledHeader.ps1 @@ -0,0 +1,26 @@ +[CmdletBinding()] +Param +( + [Parameter(Mandatory=$true)] + [string]$generatedFilesDir, + + [Parameter(Mandatory=$true)] + [string]$cppwinrtHeaderFolder +) + +if (!(Test-Path $generatedFilesDir)) +{ + mkdir $generatedFilesDir; +} + +$generatedPchContent = "#pragma once`r`n`r`n"; + +$allHeaders = Get-ChildItem "$cppwinrtHeaderFolder\\Windows.*.h"; +foreach ($header in $allHeaders) +{ + $chunks = $header.FullName.Split("\\"); + $header = $chunks[$chunks.Length - 1]; + $generatedPchContent += "#include `r`n"; +} + +Set-Content -Path "$generatedFilesDir\\pch.h" -Value $generatedPchContent -Force -Encoding UTF8 \ No newline at end of file diff --git a/test/stress_test/main.cpp b/test/stress_test/main.cpp new file mode 100644 index 000000000..66a992392 --- /dev/null +++ b/test/stress_test/main.cpp @@ -0,0 +1,13 @@ +#include "pch.h" + +using namespace winrt; + +int main() +{ + init_apartment(); + + winrt::Windows::Foundation::Uri uri{ L"https://www.microsoft.com" }; + const auto asString = uri.ToString(); + + return 0; +} diff --git a/test/stress_test/pch.cpp b/test/stress_test/pch.cpp new file mode 100644 index 000000000..1d9f38c57 --- /dev/null +++ b/test/stress_test/pch.cpp @@ -0,0 +1 @@ +#include "pch.h" diff --git a/test/stress_test/stress_test.vcxproj b/test/stress_test/stress_test.vcxproj new file mode 100644 index 000000000..f8e034043 --- /dev/null +++ b/test/stress_test/stress_test.vcxproj @@ -0,0 +1,108 @@ + + + + + Debug + ARM64 + + + Debug + Win32 + + + Release + ARM64 + + + Release + Win32 + + + Debug + x64 + + + Release + x64 + + + + true + true + true + true + 16.0 + {FF5FDA08-F84A-4AB1-9D8C-0EC78EA5A08C} + stress_test + stress_test + Application + + ..\_build\$(Platform)\$(Configuration) + false + + + + true + + + + true + + + false + true + + + + + $(OutputPath);Generated Files;..;..\..\cppwinrt + AllRules.ruleset + true + Level4 + true + AllRules.ruleset + %(AdditionalOptions) /Wv:19.40 + true + + + Console + + + powershell.exe -NoProfile -NonInteractive -File "$(ProjectDir)GeneratePrecompiledHeader.ps1" -generatedFilesDir "$(ProjectDir)Generated Files" -cppwinrtHeaderFolder "$(CppWinRTDir)\winrt" + + + + + MaxSpeed + true + true + NOMINMAX;_MBCS;%(PreprocessorDefinitions) + MultiThreaded + + + true + true + + + + + Disabled + _MBCS;%(PreprocessorDefinitions) + MultiThreadedDebug + + + + + Use + + + Create + + + + + + + + + \ No newline at end of file