Skip to content

Commit

Permalink
feat(24.10): add .NET9 slices (#436)
Browse files Browse the repository at this point in the history
  • Loading branch information
zhijie-yang authored Dec 20, 2024
1 parent 5c0b5bd commit eb825bf
Show file tree
Hide file tree
Showing 14 changed files with 230 additions and 0 deletions.
22 changes: 22 additions & 0 deletions slices/aspnetcore-runtime-9.0.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
package: aspnetcore-runtime-9.0

essential:
- aspnetcore-runtime-9.0_copyright

slices:
libs:
essential:
- dotnet-runtime-9.0_libs
contents:
/usr/lib/dotnet/shared/Microsoft.AspNetCore.App/9.0*/**.dll:
/usr/lib/dotnet/shared/Microsoft.AspNetCore.App/9.0*/**.json:
/usr/lib/dotnet/shared/Microsoft.AspNetCore.App/9.0*/.version:

notice:
contents:
/usr/lib/dotnet/shared/Microsoft.AspNetCore.App/9.0.0/THIRD-PARTY-NOTICES.txt:
/usr/share/doc/aspnetcore-runtime-9.0/NOTICE.txt.gz:

copyright:
contents:
/usr/share/doc/aspnetcore-runtime-9.0/copyright:
27 changes: 27 additions & 0 deletions slices/dotnet-host-9.0.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
package: dotnet-host-9.0

essential:
- dotnet-host-9.0_copyright

slices:
bins:
essential:
- libc6_libs
- libgcc-s1_libs
- libstdc++6_libs
contents:
# This copy is done to avoid Chisel's current handling of conflicts, as
# it flags a conflict between this slice and .NET8's, even if the two
# are not being installed at the same time.
# Override the installed slice using the following commands:
# ```
# mv ${rootfs}/usr/lib/dotnet/dotnet9 ${rootfs}/usr/lib/dotnet/dotnet
# ln -s ../lib/dotnet/dotnet ${rootfs}/usr/bin/dotnet
# ```
# TODO: once Chisel can cope with duplicate contents within the same
# release, this copy can be suppressed
/usr/lib/dotnet/dotnet9: {copy: /usr/lib/dotnet/dotnet}

copyright:
contents:
/usr/share/doc/dotnet-host-9.0/copyright:
18 changes: 18 additions & 0 deletions slices/dotnet-hostfxr-9.0.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
package: dotnet-hostfxr-9.0

essential:
- dotnet-hostfxr-9.0_copyright

slices:
libs:
essential:
- dotnet-host-9.0_bins
- libc6_libs
- libgcc-s1_libs
- libstdc++6_libs
contents:
/usr/lib/dotnet/host/fxr/9.0*/libhostfxr.so:

copyright:
contents:
/usr/share/doc/dotnet-hostfxr-9.0/copyright:
24 changes: 24 additions & 0 deletions slices/dotnet-runtime-9.0.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
package: dotnet-runtime-9.0

essential:
- dotnet-runtime-9.0_copyright

slices:
libs:
essential:
- dotnet-hostfxr-9.0_libs
- libbrotli1_libs
- libc6_libs
- libgcc-s1_libs
- libicu74_libs
- liblttng-ust1t64_libs
- libssl3t64_libs
- libstdc++6_libs
- libunwind8_libs
- zlib1g_libs
contents:
/usr/lib/dotnet/shared/Microsoft.NETCore.App/9.0*/**:

copyright:
contents:
/usr/share/doc/dotnet-runtime-9.0/copyright:
40 changes: 40 additions & 0 deletions tests/spread/integration/aspnetcore-runtime-9.0/task.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
summary: Integration tests for ASP.NET 9 Runtime

execute: |
# install slices
rootfs="$(install-slices aspnetcore-runtime-9.0_libs base-files_base)"
mv "${rootfs}"/usr/lib/dotnet/dotnet9 "${rootfs}"/usr/lib/dotnet/dotnet
ln -s ../lib/dotnet/dotnet "${rootfs}"/usr/bin/dotnet
# preparing the test data
apt update && apt install -y dotnet-sdk-9.0
cp -r web_helloworld "${rootfs}"/web_helloworld
dotnet publish "${rootfs}"/web_helloworld/Hello.csproj --no-self-contained
mkdir -p "${rootfs}"/proc
mount --bind /proc "${rootfs}"/proc
mkdir -p "${rootfs}"/dev
head -c 500 /dev/urandom > "${rootfs}"/dev/random
head -c 500 /dev/urandom > "${rootfs}"/dev/urandom
# test the helloworld web app
chroot "${rootfs}" dotnet /web_helloworld/bin/Release/net9.0/Hello.dll --urls="http://0.0.0.0:5108" &
app_pid=$!
# Wait for the web app to start
while ! fuser 5108/tcp > /dev/null 2>&1; do
if ! test -d /proc/$app_pid; then
echo "dotnet exited quickly"
exit 1
fi
sleep 1
done
# Send a request to the web app and verify the result
ret=0
curl http://localhost:5108/ | grep "Hello World!" || ret=1
# Cleanup
kill $app_pid
exit $ret
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<Project Sdk="Microsoft.NET.Sdk.Web">

<PropertyGroup>
<TargetFramework>net9.0</TargetFramework>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
</PropertyGroup>

</Project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
var builder = WebApplication.CreateBuilder(args);
var app = builder.Build();

app.MapGet("/", () => "Hello World!");

app.Run();
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
{
"iisSettings": {
"windowsAuthentication": false,
"anonymousAuthentication": true,
"iisExpress": {
"applicationUrl": "http://localhost:65090",
"sslPort": 44311
}
},
"profiles": {
"Hello": {
"commandName": "Project",
"dotnetRunMessages": true,
"launchBrowser": true,
"applicationUrl": "https://localhost:7158;http://localhost:5108",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
},
"IIS Express": {
"commandName": "IISExpress",
"launchBrowser": true,
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"Logging": {
"LogLevel": {
"Default": "Information",
"Microsoft.AspNetCore": "Warning"
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"Logging": {
"LogLevel": {
"Default": "Information",
"Microsoft.AspNetCore": "Warning"
}
},
"AllowedHosts": "*"
}
10 changes: 10 additions & 0 deletions tests/spread/integration/dotnet-host-9.0/task.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
summary: Integration tests for .NET 9 Host

execute: |
# install slices
rootfs="$(install-slices dotnet-host-9.0_bins dotnet-hostfxr-9.0_libs base-files_base)"
mv "${rootfs}"/usr/lib/dotnet/dotnet9 "${rootfs}"/usr/lib/dotnet/dotnet
ln -s ../lib/dotnet/dotnet "${rootfs}"/usr/bin/dotnet
# smoking test the .NET host
chroot "${rootfs}" /usr/bin/dotnet --info
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net9.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>

</Project>
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Console.WriteLine("Hello, World!");
18 changes: 18 additions & 0 deletions tests/spread/integration/dotnet-runtime-9.0/task.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
summary: Integration tests for .NET 9 Runtime

execute: |
# install slices
rootfs="$(install-slices dotnet-runtime-9.0_libs base-files_base)"
mv "${rootfs}"/usr/lib/dotnet/dotnet9 "${rootfs}"/usr/lib/dotnet/dotnet
ln -s ../lib/dotnet/dotnet "${rootfs}"/usr/bin/dotnet
# preparing the test data
apt update && apt install -y dotnet-sdk-9.0
cp -r app_helloworld "${rootfs}"/app_helloworld
dotnet publish "${rootfs}"/app_helloworld/Hello.csproj --no-self-contained
mkdir -p "${rootfs}"/proc
mount --bind /proc "${rootfs}"/proc
# test the helloworld app
chroot "${rootfs}" dotnet /app_helloworld/bin/Release/net9.0/Hello.dll

0 comments on commit eb825bf

Please sign in to comment.