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

Commit

Permalink
Test still hanging only on ci
Browse files Browse the repository at this point in the history
  • Loading branch information
caesay committed Dec 26, 2023
1 parent 1ab77e0 commit 5c1863f
Showing 1 changed file with 31 additions and 15 deletions.
46 changes: 31 additions & 15 deletions test/Squirrel.Packaging.Tests/WindowsPackTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -478,24 +478,40 @@ private void PackTestApp(string id, string version, string testString, string re
{
var projDir = GetPath("TestApp");
var testStringFile = Path.Combine(projDir, "Const.cs");

var oldText = File.ReadAllText(testStringFile);
File.WriteAllText(testStringFile, $"class Const {{ public const string TEST_STRING = \"{testString}\"; }}");
var args = new string[] { "publish", "--no-self-contained", "-c", "Release", "-r", "win-x64", "-o", "publish" };
RunNoCoverage("dotnet", args, projDir, logger);
File.WriteAllText(testStringFile, oldText);

var options = new WindowsPackOptions {
EntryExecutableName = "TestApp.exe",
ReleaseDir = new DirectoryInfo(releaseDir),
PackId = id,
PackVersion = version,
TargetRuntime = RID.Parse("win-x64"),
PackDirectory = Path.Combine(projDir, "publish"),
};
try {
File.WriteAllText(testStringFile, $"class Const {{ public const string TEST_STRING = \"{testString}\"; }}");
var args = new string[] { "publish", "--no-self-contained", "-c", "Release", "-r", "win-x64", "-o", "publish" };

var runner = new WindowsPackCommandRunner(logger);
runner.Pack(options);
var psi = new ProcessStartInfo("dotnet");
psi.WorkingDirectory = projDir;
psi.AppendArgumentListSafe(args, out var debug);

logger.Info($"TEST: Running {psi.FileName} {debug}");

using var p = Process.Start(psi);
p.WaitForExit();

if (p.ExitCode != 0)
throw new Exception($"dotnet publish failed with exit code {p.ExitCode}");

//RunNoCoverage("dotnet", args, projDir, logger);

var options = new WindowsPackOptions {
EntryExecutableName = "TestApp.exe",
ReleaseDir = new DirectoryInfo(releaseDir),
PackId = id,
PackVersion = version,
TargetRuntime = RID.Parse("win-x64"),
PackDirectory = Path.Combine(projDir, "publish"),
};

var runner = new WindowsPackCommandRunner(logger);
runner.Pack(options);
} finally {
File.WriteAllText(testStringFile, oldText);
}
}

private static string GetPath(params string[] paths)
Expand Down

0 comments on commit 5c1863f

Please sign in to comment.