Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
17 commits
Select commit Hold shift + click to select a range
a537d75
Set up a few of the nativeaot tests to run as their own "merged runne…
jkoritzinsky Oct 21, 2025
120f782
NativeAOT-specific ComWrappers test is no longer interesting after we…
jkoritzinsky Oct 21, 2025
401d847
Expand the "each test is a merged test runner" pattern to the rest of…
jkoritzinsky Oct 21, 2025
d52a643
Add a temporary check to ensure that we don't use the old model for a…
jkoritzinsky Oct 21, 2025
1de0ccf
Don't pass MainLibraryFileName property for NativeAOT
kotlarmilos Oct 24, 2025
8d28f46
Remove MainLibraryFileName property for NativeAOT support
kotlarmilos Oct 24, 2025
88e3e5a
Merge branch 'main' into naot-merged-runner-ios
kotlarmilos Oct 24, 2025
24ac61a
Update MainLibraryFileName property for NativeAOT
kotlarmilos Oct 31, 2025
35df246
Merge branch 'naot-merged-runner-ios' of https://github.com/jkoritzin…
kotlarmilos Oct 31, 2025
90e06bb
Add support for stress test merged assembly markers in build.proj
kotlarmilos Oct 31, 2025
0c5232f
Add support for stress test merged assembly markers in helixpublishwi…
kotlarmilos Nov 3, 2025
dbfd4fb
Merge branch 'main' into naot-merged-runner-ios
kotlarmilos Nov 3, 2025
0ffd6f3
Update merged payload file path
kotlarmilos Nov 3, 2025
9d31812
Merge branch 'naot-merged-runner-ios' of https://github.com/jkoritzin…
kotlarmilos Nov 3, 2025
fe64e02
Test regex for patching the payload path
kotlarmilos Nov 3, 2025
f0159fb
Fix XCodeSdk condition for iOS target to use 'iphoneos'
kotlarmilos Nov 4, 2025
f095e6b
Set --expected-exit-code prop
kotlarmilos Nov 6, 2025
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: 6 additions & 0 deletions src/libraries/sendtohelix-mobile.targets
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,12 @@
</XHarnessApkToTest>
</ItemDefinitionGroup>

<ItemDefinitionGroup Condition="'$(TargetsAppleMobile)' == 'true' and '$(NativeAotTest)' == 'true'">
<XHarnessAppBundleToTest>
<ExpectedExitCode>100</ExpectedExitCode>
</XHarnessAppBundleToTest>
</ItemDefinitionGroup>

<PropertyGroup Condition="'$(NeedsiOSSDK)' == 'true'">
<NeedsDotNetSdk>true</NeedsDotNetSdk>
<UseDotNetCliVersionFromGlobalJson>true</UseDotNetCliVersionFromGlobalJson>
Expand Down
1 change: 1 addition & 0 deletions src/mono/msbuild/apple/build/AppleBuild.targets
Original file line number Diff line number Diff line change
Expand Up @@ -314,6 +314,7 @@
<AppleAppBuilderRuntime Condition="'$(AppleAppBuilderRuntime)' == '' and '$(UseNativeAOTRuntime)' == 'true'">NativeAOT</AppleAppBuilderRuntime>
<AppleAppBuilderRuntime Condition="'$(AppleAppBuilderRuntime)' == '' and '$(UseMonoRuntime)' == 'false'">CoreCLR</AppleAppBuilderRuntime>
<AppleAppBuilderRuntime Condition="'$(AppleAppBuilderRuntime)' == ''">MonoVM</AppleAppBuilderRuntime>
<MainLibraryFileName Condition="'$(UseNativeAOTRuntime)' == 'true'"></MainLibraryFileName>
</PropertyGroup>

<AppleAppBuilderTask
Expand Down
25 changes: 8 additions & 17 deletions src/tests/Common/helixpublishwitharcade.proj
Original file line number Diff line number Diff line change
Expand Up @@ -342,6 +342,7 @@
<ItemGroup>
<!-- Exclude WASM support files. They can interfere with our discovery process and create extra work items that don't work. -->
<_MergedWrapperMarker Include="$(TestBinDir)**\*.MergedTestAssembly" Exclude="$(TestBinDir)**\supportFiles\*.MergedTestAssembly" />
<_MergedWrapperMarker Include="$(TestBinDir)**\*.MergedTestAssemblyForStress" Exclude="$(TestBinDir)**\supportFiles\*.MergedTestAssemblyForStress" />
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jkoritzinsky Do you know why the NAOT tests are using MergedTestAssemblyForStress instead of MergedTestAssembly?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure why they're using the stress mode. However, including the marker files here is correct.


<_MergedWrapperMarker Update="@(_MergedWrapperMarker)">
<TestExecutionScriptPath Condition="'$(TargetsMobile)' != 'true'">$([System.IO.Path]::ChangeExtension('%(Identity)', '.$(TestScriptExtension)'))</TestExecutionScriptPath>
Expand Down Expand Up @@ -549,28 +550,18 @@
Outputs="%(_MergedWrapperMarker.FileName)"
DependsOnTargets="DiscoverMergedTestWrappers;GetTestExclusionList">

<PropertyGroup>
<PropertyGroup Condition="'@(_MergedWrapperMarker)' != ''" >
<_MergedWrapperDirectory>%(_MergedWrapperMarker.RootDir)%(Directory)</_MergedWrapperDirectory>
<_MergedWrapperName>%(_MergedWrapperMarker.FileName)</_MergedWrapperName>
<_MergedWrapperName>$([System.Text.RegularExpressions.Regex]::Replace('%(_MergedWrapperMarker.FileName)', '\.MergedTestAssembly(ForStress)?\.\d+\.\d+$', ''))</_MergedWrapperName>
</PropertyGroup>

<PropertyGroup>
<XCodeSdk Condition="'$(TargetsiOS)' == 'true'">iphone</XCodeSdk>
<XCodeSdk Condition="'$(TargetsiOSSimulator)' == 'true'">iphonesimulator</XCodeSdk>
<XCodeSdk Condition="'$(TargetstvOS)' == 'true'">appletvos</XCodeSdk>
<XCodeSdk Condition="'$(TargetstvOSSimulator)' == 'true'">appletvsimulator</XCodeSdk>
<XCodeSdk Condition="'$(TargetsMacCatalyst)' == 'true'">maccatalyst</XCodeSdk>
</PropertyGroup>

<ItemGroup>
<ItemGroup Condition="'@(_MergedWrapperMarker)' != ''" >
<_MergedPayloadGroups Include="$(_MergedWrapperName)" />
</ItemGroup>
<ItemGroup>
<_MergedPayloadFiles Include="$(_MergedWrapperDirectory)AppBundle/$(_MergedWrapperName)/$(Configuration)-$(XCodeSdk)/$(_MergedWrapperName).app/**" />
<_MergedPayloadFiles Update="@(_MergedPayloadFiles)">
<_MergedPayloadFiles Include="$(_MergedWrapperDirectory)AppBundle/**" />
<_MergedPayloadFiles Update="@(_MergedPayloadFiles)" Condition="'@(_MergedPayloadFiles)' != ''" >
<!-- Never use [MSBuild]::MakeRelative here! We have some files containing Unicode characters in their %(FullPath) and
MakeRelative function calls Escape function internally that replaces all the Unicode characters with %<xx>. -->
<FileRelativeToPayloadsRootDirectory>$([System.IO.Path]::GetRelativePath('$(_MergedWrapperDirectory)AppBundle/$(_MergedWrapperName)/$(Configuration)-$(XCodeSdk)', %(FullPath)))</FileRelativeToPayloadsRootDirectory>
<FileRelativeToPayloadsRootDirectory>$([System.IO.Path]::GetRelativePath('$(_MergedWrapperDirectory)AppBundle/', %(FullPath)))</FileRelativeToPayloadsRootDirectory>
</_MergedPayloadFiles>
<!-- Remove the placeholder test exclusion list here -->
<_TestExclusionListPlaceholder Include="@(_MergedPayloadFiles)" Condition="$([System.String]::new('%(FileName)').EndsWith('TestExclusionList'))" />
Expand All @@ -591,7 +582,7 @@

<PropertyGroup Condition="'@(_MergedWrapperMarker)' != ''" >
<_MergedWrapperDirectory>%(_MergedWrapperMarker.RootDir)%(Directory)</_MergedWrapperDirectory>
<_MergedWrapperName>%(_MergedWrapperMarker.FileName)</_MergedWrapperName>
<_MergedWrapperName>$([System.Text.RegularExpressions.Regex]::Replace('%(_MergedWrapperMarker.FileName)', '\.MergedTestAssembly(ForStress)?\.\d+\.\d+$', ''))</_MergedWrapperName>
</PropertyGroup>

<ItemGroup Condition="'@(_MergedWrapperMarker)' != ''" >
Expand Down
1 change: 1 addition & 0 deletions src/tests/build.proj
Original file line number Diff line number Diff line change
Expand Up @@ -370,6 +370,7 @@
<AllRunnableTestPaths Remove="$(XunitTestBinBase)\**\run-v8.sh" Condition="'$(TargetArchitecture)' == 'wasm'" />
<AllRunnableTestPaths Remove="%(SkipTestDirsPaths.Identity)\**\*.$(TestScriptExtension)" />
<MergedAssemblyMarkerPaths Include="$(XunitTestBinBase)\**\*.MergedTestAssembly"/>
<MergedAssemblyMarkerPaths Include="$(XunitTestBinBase)\**\*.MergedTestAssemblyForStress"/>
<MergedAssemblyFolders Include="$([System.IO.Path]::GetDirectoryName('%(MergedAssemblyMarkerPaths.Identity)'))" />
<MergedAssemblyParentFolders Include="$([System.IO.Path]::GetDirectoryName('%(MergedAssemblyFolders.Identity)'))" />
<AllRunnableTestPaths Remove="%(MergedAssemblyParentFolders.Identity)\**\*.$(TestScriptExtension)" Condition="'@(MergedAssemblyParentFolders)' != ''" />
Expand Down
6 changes: 6 additions & 0 deletions src/tests/nativeaot/Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,11 @@
<PropertyGroup>
<!-- We expect trimming to be fully enabled in these tests -->
<EnableAggressiveTrimming>true</EnableAggressiveTrimming>

<!--
Each of these tests is considered its own "merged runner" that contains merged-in tests.
This allows the tests to run on mobile platforms where process isolation is not supported.
-->
<HasMergedInTests>true</HasMergedInTests>
</PropertyGroup>
</Project>
13 changes: 13 additions & 0 deletions src/tests/nativeaot/Directory.Build.targets
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<!--
Treat these tests as merged test runners.
Many of these NativeAOT tests need to be their own executables to validate specific features,
but we want to run them on mobile platforms as well.
However, mobile platforms don't support tests that require process isolation, so we can't use RequiresProcessIsolation.
Instead, we treat these tests as merged test runners themselves, so that they can run on mobile platforms.
-->
<Import Condition="'$(CLRTestKind)' != 'SharedLibrary'" Project="$(TestSourceDir)MergedTestRunner.targets" />

<!-- SDK Style projects auto-magically include this file. -->
<Import Project="..\Directory.Build.targets" />
</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -4,52 +4,56 @@
using System;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using Xunit;

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

static int Main()
private IntPtr programHandle;

public Tests()
{
IntPtr methodAddress = IntPtr.Zero;
IntPtr programHandle = IntPtr.Zero;

programHandle = NativeLibrary.GetMainProgramHandle();
if (programHandle == IntPtr.Zero)
{
return 1;
}

if (NativeLibrary.TryGetExport(programHandle, "MainAssemblyMethod", out methodAddress))
{
var MainAssemblyMethodPtr = (delegate* unmanaged <void>) methodAddress;
MainAssemblyMethodPtr();
}
else
{
return 2;
}

if (NativeLibrary.TryGetExport(programHandle, "ReferencedAssembly1Method", out methodAddress))
{
var ReferencedAssembly1MethodPtr = (delegate* unmanaged <void>) methodAddress;
ReferencedAssembly1MethodPtr();
}
else
{
return 3;
}

if (NativeLibrary.TryGetExport(programHandle, "ReferencedAssembly2Method", out methodAddress))
{
// must not be exposed from ReferencedAssembly2 assembly
return 4;
}

return 100;
Assert.NotEqual(IntPtr.Zero, programHandle);
}

[Fact]
public void ExportFromMainAssembly_IsExported()
{
IntPtr methodAddress = IntPtr.Zero;
bool found = NativeLibrary.TryGetExport(programHandle, "MainAssemblyMethod", out methodAddress);
Assert.True(found);
Assert.NotEqual(IntPtr.Zero, methodAddress);
var MainAssemblyMethodPtr = (delegate* unmanaged<void>)methodAddress;
MainAssemblyMethodPtr();
}

[Fact]
public void ExportFromUnmanagedEntryPointsAssembly_IsExported()
{
IntPtr methodAddress = IntPtr.Zero;
bool found = NativeLibrary.TryGetExport(programHandle, "ReferencedAssembly1Method", out methodAddress);
Assert.True(found);
Assert.NotEqual(IntPtr.Zero, methodAddress);
var ReferencedAssembly1MethodPtr = (delegate* unmanaged<void>)methodAddress;
ReferencedAssembly1MethodPtr();
}

[Fact]
public void ExportFromOtherAssembly_IsNotExported()
{
IntPtr methodAddress = IntPtr.Zero;
bool found = NativeLibrary.TryGetExport(programHandle, "ReferencedAssembly2Method", out methodAddress);
Assert.False(found);
Assert.Equal(IntPtr.Zero, methodAddress);
}

public void Dispose()
{
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@
Disable for now.
-->
<DisableProjectBuild Condition="'$(EnableNativeSanitizers)' != ''">true</DisableProjectBuild>
<RequiresProcessIsolation>true</RequiresProcessIsolation>
<ReferenceXUnitWrapperGenerator>false</ReferenceXUnitWrapperGenerator>
</PropertyGroup>

<ItemGroup>
Expand All @@ -22,5 +20,4 @@
<ItemGroup>
<UnmanagedEntryPointsAssembly Include="ReferencedAssembly1" />
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<CLRTestKind>SharedLibrary</CLRTestKind>
<OutputType>Library</OutputType>
</PropertyGroup>

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<CLRTestKind>SharedLibrary</CLRTestKind>
<OutputType>Library</OutputType>
</PropertyGroup>

Expand Down
7 changes: 0 additions & 7 deletions src/tests/nativeaot/SmokeTests/ComWrappers/CMakeLists.txt

This file was deleted.

Loading
Loading