Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make the Settings Model tests into proper CI tests #16773

Merged
merged 39 commits into from
Feb 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
924906a
It works?
DHowett Mar 25, 2022
a31b089
Move to FixupUserSettings, add a bunch of tests
DHowett Apr 24, 2022
56fad52
Migrate spelling-0.0.21 changes from main
DHowett Apr 24, 2022
29ff259
Merge remote-tracking branch 'origin/main' into dev/duhowett/fhl-2022…
DHowett Aug 20, 2023
8931ccf
Merge remote-tracking branch 'origin/main' into dev/duhowett/fhl-2022…
DHowett Sep 13, 2023
00a3f6e
Fix for main
DHowett Sep 27, 2023
6763baa
Merge remote-tracking branch 'origin/main' into dev/duhowett/fhl-2022…
DHowett Feb 23, 2024
1af99be
Merge remote-tracking branch 'origin/main' into dev/duhowett/fhl-2022…
DHowett Feb 23, 2024
2ada4fc
Force users to duplicate inbox schemes; make duplicate work
DHowett Feb 23, 2024
9086e69
Fix tests, Modified->modified
DHowett Feb 27, 2024
ff0bc39
Add collision detection
DHowett Feb 27, 2024
29d6eb1
reword
DHowett Feb 27, 2024
aac7f5a
comments
DHowett Feb 27, 2024
868aa1c
one spell
DHowett Feb 27, 2024
7f217e1
two spell
DHowett Feb 27, 2024
2b39c82
Merge remote-tracking branch 'origin/main' into dev/duhowett/fhl-2022…
DHowett Feb 27, 2024
50ddf7d
Fix an outdated test
DHowett Feb 27, 2024
f1341e8
mix some dark schemes in
DHowett Feb 27, 2024
3f8769f
Fix up code review nits and bugs!
DHowett Feb 27, 2024
f30e807
Add a test for a totally unused scheme too
DHowett Feb 27, 2024
36ee148
Add a comment for future generations
DHowett Feb 27, 2024
1ebb898
Make the Settings Model tests a normal testing DLL, rather than UAP
DHowett Feb 27, 2024
de6f6a6
Rename the project trees as well
DHowett Feb 27, 2024
6bf7aef
And clean an old ref
DHowett Feb 27, 2024
96fe7cb
Run the right te.exe for each test...
DHowett Feb 27, 2024
f2d3910
flip IsInBox to Editable, remove disclaimer for real
DHowett Feb 27, 2024
8440309
Track fixups made during load, rather than reverse engineering it
DHowett Feb 27, 2024
30f599e
Merge branch 'dev/duhowett/fhl-202203/color-scheme-healing' into dev/…
DHowett Feb 27, 2024
07831f8
Really everyone should be using pwsh
DHowett Feb 27, 2024
5a27116
Merge remote-tracking branch 'origin/main' into dev/duhowett/fhl-2022…
DHowett Feb 27, 2024
74299c0
Merge branch 'dev/duhowett/fhl-202203/color-scheme-healing' into dev/…
DHowett Feb 27, 2024
b4ba76c
Change the namespace, change the world
DHowett Feb 27, 2024
aaf802c
Add support for isolated te.exe to Invoke-Tests
DHowett Feb 28, 2024
2a0c20e
Add support for isolated te.exe to runut too (sheesh)
DHowett Feb 28, 2024
860a78e
this is /bImportant
zadjii-msft Feb 28, 2024
cd655ee
Theoretical fix
lhecker Feb 28, 2024
aebf73d
fix the icon check in the Profile test
zadjii-msft Feb 29, 2024
0a2929e
Merge branch 'dev/duhowett/what-if-localtests-didnt' of https://githu…
zadjii-msft Feb 29, 2024
0a9099b
you know what, more tests I'm here
zadjii-msft Feb 29, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions OpenConsole.sln
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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}
Expand Down
1 change: 1 addition & 0 deletions build/pipelines/templates-v2/job-run-pgo-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ jobs:
- task: PowerShell@2
displayName: 'Run PGO Tests'
inputs:
pwsh: true
targetType: filePath
filePath: build\scripts\Run-Tests.ps1
arguments: >-
Expand Down
2 changes: 2 additions & 0 deletions build/pipelines/templates-v2/job-test-project.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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)"
Expand All @@ -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)"
Expand Down
44 changes: 35 additions & 9 deletions build/scripts/Run-Tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -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

This file was deleted.

2 changes: 1 addition & 1 deletion src/cascadia/LocalTests_TerminalApp/SettingsTests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,6 @@

<ItemGroup>
<TestDll Include="$(OpenConsoleCommonOutDir)\LocalTests_TerminalApp\TerminalApp.LocalTests.dll" />
<TestDll Include="$(OpenConsoleCommonOutDir)\LocalTests_SettingsModel\SettingsModel.LocalTests.dll" />
</ItemGroup>

<Target Name="AfterBuild" Inputs="@(TestDll)" Outputs="@(TestDll->'$(TargetDir)'\%(Filename)%(Extension)')">
Expand Down
8 changes: 4 additions & 4 deletions src/cascadia/TerminalSettingsModel/ActionMap.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ Author(s):
#include "Command.h"

// fwdecl unittest classes
namespace SettingsModelLocalTests
namespace SettingsModelUnitTests
{
class KeyBindingsTests;
class DeserializationTests;
Expand Down Expand Up @@ -123,8 +123,8 @@ namespace winrt::Microsoft::Terminal::Settings::Model::implementation
// than is necessary to be serialized.
std::unordered_map<InternalActionID, Model::Command> _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;
};
}
6 changes: 3 additions & 3 deletions src/cascadia/TerminalSettingsModel/Command.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ Author(s):
#include "SettingsTypes.h"

// fwdecl unittest classes
namespace SettingsModelLocalTests
namespace SettingsModelUnitTests
{
class DeserializationTests;
class CommandTests;
Expand Down Expand Up @@ -87,8 +87,8 @@ namespace winrt::Microsoft::Terminal::Settings::Model::implementation
static std::vector<Model::Command> _expandCommand(Command* const expandable,
Windows::Foundation::Collections::IVectorView<Model::Profile> profiles,
Windows::Foundation::Collections::IVectorView<Model::ColorScheme> schemes);
friend class SettingsModelLocalTests::DeserializationTests;
friend class SettingsModelLocalTests::CommandTests;
friend class SettingsModelUnitTests::DeserializationTests;
friend class SettingsModelUnitTests::CommandTests;
};
}

Expand Down
2 changes: 1 addition & 1 deletion src/cascadia/TerminalSettingsModel/GlobalAppSettings.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ Author(s):
#include "RemainingProfilesEntry.h"

// fwdecl unittest classes
namespace SettingsModelLocalTests
namespace SettingsModelUnitTests
{
class DeserializationTests;
class ColorSchemeTests;
Expand Down
6 changes: 5 additions & 1 deletion src/cascadia/TerminalSettingsModel/Profile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
10 changes: 5 additions & 5 deletions src/cascadia/TerminalSettingsModel/Profile.h
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ Author(s):
#include "FontConfig.h"

// fwdecl unittest classes
namespace SettingsModelLocalTests
namespace SettingsModelUnitTests
{
class DeserializationTests;
class ProfileTests;
Expand Down Expand Up @@ -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;
};
Expand Down
4 changes: 2 additions & 2 deletions src/cascadia/TerminalSettingsModel/TerminalSettings.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ using IFontFeatureMap = winrt::Windows::Foundation::Collections::IMap<winrt::hst
using IEnvironmentVariableMap = winrt::Windows::Foundation::Collections::IMap<winrt::hstring, winrt::hstring>;

// fwdecl unittest classes
namespace SettingsModelLocalTests
namespace SettingsModelUnitTests
{
class TerminalSettingsTests;
}
Expand Down Expand Up @@ -182,7 +182,7 @@ namespace winrt::Microsoft::Terminal::Settings::Model::implementation
const Windows::Foundation::Collections::IMapView<hstring, Microsoft::Terminal::Settings::Model::ColorScheme>& schemes,
const winrt::Microsoft::Terminal::Settings::Model::Theme currentTheme);

friend class SettingsModelLocalTests::TerminalSettingsTests;
friend class SettingsModelUnitTests::TerminalSettingsTests;
};
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
Loading
Loading