diff --git a/eng/pipelines/extra-platforms/runtime-extra-platforms-ioslike.yml b/eng/pipelines/extra-platforms/runtime-extra-platforms-ioslike.yml
index 4b4c576ab3ee4a..3cf764e9369afb 100644
--- a/eng/pipelines/extra-platforms/runtime-extra-platforms-ioslike.yml
+++ b/eng/pipelines/extra-platforms/runtime-extra-platforms-ioslike.yml
@@ -115,8 +115,8 @@ jobs:
value: $[ stageDependencies.EvaluatePaths.evaluate_paths.outputs['SetPathVars_coreclr.containsChange'] ]
jobParameters:
testGroup: innerloop
- nameSuffix: AllSubsets_NativeAOT_Smoke
- buildArgs: --cross -s clr.alljits+clr.tools+clr.nativeaotruntime+clr.nativeaotlibs+libs+libs.tests -c $(_BuildConfig) /p:ArchiveTests=true /p:RunSmokeTestsOnly=true /p:DevTeamProvisioning=- /p:BuildTestsOnHelix=true /p:UseNativeAOTRuntime=true /p:RunAOTCompilation=false /p:ContinuousIntegrationBuild=true
+ nameSuffix: AllSubsets_NativeAOT
+ buildArgs: --cross -s clr.alljits+clr.tools+clr.nativeaotruntime+clr.nativeaotlibs+libs+libs.tests -c $(_BuildConfig) /p:ArchiveTests=true /p:DevTeamProvisioning=- /p:BuildTestsOnHelix=true /p:UseNativeAOTRuntime=true /p:RunAOTCompilation=false /p:ContinuousIntegrationBuild=true
timeoutInMinutes: 180
# extra steps, run tests
postBuildSteps:
diff --git a/eng/pipelines/extra-platforms/runtime-extra-platforms-ioslikesimulator.yml b/eng/pipelines/extra-platforms/runtime-extra-platforms-ioslikesimulator.yml
index c3f077f1bf513c..0eea2e3a728d25 100644
--- a/eng/pipelines/extra-platforms/runtime-extra-platforms-ioslikesimulator.yml
+++ b/eng/pipelines/extra-platforms/runtime-extra-platforms-ioslikesimulator.yml
@@ -110,8 +110,8 @@ jobs:
value: $[ stageDependencies.EvaluatePaths.evaluate_paths.outputs['SetPathVars_coreclr.containsChange'] ]
jobParameters:
testGroup: innerloop
- nameSuffix: AllSubsets_NativeAOT_Smoke
- buildArgs: --cross -s clr.alljits+clr.tools+clr.nativeaotruntime+clr.nativeaotlibs+libs+libs.tests -c $(_BuildConfig) /p:ArchiveTests=true /p:RunSmokeTestsOnly=true /p:DevTeamProvisioning=- /p:BuildTestsOnHelix=true /p:UseNativeAOTRuntime=true /p:RunAOTCompilation=false /p:ContinuousIntegrationBuild=true
+ nameSuffix: AllSubsets_NativeAOT
+ buildArgs: --cross -s clr.alljits+clr.tools+clr.nativeaotruntime+clr.nativeaotlibs+libs+libs.tests -c $(_BuildConfig) /p:ArchiveTests=true /p:DevTeamProvisioning=- /p:BuildTestsOnHelix=true /p:UseNativeAOTRuntime=true /p:RunAOTCompilation=false /p:ContinuousIntegrationBuild=true
timeoutInMinutes: 180
# extra steps, run tests
postBuildSteps:
diff --git a/eng/pipelines/extra-platforms/runtime-extra-platforms-maccatalyst.yml b/eng/pipelines/extra-platforms/runtime-extra-platforms-maccatalyst.yml
index 33cd9622cf30a5..e61d9af04f1d2f 100644
--- a/eng/pipelines/extra-platforms/runtime-extra-platforms-maccatalyst.yml
+++ b/eng/pipelines/extra-platforms/runtime-extra-platforms-maccatalyst.yml
@@ -147,8 +147,8 @@ jobs:
value: $[ stageDependencies.EvaluatePaths.evaluate_paths.outputs['SetPathVars_coreclr.containsChange'] ]
jobParameters:
testGroup: innerloop
- nameSuffix: AllSubsets_NativeAOT_Smoke
- buildArgs: --cross -s clr.alljits+clr.tools+clr.nativeaotruntime+clr.nativeaotlibs+libs+libs.tests -c $(_BuildConfig) /p:ArchiveTests=true /p:RunSmokeTestsOnly=true /p:DevTeamProvisioning=adhoc /p:BuildTestsOnHelix=true /p:UseNativeAOTRuntime=true /p:RunAOTCompilation=false /p:ContinuousIntegrationBuild=true
+ nameSuffix: AllSubsets_NativeAOT
+ buildArgs: --cross -s clr.alljits+clr.tools+clr.nativeaotruntime+clr.nativeaotlibs+libs+libs.tests -c $(_BuildConfig) /p:ArchiveTests=true /p:DevTeamProvisioning=adhoc /p:BuildTestsOnHelix=true /p:UseNativeAOTRuntime=true /p:RunAOTCompilation=false /p:ContinuousIntegrationBuild=true
timeoutInMinutes: 180
# extra steps, run tests
postBuildSteps:
@@ -180,8 +180,8 @@ jobs:
value: $[ stageDependencies.EvaluatePaths.evaluate_paths.outputs['SetPathVars_coreclr.containsChange'] ]
jobParameters:
testGroup: innerloop
- nameSuffix: AllSubsets_NativeAOT_Smoke_AppSandbox
- buildArgs: --cross -s clr.alljits+clr.tools+clr.nativeaotruntime+clr.nativeaotlibs+libs+libs.tests -c $(_BuildConfig) /p:ArchiveTests=true /p:RunSmokeTestsOnly=true /p:DevTeamProvisioning=adhoc /p:BuildTestsOnHelix=true /p:UseNativeAOTRuntime=true /p:RunAOTCompilation=false /p:ContinuousIntegrationBuild=true /p:EnableAppSandbox=true
+ nameSuffix: AllSubsets_NativeAOT_AppSandbox
+ buildArgs: --cross -s clr.alljits+clr.tools+clr.nativeaotruntime+clr.nativeaotlibs+libs+libs.tests -c $(_BuildConfig) /p:ArchiveTests=true /p:DevTeamProvisioning=adhoc /p:BuildTestsOnHelix=true /p:UseNativeAOTRuntime=true /p:RunAOTCompilation=false /p:ContinuousIntegrationBuild=true /p:EnableAppSandbox=true
timeoutInMinutes: 180
# extra steps, run tests
postBuildSteps:
diff --git a/eng/testing/tests.ioslike.targets b/eng/testing/tests.ioslike.targets
index f0c89c5ada10e7..5db83011f8d277 100644
--- a/eng/testing/tests.ioslike.targets
+++ b/eng/testing/tests.ioslike.targets
@@ -3,6 +3,28 @@
$(BundleTestAppTargets);BundleTestAppleApp
+
+
+ true
+ true
+ true
+ <_IsPublishing Condition="'$(_IsPublishing)' == ''">true
+ Static
+ true
+
+
+
+
+
+
+
+
+
+
+
+
+
helix
helix
@@ -80,6 +102,14 @@
Include="@(AppleAssembliesToBundle)" TargetDir="extraFiles\%(AppleAssembliesToBundle.RecursiveDir)" />
+
+
+ <_NativeAotHelixLinkInputs Include="$(MicrosoftNetCoreAppRuntimePackDir)/runtimes/$(TargetOS)-$(TargetArchitecture)/native/*.a" />
+ <_NativeAotHelixLinkInputs Include="$(CoreCLRAotSdkDir)*.a" />
+ <_NativeAotHelixLinkInputs Include="$(CoreCLRAotSdkDir)*.o" />
+
+
+
@@ -180,7 +210,8 @@
true
true
true
- AppleTestRunner.dll
+ AppleTestRunner.dll
+
$(PublishDir)
$(BundleDir)
diff --git a/eng/testing/tests.mobile.targets b/eng/testing/tests.mobile.targets
index d38673115d6aa4..68b06a8e308013 100644
--- a/eng/testing/tests.mobile.targets
+++ b/eng/testing/tests.mobile.targets
@@ -126,7 +126,7 @@
Condition="'$(TestFramework)' == 'xunit'">
<_runnerFilesToPublish Include="$(AndroidTestRunnerDir)*" Condition="'$(TargetOS)' == 'android'" />
- <_runnerFilesToPublish Include="$(AppleTestRunnerDir)*" Condition="'$(TargetOS)' == 'maccatalyst' or '$(TargetOS)' == 'ios' or '$(TargetOS)' == 'iossimulator' or '$(TargetOS)' == 'tvos' or '$(TargetOS)' == 'tvossimulator'" />
+ <_runnerFilesToPublish Include="$(AppleTestRunnerDir)*" Condition="('$(TargetOS)' == 'maccatalyst' or '$(TargetOS)' == 'ios' or '$(TargetOS)' == 'iossimulator' or '$(TargetOS)' == 'tvos' or '$(TargetOS)' == 'tvossimulator') and '$(TestNativeAot)' != 'true'" />
<_runnerFilesToPublish Include="$(WasmTestRunnerDir)*" Condition="'$(TargetOS)' == 'Browser' or '$(TargetOS)' == 'wasi'" />
diff --git a/eng/testing/tests.singlefile.targets b/eng/testing/tests.singlefile.targets
index 1a992b1b7e10d3..1f52835b829a1a 100644
--- a/eng/testing/tests.singlefile.targets
+++ b/eng/testing/tests.singlefile.targets
@@ -6,8 +6,8 @@
$([MSBuild]::NormalizePath('$(BundleDir)', '$(RunScriptOutputName)'))
$(TargetRid)
- $(AssemblyName).exe
- chmod +rwx $(AssemblyName) && ./$(AssemblyName)
+ $(AssemblyName).exe
+ chmod +rwx $(AssemblyName) && ./$(AssemblyName)
@@ -40,7 +40,7 @@
true
-
+
$(DefineConstants);SINGLE_FILE_TEST_RUNNER
@@ -56,7 +56,7 @@
+ Condition="'$(CLRTestKind)' == '' and '$(IsFunctionalTest)' != 'true' and '$(TargetsAppleMobile)' != 'true'" />
@@ -183,7 +183,7 @@
diff --git a/eng/testing/xunit/xunit.console.targets b/eng/testing/xunit/xunit.console.targets
index cb79571f2f1d5c..e3b2fbfa916bb6 100644
--- a/eng/testing/xunit/xunit.console.targets
+++ b/eng/testing/xunit/xunit.console.targets
@@ -52,7 +52,7 @@
$(_withoutCategories.Replace(';', '%0dcategory='))
-
+
$(RunScriptCommand) -xml $(TestResultsName)
diff --git a/src/libraries/Common/tests/AppleTestRunner/AppleTestRunner.cs b/src/libraries/Common/tests/AppleTestRunner/AppleTestRunner.cs
index 62d01c6df836eb..c126ccaeaa5693 100644
--- a/src/libraries/Common/tests/AppleTestRunner/AppleTestRunner.cs
+++ b/src/libraries/Common/tests/AppleTestRunner/AppleTestRunner.cs
@@ -6,6 +6,7 @@
using System.Text;
using System.IO;
using System.Collections.Generic;
+using System.Diagnostics.CodeAnalysis;
using System.Reflection;
using System.Threading;
using System.Threading.Tasks;
@@ -24,6 +25,7 @@ public class SimpleTestRunner : iOSApplicationEntryPoint, IDevice
public extern static void mono_ios_set_summary (string value);
private static List s_testLibs = new List();
+ private static List? s_testAssemblies;
private static string? s_MainTestName;
public static async Task Main(string[] args)
@@ -45,13 +47,30 @@ public static async Task Main(string[] args)
if (s_testLibs.Count < 1)
{
- // Look for *.Tests.dll files if target test suites are not set via "testlib:" arguments
- s_testLibs = Directory.GetFiles(Environment.CurrentDirectory, "*.Tests.dll").ToList();
+ if (!RuntimeFeature.IsDynamicCodeSupported)
+ {
+ s_testAssemblies = AppDomain.CurrentDomain.GetAssemblies()
+ .Where(a => a.GetName().Name?.EndsWith(".Tests") == true)
+ .ToList();
+ s_testLibs = s_testAssemblies.Select(a => a.GetName().Name!).ToList();
+ }
+ else
+ {
+ s_testLibs = Directory.GetFiles(Environment.CurrentDirectory, "*.Tests.dll").ToList();
+ }
}
if (s_testLibs.Count < 1)
{
- Console.WriteLine($"Test libs were not found (*.Tests.dll was not found in {Environment.CurrentDirectory})");
+ if (!RuntimeFeature.IsDynamicCodeSupported)
+ {
+ Console.WriteLine("No assemblies ending with '.Tests' were found among loaded assemblies.");
+ }
+ else
+ {
+ Console.WriteLine($"Test libs were not found (*.Tests.dll was not found in {Environment.CurrentDirectory})");
+ }
+
return -1;
}
@@ -61,7 +80,9 @@ public static async Task Main(string[] args)
Console.WriteLine(testLib);
}
Console.WriteLine(".");
- s_MainTestName = Path.GetFileNameWithoutExtension(s_testLibs[0]);
+ s_MainTestName = s_testAssemblies is not null
+ ? s_testAssemblies[0].GetName().Name
+ : Path.GetFileNameWithoutExtension(s_testLibs[0]);
mono_ios_set_summary($"Starting tests...");
var simpleTestRunner = new SimpleTestRunner(verbose);
@@ -108,11 +129,23 @@ public SimpleTestRunner(bool verbose)
}
}
+ [UnconditionalSuppressMessage("Trimming", "IL2026:RequiresUnreferencedCode",
+ Justification = "On NativeAOT s_testAssemblies is populated from AppDomain.CurrentDomain.GetAssemblies() and the Assembly.LoadFrom branch is never taken.")]
protected override IEnumerable GetTestAssemblies()
{
- foreach (string file in s_testLibs)
+ if (s_testAssemblies is not null)
+ {
+ foreach (Assembly assembly in s_testAssemblies)
+ {
+ yield return new TestAssemblyInfo(assembly, assembly.GetName().Name! + ".dll");
+ }
+ }
+ else
{
- yield return new TestAssemblyInfo(Assembly.LoadFrom(file), file);
+ foreach (string file in s_testLibs)
+ {
+ yield return new TestAssemblyInfo(Assembly.LoadFrom(file), file);
+ }
}
}
@@ -129,7 +162,31 @@ protected override void TerminateWithSuccess()
protected override string? IgnoreFilesDirectory => null;
- protected override string IgnoredTraitsFilePath => "xunit-excludes.txt";
+ protected override string IgnoredTraitsFilePath
+ {
+ get
+ {
+ string path = Path.Combine(AppContext.BaseDirectory, "xunit-excludes.txt");
+ if (File.Exists(path))
+ {
+ return path;
+ }
+
+ // On NativeAOT maccatalyst the binary lives in .app/Contents/MacOS/
+ // but xunit-excludes.txt is bundled under .app/Contents/Resources/.
+ string? appBase = Path.GetDirectoryName(AppContext.BaseDirectory.TrimEnd(Path.DirectorySeparatorChar));
+ if (appBase is not null)
+ {
+ string resourcesPath = Path.Combine(appBase, "Resources", "xunit-excludes.txt");
+ if (File.Exists(resourcesPath))
+ {
+ return resourcesPath;
+ }
+ }
+
+ return string.Empty;
+ }
+ }
public string BundleIdentifier => "net.dot." + s_MainTestName;
diff --git a/src/libraries/System.Runtime/tests/System.Runtime.Tests/System/DoubleTests.cs b/src/libraries/System.Runtime/tests/System.Runtime.Tests/System/DoubleTests.cs
index e567324ba71741..946ec2c12cda41 100644
--- a/src/libraries/System.Runtime/tests/System.Runtime.Tests/System/DoubleTests.cs
+++ b/src/libraries/System.Runtime/tests/System.Runtime.Tests/System/DoubleTests.cs
@@ -536,6 +536,7 @@ internal static string Reverse(string s)
}
[ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsNotBrowser))]
+ [ActiveIssue("https://github.com/dotnet/runtime/issues/127786", typeof(PlatformDetection), nameof(PlatformDetection.IsAppleMobile), nameof(PlatformDetection.IsNativeAot))]
public static void ParsePatterns()
{
string path = Directory.GetCurrentDirectory();
diff --git a/src/libraries/System.Runtime/tests/System.Runtime.Tests/System/Reflection/ModuleTests.cs b/src/libraries/System.Runtime/tests/System.Runtime.Tests/System/Reflection/ModuleTests.cs
index df758d8faca60c..757fa7c80a8ea1 100644
--- a/src/libraries/System.Runtime/tests/System.Runtime.Tests/System/Reflection/ModuleTests.cs
+++ b/src/libraries/System.Runtime/tests/System.Runtime.Tests/System/Reflection/ModuleTests.cs
@@ -82,6 +82,7 @@ public void CustomAttributes()
[Fact]
[ActiveIssue("https://github.com/dotnet/runtime/issues/123011", typeof(PlatformDetection), nameof(PlatformDetection.IsBrowser), nameof(PlatformDetection.IsCoreCLR))]
+ [ActiveIssue("https://github.com/dotnet/runtime/issues/127786", typeof(PlatformDetection), nameof(PlatformDetection.IsAppleMobile), nameof(PlatformDetection.IsNativeAot))]
public void FullyQualifiedName()
{
#if SINGLE_FILE_TEST_RUNNER
@@ -105,6 +106,7 @@ public void FullyQualifiedName()
[Fact]
[ActiveIssue("https://github.com/dotnet/runtime/issues/123011", typeof(PlatformDetection), nameof(PlatformDetection.IsBrowser), nameof(PlatformDetection.IsCoreCLR))]
+ [ActiveIssue("https://github.com/dotnet/runtime/issues/127786", typeof(PlatformDetection), nameof(PlatformDetection.IsAppleMobile), nameof(PlatformDetection.IsNativeAot))]
public void Name()
{
#if SINGLE_FILE_TEST_RUNNER
diff --git a/src/libraries/tests.proj b/src/libraries/tests.proj
index c3a6d07d77d383..777aeee94b2442 100644
--- a/src/libraries/tests.proj
+++ b/src/libraries/tests.proj
@@ -338,6 +338,11 @@
+
+
+
+
+
@@ -538,7 +543,7 @@
-
+
diff --git a/src/mono/msbuild/apple/build/AppleBuild.targets b/src/mono/msbuild/apple/build/AppleBuild.targets
index ee15221fca821e..c3ed3e2b04e254 100644
--- a/src/mono/msbuild/apple/build/AppleBuild.targets
+++ b/src/mono/msbuild/apple/build/AppleBuild.targets
@@ -21,8 +21,6 @@
-
@@ -96,6 +94,7 @@
<_AppleRuntimeConfigFilePath Condition="'$(_AppleRuntimeConfigFilePath)' == ''">$([MSBuild]::NormalizePath($(AppleBuildDir), '$(AssemblyName).runtimeconfig.json'))
<_ParsedRuntimeConfigFilePath Condition="'$(_ParsedRuntimeConfigFilePath)' == ''">$([MSBuild]::NormalizePath($(AppleBuildDir), 'runtimeconfig.bin'))
true
+ true
diff --git a/src/mono/msbuild/apple/data/ProxyProjectForAOTOnHelix.proj b/src/mono/msbuild/apple/data/ProxyProjectForAOTOnHelix.proj
index 30b9edf0ff4f0e..5070547f11d8c7 100644
--- a/src/mono/msbuild/apple/data/ProxyProjectForAOTOnHelix.proj
+++ b/src/mono/msbuild/apple/data/ProxyProjectForAOTOnHelix.proj
@@ -24,12 +24,13 @@
-
+
$(OriginalPublishDir)
static
true
false
+
false
@@ -47,30 +48,65 @@
+
+
+
+
+ <_NativeAotLibraryTestOnHelix Condition="'$(UseNativeAOTRuntime)' == 'true' and '$(_UseNativeAOTLibraryModeBundling)' != 'true' and '$(IncludesTestRunner)' != 'false'">true
+
+
+
+ <_PrebuiltNativeAOTLib>$(OriginalPublishDir)lib$(AssemblyName).a
+ true
+ PrepareForAppleBuild;_PublishRuntimePack;_PrepareForAppleBuildAppOnHelix;_RunR2RCompilationOnHelix;_InitializeCommonProperties;_BeforeAppleBuild;_AppleResolveReferences;_StageNativeAotLinkInputsOnHelix;_AppleGenerateAppBundle;_AfterAppleBuild;_AfterAppleBuildOnHelix
+
+
-
-
+
+
+
+
+ <_NativeAotLinkInputsDir>$(OriginalPublishDir)nativeaot-link-inputs\
+
+
+
+
+
+ $(_PrebuiltNativeAOTLib)
+
+
+ <_NativeAotHelixLinkLibs Include="$(_NativeAotLinkInputsDir)*.a"
+ Exclude="$(_NativeAotLinkInputsDir)libRuntime.ServerGC.a;$(_NativeAotLinkInputsDir)libRuntime.VxsortEnabled.a;$(_NativeAotLinkInputsDir)libstandalonegc-enabled.a;$(_NativeAotLinkInputsDir)libeventpipe-enabled.a" />
+ <_NativeAotHelixLinkLibs Include="$(_NativeAotLinkInputsDir)libbootstrapperdll.o" />
+
+
+
+
+
+
true
- AppleTestRunner.dll
+ AppleTestRunner.dll
+
$(OriginalPublishDir)
$(TestRootDir)AppBundle\
-
-
+
-
+
<_ExtraFiles Include="$(ExtraFilesPath)**\*" />
@@ -90,6 +126,11 @@
127.0.0.1:9000,nosuspend,listen
+
+
+
+
+
diff --git a/src/tasks/AppleAppBuilder/Xcode.cs b/src/tasks/AppleAppBuilder/Xcode.cs
index 89d4f19a4102db..c470bc994bcbda 100644
--- a/src/tasks/AppleAppBuilder/Xcode.cs
+++ b/src/tasks/AppleAppBuilder/Xcode.cs
@@ -278,7 +278,6 @@ public string GenerateCMake(
predefinedExcludes.Add(".dll");
predefinedExcludes.Add(".pdb");
predefinedExcludes.Add(".json");
- predefinedExcludes.Add(".txt");
predefinedExcludes.Add(".bin");
predefinedExcludes.Add(".dSYM");
}