diff --git a/src/SourceBuild/tarball/content/test/Microsoft.DotNet.SourceBuild.SmokeTests/DotNetHelper.cs b/src/SourceBuild/tarball/content/test/Microsoft.DotNet.SourceBuild.SmokeTests/DotNetHelper.cs index ae5508aa4..921ab1f97 100644 --- a/src/SourceBuild/tarball/content/test/Microsoft.DotNet.SourceBuild.SmokeTests/DotNetHelper.cs +++ b/src/SourceBuild/tarball/content/test/Microsoft.DotNet.SourceBuild.SmokeTests/DotNetHelper.cs @@ -96,7 +96,7 @@ internal class DotNetHelper } } - public void ExecuteCmd(string args, string? workingDirectory = null, Action? additionalProcessConfigCallback = null, int expectedExitCode = 0, int millisecondTimeout = -1) + public void ExecuteCmd(string args, string? workingDirectory = null, Action? additionalProcessConfigCallback = null, int? expectedExitCode = 0, int millisecondTimeout = -1) { (Process Process, string StdOut, string StdErr) executeResult = ExecuteHelper.ExecuteProcess( DotNetPath, @@ -105,7 +105,9 @@ internal class DotNetHelper configure: (process) => configureProcess(process, workingDirectory), millisecondTimeout: millisecondTimeout); - ExecuteHelper.ValidateExitCode(executeResult, expectedExitCode); + if (expectedExitCode != null) { + ExecuteHelper.ValidateExitCode(executeResult, (int) expectedExitCode); + } void configureProcess(Process process, string? workingDirectory) { diff --git a/src/SourceBuild/tarball/content/test/Microsoft.DotNet.SourceBuild.SmokeTests/DotNetWatchTests.cs b/src/SourceBuild/tarball/content/test/Microsoft.DotNet.SourceBuild.SmokeTests/DotNetWatchTests.cs index 183311037..46013bbc7 100644 --- a/src/SourceBuild/tarball/content/test/Microsoft.DotNet.SourceBuild.SmokeTests/DotNetWatchTests.cs +++ b/src/SourceBuild/tarball/content/test/Microsoft.DotNet.SourceBuild.SmokeTests/DotNetWatchTests.cs @@ -19,12 +19,11 @@ public class DotNetWatchTests : SmokeTests 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, + expectedExitCode: null, // The exit code does not reflect whether or not dotnet watch is working properly millisecondTimeout: 30000); Assert.True(outputChanged); @@ -52,7 +51,7 @@ public class DotNetWatchTests : SmokeTests { outputChanged = true; OutputHelper.WriteLine("Successfully re-ran program after code change."); - ExecuteHelper.ExecuteProcessValidateExitCode("kill", $"-s TERM {process.Id}", OutputHelper); + process.Kill(true); } }); }