[release/7.0.1xx] Port dotnet-watch smoke test fixes (#14738)
* [release/6.0.1xx] Re-write dotnet-watch smoke test (#14367) * Re-write dotnet-watch smoke test * Revert async changes * Re-enable dotnet-watch test
This commit is contained in:
parent
5d80bf0a65
commit
d41bfecf50
2 changed files with 7 additions and 7 deletions
|
@ -96,7 +96,7 @@ internal class DotNetHelper
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void ExecuteCmd(string args, string? workingDirectory = null, Action<Process>? additionalProcessConfigCallback = null, int expectedExitCode = 0, int millisecondTimeout = -1)
|
public void ExecuteCmd(string args, string? workingDirectory = null, Action<Process>? additionalProcessConfigCallback = null, int? expectedExitCode = 0, int millisecondTimeout = -1)
|
||||||
{
|
{
|
||||||
(Process Process, string StdOut, string StdErr) executeResult = ExecuteHelper.ExecuteProcess(
|
(Process Process, string StdOut, string StdErr) executeResult = ExecuteHelper.ExecuteProcess(
|
||||||
DotNetPath,
|
DotNetPath,
|
||||||
|
@ -105,7 +105,9 @@ internal class DotNetHelper
|
||||||
configure: (process) => configureProcess(process, workingDirectory),
|
configure: (process) => configureProcess(process, workingDirectory),
|
||||||
millisecondTimeout: millisecondTimeout);
|
millisecondTimeout: millisecondTimeout);
|
||||||
|
|
||||||
ExecuteHelper.ValidateExitCode(executeResult, expectedExitCode);
|
if (expectedExitCode != null) {
|
||||||
|
ExecuteHelper.ValidateExitCode(executeResult, (int) expectedExitCode);
|
||||||
|
}
|
||||||
|
|
||||||
void configureProcess(Process process, string? workingDirectory)
|
void configureProcess(Process process, string? workingDirectory)
|
||||||
{
|
{
|
||||||
|
|
|
@ -13,19 +13,17 @@ public class DotNetWatchTests : SmokeTests
|
||||||
{
|
{
|
||||||
public DotNetWatchTests(ITestOutputHelper outputHelper) : base(outputHelper) { }
|
public DotNetWatchTests(ITestOutputHelper outputHelper) : base(outputHelper) { }
|
||||||
|
|
||||||
// TODO: Re-enable https://github.com/dotnet/source-build/issues/2961
|
[Fact]
|
||||||
// [Fact]
|
|
||||||
public void WatchTests()
|
public void WatchTests()
|
||||||
{
|
{
|
||||||
string projectDirectory = DotNetHelper.ExecuteNew(DotNetTemplate.Console.GetName(), nameof(DotNetWatchTests));
|
string projectDirectory = DotNetHelper.ExecuteNew(DotNetTemplate.Console.GetName(), nameof(DotNetWatchTests));
|
||||||
bool outputChanged = false;
|
bool outputChanged = false;
|
||||||
|
|
||||||
// We expect an exit code of 143 (128 + 15, i.e. SIGTERM) because we are killing the process manually
|
|
||||||
DotNetHelper.ExecuteCmd(
|
DotNetHelper.ExecuteCmd(
|
||||||
"watch run",
|
"watch run",
|
||||||
workingDirectory: projectDirectory,
|
workingDirectory: projectDirectory,
|
||||||
additionalProcessConfigCallback: processConfigCallback,
|
additionalProcessConfigCallback: processConfigCallback,
|
||||||
expectedExitCode: 143,
|
expectedExitCode: null, // The exit code does not reflect whether or not dotnet watch is working properly
|
||||||
millisecondTimeout: 30000);
|
millisecondTimeout: 30000);
|
||||||
|
|
||||||
Assert.True(outputChanged);
|
Assert.True(outputChanged);
|
||||||
|
@ -53,7 +51,7 @@ public class DotNetWatchTests : SmokeTests
|
||||||
{
|
{
|
||||||
outputChanged = true;
|
outputChanged = true;
|
||||||
OutputHelper.WriteLine("Successfully re-ran program after code change.");
|
OutputHelper.WriteLine("Successfully re-ran program after code change.");
|
||||||
ExecuteHelper.ExecuteProcessValidateExitCode("kill", $"-s TERM {process.Id}", OutputHelper);
|
process.Kill(true);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue