From 35e771b5be30800bce9a7d8b7dfcd1c194621d32 Mon Sep 17 00:00:00 2001 From: Michael Niksa Date: Thu, 6 Feb 2020 11:39:27 -0800 Subject: [PATCH 01/18] foo --- src/foo.txt | 1 + 1 file changed, 1 insertion(+) create mode 100644 src/foo.txt diff --git a/src/foo.txt b/src/foo.txt new file mode 100644 index 00000000000..5e40c087705 --- /dev/null +++ b/src/foo.txt @@ -0,0 +1 @@ +asdf \ No newline at end of file From 12b09b7d15ba7b2ce8e184dc191fb580cd8afc95 Mon Sep 17 00:00:00 2001 From: Michael Niksa Date: Thu, 6 Feb 2020 12:01:29 -0800 Subject: [PATCH 02/18] OK, I've had enough vstest.console.exe & TAEF adapter. Let's just call TAEF straight up. --- .../templates/build-console-steps.yml | 40 +++++++++---------- 1 file changed, 18 insertions(+), 22 deletions(-) diff --git a/build/pipelines/templates/build-console-steps.yml b/build/pipelines/templates/build-console-steps.yml index b301d8a0b1d..4e58395f08c 100644 --- a/build/pipelines/templates/build-console-steps.yml +++ b/build/pipelines/templates/build-console-steps.yml @@ -52,32 +52,28 @@ steps: arguments: -SearchDir '$(Build.SourcesDirectory)' -SourceRoot '$(Build.SourcesDirectory)' -recursive -Verbose -CommitId $(Build.SourceVersion) errorActionPreference: silentlyContinue -- task: VSTest@2 - displayName: 'Run Unit Tests' +- task: CmdLine@1 + displayName: 'Run Unit Tests (x64)' inputs: - testAssemblyVer2: | - $(BUILD.SOURCESDIRECTORY)\**\*unit.test*.dll - !**\obj\** - runSettingsFile: '$(BUILD.SOURCESDIRECTORY)\src\unit.tests.$(BuildPlatform).runsettings' - codeCoverageEnabled: true - runInParallel: False - testRunTitle: 'Console Unit Tests' - platform: '$(BuildPlatform)' - configuration: '$(BuildConfiguration)' - condition: and(succeeded(), or(eq(variables['BuildPlatform'], 'x64'), eq(variables['BuildPlatform'], 'x86'))) + filename: '$(BUILD.SOURCESDIRECTORY)\packages\Taef.Redist.Wlk.10.51.200127004\build\binaries\x64\te.exe' + arguments: '$(BUILD.SOURCESDIRECTORY)\bin\x64\Release\*unit.test*.dll' + failOnStandardError: true + condition: and(succeeded(), eq(variables['BuildPlatform'], 'x64')) -- task: VSTest@2 +- task: CmdLine@1 + displayName: 'Run Unit Tests (x86)' + inputs: + filename: '$(BUILD.SOURCESDIRECTORY)\packages\Taef.Redist.Wlk.10.51.200127004\build\binaries\x86\te.exe' + arguments: '$(BUILD.SOURCESDIRECTORY)\bin\win32\Release\*unit.test*.dll' + failOnStandardError: true + condition: and(succeeded(), eq(variables['BuildPlatform'], 'x86')) + +- task: CmdLine@1 displayName: 'Run Feature Tests (x64 only)' inputs: - testAssemblyVer2: | - $(BUILD.SOURCESDIRECTORY)\**\*feature.test*.dll - !**\obj\** - runSettingsFile: '$(BUILD.SOURCESDIRECTORY)\src\unit.tests.$(BuildPlatform).runsettings' - codeCoverageEnabled: true - runInParallel: False - testRunTitle: 'Console Feature Tests' - platform: '$(BuildPlatform)' - configuration: '$(BuildConfiguration)' + filename: '$(BUILD.SOURCESDIRECTORY)\packages\Taef.Redist.Wlk.10.51.200127004\build\binaries\x64\te.exe' + arguments: '$(BUILD.SOURCESDIRECTORY)\bin\x64\Release\*feature.test*.dll' + failOnStandardError: true condition: and(succeeded(), eq(variables['BuildPlatform'], 'x64')) - task: CopyFiles@2 From 8f58ec4643922ecae7467f8674a04cda7587392d Mon Sep 17 00:00:00 2001 From: Michael Niksa Date: Thu, 6 Feb 2020 14:17:06 -0800 Subject: [PATCH 03/18] Try what Dustin proposed. --- .../templates/build-console-steps.yml | 25 ++++++++++--------- 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/build/pipelines/templates/build-console-steps.yml b/build/pipelines/templates/build-console-steps.yml index 4e58395f08c..25c5aae4d79 100644 --- a/build/pipelines/templates/build-console-steps.yml +++ b/build/pipelines/templates/build-console-steps.yml @@ -52,27 +52,28 @@ steps: arguments: -SearchDir '$(Build.SourcesDirectory)' -SourceRoot '$(Build.SourcesDirectory)' -recursive -Verbose -CommitId $(Build.SourceVersion) errorActionPreference: silentlyContinue -- task: CmdLine@1 - displayName: 'Run Unit Tests (x64)' +- task: PowerShell@2 + displayName: 'Rationalize build platform' inputs: - filename: '$(BUILD.SOURCESDIRECTORY)\packages\Taef.Redist.Wlk.10.51.200127004\build\binaries\x64\te.exe' - arguments: '$(BUILD.SOURCESDIRECTORY)\bin\x64\Release\*unit.test*.dll' - failOnStandardError: true - condition: and(succeeded(), eq(variables['BuildPlatform'], 'x64')) + targetType: inline + script: | + $Arch = "$(BuildPlatform)" + If ($Arch -Eq "x86") { $Arch = "Win32" } + Write-Host "##vso[task.setvariable variable=RationalizedBuildPlatform]${Arch}" - task: CmdLine@1 - displayName: 'Run Unit Tests (x86)' + displayName: 'Run Unit Tests' inputs: - filename: '$(BUILD.SOURCESDIRECTORY)\packages\Taef.Redist.Wlk.10.51.200127004\build\binaries\x86\te.exe' - arguments: '$(BUILD.SOURCESDIRECTORY)\bin\win32\Release\*unit.test*.dll' + filename: '$(BUILD.SOURCESDIRECTORY)\bin\$(RationalizedBuildPlatform)\$(BuildConfiguration)\te.exe' + arguments: '$(BUILD.SOURCESDIRECTORY)\bin\$(RationalizedBuildPlatform)\$(BuildConfiguration)\*unit.test*.dll' failOnStandardError: true - condition: and(succeeded(), eq(variables['BuildPlatform'], 'x86')) + condition: and(succeeded(), or(eq(variables['BuildPlatform'], 'x64'), eq(variables['BuildPlatform'], 'x86'))) - task: CmdLine@1 displayName: 'Run Feature Tests (x64 only)' inputs: - filename: '$(BUILD.SOURCESDIRECTORY)\packages\Taef.Redist.Wlk.10.51.200127004\build\binaries\x64\te.exe' - arguments: '$(BUILD.SOURCESDIRECTORY)\bin\x64\Release\*feature.test*.dll' + filename: '$(BUILD.SOURCESDIRECTORY)\bin\$(RationalizedBuildPlatform)\$(BuildConfiguration)\te.exe' + arguments: '$(BUILD.SOURCESDIRECTORY)\bin\$(RationalizedBuildPlatform)\$(BuildConfiguration)\*feature.test*.dll' failOnStandardError: true condition: and(succeeded(), eq(variables['BuildPlatform'], 'x64')) From 2bc5fa9e6c02f159bb7e1c0014d9218bd65a05ce Mon Sep 17 00:00:00 2001 From: Michael Niksa Date: Thu, 6 Feb 2020 14:39:16 -0800 Subject: [PATCH 04/18] disable flaky mouse wheel tests, file 4494 to fix em --- src/host/ft_host/API_InputTests.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/host/ft_host/API_InputTests.cpp b/src/host/ft_host/API_InputTests.cpp index cf11cd44d8c..3140da17f4c 100644 --- a/src/host/ft_host/API_InputTests.cpp +++ b/src/host/ft_host/API_InputTests.cpp @@ -409,6 +409,9 @@ void TestMouseWheelReadConsoleInputHelper(const UINT msg, const DWORD dwEventFla return; } + Log::Comment(L"This test is flaky. Fix me in GH#4494"); + Log::Result(WEX::Logging::TestResults::Skipped); + HWND const hwnd = GetConsoleWindow(); VERIFY_IS_TRUE(!!IsWindow(hwnd), L"Get console window handle to inject wheel messages."); From 94002eb5c6d234121658106703d51304c4904a45 Mon Sep 17 00:00:00 2001 From: Michael Niksa Date: Thu, 6 Feb 2020 14:46:41 -0800 Subject: [PATCH 05/18] Revert "foo" This reverts commit 35e771b5be30800bce9a7d8b7dfcd1c194621d32. --- src/foo.txt | 1 - 1 file changed, 1 deletion(-) delete mode 100644 src/foo.txt diff --git a/src/foo.txt b/src/foo.txt deleted file mode 100644 index 5e40c087705..00000000000 --- a/src/foo.txt +++ /dev/null @@ -1 +0,0 @@ -asdf \ No newline at end of file From 5e66a92b056e15d4e7a6a9cae5588960f09699f2 Mon Sep 17 00:00:00 2001 From: Michael Niksa Date: Thu, 6 Feb 2020 15:02:32 -0800 Subject: [PATCH 06/18] actually skip the tests, sheesh. --- src/host/ft_host/API_InputTests.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/host/ft_host/API_InputTests.cpp b/src/host/ft_host/API_InputTests.cpp index 3140da17f4c..19cf309721a 100644 --- a/src/host/ft_host/API_InputTests.cpp +++ b/src/host/ft_host/API_InputTests.cpp @@ -411,6 +411,7 @@ void TestMouseWheelReadConsoleInputHelper(const UINT msg, const DWORD dwEventFla Log::Comment(L"This test is flaky. Fix me in GH#4494"); Log::Result(WEX::Logging::TestResults::Skipped); + return; HWND const hwnd = GetConsoleWindow(); VERIFY_IS_TRUE(!!IsWindow(hwnd), L"Get console window handle to inject wheel messages."); From 0e597962612e56c6ae0d635306aa6671ee9be8a9 Mon Sep 17 00:00:00 2001 From: Michael Niksa Date: Thu, 6 Feb 2020 15:19:08 -0800 Subject: [PATCH 07/18] UNREACHABLE CODE. OK I GET IT. --- src/host/ft_host/API_InputTests.cpp | 108 ++++++++++++++-------------- 1 file changed, 54 insertions(+), 54 deletions(-) diff --git a/src/host/ft_host/API_InputTests.cpp b/src/host/ft_host/API_InputTests.cpp index 19cf309721a..5ff7e1ad2e5 100644 --- a/src/host/ft_host/API_InputTests.cpp +++ b/src/host/ft_host/API_InputTests.cpp @@ -413,60 +413,60 @@ void TestMouseWheelReadConsoleInputHelper(const UINT msg, const DWORD dwEventFla Log::Result(WEX::Logging::TestResults::Skipped); return; - HWND const hwnd = GetConsoleWindow(); - VERIFY_IS_TRUE(!!IsWindow(hwnd), L"Get console window handle to inject wheel messages."); - - HANDLE const hConsoleInput = GetStdInputHandle(); - VERIFY_WIN32_BOOL_SUCCEEDED(SetConsoleMode(hConsoleInput, dwConsoleMode), L"Apply the requested console mode"); - - // We don't generate mouse console event in QuickEditMode or if MouseInput is not enabled - DWORD dwExpectedEvents = 1; - if (dwConsoleMode & ENABLE_QUICK_EDIT_MODE || !(dwConsoleMode & ENABLE_MOUSE_INPUT)) - { - Log::Comment(L"QuickEditMode is set or MouseInput is not set, not expecting events"); - dwExpectedEvents = 0; - } - - VERIFY_WIN32_BOOL_SUCCEEDED(FlushConsoleInputBuffer(hConsoleInput), L"Flush input queue to make sure no one else is in the way."); - - // WM_MOUSEWHEEL params - // https://msdn.microsoft.com/en-us/library/windows/desktop/ms645617(v=vs.85).aspx - - // WPARAM is HIWORD the wheel delta and LOWORD the keystate (keys pressed with it) - // We want no keys pressed in the loword (0) and we want one tick of the wheel in the high word. - WPARAM wParam = 0; - short sKeyState = 0; - short sWheelDelta = -WHEEL_DELTA; // scroll down is negative, up is positive. - // we only use the lower 32-bits (in case of 64-bit system) - wParam = ((sWheelDelta << 16) | sKeyState) & 0xFFFFFFFF; - - // LPARAM is positioning information. We don't care so we'll leave it 0x0 - LPARAM lParam = 0; - - Log::Comment(L"Send scroll down message into console window queue."); - SendMessageW(hwnd, msg, wParam, lParam); - - Sleep(250); // give message time to sink in - - DWORD dwAvailable = 0; - VERIFY_WIN32_BOOL_SUCCEEDED(GetNumberOfConsoleInputEvents(hConsoleInput, &dwAvailable), L"Retrieve number of events in queue."); - VERIFY_ARE_EQUAL(dwExpectedEvents, dwAvailable, NoThrowString().Format(L"We expected %i event from our scroll message.", dwExpectedEvents)); - - INPUT_RECORD ir; - DWORD dwRead = 0; - if (dwExpectedEvents == 1) - { - VERIFY_WIN32_BOOL_SUCCEEDED(ReadConsoleInputW(hConsoleInput, &ir, 1, &dwRead), L"Read the event out."); - VERIFY_ARE_EQUAL(1u, dwRead); - - Log::Comment(L"Verify the event is what we expected. We only verify the fields relevant to this test."); - VERIFY_ARE_EQUAL(MOUSE_EVENT, ir.EventType); - // hard cast OK. only using lower 32-bits (see above) - VERIFY_ARE_EQUAL((DWORD)wParam, ir.Event.MouseEvent.dwButtonState); - // Don't care about ctrl key state. Can be messed with by caps lock/numlock state. Not checking this. - VERIFY_ARE_EQUAL(dwEventFlagsExpected, ir.Event.MouseEvent.dwEventFlags); - // Don't care about mouse position for ensuring scroll message went through. - } + //HWND const hwnd = GetConsoleWindow(); + //VERIFY_IS_TRUE(!!IsWindow(hwnd), L"Get console window handle to inject wheel messages."); + + //HANDLE const hConsoleInput = GetStdInputHandle(); + //VERIFY_WIN32_BOOL_SUCCEEDED(SetConsoleMode(hConsoleInput, dwConsoleMode), L"Apply the requested console mode"); + + //// We don't generate mouse console event in QuickEditMode or if MouseInput is not enabled + //DWORD dwExpectedEvents = 1; + //if (dwConsoleMode & ENABLE_QUICK_EDIT_MODE || !(dwConsoleMode & ENABLE_MOUSE_INPUT)) + //{ + // Log::Comment(L"QuickEditMode is set or MouseInput is not set, not expecting events"); + // dwExpectedEvents = 0; + //} + + //VERIFY_WIN32_BOOL_SUCCEEDED(FlushConsoleInputBuffer(hConsoleInput), L"Flush input queue to make sure no one else is in the way."); + + //// WM_MOUSEWHEEL params + //// https://msdn.microsoft.com/en-us/library/windows/desktop/ms645617(v=vs.85).aspx + + //// WPARAM is HIWORD the wheel delta and LOWORD the keystate (keys pressed with it) + //// We want no keys pressed in the loword (0) and we want one tick of the wheel in the high word. + //WPARAM wParam = 0; + //short sKeyState = 0; + //short sWheelDelta = -WHEEL_DELTA; // scroll down is negative, up is positive. + //// we only use the lower 32-bits (in case of 64-bit system) + //wParam = ((sWheelDelta << 16) | sKeyState) & 0xFFFFFFFF; + + //// LPARAM is positioning information. We don't care so we'll leave it 0x0 + //LPARAM lParam = 0; + + //Log::Comment(L"Send scroll down message into console window queue."); + //SendMessageW(hwnd, msg, wParam, lParam); + + //Sleep(250); // give message time to sink in + + //DWORD dwAvailable = 0; + //VERIFY_WIN32_BOOL_SUCCEEDED(GetNumberOfConsoleInputEvents(hConsoleInput, &dwAvailable), L"Retrieve number of events in queue."); + //VERIFY_ARE_EQUAL(dwExpectedEvents, dwAvailable, NoThrowString().Format(L"We expected %i event from our scroll message.", dwExpectedEvents)); + + //INPUT_RECORD ir; + //DWORD dwRead = 0; + //if (dwExpectedEvents == 1) + //{ + // VERIFY_WIN32_BOOL_SUCCEEDED(ReadConsoleInputW(hConsoleInput, &ir, 1, &dwRead), L"Read the event out."); + // VERIFY_ARE_EQUAL(1u, dwRead); + + // Log::Comment(L"Verify the event is what we expected. We only verify the fields relevant to this test."); + // VERIFY_ARE_EQUAL(MOUSE_EVENT, ir.EventType); + // // hard cast OK. only using lower 32-bits (see above) + // VERIFY_ARE_EQUAL((DWORD)wParam, ir.Event.MouseEvent.dwButtonState); + // // Don't care about ctrl key state. Can be messed with by caps lock/numlock state. Not checking this. + // VERIFY_ARE_EQUAL(dwEventFlagsExpected, ir.Event.MouseEvent.dwEventFlags); + // // Don't care about mouse position for ensuring scroll message went through. + //} } void InputTests::TestMouseWheelReadConsoleMouseInput() From 3a20658ad6683896acf240010e952ded53a59d24 Mon Sep 17 00:00:00 2001 From: Michael Niksa Date: Thu, 6 Feb 2020 15:37:55 -0800 Subject: [PATCH 08/18] put yml files in solution, also comment out the arguments because urgh. --- OpenConsole.sln | 36 +++++++++++++++++++++-------- src/host/ft_host/API_InputTests.cpp | 2 +- 2 files changed, 27 insertions(+), 11 deletions(-) diff --git a/OpenConsole.sln b/OpenConsole.sln index 447308098b3..b5cf5160786 100644 --- a/OpenConsole.sln +++ b/OpenConsole.sln @@ -98,16 +98,6 @@ EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Propsheet.DLL", "src\propsheet\propsheet.vcxproj", "{5D23E8E1-3C64-4CC1-A8F7-6861677F7239}" EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "_Build Common", "_Build Common", "{04170EEF-983A-4195-BFEF-2321E5E38A1E}" - ProjectSection(SolutionItems) = preProject - src\common.build.post.props = src\common.build.post.props - src\common.build.pre.props = src\common.build.pre.props - src\common.build.tests.props = src\common.build.tests.props - common.openconsole.props = common.openconsole.props - src\cppwinrt.build.post.props = src\cppwinrt.build.post.props - src\cppwinrt.build.pre.props = src\cppwinrt.build.pre.props - src\wap-common.build.post.props = src\wap-common.build.post.props - src\wap-common.build.pre.props = src\wap-common.build.pre.props - EndProjectSection EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Server", "src\server\lib\server.vcxproj", "{18D09A24-8240-42D6-8CB6-236EEE820262}" EndProject @@ -271,6 +261,30 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "til.unit.tests", "src\til\u EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "U8U16Test", "src\tools\U8U16Test\U8U16Test.vcxproj", "{A602A555-BAAC-46E1-A91D-3DAB0475C5A1}" EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Common Props", "Common Props", "{53DD5520-E64C-4C06-B472-7CE62CA539C9}" + ProjectSection(SolutionItems) = preProject + src\common.build.post.props = src\common.build.post.props + src\common.build.pre.props = src\common.build.pre.props + src\common.build.tests.props = src\common.build.tests.props + common.openconsole.props = common.openconsole.props + src\cppwinrt.build.post.props = src\cppwinrt.build.post.props + src\cppwinrt.build.pre.props = src\cppwinrt.build.pre.props + src\wap-common.build.post.props = src\wap-common.build.post.props + src\wap-common.build.pre.props = src\wap-common.build.pre.props + EndProjectSection +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "YAML", "YAML", "{6B5A44ED-918D-4747-BFB1-2472A1FCA173}" + ProjectSection(SolutionItems) = preProject + build\pipelines\templates\build-console-audit-job.yml = build\pipelines\templates\build-console-audit-job.yml + build\pipelines\templates\build-console-ci.yml = build\pipelines\templates\build-console-ci.yml + build\pipelines\templates\build-console-int.yml = build\pipelines\templates\build-console-int.yml + build\pipelines\templates\build-console-steps.yml = build\pipelines\templates\build-console-steps.yml + build\pipelines\templates\check-formatting.yml = build\pipelines\templates\check-formatting.yml + build\pipelines\ci.yml = build\pipelines\ci.yml + build\pipelines\templates\release-sign-and-bundle.yml = build\pipelines\templates\release-sign-and-bundle.yml + build\pipelines\release.yml = build\pipelines\release.yml + EndProjectSection +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution AuditMode|Any CPU = AuditMode|Any CPU @@ -1467,6 +1481,8 @@ Global {BDB237B6-1D1D-400F-84CC-40A58FA59C8E} = {59840756-302F-44DF-AA47-441A9D673202} {767268EE-174A-46FE-96F0-EEE698A1BBC9} = {89CDCC5C-9F53-4054-97A4-639D99F169CD} {A602A555-BAAC-46E1-A91D-3DAB0475C5A1} = {A10C4720-DCA4-4640-9749-67F4314F527C} + {53DD5520-E64C-4C06-B472-7CE62CA539C9} = {04170EEF-983A-4195-BFEF-2321E5E38A1E} + {6B5A44ED-918D-4747-BFB1-2472A1FCA173} = {04170EEF-983A-4195-BFEF-2321E5E38A1E} EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution SolutionGuid = {3140B1B7-C8EE-43D1-A772-D82A7061A271} diff --git a/src/host/ft_host/API_InputTests.cpp b/src/host/ft_host/API_InputTests.cpp index 5ff7e1ad2e5..25579734e18 100644 --- a/src/host/ft_host/API_InputTests.cpp +++ b/src/host/ft_host/API_InputTests.cpp @@ -400,7 +400,7 @@ void InputTests::TestReadConsolePasswordScenario() VERIFY_ARE_EQUAL(wcslen(pwszExpected), len); } -void TestMouseWheelReadConsoleInputHelper(const UINT msg, const DWORD dwEventFlagsExpected, const DWORD dwConsoleMode) +void TestMouseWheelReadConsoleInputHelper(const UINT /*msg*/, const DWORD /*dwEventFlagsExpected*/, const DWORD /*dwConsoleMode*/) { if (!OneCoreDelay::IsIsWindowPresent()) { From 593fce872baa8c7bb06cacc003436d67acbae276 Mon Sep 17 00:00:00 2001 From: Michael Niksa Date: Fri, 7 Feb 2020 14:14:44 -0800 Subject: [PATCH 09/18] Isolate these two suspicious test classes. --- src/host/ut_host/ConptyOutputTests.cpp | 4 +++- src/host/ut_host/VtIoTests.cpp | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/host/ut_host/ConptyOutputTests.cpp b/src/host/ut_host/ConptyOutputTests.cpp index 42e9f36b633..50683be2f8e 100644 --- a/src/host/ut_host/ConptyOutputTests.cpp +++ b/src/host/ut_host/ConptyOutputTests.cpp @@ -27,7 +27,9 @@ using namespace Microsoft::Console::Types; class ConptyOutputTests { - TEST_CLASS(ConptyOutputTests); + BEGIN_TEST_CLASS(ConptyOutputTests) + TEST_CLASS_PROPERTY(L"IsolationLevel", L"Class") + END_TEST_CLASS() TEST_CLASS_SETUP(ClassSetup) { diff --git a/src/host/ut_host/VtIoTests.cpp b/src/host/ut_host/VtIoTests.cpp index 860fb920937..9222a3bc474 100644 --- a/src/host/ut_host/VtIoTests.cpp +++ b/src/host/ut_host/VtIoTests.cpp @@ -21,7 +21,9 @@ using namespace std; class Microsoft::Console::VirtualTerminal::VtIoTests { - TEST_CLASS(VtIoTests); + BEGIN_TEST_CLASS(VtIoTests) + TEST_CLASS_PROPERTY(L"IsolationLevel", L"Class") + END_TEST_CLASS() // General Tests: TEST_METHOD(NoOpStartTest); From 5cd3c542e1571b0513386844994b1c6d3f625bbf Mon Sep 17 00:00:00 2001 From: Michael Niksa Date: Fri, 7 Feb 2020 15:06:19 -0800 Subject: [PATCH 10/18] format --- src/host/ut_host/ConptyOutputTests.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/host/ut_host/ConptyOutputTests.cpp b/src/host/ut_host/ConptyOutputTests.cpp index 50683be2f8e..0506acd3246 100644 --- a/src/host/ut_host/ConptyOutputTests.cpp +++ b/src/host/ut_host/ConptyOutputTests.cpp @@ -29,7 +29,7 @@ class ConptyOutputTests { BEGIN_TEST_CLASS(ConptyOutputTests) TEST_CLASS_PROPERTY(L"IsolationLevel", L"Class") - END_TEST_CLASS() + END_TEST_CLASS() TEST_CLASS_SETUP(ClassSetup) { From d174ddcdf7b3ee70a95cec0ad691ae286eaeb8d7 Mon Sep 17 00:00:00 2001 From: Michael Niksa Date: Fri, 7 Feb 2020 15:16:41 -0800 Subject: [PATCH 11/18] Get rid of sleep condition, try adding a bit more explicitness to the relationship of renderer and its thread to solve it instead. --- src/host/ut_host/VtIoTests.cpp | 4 ++-- src/renderer/base/renderer.cpp | 6 ++++++ 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/src/host/ut_host/VtIoTests.cpp b/src/host/ut_host/VtIoTests.cpp index 9222a3bc474..9d725d79bf2 100644 --- a/src/host/ut_host/VtIoTests.cpp +++ b/src/host/ut_host/VtIoTests.cpp @@ -362,7 +362,7 @@ void VtIoTests::RendererDtorAndThread() // EnablePainting gets called, and if that happens, then the thread will // never get destructed. This will only ever happen in the vstest test runner, // which is what CI uses. - Sleep(500); + /*Sleep(500);*/ pThread->EnablePainting(); pRenderer->TriggerTeardown(); @@ -389,7 +389,7 @@ void VtIoTests::RendererDtorAndThreadAndDx() // EnablePainting gets called, and if that happens, then the thread will // never get destructed. This will only ever happen in the vstest test runner, // which is what CI uses. - Sleep(500); + /*Sleep(500);*/ pThread->EnablePainting(); pRenderer->TriggerTeardown(); diff --git a/src/renderer/base/renderer.cpp b/src/renderer/base/renderer.cpp index c1ce6f622f5..e3b2ba21a70 100644 --- a/src/renderer/base/renderer.cpp +++ b/src/renderer/base/renderer.cpp @@ -47,6 +47,7 @@ Renderer::Renderer(IRenderData* pData, Renderer::~Renderer() { _destructing = true; + _pThread.reset(); } // Routine Description: @@ -67,6 +68,11 @@ Renderer::~Renderer() auto tries = maxRetriesForRenderEngine; while (tries > 0) { + if (_destructing) + { + return S_FALSE; + } + const auto hr = _PaintFrameForEngine(pEngine); if (E_PENDING == hr) { From 945a78811b016382be802b66b362756d10c4b695 Mon Sep 17 00:00:00 2001 From: Michael Niksa Date: Fri, 7 Feb 2020 15:55:52 -0800 Subject: [PATCH 12/18] Use powershell script to find tests recursively. --- .../templates/build-console-steps.yml | 20 +++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/build/pipelines/templates/build-console-steps.yml b/build/pipelines/templates/build-console-steps.yml index 25c5aae4d79..0bb743d5e80 100644 --- a/build/pipelines/templates/build-console-steps.yml +++ b/build/pipelines/templates/build-console-steps.yml @@ -61,20 +61,24 @@ steps: If ($Arch -Eq "x86") { $Arch = "Win32" } Write-Host "##vso[task.setvariable variable=RationalizedBuildPlatform]${Arch}" -- task: CmdLine@1 +- task: PowerShell@2 displayName: 'Run Unit Tests' inputs: - filename: '$(BUILD.SOURCESDIRECTORY)\bin\$(RationalizedBuildPlatform)\$(BuildConfiguration)\te.exe' - arguments: '$(BUILD.SOURCESDIRECTORY)\bin\$(RationalizedBuildPlatform)\$(BuildConfiguration)\*unit.test*.dll' - failOnStandardError: true + targetType: inline + script: | + $testdlls = Get-ChildItem -Path '$(BUILD.SOURCESDIRECTORY)\bin\$(RationalizedBuildPlatform)\$(BuildConfiguration)' -Recurse -Include '*unit.test*.dll' + foreach ($dll in $testdlls) { $(BUILD.SOURCESDIRECTORY)\bin\$(RationalizedBuildPlatform)\$(BuildConfiguration)\te.exe $dll } + failOnStderr: true condition: and(succeeded(), or(eq(variables['BuildPlatform'], 'x64'), eq(variables['BuildPlatform'], 'x86'))) -- task: CmdLine@1 +- task: PowerShell@2 displayName: 'Run Feature Tests (x64 only)' inputs: - filename: '$(BUILD.SOURCESDIRECTORY)\bin\$(RationalizedBuildPlatform)\$(BuildConfiguration)\te.exe' - arguments: '$(BUILD.SOURCESDIRECTORY)\bin\$(RationalizedBuildPlatform)\$(BuildConfiguration)\*feature.test*.dll' - failOnStandardError: true + targetType: inline + script: | + $testdlls = Get-ChildItem -Path '$(BUILD.SOURCESDIRECTORY)\bin\$(RationalizedBuildPlatform)\$(BuildConfiguration)' -Recurse -Include '*feature.test*.dll' + foreach ($dll in $testdlls) { $(BUILD.SOURCESDIRECTORY)\bin\$(RationalizedBuildPlatform)\$(BuildConfiguration)\te.exe $dll } + failOnStderr: true condition: and(succeeded(), eq(variables['BuildPlatform'], 'x64')) - task: CopyFiles@2 From 936ae05f4d90e094ec88b5acd3e3aeabafd3a3cf Mon Sep 17 00:00:00 2001 From: Michael Niksa Date: Fri, 7 Feb 2020 15:56:42 -0800 Subject: [PATCH 13/18] Add a failing test to make sure that my powershell script detects failures... --- src/host/ut_host/InitTests.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/host/ut_host/InitTests.cpp b/src/host/ut_host/InitTests.cpp index b3e32603e06..1cd35674231 100644 --- a/src/host/ut_host/InitTests.cpp +++ b/src/host/ut_host/InitTests.cpp @@ -30,6 +30,11 @@ class InitTests static LANGID const s_langIdTraditionalChinese = MAKELANGID(LANG_CHINESE, SUBLANG_CHINESE_TRADITIONAL); static LANGID const s_langIdEnglish = MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US); + TEST_METHOD(FailBoat) + { + VERIFY_FAIL(L"Ouch"); + } + // This test exists to ensure the continued behavior of the code in the Windows loader. // See the LOAD BEARING CODE comment inside GetConsoleLangId or the investigation results in MSFT: 9808579 for more detail. TEST_METHOD(TestGetConsoleLangId) From 19e602cd94aca190bb0afcea668b18aa4618bb9c Mon Sep 17 00:00:00 2001 From: Michael Niksa Date: Fri, 7 Feb 2020 16:25:19 -0800 Subject: [PATCH 14/18] filter and call te once to make it fast again? --- build/pipelines/templates/build-console-steps.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/build/pipelines/templates/build-console-steps.yml b/build/pipelines/templates/build-console-steps.yml index 0bb743d5e80..5b0c75cb561 100644 --- a/build/pipelines/templates/build-console-steps.yml +++ b/build/pipelines/templates/build-console-steps.yml @@ -66,8 +66,8 @@ steps: inputs: targetType: inline script: | - $testdlls = Get-ChildItem -Path '$(BUILD.SOURCESDIRECTORY)\bin\$(RationalizedBuildPlatform)\$(BuildConfiguration)' -Recurse -Include '*unit.test*.dll' - foreach ($dll in $testdlls) { $(BUILD.SOURCESDIRECTORY)\bin\$(RationalizedBuildPlatform)\$(BuildConfiguration)\te.exe $dll } + $testdlls = Get-ChildItem -Path '.\bin\$(RationalizedBuildPlatform)\$(BuildConfiguration)' -Recurse -Filter '*unit.test*.dll' + .\bin\$(RationalizedBuildPlatform)\$(BuildConfiguration)\te.exe $testdlls failOnStderr: true condition: and(succeeded(), or(eq(variables['BuildPlatform'], 'x64'), eq(variables['BuildPlatform'], 'x86'))) @@ -76,8 +76,8 @@ steps: inputs: targetType: inline script: | - $testdlls = Get-ChildItem -Path '$(BUILD.SOURCESDIRECTORY)\bin\$(RationalizedBuildPlatform)\$(BuildConfiguration)' -Recurse -Include '*feature.test*.dll' - foreach ($dll in $testdlls) { $(BUILD.SOURCESDIRECTORY)\bin\$(RationalizedBuildPlatform)\$(BuildConfiguration)\te.exe $dll } + $testdlls = Get-ChildItem -Path '.\bin\$(RationalizedBuildPlatform)\$(BuildConfiguration)' -Recurse -Filter '*feature.test*.dll' + .\bin\$(RationalizedBuildPlatform)\$(BuildConfiguration)\te.exe $testdlls failOnStderr: true condition: and(succeeded(), eq(variables['BuildPlatform'], 'x64')) From 49857d0dfcef08b14db30708f8bc0f7631ef5c0c Mon Sep 17 00:00:00 2001 From: Michael Niksa Date: Fri, 7 Feb 2020 16:27:02 -0800 Subject: [PATCH 15/18] fail didn't seem to fail right either. Try this. --- build/pipelines/templates/build-console-steps.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/build/pipelines/templates/build-console-steps.yml b/build/pipelines/templates/build-console-steps.yml index 5b0c75cb561..c2658356f52 100644 --- a/build/pipelines/templates/build-console-steps.yml +++ b/build/pipelines/templates/build-console-steps.yml @@ -68,7 +68,7 @@ steps: script: | $testdlls = Get-ChildItem -Path '.\bin\$(RationalizedBuildPlatform)\$(BuildConfiguration)' -Recurse -Filter '*unit.test*.dll' .\bin\$(RationalizedBuildPlatform)\$(BuildConfiguration)\te.exe $testdlls - failOnStderr: true + if ($lastexitcode -Ne 0) { Exit $lastexitcode } condition: and(succeeded(), or(eq(variables['BuildPlatform'], 'x64'), eq(variables['BuildPlatform'], 'x86'))) - task: PowerShell@2 @@ -77,8 +77,8 @@ steps: targetType: inline script: | $testdlls = Get-ChildItem -Path '.\bin\$(RationalizedBuildPlatform)\$(BuildConfiguration)' -Recurse -Filter '*feature.test*.dll' - .\bin\$(RationalizedBuildPlatform)\$(BuildConfiguration)\te.exe $testdlls - failOnStderr: true + .\bin\$(RationalizedBuildPlatform)\$(BuildConfiguration)\te.exe $testdlls + if ($lastexitcode -Ne 0) { Exit $lastexitcode } condition: and(succeeded(), eq(variables['BuildPlatform'], 'x64')) - task: CopyFiles@2 From 5352f7c78ec7318702a68bcd37e0d673c7811bc8 Mon Sep 17 00:00:00 2001 From: Michael Niksa Date: Mon, 10 Feb 2020 10:10:24 -0800 Subject: [PATCH 16/18] POWERSHELL: WILL IT BLEND?! --- .../pipelines/templates/build-console-steps.yml | 16 ++++++---------- build/scripts/Run-Tests.ps1 | 14 ++++++++++++++ 2 files changed, 20 insertions(+), 10 deletions(-) create mode 100644 build/scripts/Run-Tests.ps1 diff --git a/build/pipelines/templates/build-console-steps.yml b/build/pipelines/templates/build-console-steps.yml index c2658356f52..0fd6c7b6878 100644 --- a/build/pipelines/templates/build-console-steps.yml +++ b/build/pipelines/templates/build-console-steps.yml @@ -64,21 +64,17 @@ steps: - task: PowerShell@2 displayName: 'Run Unit Tests' inputs: - targetType: inline - script: | - $testdlls = Get-ChildItem -Path '.\bin\$(RationalizedBuildPlatform)\$(BuildConfiguration)' -Recurse -Filter '*unit.test*.dll' - .\bin\$(RationalizedBuildPlatform)\$(BuildConfiguration)\te.exe $testdlls - if ($lastexitcode -Ne 0) { Exit $lastexitcode } + targetType: filePath + filePath: build\scripts\Run-Tests.ps1 + arguments: -MatchPattern '*unit.test*.dll' -Platform '$(RationalizedBuildPlatform)' -Configuration '$(BuildConfiguration)' condition: and(succeeded(), or(eq(variables['BuildPlatform'], 'x64'), eq(variables['BuildPlatform'], 'x86'))) - task: PowerShell@2 displayName: 'Run Feature Tests (x64 only)' inputs: - targetType: inline - script: | - $testdlls = Get-ChildItem -Path '.\bin\$(RationalizedBuildPlatform)\$(BuildConfiguration)' -Recurse -Filter '*feature.test*.dll' - .\bin\$(RationalizedBuildPlatform)\$(BuildConfiguration)\te.exe $testdlls - if ($lastexitcode -Ne 0) { Exit $lastexitcode } + targetType: filePath + filePath: build\scripts\Run-Tests.ps1 + arguments: -MatchPattern '*feature.test*.dll' -Platform '$(RationalizedBuildPlatform)' -Configuration '$(BuildConfiguration)' condition: and(succeeded(), eq(variables['BuildPlatform'], 'x64')) - task: CopyFiles@2 diff --git a/build/scripts/Run-Tests.ps1 b/build/scripts/Run-Tests.ps1 new file mode 100644 index 00000000000..28c9b5bd95f --- /dev/null +++ b/build/scripts/Run-Tests.ps1 @@ -0,0 +1,14 @@ +[CmdLetBinding()] +Param( + [Parameter(Mandatory=$true, Position=0)][string]$MatchPattern, + [Parameter(Mandatory=$true, Position=1)][string]$Platform, + [Parameter(Mandatory=$true, Position=2)][string]$Configuration +) + +$testdlls = Get-ChildItem -Path ".\bin\$Platform\$Configuration" -Recurse -Filter $MatchPattern + +&".\bin\$Platform\$Configuration\te.exe" $testdlls.FullName + +if ($lastexitcode -Ne 0) { Exit $lastexitcode } + +Exit 0 From 154dcc9341740e6616b4149ff81f7021d362a7f1 Mon Sep 17 00:00:00 2001 From: Michael Niksa Date: Mon, 10 Feb 2020 10:20:08 -0800 Subject: [PATCH 17/18] Put scripts into solution file too. --- OpenConsole.sln | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/OpenConsole.sln b/OpenConsole.sln index b5cf5160786..e5c72362850 100644 --- a/OpenConsole.sln +++ b/OpenConsole.sln @@ -285,6 +285,15 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "YAML", "YAML", "{6B5A44ED-9 build\pipelines\release.yml = build\pipelines\release.yml EndProjectSection EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Scripts", "Scripts", "{D3EF7B96-CD5E-47C9-B9A9-136259563033}" + ProjectSection(SolutionItems) = preProject + build\scripts\Create-AppxBundle.ps1 = build\scripts\Create-AppxBundle.ps1 + build\scripts\Index-Pdbs.ps1 = build\scripts\Index-Pdbs.ps1 + build\scripts\Invoke-FormattingCheck.ps1 = build\scripts\Invoke-FormattingCheck.ps1 + build\scripts\Run-Tests.ps1 = build\scripts\Run-Tests.ps1 + build\scripts\Test-WindowsTerminalPackage.ps1 = build\scripts\Test-WindowsTerminalPackage.ps1 + EndProjectSection +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution AuditMode|Any CPU = AuditMode|Any CPU @@ -1483,6 +1492,7 @@ Global {A602A555-BAAC-46E1-A91D-3DAB0475C5A1} = {A10C4720-DCA4-4640-9749-67F4314F527C} {53DD5520-E64C-4C06-B472-7CE62CA539C9} = {04170EEF-983A-4195-BFEF-2321E5E38A1E} {6B5A44ED-918D-4747-BFB1-2472A1FCA173} = {04170EEF-983A-4195-BFEF-2321E5E38A1E} + {D3EF7B96-CD5E-47C9-B9A9-136259563033} = {04170EEF-983A-4195-BFEF-2321E5E38A1E} EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution SolutionGuid = {3140B1B7-C8EE-43D1-A772-D82A7061A271} From 591d7e08ba855bf1fab95781d66dfed0cdcb7bd5 Mon Sep 17 00:00:00 2001 From: Michael Niksa Date: Mon, 10 Feb 2020 10:45:13 -0800 Subject: [PATCH 18/18] Remove failboat test. --- src/host/ut_host/InitTests.cpp | 5 ----- 1 file changed, 5 deletions(-) diff --git a/src/host/ut_host/InitTests.cpp b/src/host/ut_host/InitTests.cpp index 1cd35674231..b3e32603e06 100644 --- a/src/host/ut_host/InitTests.cpp +++ b/src/host/ut_host/InitTests.cpp @@ -30,11 +30,6 @@ class InitTests static LANGID const s_langIdTraditionalChinese = MAKELANGID(LANG_CHINESE, SUBLANG_CHINESE_TRADITIONAL); static LANGID const s_langIdEnglish = MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US); - TEST_METHOD(FailBoat) - { - VERIFY_FAIL(L"Ouch"); - } - // This test exists to ensure the continued behavior of the code in the Windows loader. // See the LOAD BEARING CODE comment inside GetConsoleLangId or the investigation results in MSFT: 9808579 for more detail. TEST_METHOD(TestGetConsoleLangId)