Skip to content

Commit 6e63861

Browse files
committed
[wasm][tests][aot] Propogate wasm properties from the original project
.. to the proxy project on helix. This also fixes #50727 , by correctly passing `$(InvariantGlobalization)` property to the proxy project. So, re-enable `Invariant.Tests`.
1 parent cac4de8 commit 6e63861

File tree

4 files changed

+93
-11
lines changed

4 files changed

+93
-11
lines changed

eng/testing/tests.mobile.targets

Lines changed: 34 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,15 +20,21 @@
2020
</PropertyGroup>
2121

2222
<PropertyGroup Condition="'$(TargetOS)' == 'Browser' and '$(BuildWasmAOTTestsOnHelix)' == 'true'">
23-
<RunScriptCommand >dotnet msbuild publish/aot-build.proj /bl:$XHARNESS_OUT/AOTBuild.binlog</RunScriptCommand>
24-
<RunScriptCommand Condition="'$(BuildWasmTestsOn)' == 'helix' and '$(ContinuousIntegrationBuild)' != 'true'">$(RunScriptCommand) /p:RuntimeSrcDir=$(RepoRoot) /p:RuntimeConfig=$(Configuration)</RunScriptCommand>
25-
<RunScriptCommand Condition="'$(BuildWasmTestsOn)' == 'helix' and '$(ContinuousIntegrationBuild)' == 'true'">$(RunScriptCommand) /p:WasmBuildSupportDir=$HELIX_CORRELATION_PAYLOAD/build</RunScriptCommand>
26-
<RunScriptCommand >$(RunScriptCommand) /p:RunAOTCompilation=$(RunAOTCompilation)</RunScriptCommand>
23+
<RunScriptCommand >dotnet msbuild publish/AOTTestProjectForHelix.proj /bl:$XHARNESS_OUT/AOTBuild.binlog</RunScriptCommand>
2724

28-
<RunScriptCommand>$(RunScriptCommand) &amp;&amp; cd wasm_build/AppBundle &amp;&amp;</RunScriptCommand>
25+
<!-- running aot-helix tests locally, so we can test with the same project file as CI -->
26+
<RunScriptCommand Condition="'$(ContinuousIntegrationBuild)' != 'true'">$(RunScriptCommand) /p:RuntimeSrcDir=$(RepoRoot) /p:RuntimeConfig=$(Configuration)</RunScriptCommand>
27+
28+
<!-- running aot-helix tests on helix! -->
29+
<RunScriptCommand Condition="'$(ContinuousIntegrationBuild)' == 'true'">$(RunScriptCommand) /p:WasmBuildSupportDir=$HELIX_CORRELATION_PAYLOAD/build</RunScriptCommand>
30+
31+
<RunScriptCommand >$(RunScriptCommand) /p:RunAOTCompilation=$(RunAOTCompilation)</RunScriptCommand>
32+
<RunScriptCommand >$(RunScriptCommand) &amp;&amp; cd wasm_build/AppBundle</RunScriptCommand>
2933
</PropertyGroup>
3034

3135
<PropertyGroup Condition="'$(TargetOS)' == 'Browser'">
36+
<RunScriptCommand Condition="'$(RunScriptCommand)' != ''">$(RunScriptCommand) &amp;&amp;</RunScriptCommand>
37+
3238
<!-- We need to set this in order to get extensibility on xunit category traits and other arguments we pass down to xunit via MSBuild properties -->
3339
<RunScriptCommand Condition="'$(IsFunctionalTest)' != 'true' and '$(Scenario)' != 'BuildWasmApps'">$(RunScriptCommand) $HARNESS_RUNNER wasm $XHARNESS_COMMAND --app=. --engine=$(JSEngine) $(JSEngineArgs) --js-file=runtime.js --output-directory=$XHARNESS_OUT -- $(RunTestsJSArguments) --run WasmTestRunner.dll $(AssemblyName).dll</RunScriptCommand>
3440
<RunScriptCommand Condition="'$(IsFunctionalTest)' == 'true'">$(RunScriptCommand) $HARNESS_RUNNER wasm $XHARNESS_COMMAND --app=. --engine=$(JSEngine) $(JSEngineArgs) --js-file=runtime.js --output-directory=$XHARNESS_OUT --expected-exit-code=$(ExpectedExitCode) -- $(RunTestsJSArguments) --run $(AssemblyName).dll --testing</RunScriptCommand>
@@ -280,6 +286,7 @@
280286

281287
<Target Name="BundleTestWasmApp" Condition="'$(TargetOS)' == 'Browser'" DependsOnTargets="$(BundleTestWasmAppDependsOn)" />
282288

289+
<UsingTask Condition="'$(BuildWasmAOTTestsOnHelix)' == 'true'" TaskName="Microsoft.WebAssembly.Build.Tasks.GenerateAOTProps" AssemblyFile="$(WasmBuildTasksAssemblyPath)" />
283290
<Target Name="_BundleAOTTestWasmAppForHelix" DependsOnTargets="PrepareForWasmBuildApp">
284291
<ItemGroup>
285292
<BundleFiles Include="$(WasmMainJSPath)" TargetDir="publish" />
@@ -289,6 +296,28 @@
289296
<BundleFiles Include="$(MonoProjectRoot)\wasm\data\aot-tests\*" TargetDir="publish" />
290297
</ItemGroup>
291298

299+
<!-- To recreate the original project on helix, we need to set the wasm properties also, same as the
300+
library test project. Eg. $(InvariantGlobalization) -->
301+
<ItemGroup>
302+
<_WasmPropertyNames Include="InvariantGlobalization" />
303+
<_WasmPropertyNames Include="AOTMode" />
304+
<_WasmPropertyNames Include="WasmDebugLevel" />
305+
<_WasmPropertyNames Include="WasmBuildNative" />
306+
<_WasmPropertyNames Include="_WasmDevel" />
307+
<_WasmPropertyNames Include="WasmLinkIcalls" />
308+
<_WasmPropertyNames Include="WasmDedup" />
309+
310+
<_WasmPropertiesToPass
311+
Include="$(%(_WasmPropertyNames.Identity))"
312+
Name="%(_WasmPropertyNames.Identity)"
313+
ConditionToUse="%(_WasmPropertyNames.ConditionToUse)" />
314+
</ItemGroup>
315+
316+
<!-- This file gets imported by the project file on helix -->
317+
<GenerateAOTProps
318+
Properties="@(_WasmPropertiesToPass)"
319+
OutputFile="$(BundleDir)publish\AOTTestProjectForHelix.props" />
320+
292321
<Copy SourceFiles="@(BundleFiles)" DestinationFolder="$(BundleDir)%(TargetDir)" />
293322
<Copy SourceFiles="@(WasmFilesToIncludeInFileSystem)" DestinationFiles="$(BundleDir)\extraFiles\%(WasmFilesToIncludeInFileSystem.TargetPath)" Condition="'%(WasmFilesToIncludeInFileSystem.TargetPath)' != ''" />
294323
</Target>

src/libraries/tests.proj

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -274,9 +274,6 @@
274274
<!-- Issue: https://github.com/dotnet/runtime/issues/50726 -->
275275
<ProjectExclusions Include="$(MSBuildThisFileDirectory)System.Runtime.Caching/tests/System.Runtime.Caching.Tests.csproj" />
276276

277-
<!-- Issue: https://github.com/dotnet/runtime/issues/50727 -->
278-
<ProjectExclusions Include="$(MSBuildThisFileDirectory)System.Globalization\tests\Invariant\Invariant.Tests.csproj" />
279-
280277
<!-- Issue: https://github.com/dotnet/runtime/issues/50730 -->
281278
<ProjectExclusions Include="$(MSBuildThisFileDirectory)System.Runtime.Serialization.Json\tests\System.Runtime.Serialization.Json.Tests.csproj" />
282279
<ProjectExclusions Include="$(MSBuildThisFileDirectory)System.Runtime.Serialization.Json\tests\ReflectionOnly\System.Runtime.Serialization.Json.ReflectionOnly.Tests.csproj" />

src/mono/wasm/data/aot-tests/aot-build.proj renamed to src/mono/wasm/data/aot-tests/AOTTestProjectForHelix.proj

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,19 +6,20 @@
66
<TestRootDir Condition="'$(HELIX_WORKITEM_ROOT)' == ''">$(MSBuildThisFileDirectory)..\wasm_build\</TestRootDir>
77
<OriginalPublishDir>$(TestRootDir)..\publish\</OriginalPublishDir>
88
<IntermediateOutputPath>$(TestRootDir)\obj</IntermediateOutputPath>
9+
910
<WasmStripAOTAssemblies>false</WasmStripAOTAssemblies>
10-
<WasmNativeBuild>false</WasmNativeBuild>
1111
<WasmNativeDebugSymbols>true</WasmNativeDebugSymbols>
1212
<WasmNativeStrip>false</WasmNativeStrip>
13-
1413
<WasmBuildAppDependsOn>PrepareForWasmBuildApp;$(WasmBuildAppDependsOn)</WasmBuildAppDependsOn>
1514
</PropertyGroup>
1615

16+
<Import Project="$(MSBuildThisFileDirectory)$(MSBuildThisFileName).props" />
17+
1718
<Target Name="BundleTestWasmApp" DependsOnTargets="WasmBuildApp" />
1819

1920
<Target Name="PrepareForWasmBuildApp">
2021
<PropertyGroup>
21-
<WasmAppDir>>$(TestRootDir)AppBundle\</WasmAppDir>
22+
<WasmAppDir>$(TestRootDir)AppBundle\</WasmAppDir>
2223
<WasmMainAssemblyFileName>$(OriginalPublishDir)WasmTestRunner.dll</WasmMainAssemblyFileName>
2324
<WasmMainJSPath>$(OriginalPublishDir)runtime-test.js</WasmMainJSPath>
2425
<WasmGenerateRunV8Script Condition="'$(WasmGenerateRunV8Script)' == ''">true</WasmGenerateRunV8Script>
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
// Licensed to the .NET Foundation under one or more agreements.
2+
// The .NET Foundation licenses this file to you under the MIT license.
3+
4+
using System;
5+
using System.Collections.Generic;
6+
using System.Diagnostics.CodeAnalysis;
7+
using System.IO;
8+
using System.Text;
9+
using Microsoft.Build.Framework;
10+
using Microsoft.Build.Utilities;
11+
12+
namespace Microsoft.WebAssembly.Build.Tasks
13+
{
14+
public class GenerateAOTProps : Task
15+
{
16+
[NotNull]
17+
[Required]
18+
public ITaskItem[]? Properties { get; set; }
19+
20+
[NotNull]
21+
[Required]
22+
public string? OutputFile { get; set; }
23+
24+
public override bool Execute()
25+
{
26+
var outDir = Path.GetDirectoryName(OutputFile);
27+
if (!string.IsNullOrEmpty(outDir) && !Directory.Exists(outDir))
28+
Directory.CreateDirectory(outDir);
29+
30+
StringBuilder sb = new();
31+
32+
sb.AppendLine("<Project>");
33+
sb.AppendLine(" <PropertyGroup>");
34+
35+
foreach (var prop in Properties)
36+
{
37+
string value = prop.ItemSpec;
38+
string? name = prop.GetMetadata("Name");
39+
string? condition = prop.GetMetadata("ConditionToUse");
40+
41+
if (!string.IsNullOrEmpty(condition))
42+
sb.AppendLine($" <{name} Condition=\"{condition}\">{value}</{name}>");
43+
else
44+
sb.AppendLine($" <{name}>{value}</{name}>");
45+
}
46+
47+
sb.AppendLine(" </PropertyGroup>");
48+
sb.AppendLine("</Project>");
49+
50+
File.WriteAllText(OutputFile, sb.ToString());
51+
return !Log.HasLoggedErrors;
52+
}
53+
54+
}
55+
}

0 commit comments

Comments
 (0)