Skip to content

Commit d12012d

Browse files
authored
Skip h2spec test enumeration on unsupported platforms dotnet#38794 (dotnet#38799)
1 parent 3446c22 commit d12012d

File tree

2 files changed

+27
-3
lines changed

2 files changed

+27
-3
lines changed

src/Servers/Kestrel/test/Interop.FunctionalTests/H2SpecCommands.cs

+15-2
Original file line numberDiff line numberDiff line change
@@ -45,12 +45,18 @@ public static class H2SpecCommands
4545

4646
private static string GetToolLocation()
4747
{
48+
if (RuntimeInformation.OSArchitecture != Architecture.X64)
49+
{
50+
// This is a known, unsupported scenario, no-op.
51+
return null;
52+
}
53+
4854
var root = Path.Combine(Environment.CurrentDirectory, "h2spec");
4955
if (OperatingSystem.IsWindows())
5056
{
5157
return Path.Combine(root, "windows", "h2spec.exe");
5258
}
53-
else if (OperatingSystem.IsLinux() && (RuntimeInformation.OSArchitecture == Architecture.X64))
59+
else if (OperatingSystem.IsLinux())
5460
{
5561
var toolPath = Path.Combine(root, "linux", "h2spec");
5662
chmod755(toolPath);
@@ -67,10 +73,17 @@ private static string GetToolLocation()
6773

6874
public static IList<Tuple<string, string>> EnumerateTestCases()
6975
{
76+
// The tool isn't supported on some platforms (arm64), so we can't even enumerate the tests.
77+
var toolLocation = GetToolLocation();
78+
if (toolLocation == null)
79+
{
80+
return null;
81+
}
82+
7083
var testCases = new List<Tuple<string, string>>();
7184
var processOptions = new ProcessStartInfo
7285
{
73-
FileName = GetToolLocation(),
86+
FileName = toolLocation,
7487
RedirectStandardOutput = true,
7588
Arguments = "--strict --dryrun",
7689
WindowStyle = ProcessWindowStyle.Hidden,

src/Servers/Kestrel/test/Interop.FunctionalTests/H2SpecTests.cs

+12-1
Original file line numberDiff line numberDiff line change
@@ -63,9 +63,20 @@ public static TheoryData<H2SpecTestCase> H2SpecTestCases
6363
var dataset = new TheoryData<H2SpecTestCase>();
6464
var toSkip = new string[] { "http2/6.9.1/2" };
6565

66+
var testCases = H2SpecCommands.EnumerateTestCases();
67+
68+
if (testCases == null || !testCases.Any())
69+
{
70+
dataset.Add(new H2SpecTestCase()
71+
{
72+
Skip = "Unable to detect test cases on this platform.",
73+
});
74+
return dataset;
75+
}
76+
6677
var supportsAlpn = Utilities.CurrentPlatformSupportsHTTP2OverTls();
6778

68-
foreach (var testcase in H2SpecCommands.EnumerateTestCases())
79+
foreach (var testcase in testCases)
6980
{
7081
string skip = null;
7182
if (toSkip.Contains(testcase.Item1))

0 commit comments

Comments
 (0)