Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 2 additions & 4 deletions src/tests/nativeaot/CustomMain/CustomMain.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,8 @@
using System;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using Xunit;

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

int ExitCode;

[Fact]
public static int TestEntryPoint()
static int Main(string[] args)
{
Console.WriteLine("hello from managed main");
return s_exitCode;
Expand Down
2 changes: 1 addition & 1 deletion src/tests/nativeaot/CustomMain/CustomMain.csproj
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<CustomNativeMain>true</CustomNativeMain>
<StaticLibraryPrefix Condition="'$(TargetOS)' != 'windows'">lib</StaticLibraryPrefix>
<RequiresProcessIsolation>true</RequiresProcessIsolation>
</PropertyGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,15 @@
using System;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using Xunit;

namespace GenerateUnmanagedEntryPoints
{
public unsafe class Program
unsafe class Program
{
[UnmanagedCallersOnly(EntryPoint = "MainAssemblyMethod")]
static void MainAssemblyMethod() => Console.WriteLine($"Hello from {nameof(MainAssemblyMethod)}");

[Fact]
public static int TestEntryPoint()
static int Main()
{
IntPtr methodAddress = IntPtr.Zero;
IntPtr programHandle = IntPtr.Zero;
Expand Down Expand Up @@ -54,4 +52,4 @@ public static int TestEntryPoint()
return 100;
}
}
}
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<RequiresProcessIsolation>true</RequiresProcessIsolation>
<IlcExportUnmanagedEntrypoints>true</IlcExportUnmanagedEntrypoints>
<!--
For some reason, this particular test hits some case in AddressSanitizer where it fails to intercept methods correctly, causing failures.
Expand Down
23 changes: 0 additions & 23 deletions src/tests/nativeaot/NativeAot.csproj

This file was deleted.

6 changes: 2 additions & 4 deletions src/tests/nativeaot/SmokeTests/ComWrappers/ComWrappers.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,15 @@
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Text;
using Xunit;

namespace ComWrappersTests
{
public class Program
internal class Program
{
static ComWrappers GlobalComWrappers;

[DynamicDependency(DynamicallyAccessedMemberTypes.PublicMethods, typeof(IComInterface))]
[Fact]
public static int TestEntryPoint()
public static int Main()
{
TestComInteropNullPointers();
TestComInteropRegistrationRequired();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,13 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<CLRTestTargetUnsupported Condition="'$(TargetsWindows)' != 'true'">true</CLRTestTargetUnsupported>

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

<!-- Registers a global 'ComWrappers' instance for marshalling. -->
<RequiresProcessIsolation>true</RequiresProcessIsolation>
</PropertyGroup>

<ItemGroup>
<Compile Include="ComWrappers.cs" />
</ItemGroup>
Expand Down
57 changes: 21 additions & 36 deletions src/tests/nativeaot/SmokeTests/Determinism/Determinism.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,45 +3,30 @@

using System;
using System.IO;
using Xunit;

public class Program
{
[Fact]
public static int TestEntryPoint()
{
var baseline = File.OpenRead("baseline.object");
var compare = File.OpenRead("compare.object");

Console.WriteLine($"Baseline size: {baseline.Length}");
Console.WriteLine($"Compare size: {compare.Length}");
using var baseline = File.OpenRead("baseline.object");
using var compare = File.OpenRead("compare.object");

if (baseline.Length != compare.Length)
{
Console.WriteLine("Test Fail: Baseline and Compare have different sizes.");
return 101;
}
Console.WriteLine($"Baseline size: {baseline.Length}");
Console.WriteLine($"Compare size: {compare.Length}");

long length = baseline.Length;
for (int i = 0; i < length; i++)
{
if (baseline.ReadByte() != compare.ReadByte())
{
Console.WriteLine($"Test Fail: Baseline and Compare were different"
+ " at byte {i}.");
return 101;
}
}
if (baseline.Length != compare.Length)
throw new Exception("Different sizes");

// We're not interested in running this, we just want some junk to compile
if (Environment.GetEnvironmentVariable("Never") == "Ever")
{
Delegates.Run();
Devirtualization.Run();
Generics.Run();
Interfaces.Run();
}
long length = baseline.Length;
for (int i = 0; i < length; i++)
{
if (baseline.ReadByte() != compare.ReadByte())
throw new Exception($"Different at byte {i}");
}

return 100;
}
// We're not interested in running this, we just want some junk to compile
if (Environment.GetEnvironmentVariable("Never") == "Ever")
{
Delegates.Run();
Devirtualization.Run();
Generics.Run();
Interfaces.Run();
}

return 100;
5 changes: 2 additions & 3 deletions src/tests/nativeaot/SmokeTests/Determinism/Determinism.csproj
Original file line number Diff line number Diff line change
@@ -1,19 +1,18 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<CLRTestPriority>0</CLRTestPriority>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<RequiresProcessIsolation>true</RequiresProcessIsolation>

<!-- test tries to read files from disk, bundling them into the app isn't easily possible right now -->
<CLRTestTargetUnsupported Condition="'$(TargetsAppleMobile)' == 'true'">true</CLRTestTargetUnsupported>
</PropertyGroup>

<ItemGroup>
<Compile Include="Determinism.cs" />
<Compile Include="../UnitTests/Delegates.cs" />
<Compile Include="../UnitTests/Devirtualization.cs" />
<Compile Include="../UnitTests/Generics.cs" />
<Compile Include="../UnitTests/Interfaces.cs" />

</ItemGroup>

<Target Name="IlcCompileSingleThreaded"
Expand Down
2 changes: 1 addition & 1 deletion src/tests/nativeaot/SmokeTests/DwarfDump/DwarfDump.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<CLRTestPriority>0</CLRTestPriority>
<RequiresProcessIsolation>true</RequiresProcessIsolation>
<!-- Currently only tracking DWARF info on Linux -->
<CLRTestTargetUnsupported Condition="'$(TargetOS)' != 'linux'">true</CLRTestTargetUnsupported>
<!-- We don't have SuperFileCheck binaries for llvm-dwarfdump on ARM platform -->
Expand Down
4 changes: 1 addition & 3 deletions src/tests/nativeaot/SmokeTests/DwarfDump/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,10 @@
using System.Diagnostics;
using System.IO;
using System.Runtime.InteropServices;
using Xunit;

public class Program
{
[Fact]
public static int TestEntryPoint()
public static int Main(string[] args)
{
var llvmDwarfDumpPath = Path.Combine(
Environment.GetEnvironmentVariable("CORE_ROOT"),
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<CLRTestPriority>0</CLRTestPriority>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<RequiresProcessIsolation>true</RequiresProcessIsolation>

<!-- There's just too many of these warnings -->
<SuppressTrimAnalysisWarnings>true</SuppressTrimAnalysisWarnings>
Expand Down
Loading