diff --git a/slices/aspnetcore-runtime-9.0.yaml b/slices/aspnetcore-runtime-9.0.yaml new file mode 100644 index 00000000..5e237b04 --- /dev/null +++ b/slices/aspnetcore-runtime-9.0.yaml @@ -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: diff --git a/slices/dotnet-host-9.0.yaml b/slices/dotnet-host-9.0.yaml new file mode 100644 index 00000000..c03147d2 --- /dev/null +++ b/slices/dotnet-host-9.0.yaml @@ -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: diff --git a/slices/dotnet-hostfxr-9.0.yaml b/slices/dotnet-hostfxr-9.0.yaml new file mode 100644 index 00000000..b7eccc5c --- /dev/null +++ b/slices/dotnet-hostfxr-9.0.yaml @@ -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: diff --git a/slices/dotnet-runtime-9.0.yaml b/slices/dotnet-runtime-9.0.yaml new file mode 100644 index 00000000..2c01b67b --- /dev/null +++ b/slices/dotnet-runtime-9.0.yaml @@ -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: diff --git a/tests/spread/integration/aspnetcore-runtime-9.0/task.yaml b/tests/spread/integration/aspnetcore-runtime-9.0/task.yaml new file mode 100644 index 00000000..cfcdda76 --- /dev/null +++ b/tests/spread/integration/aspnetcore-runtime-9.0/task.yaml @@ -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 diff --git a/tests/spread/integration/aspnetcore-runtime-9.0/web_helloworld/Hello.csproj b/tests/spread/integration/aspnetcore-runtime-9.0/web_helloworld/Hello.csproj new file mode 100644 index 00000000..6568b3dc --- /dev/null +++ b/tests/spread/integration/aspnetcore-runtime-9.0/web_helloworld/Hello.csproj @@ -0,0 +1,9 @@ + + + + net9.0 + enable + enable + + + diff --git a/tests/spread/integration/aspnetcore-runtime-9.0/web_helloworld/Program.cs b/tests/spread/integration/aspnetcore-runtime-9.0/web_helloworld/Program.cs new file mode 100644 index 00000000..1760df1d --- /dev/null +++ b/tests/spread/integration/aspnetcore-runtime-9.0/web_helloworld/Program.cs @@ -0,0 +1,6 @@ +var builder = WebApplication.CreateBuilder(args); +var app = builder.Build(); + +app.MapGet("/", () => "Hello World!"); + +app.Run(); diff --git a/tests/spread/integration/aspnetcore-runtime-9.0/web_helloworld/Properties/launchSettings.json b/tests/spread/integration/aspnetcore-runtime-9.0/web_helloworld/Properties/launchSettings.json new file mode 100644 index 00000000..0bf46a5e --- /dev/null +++ b/tests/spread/integration/aspnetcore-runtime-9.0/web_helloworld/Properties/launchSettings.json @@ -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" + } + } + } +} diff --git a/tests/spread/integration/aspnetcore-runtime-9.0/web_helloworld/appsettings.Development.json b/tests/spread/integration/aspnetcore-runtime-9.0/web_helloworld/appsettings.Development.json new file mode 100644 index 00000000..a34cd70c --- /dev/null +++ b/tests/spread/integration/aspnetcore-runtime-9.0/web_helloworld/appsettings.Development.json @@ -0,0 +1,8 @@ +{ + "Logging": { + "LogLevel": { + "Default": "Information", + "Microsoft.AspNetCore": "Warning" + } + } +} diff --git a/tests/spread/integration/aspnetcore-runtime-9.0/web_helloworld/appsettings.json b/tests/spread/integration/aspnetcore-runtime-9.0/web_helloworld/appsettings.json new file mode 100644 index 00000000..23160a4d --- /dev/null +++ b/tests/spread/integration/aspnetcore-runtime-9.0/web_helloworld/appsettings.json @@ -0,0 +1,9 @@ +{ + "Logging": { + "LogLevel": { + "Default": "Information", + "Microsoft.AspNetCore": "Warning" + } + }, + "AllowedHosts": "*" +} diff --git a/tests/spread/integration/dotnet-host-9.0/task.yaml b/tests/spread/integration/dotnet-host-9.0/task.yaml new file mode 100644 index 00000000..b67585f1 --- /dev/null +++ b/tests/spread/integration/dotnet-host-9.0/task.yaml @@ -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 diff --git a/tests/spread/integration/dotnet-runtime-9.0/app_helloworld/Hello.csproj b/tests/spread/integration/dotnet-runtime-9.0/app_helloworld/Hello.csproj new file mode 100644 index 00000000..694035b3 --- /dev/null +++ b/tests/spread/integration/dotnet-runtime-9.0/app_helloworld/Hello.csproj @@ -0,0 +1,10 @@ + + + + Exe + net9.0 + enable + enable + + + diff --git a/tests/spread/integration/dotnet-runtime-9.0/app_helloworld/Program.cs b/tests/spread/integration/dotnet-runtime-9.0/app_helloworld/Program.cs new file mode 100644 index 00000000..b0d81242 --- /dev/null +++ b/tests/spread/integration/dotnet-runtime-9.0/app_helloworld/Program.cs @@ -0,0 +1 @@ +Console.WriteLine("Hello, World!"); diff --git a/tests/spread/integration/dotnet-runtime-9.0/task.yaml b/tests/spread/integration/dotnet-runtime-9.0/task.yaml new file mode 100644 index 00000000..43078e84 --- /dev/null +++ b/tests/spread/integration/dotnet-runtime-9.0/task.yaml @@ -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