This repository has been archived on 2025-09-07. You can view files and clone it, but you cannot make any changes to its state, such as pushing and creating new issues, pull requests or comments.
dotnet-installer/src/SourceBuild/content/test/Microsoft.DotNet.SourceBuild.SmokeTests/DotNetWatchTests.cs

60 lines
2.2 KiB
C#
Raw Normal View History

[automated] Merge branch 'release/6.0.2xx' => 'release/6.0.3xx' (#13461) (#13469) * 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>
2022-03-28 09:15:59 -07:00
// 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) { }
2022-12-16 17:33:58 -06:00
[Fact]
[automated] Merge branch 'release/6.0.2xx' => 'release/6.0.3xx' (#13461) (#13469) * 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>
2022-03-28 09:15:59 -07:00
public void WatchTests()
{
string projectDirectory = DotNetHelper.ExecuteNew(DotNetTemplate.Console.GetName(), nameof(DotNetWatchTests));
bool outputChanged = false;
DotNetHelper.ExecuteCmd(
"watch run",
workingDirectory: projectDirectory,
additionalProcessConfigCallback: processConfigCallback,
expectedExitCode: null, // The exit code does not reflect whether or not dotnet watch is working properly
millisecondTimeout: 60000);
[automated] Merge branch 'release/6.0.2xx' => 'release/6.0.3xx' (#13461) (#13469) * 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>
2022-03-28 09:15:59 -07:00
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.");
process.Kill(true);
[automated] Merge branch 'release/6.0.2xx' => 'release/6.0.3xx' (#13461) (#13469) * 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>
2022-03-28 09:15:59 -07:00
}
});
}
}
}