Skip to content

Commit adcf6c2

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

File tree

3 files changed

+35
-29
lines changed

3 files changed

+35
-29
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: 1 addition & 1 deletion
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>

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

Lines changed: 33 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,6 @@
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>
@@ -23,6 +15,34 @@
2315
<Test_RestorePackagesPath>$([MSBuild]::NormalizeDirectory('$(PackageOutputPath)', 'packages', '$(Configuration)'))</Test_RestorePackagesPath>
2416
</PropertyGroup>
2517

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

@@ -35,33 +55,19 @@
3555
before "./build nativeaot.packages" because the pkgproj targets do
3656
not declare their inputs properly. -->
3757
<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>
58+
<RemoveDir Directories="%(PackagingTestProject.OutputPathRoot)bin;
59+
%(PackagingTestProject.OutputPathRoot)obj" />
5260

5361
<MSBuild Projects="@(PackagingTestProject)"
5462
Targets="Restore"
55-
Properties="$(PackagingTestProjectProperties);
56-
Test_TestOutputPath=%(TestOutputPath);
63+
Properties="%(BuildProperties);
5764
MSBuildRestoreSessionId=$([System.Guid]::NewGuid())" />
5865

5966
<MSBuild Projects="@(PackagingTestProject)"
6067
Targets="Publish"
61-
Properties="$(PackagingTestProjectProperties);
62-
Test_TestOutputPath=%(TestOutputPath)" />
68+
Properties="%(BuildProperties)" />
6369

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

0 commit comments

Comments
 (0)