Skip to content

Commit 37544e5

Browse files
Add sample testing
This will effectively smoke-test the "LKG" package.
1 parent 7076842 commit 37544e5

File tree

3 files changed

+38
-30
lines changed

3 files changed

+38
-30
lines changed

samples/HelloWorld/HelloWorld.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
<PropertyGroup>
44
<OutputType>Exe</OutputType>
5-
<TargetFramework>net9.0</TargetFramework>
5+
<TargetFramework>net10.0</TargetFramework>
66

77
<PublishTrimmed>true</PublishTrimmed>
88
<SelfContained>true</SelfContained>

samples/NativeLibrary/NativeLibrary.csproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
<PropertyGroup>
44
<OutputType>library</OutputType>
5-
<TargetFramework>net9.0</TargetFramework>
5+
<TargetFramework>net10.0</TargetFramework>
66
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
77

88
<PublishTrimmed>true</PublishTrimmed>
@@ -15,7 +15,7 @@
1515
<PackageReference Include="runtime.$(NETCoreSdkPortableRuntimeIdentifier).Microsoft.DotNet.ILCompiler.LLVM" Version="10.0.0-*" />
1616
</ItemGroup>
1717

18-
<ItemGroup>
18+
<ItemGroup Condition="'$(RuntimeIdentifier)' == 'browser-wasm'">
1919
<LinkerArg Include="-sEXPORTED_RUNTIME_METHODS=stringToNewUTF8" />
2020
</ItemGroup>
2121

src/tests/nativeaot/SmokeTests/HelloWasm/PackagingTests.csproj

Lines changed: 35 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -7,22 +7,44 @@
77
</PropertyGroup>
88

99
<Target Name="PublishPackagingTestProject" BeforeTargets="BeforeBuild">
10-
<ItemGroup>
11-
<PackagingTestProject Include="PackagingTests/PackagingTestProject.csproj" />
12-
13-
<PackagingTestProject>
14-
<TestOutputPath>$(OutputPath)%(FileName)</TestOutputPath>
15-
</PackagingTestProject>
16-
</ItemGroup>
17-
1810
<PropertyGroup>
1911
<Test_Configuration>$(Configuration)</Test_Configuration>
2012
<Test_TargetFramework>$(NetCoreAppCurrent)</Test_TargetFramework>
2113
<Test_RuntimeIdentifier>$(TargetOS)-$(TargetArchitecture)</Test_RuntimeIdentifier>
2214
<Test_RestoreSource>$(ArtifactsShippingPackagesDir)</Test_RestoreSource>
2315
<Test_RestorePackagesPath>$([MSBuild]::NormalizeDirectory('$(PackageOutputPath)', 'packages', '$(Configuration)'))</Test_RestorePackagesPath>
16+
<Test_HostPackageRuntimeIdentifier>$(NETCoreSdkPortableRuntimeIdentifier.Replace('-$(BuildArchitecture)', '-$(IlcHostArch)'))</Test_HostPackageRuntimeIdentifier>
2417
</PropertyGroup>
2518

19+
<ItemGroup>
20+
<PackagingTestProject Include="PackagingTests/PackagingTestProject.csproj">
21+
<BuildProperties>
22+
Test_Configuration=$(Test_Configuration);
23+
Test_TargetFramework=$(Test_TargetFramework);
24+
Test_RuntimeIdentifier=$(Test_RuntimeIdentifier);
25+
Test_PackageVersion=$(NetCoreAppCurrentVersion).0-*;
26+
Test_RestoreSource=$(Test_RestoreSource);
27+
Test_RestorePackagesPath=$(Test_RestorePackagesPath);
28+
Test_HostPackageRuntimeIdentifier=$(Test_HostPackageRuntimeIdentifier);
29+
_hostArchitecture=$(IlcHostArch); <!-- Override host package resolution in ILC targets. -->
30+
</BuildProperties>
31+
</PackagingTestProject>
32+
<PackagingTestProject OutputPathRoot="$(OutputPath)%(FileName)/" />
33+
<PackagingTestProject BuildProperties="Test_TestOutputPath=%(OutputPathRoot);%(BuildProperties)" />
34+
35+
<SampleProject Include="$(RepoRoot)samples/HelloWorld/HelloWorld.csproj;
36+
$(RepoRoot)samples/NativeLibrary/NativeLibrary.csproj">
37+
<BuildProperties>
38+
Configuration=$(Test_Configuration);
39+
RuntimeIdentifier=$(Test_RuntimeIdentifier);
40+
</BuildProperties>
41+
</SampleProject>
42+
<SampleProject OutputPathRoot="%(RootDir)%(Directory)" />
43+
44+
<PackagingTestProject Include="@(SampleProject)"
45+
Condition="'$(Test_HostPackageRuntimeIdentifier)' == '$(NETCoreSdkPortableRuntimeIdentifier)'" />
46+
</ItemGroup>
47+
2648
<Error Condition="!Exists($(Test_RestoreSource))"
2749
Text="The 'nativeaot.packages' subset must be built before building this project" />
2850

@@ -35,33 +57,19 @@
3557
before "./build nativeaot.packages" because the pkgproj targets do
3658
not declare their inputs properly. -->
3759
<RemoveDir Directories="$(Test_RestorePackagesPath)" />
38-
<RemoveDir Directories="@(PackagingTestProject->'%(TestOutputPath)')" />
39-
40-
<PropertyGroup>
41-
<PackagingTestProjectProperties>
42-
Test_Configuration=$(Test_Configuration);
43-
Test_TargetFramework=$(Test_TargetFramework);
44-
Test_RuntimeIdentifier=$(Test_RuntimeIdentifier);
45-
Test_PackageVersion=$(NetCoreAppCurrentVersion).0-*;
46-
Test_RestoreSource=$(Test_RestoreSource);
47-
Test_RestorePackagesPath=$(Test_RestorePackagesPath);
48-
Test_HostPackageRuntimeIdentifier=$(NETCoreSdkPortableRuntimeIdentifier.Replace('-$(BuildArchitecture)', '-$(IlcHostArch)'));
49-
_hostArchitecture=$(IlcHostArch); <!-- Override host package resolution in ILC targets. -->
50-
</PackagingTestProjectProperties>
51-
</PropertyGroup>
60+
<RemoveDir Directories="%(PackagingTestProject.OutputPathRoot)bin;
61+
%(PackagingTestProject.OutputPathRoot)obj" />
5262

5363
<MSBuild Projects="@(PackagingTestProject)"
5464
Targets="Restore"
55-
Properties="$(PackagingTestProjectProperties);
56-
Test_TestOutputPath=%(TestOutputPath);
65+
Properties="%(BuildProperties);
5766
MSBuildRestoreSessionId=$([System.Guid]::NewGuid())" />
5867

5968
<MSBuild Projects="@(PackagingTestProject)"
6069
Targets="Publish"
61-
Properties="$(PackagingTestProjectProperties);
62-
Test_TestOutputPath=%(TestOutputPath)" />
70+
Properties="%(BuildProperties)" />
6371

64-
<Error Condition="!Exists('%(TestOutputPath)/bin/$(Test_Configuration)/$(Test_TargetFramework)/$(Test_RuntimeIdentifier)/publish/%(FileName).wasm')"
72+
<Error Condition="!Exists('%(OutputPathRoot)/bin/$(Test_Configuration)/$(Test_TargetFramework)/$(Test_RuntimeIdentifier)/publish/%(FileName).wasm')"
6573
Text="%(PackagingTestProject.FullPath) did not produce the expected native artifacts" />
6674
</Target>
6775
</Project>

0 commit comments

Comments
 (0)