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

Adjust tests with terminal logger enabled #9995

Merged
merged 4 commits into from
Apr 16, 2024
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
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
6 changes: 3 additions & 3 deletions src/MSBuild.UnitTests/MSBuildServer_Tests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ public class MSBuildServer_Tests : IDisposable
<ProcessIdTask>
<Output PropertyName=""PID"" TaskParameter=""Pid"" />
</ProcessIdTask>
<Message Text=""Server ID is $(PID)"" Importance=""High"" />
<Message Text=""[Work around Github issue #9667 with --interactive]Server ID is $(PID)"" Importance=""High"" />
</Target>
</Project>";
private static string sleepingTaskContentsFormat = @$"
Expand Down Expand Up @@ -313,8 +313,8 @@ public void PropertyMSBuildStartupDirectoryOnServer()
<ProcessIdTask>
<Output PropertyName=""PID"" TaskParameter=""Pid"" />
</ProcessIdTask>
<Message Text=""Server ID is $(PID)"" Importance=""High"" />
<Message Text="":MSBuildStartupDirectory:$(MSBuildStartupDirectory):"" Importance=""high"" />
<Message Text=""[Work around Github issue #9667 with --interactive]Server ID is $(PID)"" Importance=""High"" />
<Message Text=""[Work around Github issue #9667 with --interactive]:MSBuildStartupDirectory:$(MSBuildStartupDirectory):"" Importance=""high"" />
</Target>
</Project>";

Expand Down
6 changes: 6 additions & 0 deletions src/UnitTests.Shared/TestEnvironment.cs
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,10 @@ public static TestEnvironment Create(ITestOutputHelper output = null, bool ignor
env.WithInvariant(new BuildFailureLogInvariant());
}

// Clear these two environment variables first in case pre-setting affects the test.
env.SetEnvironmentVariable("MSBUILDLIVELOGGER", null);
env.SetEnvironmentVariable("MSBUILDTERMINALLOGGER", null);
GangWang01 marked this conversation as resolved.
Show resolved Hide resolved

return env;
}

Expand Down Expand Up @@ -83,6 +87,8 @@ private void Cleanup()
{
_disposed = true;

// It should be in reverse order revert to get back to original state.
_variants.Reverse();
// Reset test variants
foreach (var variant in _variants)
{
GangWang01 marked this conversation as resolved.
Show resolved Hide resolved
Expand Down