From e9a885f165dda9b73d19c45454ff454b64326244 Mon Sep 17 00:00:00 2001 From: Zhijie Yang Date: Tue, 17 Dec 2024 17:04:55 +0100 Subject: [PATCH] test(24.10): add test for dotnet-runtime-9.0 --- .../app_helloworld/Hello.csproj | 10 +++++++ .../app_helloworld/Program.cs | 1 + .../integration/dotnet-runtime-9.0/task.yaml | 30 +++++++++++++++++++ 3 files changed, 41 insertions(+) create mode 100644 tests/spread/integration/dotnet-runtime-9.0/app_helloworld/Hello.csproj create mode 100644 tests/spread/integration/dotnet-runtime-9.0/app_helloworld/Program.cs create mode 100644 tests/spread/integration/dotnet-runtime-9.0/task.yaml 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..968c661a --- /dev/null +++ b/tests/spread/integration/dotnet-runtime-9.0/task.yaml @@ -0,0 +1,30 @@ +summary: Integration tests for .NET 9 Runtime + +execute: | + # install slices + rootfs="$(install-slices dotnet-runtime-9.0_libs base-files_base bash_bins coreutils_directory-listing)" + mv $rootfs/usr/lib/dotnet/dotnet9 $rootfs/usr/lib/dotnet/dotnet + ln -s ../lib/dotnet/dotnet $rootfs/usr/bin/dotnet + + # smoking test the .NET runtime + chroot "$rootfs" /usr/bin/dotnet --info + + # preparing the test data + apt update && apt install -y dotnet-sdk-9.0 + cp -r app_helloworld $rootfs/app_helloworld + cp -r app_helloworld $rootfs/app_helloworld-self-contained + # chroot "$rootfs" dotnet publish /dotnet/tests/app_helloworld/src/Hello.csproj --no-self-contained + # chroot "$rootfs" dotnet publish /dotnet/tests/app_helloworld-self-contained/src/Hello.csproj --self-contained + dotnet publish $rootfs/app_helloworld/Hello.csproj --no-self-contained + dotnet publish $rootfs/app_helloworld-self-contained/Hello.csproj --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 + + # test the helloworld self-contained app + for dll in $(ls /app_helloworld-self-contained/bin/Release/net9.0/linux-*/Hello.dll); do + chroot "$rootfs" dotnet $dll + done