* Update dependencies from https://github.com/dotnet/source-build-reference-packages build 20220309.1 Microsoft.SourceBuild.Intermediate.source-build-reference-packages From Version 6.0.0-servicing.22158.2 -> To Version 6.0.0-servicing.22159.1 * Update source-build with 6.0.103 artifacts * Disable public source-build tarball ci (#13377) * Fix invalid pipeline trigger. * Update dependencies from https://github.com/dotnet/source-build-reference-packages build 20220310.1 Microsoft.SourceBuild.Intermediate.source-build-reference-packages From Version 6.0.0-servicing.22159.1 -> To Version 6.0.0-servicing.22160.1 * Update dependencies from https://github.com/dotnet/arcade build 20220309.8 Microsoft.DotNet.CMake.Sdk , Microsoft.DotNet.Build.Tasks.Installers , Microsoft.DotNet.Arcade.Sdk From Version 6.0.0-beta.22122.7 -> To Version 6.0.0-beta.22159.8 * Remove maui workloads from 6.0.100 The old workloads break MU so we either have to update them or remove them. * Only do signcheck if there are files to sign check * Remove template text-only packages which are alread included in source-build (#13380) * Update dependencies from https://github.com/dotnet/arcade build 20220311.1 Microsoft.DotNet.CMake.Sdk , Microsoft.DotNet.Build.Tasks.Installers , Microsoft.DotNet.Arcade.Sdk From Version 6.0.0-beta.22159.8 -> To Version 6.0.0-beta.22161.1 * Update source-build MsftToSbSdk.diff baseline (#13400) * Update dependencies from https://github.com/dotnet/source-build-reference-packages build 20220311.1 Microsoft.SourceBuild.Intermediate.source-build-reference-packages From Version 6.0.0-servicing.22160.1 -> To Version 6.0.0-servicing.22161.1 * [release/6.0.1xx] Windows SDK projection update * [release/6.0.1xx] dotnet watch smoke test (#13392) * add dotnet watch smoke test * Fix issue with BundledTemplates condition * Make a source-build targetted fix to unblock release * Fix issue with BundledTemplates condition * Make a source-build targetted fix to unblock release * Refactor build.sh to optimize PackageVersions.props retrieval (#13443) * Update NuGet path issue in Run Tests CI step (#13453) * Refactor SdkContentTests to warn on diffs when run in CI (#13432) * Revert the Versions.props file * Revert the Versions.props file Co-authored-by: dotnet-maestro[bot] <dotnet-maestro[bot]@users.noreply.github.com> Co-authored-by: MichaelSimons <msimons@microsoft.com> Co-authored-by: v-wuzhai <46013274+v-wuzhai@users.noreply.github.com> Co-authored-by: Marc Paine <marcpop@microsoft.com> Co-authored-by: Jason Zhai <v-wuzhai@microsoft.com> Co-authored-by: Manodasan Wignarajah <mawign@microsoft.com> Co-authored-by: Logan Bussell <loganbussell@microsoft.com> Co-authored-by: dotnet-maestro[bot] <dotnet-maestro[bot]@users.noreply.github.com> Co-authored-by: MichaelSimons <msimons@microsoft.com> Co-authored-by: v-wuzhai <46013274+v-wuzhai@users.noreply.github.com> Co-authored-by: Marc Paine <marcpop@microsoft.com> Co-authored-by: Jason Zhai <v-wuzhai@microsoft.com> Co-authored-by: Manodasan Wignarajah <mawign@microsoft.com> Co-authored-by: Logan Bussell <loganbussell@microsoft.com>
This commit is contained in:
parent
6c86bbcde7
commit
a2a2f48f83
13 changed files with 136 additions and 49 deletions
|
@ -0,0 +1,60 @@
|
|||
// Licensed to the .NET Foundation under one or more agreements.
|
||||
// The .NET Foundation licenses this file to you under the MIT license.
|
||||
// See the LICENSE file in the project root for more information.
|
||||
|
||||
using System.Diagnostics;
|
||||
using System.IO;
|
||||
using Xunit;
|
||||
using Xunit.Abstractions;
|
||||
|
||||
namespace Microsoft.DotNet.SourceBuild.SmokeTests;
|
||||
|
||||
public class DotNetWatchTests : SmokeTests
|
||||
{
|
||||
public DotNetWatchTests(ITestOutputHelper outputHelper) : base(outputHelper) { }
|
||||
|
||||
[Fact]
|
||||
public void WatchTests()
|
||||
{
|
||||
string projectDirectory = DotNetHelper.ExecuteNew(DotNetTemplate.Console.GetName(), nameof(DotNetWatchTests));
|
||||
bool outputChanged = false;
|
||||
|
||||
// We expect an exit code of 143 (128 + 15, i.e. SIGTERM) because we are killing the process manually
|
||||
DotNetHelper.ExecuteCmd(
|
||||
"watch run",
|
||||
workingDirectory: projectDirectory,
|
||||
additionalProcessConfigCallback: processConfigCallback,
|
||||
expectedExitCode: 143,
|
||||
millisecondTimeout: 30000);
|
||||
|
||||
Assert.True(outputChanged);
|
||||
|
||||
void processConfigCallback(Process process)
|
||||
{
|
||||
const string waitingString = "Waiting for a file to change before restarting dotnet...";
|
||||
const string expectedString = "Hello from dotnet watch!";
|
||||
|
||||
bool fileChanged = false;
|
||||
|
||||
process.OutputDataReceived += new DataReceivedEventHandler((sender, e) =>
|
||||
{
|
||||
if (e.Data?.Contains(waitingString) ?? false)
|
||||
{
|
||||
if (!fileChanged) {
|
||||
OutputHelper.WriteLine("Program started, changing file on disk to trigger restart...");
|
||||
File.WriteAllText(
|
||||
Path.Combine(projectDirectory, "Program.cs"),
|
||||
File.ReadAllText(Path.Combine(projectDirectory, "Program.cs")).Replace("Hello, World!", expectedString));
|
||||
fileChanged = true;
|
||||
}
|
||||
}
|
||||
else if (e.Data?.Contains(expectedString) ?? false)
|
||||
{
|
||||
outputChanged = true;
|
||||
OutputHelper.WriteLine("Successfully re-ran program after code change.");
|
||||
ExecuteHelper.ExecuteProcessValidateExitCode("kill", $"-s TERM {process.Id}", OutputHelper);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
Reference in a new issue