diff --git a/Makefile b/Makefile
index 3239406..45dab46 100644
--- a/Makefile
+++ b/Makefile
@@ -1,4 +1,4 @@
-FRAMEWORK:=net6.0
+FRAMEWORK:=net8.0
CONFIGURATION:=Release
ARCH:=$(subst aarch64,arm64,$(subst x86_64,x64,$(shell uname -m)))
RUNTIME:=linux-$(ARCH)
diff --git a/Samples/FailingXUnitTest/FailingXUnitTest.csproj b/Samples/FailingXUnitTest/FailingXUnitTest.csproj
index 2d56af7..b2899f0 100644
--- a/Samples/FailingXUnitTest/FailingXUnitTest.csproj
+++ b/Samples/FailingXUnitTest/FailingXUnitTest.csproj
@@ -2,7 +2,7 @@
true
- net6.0
+ net8.0
false
diff --git a/Samples/PassingXUnitTest/PassingXUnitTest.csproj b/Samples/PassingXUnitTest/PassingXUnitTest.csproj
index 7b91ab8..19fc4d7 100644
--- a/Samples/PassingXUnitTest/PassingXUnitTest.csproj
+++ b/Samples/PassingXUnitTest/PassingXUnitTest.csproj
@@ -2,7 +2,7 @@
true
- net6.0
+ net8.0
false
diff --git a/Samples/PassingXUnitTestWithEnvironmentVariables/PassingXUnitTestWithEnvironmentVariables.csproj b/Samples/PassingXUnitTestWithEnvironmentVariables/PassingXUnitTestWithEnvironmentVariables.csproj
index 2d56af7..b2899f0 100644
--- a/Samples/PassingXUnitTestWithEnvironmentVariables/PassingXUnitTestWithEnvironmentVariables.csproj
+++ b/Samples/PassingXUnitTestWithEnvironmentVariables/PassingXUnitTestWithEnvironmentVariables.csproj
@@ -2,7 +2,7 @@
true
- net6.0
+ net8.0
false
diff --git a/Samples/TimeOutXUnitTest/TimeOutXUnitTest.csproj b/Samples/TimeOutXUnitTest/TimeOutXUnitTest.csproj
index 7b91ab8..19fc4d7 100644
--- a/Samples/TimeOutXUnitTest/TimeOutXUnitTest.csproj
+++ b/Samples/TimeOutXUnitTest/TimeOutXUnitTest.csproj
@@ -2,7 +2,7 @@
true
- net6.0
+ net8.0
false
diff --git a/Turkey.Tests/ProgramTest.cs b/Turkey.Tests/ProgramTest.cs
index ab34ed3..f1af04c 100644
--- a/Turkey.Tests/ProgramTest.cs
+++ b/Turkey.Tests/ProgramTest.cs
@@ -94,7 +94,7 @@ private static string OSArchitectureName
Architecture.Arm => "arm",
Architecture.Arm64 => "arm64",
Architecture.S390x => "s390x",
- (Architecture)8 => "ppc64le", // not defined for 'net6.0' target.
+ Architecture.Ppc64le => "ppc64le",
_ => throw new NotSupportedException(),
};
}
diff --git a/Turkey.Tests/Turkey.Tests.csproj b/Turkey.Tests/Turkey.Tests.csproj
index 872abc1..32f6a40 100644
--- a/Turkey.Tests/Turkey.Tests.csproj
+++ b/Turkey.Tests/Turkey.Tests.csproj
@@ -1,7 +1,7 @@
- net6.0
+ net8.0
false
Major
diff --git a/Turkey/DotNet.cs b/Turkey/DotNet.cs
index 677b3b5..e0d3502 100644
--- a/Turkey/DotNet.cs
+++ b/Turkey/DotNet.cs
@@ -31,26 +31,14 @@ public List RuntimeVersions
{
get
{
- ProcessStartInfo startInfo = new ProcessStartInfo()
- {
- FileName = DotnetFileName,
- RedirectStandardOutput = true,
- RedirectStandardError = true,
- Arguments = "--list-runtimes",
- };
- using (Process p = Process.Start(startInfo))
- {
- p.WaitForExit();
- string output = p.StandardOutput.ReadToEnd();
- var list = output
- .Split("\n", StringSplitOptions.RemoveEmptyEntries)
- .Where(line => line.StartsWith("Microsoft.NETCore.App", StringComparison.Ordinal))
- .Select(line => line.Split(" ")[1])
- .Select(versionString => Version.Parse(versionString))
- .OrderBy(x => x)
- .ToList();
- return list;
- }
+ string output = ProcessRunner.Run(DotnetFileName, "--list-runtimes");
+ return output
+ .Split("\n", StringSplitOptions.RemoveEmptyEntries)
+ .Where(line => line.StartsWith("Microsoft.NETCore.App", StringComparison.Ordinal))
+ .Select(line => line.Split(" ")[1])
+ .Select(versionString => Version.Parse(versionString))
+ .OrderBy(x => x)
+ .ToList();
}
}
@@ -72,25 +60,14 @@ public List SdkVersions
{
get
{
- ProcessStartInfo startInfo = new ProcessStartInfo()
- {
- FileName = DotnetFileName,
- RedirectStandardOutput = true,
- RedirectStandardError = true,
- Arguments = "--list-sdks",
- };
- using (Process p = Process.Start(startInfo))
- {
- p.WaitForExit();
- string output = p.StandardOutput.ReadToEnd();
- var list = output
+
+ string output = ProcessRunner.Run(DotnetFileName, "--list-sdks");
+ return output
.Split("\n", StringSplitOptions.RemoveEmptyEntries)
.Select(line => line.Split(" ")[0])
.Select(versionString => Version.Parse(versionString))
.OrderBy(x => x)
.ToList();
- return list;
- }
}
}
diff --git a/Turkey/ProcessExtensions.cs b/Turkey/ProcessExtensions.cs
index dd8ee3a..00c4bd5 100644
--- a/Turkey/ProcessExtensions.cs
+++ b/Turkey/ProcessExtensions.cs
@@ -1,4 +1,5 @@
using System;
+using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Threading;
@@ -15,6 +16,33 @@ public static async Task RunAsync(ProcessStartInfo psi, Action logg
await process.WaitForExitAsync(logger, token).ConfigureAwait(false);
return process.ExitCode;
}
+
+ public static string Run(string filename, params string[] args)
+ {
+ ProcessStartInfo startInfo = new ProcessStartInfo()
+ {
+ FileName = filename,
+ RedirectStandardInput = true,
+ RedirectStandardOutput = true,
+ RedirectStandardError = true,
+ };
+ foreach (var arg in args)
+ {
+ startInfo.ArgumentList.Add(arg);
+ }
+ using (Process p = Process.Start(startInfo))
+ {
+ p.StandardInput.Close();
+ string stdout = p.StandardOutput.ReadToEnd();
+ p.WaitForExit();
+ if (p.ExitCode != 0)
+ {
+ string stderr = p.StandardError.ReadToEnd();
+ throw new InvalidOperationException($"Executing {filename} {string.Join(' ', args)} failed with exit code {p.ExitCode} and stderr: {stderr}");
+ }
+ return stdout;
+ }
+ }
}
public static class ProcessExtensions
diff --git a/Turkey/TestRunner.cs b/Turkey/TestRunner.cs
index 929e13f..5289b50 100644
--- a/Turkey/TestRunner.cs
+++ b/Turkey/TestRunner.cs
@@ -71,6 +71,7 @@ public TestRunner(SystemUnderTest system, DirectoryInfo root, bool verboseOutput
public async Task ScanAndRunAsync(List outputs, string logDir, TimeSpan defaultTimeout)
{
+ LogEnvironment(logDir);
await outputs.ForEachAsync(output => output.AtStartupAsync()).ConfigureAwait(false);
@@ -161,5 +162,22 @@ public async Task ScanAndRunAsync(List outputs, string
return results;
}
+
+ private static void LogEnvironment(string logDir)
+ {
+ foreach (var sourcePath in new[] { "/proc/cpuinfo", "/proc/meminfo", "/etc/os-release" })
+ {
+ if (File.Exists(sourcePath))
+ {
+ string destinationPath = Path.Combine(logDir, Path.GetFileName(sourcePath));
+ // Note: we don't use File.Copy because that copies the file permissions,
+ // which gives issues on successive runs since the files are non-writable.
+ File.WriteAllBytes(destinationPath, File.ReadAllBytes(sourcePath));
+ }
+ }
+
+ string unameOutput = ProcessRunner.Run("uname", "-a");
+ File.WriteAllText(Path.Combine(logDir, "uname"), unameOutput);
+ }
}
}
diff --git a/Turkey/Turkey.csproj b/Turkey/Turkey.csproj
index 6e1d771..b67ffef 100644
--- a/Turkey/Turkey.csproj
+++ b/Turkey/Turkey.csproj
@@ -2,7 +2,7 @@
Exe
- net6.0
+ net8.0