Skip to content

Commit 782c2ee

Browse files
Roll back conversion of native aot tests to merged model (#100269)
1 parent f390243 commit 782c2ee

45 files changed

Lines changed: 330 additions & 473 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

src/tests/nativeaot/CustomMain/CustomMain.cs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,8 @@
44
using System;
55
using System.Runtime.CompilerServices;
66
using System.Runtime.InteropServices;
7-
using Xunit;
87

9-
public class Program
8+
class Program
109
{
1110
// Each of the module initializer, class constructor, and IncrementExitCode
1211
// should be executed exactly once, causing this to each 100 by program exit.
@@ -33,8 +32,7 @@ static void IncrementExitCode(int amount)
3332

3433
int ExitCode;
3534

36-
[Fact]
37-
public static int TestEntryPoint()
35+
static int Main(string[] args)
3836
{
3937
Console.WriteLine("hello from managed main");
4038
return s_exitCode;

src/tests/nativeaot/CustomMain/CustomMain.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22
<PropertyGroup>
3+
<OutputType>Exe</OutputType>
34
<CustomNativeMain>true</CustomNativeMain>
45
<StaticLibraryPrefix Condition="'$(TargetOS)' != 'windows'">lib</StaticLibraryPrefix>
5-
<RequiresProcessIsolation>true</RequiresProcessIsolation>
66
</PropertyGroup>
77

88
<ItemGroup>

src/tests/nativeaot/GenerateUnmanagedEntryPoints/GenerateUnmanagedEntryPoints.cs

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,17 +4,15 @@
44
using System;
55
using System.Runtime.CompilerServices;
66
using System.Runtime.InteropServices;
7-
using Xunit;
87

98
namespace GenerateUnmanagedEntryPoints
109
{
11-
public unsafe class Program
10+
unsafe class Program
1211
{
1312
[UnmanagedCallersOnly(EntryPoint = "MainAssemblyMethod")]
1413
static void MainAssemblyMethod() => Console.WriteLine($"Hello from {nameof(MainAssemblyMethod)}");
1514

16-
[Fact]
17-
public static int TestEntryPoint()
15+
static int Main()
1816
{
1917
IntPtr methodAddress = IntPtr.Zero;
2018
IntPtr programHandle = IntPtr.Zero;
@@ -54,4 +52,4 @@ public static int TestEntryPoint()
5452
return 100;
5553
}
5654
}
57-
}
55+
}

src/tests/nativeaot/GenerateUnmanagedEntryPoints/GenerateUnmanagedEntryPoints.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22
<PropertyGroup>
3+
<OutputType>Exe</OutputType>
34
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
4-
<RequiresProcessIsolation>true</RequiresProcessIsolation>
55
<IlcExportUnmanagedEntrypoints>true</IlcExportUnmanagedEntrypoints>
66
<!--
77
For some reason, this particular test hits some case in AddressSanitizer where it fails to intercept methods correctly, causing failures.

src/tests/nativeaot/NativeAot.csproj

Lines changed: 0 additions & 23 deletions
This file was deleted.

src/tests/nativeaot/SmokeTests/ComWrappers/ComWrappers.cs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,17 +6,15 @@
66
using System.Runtime.CompilerServices;
77
using System.Runtime.InteropServices;
88
using System.Text;
9-
using Xunit;
109

1110
namespace ComWrappersTests
1211
{
13-
public class Program
12+
internal class Program
1413
{
1514
static ComWrappers GlobalComWrappers;
1615

1716
[DynamicDependency(DynamicallyAccessedMemberTypes.PublicMethods, typeof(IComInterface))]
18-
[Fact]
19-
public static int TestEntryPoint()
17+
public static int Main()
2018
{
2119
TestComInteropNullPointers();
2220
TestComInteropRegistrationRequired();

src/tests/nativeaot/SmokeTests/ComWrappers/ComWrappers.csproj

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,13 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22
<PropertyGroup>
3+
<OutputType>Exe</OutputType>
34
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
45
<CLRTestTargetUnsupported Condition="'$(TargetsWindows)' != 'true'">true</CLRTestTargetUnsupported>
56

67
<!-- Shouldn't need this: https://github.com/dotnet/linker/issues/2618 -->
78
<NoWarn>$(NoWarn);IL2050</NoWarn>
89

9-
<!-- Registers a global 'ComWrappers' instance for marshalling. -->
10-
<RequiresProcessIsolation>true</RequiresProcessIsolation>
1110
</PropertyGroup>
12-
1311
<ItemGroup>
1412
<Compile Include="ComWrappers.cs" />
1513
</ItemGroup>

src/tests/nativeaot/SmokeTests/Determinism/Determinism.cs

Lines changed: 21 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -3,45 +3,30 @@
33

44
using System;
55
using System.IO;
6-
using Xunit;
76

8-
public class Program
9-
{
10-
[Fact]
11-
public static int TestEntryPoint()
12-
{
13-
var baseline = File.OpenRead("baseline.object");
14-
var compare = File.OpenRead("compare.object");
15-
16-
Console.WriteLine($"Baseline size: {baseline.Length}");
17-
Console.WriteLine($"Compare size: {compare.Length}");
7+
using var baseline = File.OpenRead("baseline.object");
8+
using var compare = File.OpenRead("compare.object");
189

19-
if (baseline.Length != compare.Length)
20-
{
21-
Console.WriteLine("Test Fail: Baseline and Compare have different sizes.");
22-
return 101;
23-
}
10+
Console.WriteLine($"Baseline size: {baseline.Length}");
11+
Console.WriteLine($"Compare size: {compare.Length}");
2412

25-
long length = baseline.Length;
26-
for (int i = 0; i < length; i++)
27-
{
28-
if (baseline.ReadByte() != compare.ReadByte())
29-
{
30-
Console.WriteLine($"Test Fail: Baseline and Compare were different"
31-
+ " at byte {i}.");
32-
return 101;
33-
}
34-
}
13+
if (baseline.Length != compare.Length)
14+
throw new Exception("Different sizes");
3515

36-
// We're not interested in running this, we just want some junk to compile
37-
if (Environment.GetEnvironmentVariable("Never") == "Ever")
38-
{
39-
Delegates.Run();
40-
Devirtualization.Run();
41-
Generics.Run();
42-
Interfaces.Run();
43-
}
16+
long length = baseline.Length;
17+
for (int i = 0; i < length; i++)
18+
{
19+
if (baseline.ReadByte() != compare.ReadByte())
20+
throw new Exception($"Different at byte {i}");
21+
}
4422

45-
return 100;
46-
}
23+
// We're not interested in running this, we just want some junk to compile
24+
if (Environment.GetEnvironmentVariable("Never") == "Ever")
25+
{
26+
Delegates.Run();
27+
Devirtualization.Run();
28+
Generics.Run();
29+
Interfaces.Run();
4730
}
31+
32+
return 100;

src/tests/nativeaot/SmokeTests/Determinism/Determinism.csproj

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,18 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22
<PropertyGroup>
3+
<OutputType>Exe</OutputType>
34
<CLRTestPriority>0</CLRTestPriority>
45
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
5-
<RequiresProcessIsolation>true</RequiresProcessIsolation>
6-
76
<!-- test tries to read files from disk, bundling them into the app isn't easily possible right now -->
87
<CLRTestTargetUnsupported Condition="'$(TargetsAppleMobile)' == 'true'">true</CLRTestTargetUnsupported>
98
</PropertyGroup>
10-
119
<ItemGroup>
1210
<Compile Include="Determinism.cs" />
1311
<Compile Include="../UnitTests/Delegates.cs" />
1412
<Compile Include="../UnitTests/Devirtualization.cs" />
1513
<Compile Include="../UnitTests/Generics.cs" />
1614
<Compile Include="../UnitTests/Interfaces.cs" />
15+
1716
</ItemGroup>
1817

1918
<Target Name="IlcCompileSingleThreaded"

src/tests/nativeaot/SmokeTests/DwarfDump/DwarfDump.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22
<PropertyGroup>
3+
<OutputType>Exe</OutputType>
34
<CLRTestPriority>0</CLRTestPriority>
4-
<RequiresProcessIsolation>true</RequiresProcessIsolation>
55
<!-- Currently only tracking DWARF info on Linux -->
66
<CLRTestTargetUnsupported Condition="'$(TargetOS)' != 'linux'">true</CLRTestTargetUnsupported>
77
<!-- We don't have SuperFileCheck binaries for llvm-dwarfdump on ARM platform -->

0 commit comments

Comments
 (0)