diff --git a/OpenConsole.sln b/OpenConsole.sln index e699c77cece..1a05e24b750 100644 --- a/OpenConsole.sln +++ b/OpenConsole.sln @@ -270,7 +270,6 @@ EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "TestHostApp", "src\cascadia\LocalTests_TerminalApp\TestHostApp\TestHostApp.vcxproj", "{A021EDFF-45C8-4DC2-BEF7-36E1B3B8CFE8}" ProjectSection(ProjectDependencies) = postProject {CA5CAD1A-082C-4476-9F33-94B339494076} = {CA5CAD1A-082C-4476-9F33-94B339494076} - {CA5CAD1A-9B68-456A-B13E-C8218070DC42} = {CA5CAD1A-9B68-456A-B13E-C8218070DC42} {CA5CAD1A-B11C-4DDB-A4FE-C3AFAE9B5506} = {CA5CAD1A-B11C-4DDB-A4FE-C3AFAE9B5506} EndProjectSection EndProject @@ -350,7 +349,7 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Microsoft.Terminal.Settings {CA5CAD1A-D7EC-4107-B7C6-79CB77AE2907} = {CA5CAD1A-D7EC-4107-B7C6-79CB77AE2907} EndProjectSection EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "LocalTests_SettingsModel", "src\cascadia\LocalTests_SettingsModel\SettingsModel.LocalTests.vcxproj", "{CA5CAD1A-9B68-456A-B13E-C8218070DC42}" +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "UnitTests_SettingsModel", "src\cascadia\UnitTests_SettingsModel\SettingsModel.UnitTests.vcxproj", "{CA5CAD1A-9B68-456A-B13E-C8218070DC42}" ProjectSection(ProjectDependencies) = postProject {CA5CAD1A-082C-4476-9F33-94B339494076} = {CA5CAD1A-082C-4476-9F33-94B339494076} {CA5CAD1A-C46D-4588-B1C0-40F31AE9100B} = {CA5CAD1A-C46D-4588-B1C0-40F31AE9100B} diff --git a/build/pipelines/templates-v2/job-run-pgo-tests.yml b/build/pipelines/templates-v2/job-run-pgo-tests.yml index 817d97ff9ce..f4208bf9553 100644 --- a/build/pipelines/templates-v2/job-run-pgo-tests.yml +++ b/build/pipelines/templates-v2/job-run-pgo-tests.yml @@ -56,6 +56,7 @@ jobs: - task: PowerShell@2 displayName: 'Run PGO Tests' inputs: + pwsh: true targetType: filePath filePath: build\scripts\Run-Tests.ps1 arguments: >- diff --git a/build/pipelines/templates-v2/job-test-project.yml b/build/pipelines/templates-v2/job-test-project.yml index 1cd8e2bef67..5c53d76cfd0 100644 --- a/build/pipelines/templates-v2/job-test-project.yml +++ b/build/pipelines/templates-v2/job-test-project.yml @@ -44,6 +44,7 @@ jobs: - task: PowerShell@2 displayName: 'Run Unit Tests' inputs: + pwsh: true targetType: filePath filePath: build\scripts\Run-Tests.ps1 arguments: -MatchPattern '*unit.test*.dll' -Platform '$(OutputBuildPlatform)' -Configuration '$(BuildConfiguration)' -LogPath '${{ parameters.testLogPath }}' -Root "$(Terminal.BinDir)" @@ -52,6 +53,7 @@ jobs: - task: PowerShell@2 displayName: 'Run Feature Tests' inputs: + pwsh: true targetType: filePath filePath: build\scripts\Run-Tests.ps1 arguments: -MatchPattern '*feature.test*.dll' -Platform '$(OutputBuildPlatform)' -Configuration '$(BuildConfiguration)' -LogPath '${{ parameters.testLogPath }}' -Root "$(Terminal.BinDir)" diff --git a/build/scripts/Run-Tests.ps1 b/build/scripts/Run-Tests.ps1 index bd4cf28fc50..c9a37001c72 100644 --- a/build/scripts/Run-Tests.ps1 +++ b/build/scripts/Run-Tests.ps1 @@ -16,22 +16,48 @@ Param( # Find test DLLs based on the provided root, match pattern, and recursion $testDlls = Get-ChildItem -Path $Root -Recurse -Filter $MatchPattern -$args = @() +$teArgs = @() # Check if the LogPath parameter is provided and enable WTT logging if ($LogPath) { - $args += '/enablewttlogging' - $args += '/appendwttlogging' - $args += "/logFile:$LogPath" + $teArgs += '/enablewttlogging' + $teArgs += '/appendwttlogging' + $teArgs += "/logFile:$LogPath" Write-Host "WTT Logging Enabled" } -# Invoke the te.exe executable with arguments and test DLLs -& "$Root\te.exe" $args $testDlls.FullName $AdditionalTaefArguments +$rootTe = "$Root\te.exe" -# Check the exit code of the te.exe process and exit accordingly -if ($LASTEXITCODE -ne 0) { - Exit $LASTEXITCODE +# Some of our test fixtures depend on resources.pri in the same folder as the .exe hosting them. +# Unfortunately, that means that we need to run the te.exe *next to* each test DLL we discover. +# This code establishes a mapping from te.exe to test DLL (or DLLs) +$testDllTaefGroups = $testDlls | % { + $localTe = Get-Item (Join-Path (Split-Path $_ -Parent) "te.exe") -EA:Ignore + If ($null -eq $localTe) { + $finalTePath = $rootTe + } Else { + $finalTePath = $localTe.FullName + } + [PSCustomObject]@{ + TePath = $finalTePath; + TestDll = $_; + } +} + +# Invoke the te.exe executables with arguments and test DLLs +$anyFailed = $false +$testDllTaefGroups | Group-Object TePath | % { + $te = $_.Group[0].TePath + $dlls = $_.Group.TestDll + Write-Verbose "Running $te (for $($dlls.Name))" + & $te $teArgs $dlls.FullName $AdditionalTaefArguments + if ($LASTEXITCODE -ne 0) { + $anyFailed = $true + } +} + +if ($anyFailed) { + Exit 1 } Exit 0 diff --git a/src/cascadia/LocalTests_SettingsModel/LocalTests_SettingsModel.def b/src/cascadia/LocalTests_SettingsModel/LocalTests_SettingsModel.def deleted file mode 100644 index ba15818ddb1..00000000000 --- a/src/cascadia/LocalTests_SettingsModel/LocalTests_SettingsModel.def +++ /dev/null @@ -1,3 +0,0 @@ -EXPORTS -DllCanUnloadNow = WINRT_CanUnloadNow PRIVATE -DllGetActivationFactory = WINRT_GetActivationFactory PRIVATE diff --git a/src/cascadia/LocalTests_TerminalApp/SettingsTests.cpp b/src/cascadia/LocalTests_TerminalApp/SettingsTests.cpp index a940cc915f3..8116e9e4574 100644 --- a/src/cascadia/LocalTests_TerminalApp/SettingsTests.cpp +++ b/src/cascadia/LocalTests_TerminalApp/SettingsTests.cpp @@ -4,7 +4,7 @@ #include "pch.h" #include "../TerminalApp/TerminalPage.h" -#include "../LocalTests_SettingsModel/TestUtils.h" +#include "../UnitTests_SettingsModel/TestUtils.h" using namespace Microsoft::Console; using namespace WEX::Logging; diff --git a/src/cascadia/LocalTests_TerminalApp/TestHostApp/TestHostApp.vcxproj b/src/cascadia/LocalTests_TerminalApp/TestHostApp/TestHostApp.vcxproj index 9e2029c9bcc..8d431bffcc0 100644 --- a/src/cascadia/LocalTests_TerminalApp/TestHostApp/TestHostApp.vcxproj +++ b/src/cascadia/LocalTests_TerminalApp/TestHostApp/TestHostApp.vcxproj @@ -133,7 +133,6 @@ - diff --git a/src/cascadia/TerminalSettingsModel/ActionMap.h b/src/cascadia/TerminalSettingsModel/ActionMap.h index d59dc0677d8..937d79f66cb 100644 --- a/src/cascadia/TerminalSettingsModel/ActionMap.h +++ b/src/cascadia/TerminalSettingsModel/ActionMap.h @@ -20,7 +20,7 @@ Author(s): #include "Command.h" // fwdecl unittest classes -namespace SettingsModelLocalTests +namespace SettingsModelUnitTests { class KeyBindingsTests; class DeserializationTests; @@ -123,8 +123,8 @@ namespace winrt::Microsoft::Terminal::Settings::Model::implementation // than is necessary to be serialized. std::unordered_map _MaskingActions; - friend class SettingsModelLocalTests::KeyBindingsTests; - friend class SettingsModelLocalTests::DeserializationTests; - friend class SettingsModelLocalTests::TerminalSettingsTests; + friend class SettingsModelUnitTests::KeyBindingsTests; + friend class SettingsModelUnitTests::DeserializationTests; + friend class SettingsModelUnitTests::TerminalSettingsTests; }; } diff --git a/src/cascadia/TerminalSettingsModel/Command.h b/src/cascadia/TerminalSettingsModel/Command.h index 4418716c815..a432fe9a370 100644 --- a/src/cascadia/TerminalSettingsModel/Command.h +++ b/src/cascadia/TerminalSettingsModel/Command.h @@ -25,7 +25,7 @@ Author(s): #include "SettingsTypes.h" // fwdecl unittest classes -namespace SettingsModelLocalTests +namespace SettingsModelUnitTests { class DeserializationTests; class CommandTests; @@ -87,8 +87,8 @@ namespace winrt::Microsoft::Terminal::Settings::Model::implementation static std::vector _expandCommand(Command* const expandable, Windows::Foundation::Collections::IVectorView profiles, Windows::Foundation::Collections::IVectorView schemes); - friend class SettingsModelLocalTests::DeserializationTests; - friend class SettingsModelLocalTests::CommandTests; + friend class SettingsModelUnitTests::DeserializationTests; + friend class SettingsModelUnitTests::CommandTests; }; } diff --git a/src/cascadia/TerminalSettingsModel/GlobalAppSettings.h b/src/cascadia/TerminalSettingsModel/GlobalAppSettings.h index 21d73483c02..79f40342254 100644 --- a/src/cascadia/TerminalSettingsModel/GlobalAppSettings.h +++ b/src/cascadia/TerminalSettingsModel/GlobalAppSettings.h @@ -27,7 +27,7 @@ Author(s): #include "RemainingProfilesEntry.h" // fwdecl unittest classes -namespace SettingsModelLocalTests +namespace SettingsModelUnitTests { class DeserializationTests; class ColorSchemeTests; diff --git a/src/cascadia/TerminalSettingsModel/Profile.cpp b/src/cascadia/TerminalSettingsModel/Profile.cpp index f31cd4e85f7..0db012e7bc7 100644 --- a/src/cascadia/TerminalSettingsModel/Profile.cpp +++ b/src/cascadia/TerminalSettingsModel/Profile.cpp @@ -317,7 +317,11 @@ Json::Value Profile::ToJson() const JsonUtils::SetValueForKey(json, GuidKey, writeBasicSettings ? Guid() : _Guid); JsonUtils::SetValueForKey(json, HiddenKey, writeBasicSettings ? Hidden() : _Hidden); JsonUtils::SetValueForKey(json, SourceKey, writeBasicSettings ? Source() : _Source); - JsonUtils::SetValueForKey(json, IconKey, writeBasicSettings ? Icon() : _Icon); + + // Recall: Icon isn't actually a setting in the MTSM_PROFILE_SETTINGS. We + // defined it manually in Profile, so make sure we only serialize the Icon + // if the user actually changed it here. + JsonUtils::SetValueForKey(json, IconKey, (writeBasicSettings && HasIcon()) ? Icon() : _Icon); // PermissiveStringConverter is unnecessary for serialization JsonUtils::SetValueForKey(json, PaddingKey, _Padding); diff --git a/src/cascadia/TerminalSettingsModel/Profile.h b/src/cascadia/TerminalSettingsModel/Profile.h index 1414dc0be1d..6fdd5c3ed57 100644 --- a/src/cascadia/TerminalSettingsModel/Profile.h +++ b/src/cascadia/TerminalSettingsModel/Profile.h @@ -54,7 +54,7 @@ Author(s): #include "FontConfig.h" // fwdecl unittest classes -namespace SettingsModelLocalTests +namespace SettingsModelUnitTests { class DeserializationTests; class ProfileTests; @@ -147,10 +147,10 @@ namespace winrt::Microsoft::Terminal::Settings::Model::implementation winrt::hstring _evaluateIcon() const; - friend class SettingsModelLocalTests::DeserializationTests; - friend class SettingsModelLocalTests::ProfileTests; - friend class SettingsModelLocalTests::ColorSchemeTests; - friend class SettingsModelLocalTests::KeyBindingsTests; + friend class SettingsModelUnitTests::DeserializationTests; + friend class SettingsModelUnitTests::ProfileTests; + friend class SettingsModelUnitTests::ColorSchemeTests; + friend class SettingsModelUnitTests::KeyBindingsTests; friend class TerminalAppUnitTests::DynamicProfileTests; friend class TerminalAppUnitTests::JsonTests; }; diff --git a/src/cascadia/TerminalSettingsModel/TerminalSettings.h b/src/cascadia/TerminalSettingsModel/TerminalSettings.h index 0e7346a5960..22fba938723 100644 --- a/src/cascadia/TerminalSettingsModel/TerminalSettings.h +++ b/src/cascadia/TerminalSettingsModel/TerminalSettings.h @@ -25,7 +25,7 @@ using IFontFeatureMap = winrt::Windows::Foundation::Collections::IMap; // fwdecl unittest classes -namespace SettingsModelLocalTests +namespace SettingsModelUnitTests { class TerminalSettingsTests; } @@ -182,7 +182,7 @@ namespace winrt::Microsoft::Terminal::Settings::Model::implementation const Windows::Foundation::Collections::IMapView& schemes, const winrt::Microsoft::Terminal::Settings::Model::Theme currentTheme); - friend class SettingsModelLocalTests::TerminalSettingsTests; + friend class SettingsModelUnitTests::TerminalSettingsTests; }; } diff --git a/src/cascadia/LocalTests_SettingsModel/ColorSchemeTests.cpp b/src/cascadia/UnitTests_SettingsModel/ColorSchemeTests.cpp similarity index 96% rename from src/cascadia/LocalTests_SettingsModel/ColorSchemeTests.cpp rename to src/cascadia/UnitTests_SettingsModel/ColorSchemeTests.cpp index a537c3dc698..b2198160671 100644 --- a/src/cascadia/LocalTests_SettingsModel/ColorSchemeTests.cpp +++ b/src/cascadia/UnitTests_SettingsModel/ColorSchemeTests.cpp @@ -16,24 +16,11 @@ using namespace WEX::Logging; using namespace WEX::TestExecution; using namespace WEX::Common; -namespace SettingsModelLocalTests +namespace SettingsModelUnitTests { - // TODO:microsoft/terminal#3838: - // Unfortunately, these tests _WILL NOT_ work in our CI. We're waiting for - // an updated TAEF that will let us install framework packages when the test - // package is deployed. Until then, these tests won't deploy in CI. - class ColorSchemeTests : public JsonTestClass { - // Use a custom AppxManifest to ensure that we can activate winrt types - // from our test. This property will tell taef to manually use this as - // the AppxManifest for this test class. - // This does not yet work for anything XAML-y. See TabTests.cpp for more - // details on that. - BEGIN_TEST_CLASS(ColorSchemeTests) - TEST_CLASS_PROPERTY(L"RunAs", L"UAP") - TEST_CLASS_PROPERTY(L"UAP:AppXManifest", L"TestHostAppXManifest.xml") - END_TEST_CLASS() + TEST_CLASS(ColorSchemeTests); TEST_METHOD(ParseSimpleColorScheme); TEST_METHOD(LayerColorSchemesOnArray); diff --git a/src/cascadia/LocalTests_SettingsModel/CommandTests.cpp b/src/cascadia/UnitTests_SettingsModel/CommandTests.cpp similarity index 95% rename from src/cascadia/LocalTests_SettingsModel/CommandTests.cpp rename to src/cascadia/UnitTests_SettingsModel/CommandTests.cpp index cf8116033a1..f68b0224a47 100644 --- a/src/cascadia/LocalTests_SettingsModel/CommandTests.cpp +++ b/src/cascadia/UnitTests_SettingsModel/CommandTests.cpp @@ -15,24 +15,11 @@ using namespace WEX::Logging; using namespace WEX::TestExecution; using namespace WEX::Common; -namespace SettingsModelLocalTests +namespace SettingsModelUnitTests { - // TODO:microsoft/terminal#3838: - // Unfortunately, these tests _WILL NOT_ work in our CI. We're waiting for - // an updated TAEF that will let us install framework packages when the test - // package is deployed. Until then, these tests won't deploy in CI. - class CommandTests : public JsonTestClass { - // Use a custom AppxManifest to ensure that we can activate winrt types - // from our test. This property will tell taef to manually use this as - // the AppxManifest for this test class. - // This does not yet work for anything XAML-y. See TabTests.cpp for more - // details on that. - BEGIN_TEST_CLASS(CommandTests) - TEST_CLASS_PROPERTY(L"RunAs", L"UAP") - TEST_CLASS_PROPERTY(L"UAP:AppXManifest", L"TestHostAppXManifest.xml") - END_TEST_CLASS() + TEST_CLASS(CommandTests); TEST_METHOD(ManyCommandsSameAction); TEST_METHOD(LayerCommand); diff --git a/src/cascadia/LocalTests_SettingsModel/DeserializationTests.cpp b/src/cascadia/UnitTests_SettingsModel/DeserializationTests.cpp similarity index 96% rename from src/cascadia/LocalTests_SettingsModel/DeserializationTests.cpp rename to src/cascadia/UnitTests_SettingsModel/DeserializationTests.cpp index 50d649d7a5d..e546cf3305e 100644 --- a/src/cascadia/LocalTests_SettingsModel/DeserializationTests.cpp +++ b/src/cascadia/UnitTests_SettingsModel/DeserializationTests.cpp @@ -19,24 +19,11 @@ using namespace winrt::Microsoft::Terminal::Settings::Model; using namespace winrt::Microsoft::Terminal::Control; using VirtualKeyModifiers = winrt::Windows::System::VirtualKeyModifiers; -namespace SettingsModelLocalTests +namespace SettingsModelUnitTests { - // TODO:microsoft/terminal#3838: - // Unfortunately, these tests _WILL NOT_ work in our CI. We're waiting for - // an updated TAEF that will let us install framework packages when the test - // package is deployed. Until then, these tests won't deploy in CI. - class DeserializationTests : public JsonTestClass { - // Use a custom AppxManifest to ensure that we can activate winrt types - // from our test. This property will tell taef to manually use this as - // the AppxManifest for this test class. - // This does not yet work for anything XAML-y. See TabTests.cpp for more - // details on that. - BEGIN_TEST_CLASS(DeserializationTests) - TEST_CLASS_PROPERTY(L"RunAs", L"UAP") - TEST_CLASS_PROPERTY(L"UAP:AppXManifest", L"TestHostAppXManifest.xml") - END_TEST_CLASS() + TEST_CLASS(DeserializationTests); TEST_METHOD(ValidateProfilesExist); TEST_METHOD(ValidateDefaultProfileExists); diff --git a/src/cascadia/LocalTests_SettingsModel/JsonTestClass.h b/src/cascadia/UnitTests_SettingsModel/JsonTestClass.h similarity index 100% rename from src/cascadia/LocalTests_SettingsModel/JsonTestClass.h rename to src/cascadia/UnitTests_SettingsModel/JsonTestClass.h diff --git a/src/cascadia/LocalTests_SettingsModel/KeyBindingsTests.cpp b/src/cascadia/UnitTests_SettingsModel/KeyBindingsTests.cpp similarity index 95% rename from src/cascadia/LocalTests_SettingsModel/KeyBindingsTests.cpp rename to src/cascadia/UnitTests_SettingsModel/KeyBindingsTests.cpp index b2e77f5b4e6..8eed7276f1b 100644 --- a/src/cascadia/LocalTests_SettingsModel/KeyBindingsTests.cpp +++ b/src/cascadia/UnitTests_SettingsModel/KeyBindingsTests.cpp @@ -17,24 +17,11 @@ using namespace WEX::TestExecution; using namespace WEX::Common; using VirtualKeyModifiers = winrt::Windows::System::VirtualKeyModifiers; -namespace SettingsModelLocalTests +namespace SettingsModelUnitTests { - // TODO:microsoft/terminal#3838: - // Unfortunately, these tests _WILL NOT_ work in our CI. We're waiting for - // an updated TAEF that will let us install framework packages when the test - // package is deployed. Until then, these tests won't deploy in CI. - class KeyBindingsTests : public JsonTestClass { - // Use a custom AppxManifest to ensure that we can activate winrt types - // from our test. This property will tell taef to manually use this as - // the AppxManifest for this test class. - // This does not yet work for anything XAML-y. See TabTests.cpp for more - // details on that. - BEGIN_TEST_CLASS(KeyBindingsTests) - TEST_CLASS_PROPERTY(L"RunAs", L"UAP") - TEST_CLASS_PROPERTY(L"UAP:AppXManifest", L"TestHostAppXManifest.xml") - END_TEST_CLASS() + TEST_CLASS(KeyBindingsTests); TEST_METHOD(KeyChords); TEST_METHOD(ManyKeysSameAction); diff --git a/src/cascadia/LocalTests_SettingsModel/NewTabMenuTests.cpp b/src/cascadia/UnitTests_SettingsModel/NewTabMenuTests.cpp similarity index 75% rename from src/cascadia/LocalTests_SettingsModel/NewTabMenuTests.cpp rename to src/cascadia/UnitTests_SettingsModel/NewTabMenuTests.cpp index f9e4625e995..d5bc0a75161 100644 --- a/src/cascadia/LocalTests_SettingsModel/NewTabMenuTests.cpp +++ b/src/cascadia/UnitTests_SettingsModel/NewTabMenuTests.cpp @@ -18,24 +18,11 @@ using namespace WEX::Logging; using namespace WEX::TestExecution; using namespace WEX::Common; -namespace SettingsModelLocalTests +namespace SettingsModelUnitTests { - // TODO:microsoft/terminal#3838: - // Unfortunately, these tests _WILL NOT_ work in our CI. We're waiting for - // an updated TAEF that will let us install framework packages when the test - // package is deployed. Until then, these tests won't deploy in CI. - class NewTabMenuTests : public JsonTestClass { - // Use a custom AppxManifest to ensure that we can activate winrt types - // from our test. This property will tell taef to manually use this as - // the AppxManifest for this test class. - // This does not yet work for anything XAML-y. See TabTests.cpp for more - // details on that. - BEGIN_TEST_CLASS(NewTabMenuTests) - TEST_CLASS_PROPERTY(L"RunAs", L"UAP") - TEST_CLASS_PROPERTY(L"UAP:AppXManifest", L"TestHostAppXManifest.xml") - END_TEST_CLASS() + TEST_CLASS(NewTabMenuTests); TEST_METHOD(DefaultsToRemainingProfiles); TEST_METHOD(ParseEmptyFolder); diff --git a/src/cascadia/LocalTests_SettingsModel/ProfileTests.cpp b/src/cascadia/UnitTests_SettingsModel/ProfileTests.cpp similarity index 93% rename from src/cascadia/LocalTests_SettingsModel/ProfileTests.cpp rename to src/cascadia/UnitTests_SettingsModel/ProfileTests.cpp index a73b2bec3e4..047d3c89cfb 100644 --- a/src/cascadia/LocalTests_SettingsModel/ProfileTests.cpp +++ b/src/cascadia/UnitTests_SettingsModel/ProfileTests.cpp @@ -15,24 +15,11 @@ using namespace WEX::Logging; using namespace WEX::TestExecution; using namespace WEX::Common; -namespace SettingsModelLocalTests +namespace SettingsModelUnitTests { - // TODO:microsoft/terminal#3838: - // Unfortunately, these tests _WILL NOT_ work in our CI. We're waiting for - // an updated TAEF that will let us install framework packages when the test - // package is deployed. Until then, these tests won't deploy in CI. - class ProfileTests : public JsonTestClass { - // Use a custom AppxManifest to ensure that we can activate winrt types - // from our test. This property will tell taef to manually use this as - // the AppxManifest for this test class. - // This does not yet work for anything XAML-y. See TabTests.cpp for more - // details on that. - BEGIN_TEST_CLASS(ProfileTests) - TEST_CLASS_PROPERTY(L"RunAs", L"UAP") - TEST_CLASS_PROPERTY(L"UAP:AppXManifest", L"TestHostAppXManifest.xml") - END_TEST_CLASS() + TEST_CLASS(ProfileTests); TEST_METHOD(ProfileGeneratesGuid); TEST_METHOD(LayerProfileProperties); diff --git a/src/cascadia/LocalTests_SettingsModel/SerializationTests.cpp b/src/cascadia/UnitTests_SettingsModel/SerializationTests.cpp similarity index 95% rename from src/cascadia/LocalTests_SettingsModel/SerializationTests.cpp rename to src/cascadia/UnitTests_SettingsModel/SerializationTests.cpp index b4778e8b814..c75da633ac2 100644 --- a/src/cascadia/LocalTests_SettingsModel/SerializationTests.cpp +++ b/src/cascadia/UnitTests_SettingsModel/SerializationTests.cpp @@ -16,24 +16,11 @@ using namespace WEX::Common; using namespace winrt::Microsoft::Terminal::Settings::Model; using namespace winrt::Microsoft::Terminal::Control; -namespace SettingsModelLocalTests +namespace SettingsModelUnitTests { - // TODO:microsoft/terminal#3838: - // Unfortunately, these tests _WILL NOT_ work in our CI. We're waiting for - // an updated TAEF that will let us install framework packages when the test - // package is deployed. Until then, these tests won't deploy in CI. - class SerializationTests : public JsonTestClass { - // Use a custom AppxManifest to ensure that we can activate winrt types - // from our test. This property will tell taef to manually use this as - // the AppxManifest for this test class. - // This does not yet work for anything XAML-y. See TabTests.cpp for more - // details on that. - BEGIN_TEST_CLASS(SerializationTests) - TEST_CLASS_PROPERTY(L"RunAs", L"UAP") - TEST_CLASS_PROPERTY(L"UAP:AppXManifest", L"TestHostAppXManifest.xml") - END_TEST_CLASS() + TEST_CLASS(SerializationTests); TEST_METHOD(GlobalSettings); TEST_METHOD(Profile); @@ -212,9 +199,34 @@ namespace SettingsModelLocalTests "source": "local" })" }; + static constexpr std::string_view profileWithIcon{ R"( + { + "guid" : "{8b039d4d-77ca-5a83-88e1-dfc8e895a127}", + "name": "profileWithIcon", + "hidden": false, + "icon": "foo.png" + })" }; + static constexpr std::string_view profileWithNullIcon{ R"( + { + "guid" : "{8b039d4d-77ca-5a83-88e1-dfc8e895a127}", + "name": "profileWithNullIcon", + "hidden": false, + "icon": null + })" }; + static constexpr std::string_view profileWithNoIcon{ R"( + { + "guid" : "{8b039d4d-77ca-5a83-88e1-dfc8e895a127}", + "name": "profileWithNoIcon", + "hidden": false, + "icon": "none" + })" }; + RoundtripTest(profileString); RoundtripTest(smallProfileString); RoundtripTest(weirdProfileString); + RoundtripTest(profileWithIcon); + RoundtripTest(profileWithNullIcon); + RoundtripTest(profileWithNoIcon); } void SerializationTests::ColorScheme() diff --git a/src/cascadia/LocalTests_SettingsModel/SettingsModel.LocalTests.vcxproj b/src/cascadia/UnitTests_SettingsModel/SettingsModel.UnitTests.vcxproj similarity index 87% rename from src/cascadia/LocalTests_SettingsModel/SettingsModel.LocalTests.vcxproj rename to src/cascadia/UnitTests_SettingsModel/SettingsModel.UnitTests.vcxproj index dbd279005be..6210385b26a 100644 --- a/src/cascadia/LocalTests_SettingsModel/SettingsModel.LocalTests.vcxproj +++ b/src/cascadia/UnitTests_SettingsModel/SettingsModel.UnitTests.vcxproj @@ -14,9 +14,9 @@ {CA5CAD1A-9B68-456A-B13E-C8218070DC42} Win32Proj - SettingsModelLocalTests - LocalTests_SettingsModel - SettingsModel.LocalTests + SettingsModelUnitTests + UnitTests_SettingsModel + SettingsModel.Unit.Tests DynamicLibrary true @@ -64,7 +64,6 @@ _ConsoleGenerateAdditionalWinmdManifests step won't gather the winmd's --> - @@ -98,4 +97,16 @@ + + + + + + + + + diff --git a/src/cascadia/LocalTests_SettingsModel/TerminalSettingsTests.cpp b/src/cascadia/UnitTests_SettingsModel/TerminalSettingsTests.cpp similarity index 96% rename from src/cascadia/LocalTests_SettingsModel/TerminalSettingsTests.cpp rename to src/cascadia/UnitTests_SettingsModel/TerminalSettingsTests.cpp index 4dbc7f88db8..f45fd1624f7 100644 --- a/src/cascadia/LocalTests_SettingsModel/TerminalSettingsTests.cpp +++ b/src/cascadia/UnitTests_SettingsModel/TerminalSettingsTests.cpp @@ -16,24 +16,11 @@ using namespace WEX::Common; using namespace winrt::Microsoft::Terminal::Settings::Model; using namespace winrt::Microsoft::Terminal::Control; -namespace SettingsModelLocalTests +namespace SettingsModelUnitTests { - // TODO:microsoft/terminal#3838: - // Unfortunately, these tests _WILL NOT_ work in our CI. We're waiting for - // an updated TAEF that will let us install framework packages when the test - // package is deployed. Until then, these tests won't deploy in CI. - class TerminalSettingsTests { - // Use a custom AppxManifest to ensure that we can activate winrt types - // from our test. This property will tell taef to manually use this as - // the AppxManifest for this test class. - // This does not yet work for anything XAML-y. See TabTests.cpp for more - // details on that. - BEGIN_TEST_CLASS(TerminalSettingsTests) - TEST_CLASS_PROPERTY(L"RunAs", L"UAP") - TEST_CLASS_PROPERTY(L"UAP:AppXManifest", L"TestHostAppXManifest.xml") - END_TEST_CLASS() + TEST_CLASS(TerminalSettingsTests); TEST_METHOD(TryCreateWinRTType); TEST_METHOD(TestTerminalArgsForBinding); @@ -153,7 +140,7 @@ namespace SettingsModelLocalTests g.Data4[7]); } - const auto tmpdir = std::filesystem::temp_directory_path(); + const auto tmpdir = std::filesystem::canonical(std::filesystem::temp_directory_path()); const auto dir1 = tmpdir / guid; const auto dir2 = tmpdir / (guid + L" two"); const auto file1 = dir1 / L"file 1.exe"; diff --git a/src/cascadia/LocalTests_SettingsModel/TestUtils.h b/src/cascadia/UnitTests_SettingsModel/TestUtils.h similarity index 100% rename from src/cascadia/LocalTests_SettingsModel/TestUtils.h rename to src/cascadia/UnitTests_SettingsModel/TestUtils.h diff --git a/src/cascadia/LocalTests_SettingsModel/ThemeTests.cpp b/src/cascadia/UnitTests_SettingsModel/ThemeTests.cpp similarity index 89% rename from src/cascadia/LocalTests_SettingsModel/ThemeTests.cpp rename to src/cascadia/UnitTests_SettingsModel/ThemeTests.cpp index c7bf11326af..512d9b20aa5 100644 --- a/src/cascadia/LocalTests_SettingsModel/ThemeTests.cpp +++ b/src/cascadia/UnitTests_SettingsModel/ThemeTests.cpp @@ -17,24 +17,11 @@ using namespace WEX::Logging; using namespace WEX::TestExecution; using namespace WEX::Common; -namespace SettingsModelLocalTests +namespace SettingsModelUnitTests { - // TODO:microsoft/terminal#3838: - // Unfortunately, these tests _WILL NOT_ work in our CI. We're waiting for - // an updated TAEF that will let us install framework packages when the test - // package is deployed. Until then, these tests won't deploy in CI. - class ThemeTests : public JsonTestClass { - // Use a custom AppxManifest to ensure that we can activate winrt types - // from our test. This property will tell taef to manually use this as - // the AppxManifest for this test class. - // This does not yet work for anything XAML-y. See TabTests.cpp for more - // details on that. - BEGIN_TEST_CLASS(ThemeTests) - TEST_CLASS_PROPERTY(L"RunAs", L"UAP") - TEST_CLASS_PROPERTY(L"UAP:AppXManifest", L"TestHostAppXManifest.xml") - END_TEST_CLASS() + TEST_CLASS(ThemeTests); TEST_METHOD(ParseSimpleTheme); TEST_METHOD(ParseEmptyTheme); diff --git a/src/cascadia/UnitTests_SettingsModel/UnitTests_SettingsModel.def b/src/cascadia/UnitTests_SettingsModel/UnitTests_SettingsModel.def new file mode 100644 index 00000000000..e80a637aa25 --- /dev/null +++ b/src/cascadia/UnitTests_SettingsModel/UnitTests_SettingsModel.def @@ -0,0 +1 @@ +EXPORTS diff --git a/src/cascadia/LocalTests_SettingsModel/pch.cpp b/src/cascadia/UnitTests_SettingsModel/pch.cpp similarity index 100% rename from src/cascadia/LocalTests_SettingsModel/pch.cpp rename to src/cascadia/UnitTests_SettingsModel/pch.cpp diff --git a/src/cascadia/LocalTests_SettingsModel/pch.h b/src/cascadia/UnitTests_SettingsModel/pch.h similarity index 100% rename from src/cascadia/LocalTests_SettingsModel/pch.h rename to src/cascadia/UnitTests_SettingsModel/pch.h diff --git a/tools/OpenConsole.psm1 b/tools/OpenConsole.psm1 index 3dd17957161..0f25a8e93a8 100644 --- a/tools/OpenConsole.psm1 +++ b/tools/OpenConsole.psm1 @@ -169,7 +169,7 @@ function Invoke-OpenConsoleTests() [switch]$FTOnly, [parameter(Mandatory=$false)] - [ValidateSet('host', 'interactivityWin32', 'terminal', 'adapter', 'feature', 'uia', 'textbuffer', 'til', 'types', 'terminalCore', 'terminalApp', 'localTerminalApp', 'localSettingsModel', 'unitRemoting', 'unitControl')] + [ValidateSet('host', 'interactivityWin32', 'terminal', 'adapter', 'feature', 'uia', 'textbuffer', 'til', 'types', 'terminalCore', 'terminalApp', 'localTerminalApp', 'unitSettingsModel', 'unitRemoting', 'unitControl')] [string]$Test, [parameter(Mandatory=$false)] @@ -232,13 +232,19 @@ function Invoke-OpenConsoleTests() # run selected tests foreach ($t in $TestsToRun) { + $currentTaefExe = $TaefExePath + if ($t.isolatedTaef -eq "true") + { + $currentTaefExe = (Join-Path (Split-Path (Join-Path $BinDir $t.binary)) "te.exe") + } + if ($t.type -eq "unit") { - & $TaefExePath "$BinDir\$($t.binary)" $TaefArgs + & $currentTaefExe "$BinDir\$($t.binary)" $TaefArgs } elseif ($t.type -eq "ft") { - Invoke-TaefInNewWindow -OpenConsolePath $OpenConsolePath -TaefPath $TaefExePath -TestDll "$BinDir\$($t.binary)" -TaefArgs $TaefArgs + Invoke-TaefInNewWindow -OpenConsolePath $OpenConsolePath -TaefPath $currentTaefExe -TestDll "$BinDir\$($t.binary)" -TaefArgs $TaefArgs } else { diff --git a/tools/runut.cmd b/tools/runut.cmd index 02bcc47d192..62614d15d94 100644 --- a/tools/runut.cmd +++ b/tools/runut.cmd @@ -13,7 +13,7 @@ if "%PLATFORM%" == "Win32" ( set _TestHostAppPath=%OPENCON%\bin\%_LAST_BUILD_CONF%\TestHostApp ) -call %TAEF% ^ +%TAEF% ^ %OPENCON%\bin\%PLATFORM%\%_LAST_BUILD_CONF%\Conhost.Unit.Tests.dll ^ %OPENCON%\bin\%PLATFORM%\%_LAST_BUILD_CONF%\TextBuffer.Unit.Tests.dll ^ %OPENCON%\bin\%PLATFORM%\%_LAST_BUILD_CONF%\UnitTests_TerminalCore\Terminal.Core.Unit.Tests.dll ^ @@ -26,6 +26,16 @@ call %TAEF% ^ %OPENCON%\bin\%PLATFORM%\%_LAST_BUILD_CONF%\UnitTests_Remoting\Remoting.Unit.Tests.dll ^ %OPENCON%\bin\%PLATFORM%\%_LAST_BUILD_CONF%\UnitTests_Control\Control.Unit.Tests.dll ^ %_TestHostAppPath%\TerminalApp.LocalTests.dll ^ - %_TestHostAppPath%\SettingsModel.LocalTests.dll ^ %* +set _EarlyTestFail=%ERRORLEVEL% + +%OPENCON%\bin\%PLATFORM%\%_LAST_BUILD_CONF%\UnitTests_SettingsModel\te.exe ^ + %OPENCON%\bin\%PLATFORM%\%_LAST_BUILD_CONF%\UnitTests_SettingsModel\SettingsModel.Unit.Tests.dll ^ + %* + +if %_EarlyTestFail% NEQ 0 ( + exit /b %_EarlyTestFail% +) + +exit /b %ERRORLEVEL% diff --git a/tools/tests.xml b/tools/tests.xml index c6085b0b468..4301c09b2a3 100644 --- a/tools/tests.xml +++ b/tools/tests.xml @@ -5,7 +5,7 @@ - +