Skip to content

Commit 94ef0e9

Browse files
Simplify tests for macOS arm64
net8.0 target framework was crashing due to lack of Rosetta x64 -> arm64 translation. I think we can just use net9.0 + "current" instead
1 parent f184fd0 commit 94ef0e9

File tree

2 files changed

+15
-28
lines changed

2 files changed

+15
-28
lines changed

test/TestAssets/TestProjects/DotnetRunDevices/DotnetRunDevices.csproj

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
<PropertyGroup>
44
<OutputType>Exe</OutputType>
5-
<TargetFrameworks>net8.0;net9.0;$(CurrentTargetFramework)</TargetFrameworks>
5+
<TargetFrameworks>net9.0;$(CurrentTargetFramework)</TargetFrameworks>
66
</PropertyGroup>
77

88
<Target Name="ComputeAvailableDevices" Returns="@(Devices)">
@@ -11,15 +11,11 @@
1111
<Devices Include="single-device" Description="Single Device" Type="Emulator" Status="Online" RuntimeIdentifier="$(NETCoreSdkRuntimeIdentifier)" />
1212
</ItemGroup>
1313
<!-- Otherwise return multiple devices based on target framework -->
14-
<ItemGroup Condition="'$(NoDevices)' != 'true' and '$(SingleDevice)' != 'true' and '$(TargetFramework)' == 'net8.0'">
14+
<ItemGroup Condition="'$(NoDevices)' != 'true' and '$(SingleDevice)' != 'true' and '$(TargetFramework)' == 'net9.0'">
1515
<Devices Include="test-device-1" Description="Test Device 1" Type="Emulator" Status="Online" RuntimeIdentifier="$(NETCoreSdkRuntimeIdentifier)" />
1616
<Devices Include="test-device-2" Description="Test Device 2" Type="Device" Status="Online" />
1717
</ItemGroup>
18-
<ItemGroup Condition="'$(NoDevices)' != 'true' and '$(SingleDevice)' != 'true' and '$(TargetFramework)' == 'net9.0'">
19-
<Devices Include="test-device-3" Description="Test Device 3" Type="Simulator" Status="Booted" RuntimeIdentifier="$(NETCoreSdkRuntimeIdentifier)" />
20-
<Devices Include="test-device-4" Description="Test Device 4" Type="Device" Status="Paired" />
21-
</ItemGroup>
22-
<ItemGroup Condition="'$(NoDevices)' != 'true' and '$(SingleDevice)' != 'true' and '$(TargetFramework)' != 'net8.0' and '$(TargetFramework)' != 'net9.0'">
18+
<ItemGroup Condition="'$(NoDevices)' != 'true' and '$(SingleDevice)' != 'true' and '$(TargetFramework)' != 'net9.0'">
2319
<Devices Include="test-device-current-1" Description="Test Device Current 1" Type="Emulator" Status="Online" RuntimeIdentifier="$(NETCoreSdkRuntimeIdentifier)" />
2420
<Devices Include="test-device-current-2" Description="Test Device Current 2" Type="Simulator" Status="Booted" />
2521
</ItemGroup>

test/dotnet.Tests/CommandTests/Run/GivenDotnetRunSelectsDevice.cs

Lines changed: 12 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ public void ItFailsInNonInteractiveMode_WhenMultipleDevicesAvailableAndNoneSpeci
2525
var result = new DotnetCommand(Log, "run")
2626
.WithWorkingDirectory(testInstance.Path)
2727
.WithEnvironmentVariable("DOTNET_CLI_UI_LANGUAGE", "en-US")
28-
.Execute("--framework", "net8.0", "--no-interactive");
28+
.Execute("--framework", "net9.0", "--no-interactive");
2929

3030
result.Should().Fail()
3131
.And.HaveStdErrContaining(string.Format(CliCommandStrings.RunCommandExceptionUnableToRunSpecifyDevice, "--device"));
@@ -39,7 +39,7 @@ public void ItListsDevicesForSpecifiedFramework()
3939

4040
var result = new DotnetCommand(Log, "run")
4141
.WithWorkingDirectory(testInstance.Path)
42-
.Execute("--framework", "net8.0", "--list-devices");
42+
.Execute("--framework", "net9.0", "--list-devices");
4343

4444
result.Should().Pass()
4545
.And.HaveStdOutContaining("test-device-1")
@@ -48,19 +48,10 @@ public void ItListsDevicesForSpecifiedFramework()
4848
}
4949

5050
[Theory]
51-
[InlineData("net8.0", "test-device-1")]
52-
[InlineData("net8.0", "test-device-2")]
53-
[InlineData("net9.0", "test-device-3")]
54-
[InlineData("net9.0", "test-device-4")]
51+
[InlineData("net9.0", "test-device-1")]
52+
[InlineData("net9.0", "test-device-2")]
5553
public void ItRunsDifferentDevicesInMultiTargetedApp(string targetFramework, string deviceId)
5654
{
57-
// Skip net8.0 and net9.0 on arm64 as they may not be available on CI
58-
if (RuntimeInformation.ProcessArchitecture == Architecture.Arm64 &&
59-
(targetFramework == "net8.0" || targetFramework == "net9.0"))
60-
{
61-
return;
62-
}
63-
6455
var testInstance = _testAssetsManager.CopyTestAsset("DotnetRunDevices")
6556
.WithSource();
6657

@@ -80,7 +71,7 @@ public void ItShowsErrorMessageWithAvailableDevices_InNonInteractiveMode()
8071
var result = new DotnetCommand(Log, "run")
8172
.WithWorkingDirectory(testInstance.Path)
8273
.WithEnvironmentVariable("DOTNET_CLI_UI_LANGUAGE", "en-US")
83-
.Execute("--framework", "net8.0", "--no-interactive");
74+
.Execute("--framework", "net9.0", "--no-interactive");
8475

8576
result.Should().Fail()
8677
.And.HaveStdErrContaining(string.Format(CliCommandStrings.RunCommandExceptionUnableToRunSpecifyDevice, "--device"))
@@ -115,7 +106,7 @@ public void ItTreatsEmptyDeviceSpecificationAsNotSpecified()
115106
var result = new DotnetCommand(Log, "run")
116107
.WithWorkingDirectory(testInstance.Path)
117108
.WithEnvironmentVariable("DOTNET_CLI_UI_LANGUAGE", "en-US")
118-
.Execute("--framework", "net8.0", "-p:Device=", "--no-interactive");
109+
.Execute("--framework", "net9.0", "-p:Device=", "--no-interactive");
119110

120111
result.Should().Fail()
121112
.And.HaveStdErrContaining(string.Format(CliCommandStrings.RunCommandExceptionUnableToRunSpecifyDevice, "--device"));
@@ -130,7 +121,7 @@ public void ItWorksWithDevicePropertySyntax()
130121
string deviceId = "test-device-1";
131122
new DotnetCommand(Log, "run")
132123
.WithWorkingDirectory(testInstance.Path)
133-
.Execute("--framework", "net8.0", $"-p:Device={deviceId}")
124+
.Execute("--framework", "net9.0", $"-p:Device={deviceId}")
134125
.Should().Pass()
135126
.And.HaveStdOutContaining($"Device: {deviceId}");
136127
}
@@ -144,7 +135,7 @@ public void ItWorksWithDeviceWithoutRuntimeIdentifier()
144135
string deviceId = "test-device-2";
145136
new DotnetCommand(Log, "run")
146137
.WithWorkingDirectory(testInstance.Path)
147-
.Execute("--framework", "net8.0", "--device", deviceId)
138+
.Execute("--framework", "net9.0", "--device", deviceId)
148139
.Should().Pass()
149140
.And.HaveStdOutContaining($"Device: {deviceId}")
150141
.And.HaveStdOutContaining("RuntimeIdentifier:");
@@ -161,7 +152,7 @@ public void ItAutoSelectsSingleDeviceWithoutPrompting(bool interactive)
161152
var command = new DotnetCommand(Log, "run")
162153
.WithWorkingDirectory(testInstance.Path);
163154

164-
var args = new List<string> { "--framework", "net8.0", "-p:SingleDevice=true" };
155+
var args = new List<string> { "--framework", "net9.0", "-p:SingleDevice=true" };
165156
if (!interactive)
166157
{
167158
args.Add("--no-interactive");
@@ -186,7 +177,7 @@ public void ItCreatesBinlogWhenRequestedForDeviceSelection()
186177

187178
var result = new DotnetCommand(Log, "run")
188179
.WithWorkingDirectory(testInstance.Path)
189-
.Execute("--framework", "net8.0", "--list-devices", "/bl:device-list.binlog");
180+
.Execute("--framework", "net9.0", "--list-devices", "/bl:device-list.binlog");
190181

191182
result.Should().Pass()
192183
.And.HaveStdOutContaining("test-device-1");
@@ -204,7 +195,7 @@ public void ItFailsWhenNoDevicesAreAvailable()
204195
var result = new DotnetCommand(Log, "run")
205196
.WithWorkingDirectory(testInstance.Path)
206197
.WithEnvironmentVariable("DOTNET_CLI_UI_LANGUAGE", "en-US")
207-
.Execute("--framework", "net8.0", "-p:NoDevices=true", "--no-interactive");
198+
.Execute("--framework", "net9.0", "-p:NoDevices=true", "--no-interactive");
208199

209200
result.Should().Fail()
210201
.And.HaveStdErrContaining(CliCommandStrings.RunCommandNoDevicesAvailable);
@@ -221,7 +212,7 @@ public void ItDoesNotRunComputeAvailableDevicesWhenDeviceIsPreSpecified(string d
221212

222213
string deviceSelectionBinlogPath = Path.Combine(testInstance.Path, "msbuild-dotnet-run-devices.binlog");
223214

224-
var args = new List<string> { "--framework", "net8.0" };
215+
var args = new List<string> { "--framework", "net9.0" };
225216
if (deviceArgPrefix == "--device")
226217
{
227218
args.Add("--device");

0 commit comments

Comments
 (0)