Skip to content
This repository has been archived by the owner on Jul 5, 2024. It is now read-only.

Commit

Permalink
throw exit code after printing test output
Browse files Browse the repository at this point in the history
  • Loading branch information
caesay committed Dec 26, 2023
1 parent f12aa46 commit 4c7eacb
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions test/Squirrel.Packaging.Tests/WindowsPackTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -405,9 +405,6 @@ private string RunImpl(ProcessStartInfo psi, ILogger logger, int? exitCode = 0)

logger.Info($"TEST: Process exited with code {p.ExitCode} in {elapsed.TotalSeconds}s");

if (exitCode != null)
Assert.Equal(exitCode, p.ExitCode);

using var fs = Utility.Retry(() => {
return File.Open(outputfile, FileMode.Open, FileAccess.ReadWrite, FileShare.None);
}, 10, 1000, logger);
Expand All @@ -421,6 +418,10 @@ private string RunImpl(ProcessStartInfo psi, ILogger logger, int? exitCode = 0)
logger.Info($"TEST: Process output: {Environment.NewLine}{output.Trim()}{Environment.NewLine}");
}

if (exitCode.HasValue && p.ExitCode != exitCode.Value) {
throw new Exception($"Process exited with code {p.ExitCode} but expected {exitCode.Value}");
}

return String.Join(Environment.NewLine,
output
.Split('\n')
Expand Down

0 comments on commit 4c7eacb

Please sign in to comment.