diff -Nru dotnet8-8.0.103-8.0.3/debian/build-dotnet-tarball.sh dotnet8-8.0.103-8.0.3/debian/build-dotnet-tarball.sh --- dotnet8-8.0.103-8.0.3/debian/build-dotnet-tarball.sh 2024-03-08 08:25:53.000000000 +0000 +++ dotnet8-8.0.103-8.0.3/debian/build-dotnet-tarball.sh 1970-01-01 00:00:00.000000000 +0000 @@ -1,450 +0,0 @@ -#!/usr/bin/env bash - -trap on_exit TERM -trap on_exit EXIT - -set -euo pipefail -IFS=$'\n\t' - -INITIAL_DIRECTORY=$PWD - -REPACK=false -CLONE_REPOSITORY=false -BOOTSTRAP=false -CLEANUP_SOURCE_TREE=true -SOURCE_TREE_DIRECTORY_NAME="" -SECURITY_PARTNERS_REPOSITORY='git@ssh.dev.azure.com:v3/dotnet-security-partners/dotnet/dotnet' -REPOSITORY="$SECURITY_PARTNERS_REPOSITORY" -MS_TARBALL_SHA512_HASH="" - -RM_GIT_COMMIT="" -RM_GIT_REPO="https://github.com/dotnet/dotnet" - -function print_usage -{ - bold_style='\033[1m' - underline_style='\033[4m' - reset_style='\033[0m' - - echo "" - echo -e "${bold_style}Usage:${reset_style} $0 --upstream-version ${underline_style}version${reset_style} [--repository ${underline_style}repository${reset_style}] [--source-version ${underline_style}commit${reset_style}] [--source-repository ${underline_style}repository${reset_style}] [--bootstrap] [--no-clean]" - echo "" - echo "Creates the orig tarball for the dotnet package from a branch version at a git repository." - echo "" - echo "Parameter:" - echo -e " --upstream-version ${underline_style}version${reset_style}" - echo -e " ${underline_style}version${reset_style} is used to determine the git tag that should be pulled from the ${underline_style}repository${reset_style}" - echo -e " --repository ${underline_style}repository${reset_style}" - echo " Address to the git repository that will be cloned. (Default: ${SECURITY_PARTNERS_REPOSITORY})" - echo -e " --source-version ${underline_style}commit${reset_style}" - echo -e " Source Link revision (commit SHA), required when building from tarball. (Default: commit SHA linked to tag at ${underline_style}version${reset_style})" - echo -e " --source-repository ${underline_style}repository${reset_style}" - echo " Source Link repository URL, required when building from tarball. (Default: https://github.com/dotnet/dotnet)" - echo " --bootstrap" - echo " incorporate Microsoft pre-builts into the resulting orig tarball to prepare for initial bootstrapping" - echo " --no-clean" - echo -e " does not delete the cloned ${underline_style}repository${reset_style} when the script exits" - echo "" - echo "Example:" - echo " $0 --upstream-version 7.0.109" - echo "" - echo -e "${bold_style}Usage:${reset_style} $0 --repack ${underline_style}tarball-url${reset_style} --source-version ${underline_style}commit${reset_style} [--source-repository ${underline_style}repository${reset_style}] [--sha512 ${underline_style}hash${reset_style}] [--bootstrap] [--no-clean]" - echo "" - echo "Repack a source archive tarball for dotnet." - echo "" - echo "Parameter:" - echo -e " --repack ${underline_style}tarball-url${reset_style}" - echo " URL to download the source tarball from" - echo -e " --source-version ${underline_style}commit${reset_style}" - echo " Source Link revision (commit SHA), required when building from tarball" - echo -e " --source-repository ${underline_style}repository${reset_style}" - echo " Source Link repository URL, required when building from tarball. (Default: https://github.com/dotnet/dotnet)" - echo -e " --sha512 ${underline_style}hash${reset_style}" - echo " tarball SHA512 hash to be verified against" - echo " --bootstrap" - echo " incorporate Microsoft pre-builts into the resulting orig tarball to prepare for initial bootstrapping" - echo " --no-clean" - echo " does not delete the unpacked tarball when the script exits" - echo "" - echo "Run $0 --help to show this usage information." -} - -function on_exit { - # shellcheck disable=SC2317 - # irrelevant shellcheck warning because code is reachable through - # on_exit trap on lines 3 and 4 - if $CLEANUP_SOURCE_TREE && - [ -n "$INITIAL_DIRECTORY" ] && - [ -n "$SOURCE_TREE_DIRECTORY_NAME" ]; then - rm -rf "${INITIAL_DIRECTORY:?}/${SOURCE_TREE_DIRECTORY_NAME:?}" - fi -} - -function print_error { - echo "ERROR:" "$@" 1>&2; -} - -# Parse parameters: -while [ "$#" -gt "0" ]; do - case $1 in - --help) - print_usage - exit 0 - ;; - --upstream-version) - if [ "$#" -lt "2" ]; then - print_error "parameter --upstream-version is specified, but no value was provided" - print_usage - exit 1 - fi - - if $REPACK; then - print_error "conflicting parameters; --upstream-version and --repack is specified" - print_usage - exit 1 - fi - - CLONE_REPOSITORY=true - UPSTREAM_VERSION=$2 - shift 2 - ;; - --repository) - if [ "$#" -lt "2" ]; then - print_error "parameter --repository is specified, but no value was provided" - print_usage - exit 1 - fi - - if $REPACK; then - print_error "conflicting parameters; --repository and --repack is specified" - print_usage - exit 1 - fi - - CLONE_REPOSITORY=true - REPOSITORY=$2 - shift 2 - ;; - --repack) - if [ "$#" -lt "2" ]; then - print_error "parameter --repack is specified, but no value was provided" - print_usage - exit 1 - fi - - if $CLONE_REPOSITORY; then - print_error "conflicting parameters; --repack and either --upstream-version or --repository is specified" - print_usage - exit 1 - fi - - REPACK=true - MS_TARBALL_URL=$2 - MS_TARBALL_FILENAME=$(echo "${MS_TARBALL_URL}" | sed -r 's|.*/([^/]+tar.gz)\?.*|\1|') - UPSTREAM_VERSION=$(echo "${MS_TARBALL_FILENAME}" | sed -r 's|.*-(.*).tar.gz|\1|') - shift 2 - ;; - --source-version) - if [ "$#" -lt "2" ]; then - print_error "parameter --source-version is specified, but no value was provided" - print_usage - exit 1 - fi - - RM_GIT_COMMIT=$2 - shift 2 - ;; - --source-repository) - if [ "$#" -lt "2" ]; then - print_error "parameter --source-version is specified, but no value was provided" - print_usage - exit 1 - fi - - RM_GIT_REPO=$2 - shift 2 - ;; - --bootstrap) - BOOTSTRAP=true; - case "$(uname --hardware-platform)" in - x86_64) - DPKG_ARCHITECTURE="amd64"; - ;; - aarch64) - DPKG_ARCHITECTURE="arm64"; - ;; - *) - print_error "Unknown/Unsupported architecture '$(uname --hardware-platform)'." - exit 1 - ;; - esac - shift 1 - ;; - --sha512) - if [ "$#" -lt "2" ]; then - print_error "parameter --sha512 is specified, but no value was provided" - print_usage - exit 1 - fi - - MS_TARBALL_SHA512_HASH=$2 - shift 2 - ;; - --no-clean) - CLEANUP_SOURCE_TREE=false - shift 1 - ;; - *) - print_error "unexpected argument '$1'" - print_usage - exit 1 - ;; - esac -done - -if ! $CLONE_REPOSITORY && ! $REPACK; then - print_error "neither --upstream-version nor --repack was specified" - print_usage - exit 1 -fi - -if $REPACK && [ -z "$MS_TARBALL_SHA512_HASH" ]; then - echo "Warning: include a sha512 hash for tarball integrity verification" -fi - -MAJOR_VERSION_NUMBER=${UPSTREAM_VERSION%%.*} -PKG_NAME="dotnet$MAJOR_VERSION_NUMBER" -SOURCE_TREE_DIRECTORY_NAME="${PKG_NAME}_${UPSTREAM_VERSION}" -ORIG_TARBALL_FILENAME="${PKG_NAME}_$(dpkg-parsechangelog --show-field Version | rev | cut -d- -f2- | rev).orig.tar.xz" -TAG_NAME="" - -if [ -d "$SOURCE_TREE_DIRECTORY_NAME" ]; then - echo "Error an directory $SOURCE_TREE_DIRECTORY_NAME already exists; you may want to delete it" -fi - -if $CLONE_REPOSITORY; then - echo "Info: cloning repository..." - if ! git clone --no-checkout "$REPOSITORY" "$SOURCE_TREE_DIRECTORY_NAME"; then - print_error "failed to clone repository" - exit 1 - fi - - pushd "$SOURCE_TREE_DIRECTORY_NAME" - - if [ "$(git tag | grep --count "$UPSTREAM_VERSION")" -ne "1" ]; then - echo "WARNING: Found none or more than one tag that matches the upstream version." - echo " Please, insert the tag name manually." - echo "-------------------------------------------------------------------------" - echo "Available tags in the repo are:" - for tag in $(git tag); do - echo " - $tag" - done - read -rp "Upstream tag name: " TAG_NAME - - if [ -z "$TAG_NAME" ]; then - print_error "Tag name has not been specified. Exiting..." - exit 1 - fi - else - TAG_NAME=$(git tag | grep "$UPSTREAM_VERSION") - fi - - echo "Info: checkout upstream version..." - if ! git checkout "$TAG_NAME"; then - print_error "failed to checkout upstream version." - git tag | grep "$UPSTREAM_VERSION" - exit 1 - fi -elif $REPACK; then - mkdir "$SOURCE_TREE_DIRECTORY_NAME" - - if [ -e "$MS_TARBALL_FILENAME" ]; then - SHA512_FILEHASH=$(sha512sum "${MS_TARBALL_FILENAME}" | cut -d' ' -f1) - - if [ -n "$MS_TARBALL_SHA512_HASH" ] && - [ "$SHA512_FILEHASH" != "$MS_TARBALL_SHA512_HASH" ]; then - echo "Error: file $MS_TARBALL_SHA512_HASH already exists, but does not match the expected hashsum; maybe the file is corrupted and you want to delete it" - echo " Expected SHA512-HASH: $MS_TARBALL_SHA512_HASH" - echo " Actual SHA512-HASH: $SHA512_FILEHASH" - exit 1 - fi - else - echo "Info: downloading MS tarball..." - if ! wget --progress=bar "$MS_TARBALL_URL" -O "$MS_TARBALL_FILENAME"; then - print_error "wget failed" - exit 1 - fi - - SHA512_FILEHASH=$(sha512sum "${MS_TARBALL_FILENAME}" | cut -d' ' -f1) - - if [ "$SHA512_FILEHASH" != "$MS_TARBALL_SHA512_HASH" ]; then - echo "Error: downloaded file $MS_TARBALL_SHA512_HASH does not match the shasum provided" - echo " Expected SHA512-HASH: $MS_TARBALL_SHA512_HASH" - echo " Actual SHA512-HASH: $SHA512_FILEHASH" - exit 1 - fi - fi - - echo "Info: unpacking MS tarball..." - pushd "$SOURCE_TREE_DIRECTORY_NAME" - tar xvzf "../$MS_TARBALL_FILENAME" -fi - -if $BOOTSTRAP; then - echo "Info: prepare bootstraping..." - ./prep.sh -fi - -if [ -e "../$ORIG_TARBALL_FILENAME" ]; then - print_error "$ORIG_TARBALL_FILENAME already exists; maybe delete it?" - exit 1 -fi - -echo "Info: removing unneeded/unwanted files..." -# Remove files with funny licenses, crypto implementations and other -# not-very-useful artifacts to reduce tarball size -# This list concords with the File-Excluded stanza in the copyright - -# Binaries for gradle -rm -r src/aspnetcore/src/SignalR/clients/java/signalr/gradle* - -# Unnecessary crypto implementation: IDEA -rm -r src/runtime/src/tests/JIT/Performance/CodeQuality/Bytemark/ - -# https://github.com/dotnet/aspnetcore/issues/34785 -find src/aspnetcore/src -type d -name samples -print0 | xargs -0 rm -r - -# https://github.com/NuGet/Home/issues/11094 -rm -r src/nuget-client/test/EndToEnd - -# Checked that are not needed in the build: this only removes under roslyn: -# src/roslyn/src/Compilers/Test/Resources/Core/SymbolsTests/V?/*.dll -find src/roslyn/src/Compilers/Test/Resources -iname "*.dll" -exec rm -rf {} + - -# https://github.com/microsoft/ApplicationInsights-dotnet/issues/2670 -# we are applying a patch for this -# rm -r src/source-build-externals/src/application-insights/LOGGING/test/Shared/CustomTelemetryChannel.cs - -# Don't remove vendorized libunwind because we need it for arm64 archs -# rm -r src/runtime/src/coreclr/pal/src/libunwind - -# CPC-1578 prebuilts not used in build -rm src/roslyn/src/Compilers/Test/Resources/Core/DiagnosticTests/ErrTestMod01.netmodule -rm src/roslyn/src/Compilers/Test/Resources/Core/DiagnosticTests/ErrTestMod02.netmodule -rm src/roslyn/src/Compilers/Test/Resources/Core/ExpressionCompiler/LibraryA.winmd -rm src/roslyn/src/Compilers/Test/Resources/Core/ExpressionCompiler/LibraryB.winmd -rm src/roslyn/src/Compilers/Test/Resources/Core/ExpressionCompiler/Windows.Data.winmd -rm src/roslyn/src/Compilers/Test/Resources/Core/ExpressionCompiler/Windows.Storage.winmd -rm src/roslyn/src/Compilers/Test/Resources/Core/ExpressionCompiler/Windows.winmd -rm src/roslyn/src/Compilers/Test/Resources/Core/MetadataTests/Invalid/EmptyModuleTable.netmodule -rm src/roslyn/src/Compilers/Test/Resources/Core/MetadataTests/NetModule01/ModuleCS00.mod -rm src/roslyn/src/Compilers/Test/Resources/Core/MetadataTests/NetModule01/ModuleCS01.mod -rm src/roslyn/src/Compilers/Test/Resources/Core/MetadataTests/NetModule01/ModuleVB01.mod -rm src/roslyn/src/Compilers/Test/Resources/Core/SymbolsTests/CustomModifiers/Modifiers.netmodule -rm src/roslyn/src/Compilers/Test/Resources/Core/SymbolsTests/MultiModule/mod2.netmodule -rm src/roslyn/src/Compilers/Test/Resources/Core/SymbolsTests/MultiModule/mod3.netmodule -rm src/roslyn/src/Compilers/Test/Resources/Core/SymbolsTests/MultiTargeting/Source1Module.netmodule -rm src/roslyn/src/Compilers/Test/Resources/Core/SymbolsTests/MultiTargeting/Source3Module.netmodule -rm src/roslyn/src/Compilers/Test/Resources/Core/SymbolsTests/MultiTargeting/Source4Module.netmodule -rm src/roslyn/src/Compilers/Test/Resources/Core/SymbolsTests/MultiTargeting/Source5Module.netmodule -rm src/roslyn/src/Compilers/Test/Resources/Core/SymbolsTests/MultiTargeting/Source7Module.netmodule -rm src/roslyn/src/Compilers/Test/Resources/Core/SymbolsTests/RetargetingCycle/V1/ClassB.netmodule -rm src/roslyn/src/Compilers/Test/Resources/Core/SymbolsTests/TypeForwarders/Forwarded.netmodule -rm src/roslyn/src/Compilers/Test/Resources/Core/SymbolsTests/V1/MTTestModule1.netmodule -rm src/roslyn/src/Compilers/Test/Resources/Core/SymbolsTests/V1/MTTestModule2.netmodule -rm src/roslyn/src/Compilers/Test/Resources/Core/SymbolsTests/V2/MTTestModule1.netmodule -rm src/roslyn/src/Compilers/Test/Resources/Core/SymbolsTests/V2/MTTestModule3.netmodule -rm src/roslyn/src/Compilers/Test/Resources/Core/SymbolsTests/V3/MTTestModule1.netmodule -rm src/roslyn/src/Compilers/Test/Resources/Core/SymbolsTests/V3/MTTestModule4.netmodule -rm 'src/roslyn/src/Compilers/Test/Resources/Core/SymbolsTests/With Spaces.netmodule' -rm src/roslyn/src/Compilers/Test/Resources/Core/SymbolsTests/netModule/CrossRefModule1.netmodule -rm src/roslyn/src/Compilers/Test/Resources/Core/SymbolsTests/netModule/CrossRefModule2.netmodule -rm src/roslyn/src/Compilers/Test/Resources/Core/SymbolsTests/netModule/hash_module.netmodule -rm src/roslyn/src/Compilers/Test/Resources/Core/SymbolsTests/netModule/netModule1.netmodule -rm src/roslyn/src/Compilers/Test/Resources/Core/SymbolsTests/netModule/netModule2.netmodule -rm src/roslyn/src/Compilers/Test/Resources/Core/WinRt/W1.winmd -rm src/roslyn/src/Compilers/Test/Resources/Core/WinRt/W2.winmd -rm src/roslyn/src/Compilers/Test/Resources/Core/WinRt/WB.winmd -rm src/roslyn/src/Compilers/Test/Resources/Core/WinRt/WB_Version1.winmd -rm src/roslyn/src/Compilers/Test/Resources/Core/WinRt/WImpl.winmd -rm src/roslyn/src/Compilers/Test/Resources/Core/WinRt/WinMDPrefixing.winmd -rm src/roslyn/src/Compilers/Test/Resources/Core/WinRt/Windows.Languages.WinRTTest.winmd -rm src/roslyn/src/Compilers/Test/Resources/Core/WinRt/Windows.winmd -rm src/roslyn/src/ExpressionEvaluator/Core/Source/ExpressionCompiler/Resources/WindowsProxy.winmd -rm src/runtime/src/libraries/System.Reflection.Metadata/tests/Resources/NetModule/ModuleCS00.mod -rm src/runtime/src/libraries/System.Reflection.Metadata/tests/Resources/NetModule/ModuleCS01.mod -rm src/runtime/src/libraries/System.Reflection.Metadata/tests/Resources/NetModule/ModuleVB01.mod -rm src/runtime/src/libraries/System.Reflection.Metadata/tests/Resources/WinRT/Lib.winmd -rm src/cecil/Test/Resources/assemblies/ManagedWinmd.winmd -rm src/cecil/Test/Resources/assemblies/NativeWinmd.winmd -rm src/cecil/Test/Resources/assemblies/moda.netmodule -rm src/cecil/Test/Resources/assemblies/modb.netmodule -rm src/cecil/Test/Resources/assemblies/winrtcomp.winmd - -# Build release manifest file -# -# This repository information will be passed to the build script, which, in turn, will -# send this to SourceLink. This should always point to the public Github VMR repo -# (not a private one), otherwise SourceLink will not be able to fetch source code -# when doing assembly debugging. -# -# If the commit does not yet exist at build time in the repo, use it anyway if it -# will eventually exist. -# -# Commit SHAs from the Azure DevOps partners repo equal the ones from the Github dotnet/dotnet repo. -if $CLONE_REPOSITORY; then - if [ ! -d ".git" ]; then - print_err "This is not a git repository." - exit 1 - fi - - if [ -z "$RM_GIT_REPO" ]; then - print_err "No SourceLink Git repository was specified. Please use --source-repository to do so." - exit 1 - fi - - if [ -z "$RM_GIT_COMMIT" ]; then - RM_GIT_COMMIT="$(git log "${TAG_NAME}" -n 1 | grep commit -m 1 | cut -d ' ' -f 2)" - fi -elif $REPACK; then - if [ -z "$RM_GIT_REPO" ]; then - print_err "No SourceLink Git repository was specified. Please use --source-repository to do so." - exit 1 - elif [ -z "$RM_GIT_COMMIT" ]; then - print_err "No SourceLink Git commit was specified. Please use --source-version to do so." - fi -fi - -echo "Creating release.info file with:" -echo " Repo: ${RM_GIT_REPO}" -echo " Commit: ${RM_GIT_COMMIT}" - -tee -a release.info << END -RM_GIT_REPO=${RM_GIT_REPO} -RM_GIT_COMMIT=${RM_GIT_COMMIT} -END - -if [ -e release.info ]; then - echo "release.info created!" -else - print_err "release.info not created." - exit 1 -fi - -# Remove unnecessary git-related files -if [ -d ".git" ]; then - rm -rf .git -fi -rm .gitignore - -popd - -echo "Info: creating orig tarball..." -pushd "${SOURCE_TREE_DIRECTORY_NAME}" -tar --use-compress-program 'xz --threads 0' --create --file "../../${ORIG_TARBALL_FILENAME}" "." -popd -rsync -a --progress --remove-source-files "${SOURCE_TREE_DIRECTORY_NAME}/" "." --exclude ".git" -rm -rf "${SOURCE_TREE_DIRECTORY_NAME}" - -echo "Info: Done! orig tarball at ../${ORIG_TARBALL_FILENAME}" -exit 0 diff -Nru dotnet8-8.0.103-8.0.3/debian/changelog dotnet8-8.0.103-8.0.3/debian/changelog --- dotnet8-8.0.103-8.0.3/debian/changelog 2024-03-08 08:26:20.000000000 +0000 +++ dotnet8-8.0.103-8.0.3/debian/changelog 2024-03-18 12:48:03.000000000 +0000 @@ -1,3 +1,26 @@ +dotnet8 (8.0.103-8.0.3-0ubuntu1~23.10.2) mantic; urgency=medium + + * Add ca-certificates to dotnet-sdk-8.0 depends (LP: #2057982). + * Replace debian/tests: + - Add debian/tests/01_regular-tests & debian/tests/regular-tests + (testcases files; included version of: + https://github.com/canonical/dotnet-regular-tests/). + - Add debian/tests/build-time-tests + * debian/rules: Added override_dh_auto_test; runs d/t/build-time-tests + * debian/copyright: Update debian/ copyright information + * debian/eng: Added directory for scripts & libraries used within the package: + - Add debian/eng/test-runner (executes debian/tests/regular-tests testcases; + included version of: https://github.com/canonical/dotnet-test-runner). + - Added debian/eng/versionlib (.NET version parsing library; used by + debian/tests). + - Added debian/eng/strenum; needed by debian/eng/versionlib + - Added debian/eng/dotnet-version.py; needed by debian/tests/01_regular-tests + - Moved debian/watch-script.sh and debian/build-dotnet-tarball.sh + to debian/eng + * Removed debian/repack-dotnet-tarball.sh (deprecated) + + -- Dominik Viererbe Mon, 18 Mar 2024 14:48:03 +0200 + dotnet8 (8.0.103-8.0.3-0ubuntu1~23.10.1) mantic-security; urgency=medium * New upstream release diff -Nru dotnet8-8.0.103-8.0.3/debian/control dotnet8-8.0.103-8.0.3/debian/control --- dotnet8-8.0.103-8.0.3/debian/control 2024-03-08 08:25:53.000000000 +0000 +++ dotnet8-8.0.103-8.0.3/debian/control 2024-03-18 12:48:03.000000000 +0000 @@ -123,6 +123,7 @@ dotnet-targeting-pack-8.0, dotnet-templates-8.0, netstandard-targeting-pack-2.1-8.0, + ca-certificates, ${misc:Depends}, ${shlibs:Depends} Breaks: dotnet-sdk-6.0 (<< 6.0.111~) diff -Nru dotnet8-8.0.103-8.0.3/debian/copyright dotnet8-8.0.103-8.0.3/debian/copyright --- dotnet8-8.0.103-8.0.3/debian/copyright 2024-03-08 08:25:53.000000000 +0000 +++ dotnet8-8.0.103-8.0.3/debian/copyright 2024-03-18 12:48:03.000000000 +0000 @@ -7,10 +7,33 @@ License: Expat Files: debian/* -Copyright: 2023 Canonical Ltd. +Copyright: 2022 Canonical Ltd. + Dominik Viererbe Mateus Rodrigues de Morais + Miriam España Acebal License: Expat or Apache-2.0 +Files: debian/copyright +Copyright: 2022 Canonical Ltd. + Dominik Viererbe + Mateus Rodrigues de Morais + Miriam España Acebal + Jesús Soto Mendoza +License: Expat or Apache-2.0 + +Files: debian/eng/strenum +Copyright: 2019 James C Sinclair +License: Expat + +Files: debian/eng/test-runner +Copyright: 2019 Red Hat, Inc +License: LGPL-2.1 + +Files: debian/tests/regular-tests +Copyright: 2018 Radka Janeková + 2022 Canonical Ltd. +License: Expat + Files: eng/tools/tasks/Microsoft.DotNet.SourceBuild.Tasks.XPlat/RepoTasks/* Copyright: .NET Foundation License: Apache-2.0 diff -Nru dotnet8-8.0.103-8.0.3/debian/eng/build-dotnet-tarball.sh dotnet8-8.0.103-8.0.3/debian/eng/build-dotnet-tarball.sh --- dotnet8-8.0.103-8.0.3/debian/eng/build-dotnet-tarball.sh 1970-01-01 00:00:00.000000000 +0000 +++ dotnet8-8.0.103-8.0.3/debian/eng/build-dotnet-tarball.sh 2024-03-18 12:48:03.000000000 +0000 @@ -0,0 +1,450 @@ +#!/usr/bin/env bash + +trap on_exit TERM +trap on_exit EXIT + +set -euo pipefail +IFS=$'\n\t' + +INITIAL_DIRECTORY=$PWD + +REPACK=false +CLONE_REPOSITORY=false +BOOTSTRAP=false +CLEANUP_SOURCE_TREE=true +SOURCE_TREE_DIRECTORY_NAME="" +SECURITY_PARTNERS_REPOSITORY='git@ssh.dev.azure.com:v3/dotnet-security-partners/dotnet/dotnet' +REPOSITORY="$SECURITY_PARTNERS_REPOSITORY" +MS_TARBALL_SHA512_HASH="" + +RM_GIT_COMMIT="" +RM_GIT_REPO="https://github.com/dotnet/dotnet" + +function print_usage +{ + bold_style='\033[1m' + underline_style='\033[4m' + reset_style='\033[0m' + + echo "" + echo -e "${bold_style}Usage:${reset_style} $0 --upstream-version ${underline_style}version${reset_style} [--repository ${underline_style}repository${reset_style}] [--source-version ${underline_style}commit${reset_style}] [--source-repository ${underline_style}repository${reset_style}] [--bootstrap] [--no-clean]" + echo "" + echo "Creates the orig tarball for the dotnet package from a branch version at a git repository." + echo "" + echo "Parameter:" + echo -e " --upstream-version ${underline_style}version${reset_style}" + echo -e " ${underline_style}version${reset_style} is used to determine the git tag that should be pulled from the ${underline_style}repository${reset_style}" + echo -e " --repository ${underline_style}repository${reset_style}" + echo " Address to the git repository that will be cloned. (Default: ${SECURITY_PARTNERS_REPOSITORY})" + echo -e " --source-version ${underline_style}commit${reset_style}" + echo -e " Source Link revision (commit SHA), required when building from tarball. (Default: commit SHA linked to tag at ${underline_style}version${reset_style})" + echo -e " --source-repository ${underline_style}repository${reset_style}" + echo " Source Link repository URL, required when building from tarball. (Default: https://github.com/dotnet/dotnet)" + echo " --bootstrap" + echo " incorporate Microsoft pre-builts into the resulting orig tarball to prepare for initial bootstrapping" + echo " --no-clean" + echo -e " does not delete the cloned ${underline_style}repository${reset_style} when the script exits" + echo "" + echo "Example:" + echo " $0 --upstream-version 7.0.109" + echo "" + echo -e "${bold_style}Usage:${reset_style} $0 --repack ${underline_style}tarball-url${reset_style} --source-version ${underline_style}commit${reset_style} [--source-repository ${underline_style}repository${reset_style}] [--sha512 ${underline_style}hash${reset_style}] [--bootstrap] [--no-clean]" + echo "" + echo "Repack a source archive tarball for dotnet." + echo "" + echo "Parameter:" + echo -e " --repack ${underline_style}tarball-url${reset_style}" + echo " URL to download the source tarball from" + echo -e " --source-version ${underline_style}commit${reset_style}" + echo " Source Link revision (commit SHA), required when building from tarball" + echo -e " --source-repository ${underline_style}repository${reset_style}" + echo " Source Link repository URL, required when building from tarball. (Default: https://github.com/dotnet/dotnet)" + echo -e " --sha512 ${underline_style}hash${reset_style}" + echo " tarball SHA512 hash to be verified against" + echo " --bootstrap" + echo " incorporate Microsoft pre-builts into the resulting orig tarball to prepare for initial bootstrapping" + echo " --no-clean" + echo " does not delete the unpacked tarball when the script exits" + echo "" + echo "Run $0 --help to show this usage information." +} + +function on_exit { + # shellcheck disable=SC2317 + # irrelevant shellcheck warning because code is reachable through + # on_exit trap on lines 3 and 4 + if $CLEANUP_SOURCE_TREE && + [ -n "$INITIAL_DIRECTORY" ] && + [ -n "$SOURCE_TREE_DIRECTORY_NAME" ]; then + rm -rf "${INITIAL_DIRECTORY:?}/${SOURCE_TREE_DIRECTORY_NAME:?}" + fi +} + +function print_error { + echo "ERROR:" "$@" 1>&2; +} + +# Parse parameters: +while [ "$#" -gt "0" ]; do + case $1 in + --help) + print_usage + exit 0 + ;; + --upstream-version) + if [ "$#" -lt "2" ]; then + print_error "parameter --upstream-version is specified, but no value was provided" + print_usage + exit 1 + fi + + if $REPACK; then + print_error "conflicting parameters; --upstream-version and --repack is specified" + print_usage + exit 1 + fi + + CLONE_REPOSITORY=true + UPSTREAM_VERSION=$2 + shift 2 + ;; + --repository) + if [ "$#" -lt "2" ]; then + print_error "parameter --repository is specified, but no value was provided" + print_usage + exit 1 + fi + + if $REPACK; then + print_error "conflicting parameters; --repository and --repack is specified" + print_usage + exit 1 + fi + + CLONE_REPOSITORY=true + REPOSITORY=$2 + shift 2 + ;; + --repack) + if [ "$#" -lt "2" ]; then + print_error "parameter --repack is specified, but no value was provided" + print_usage + exit 1 + fi + + if $CLONE_REPOSITORY; then + print_error "conflicting parameters; --repack and either --upstream-version or --repository is specified" + print_usage + exit 1 + fi + + REPACK=true + MS_TARBALL_URL=$2 + MS_TARBALL_FILENAME=$(echo "${MS_TARBALL_URL}" | sed -r 's|.*/([^/]+tar.gz)\?.*|\1|') + UPSTREAM_VERSION=$(echo "${MS_TARBALL_FILENAME}" | sed -r 's|.*-(.*).tar.gz|\1|') + shift 2 + ;; + --source-version) + if [ "$#" -lt "2" ]; then + print_error "parameter --source-version is specified, but no value was provided" + print_usage + exit 1 + fi + + RM_GIT_COMMIT=$2 + shift 2 + ;; + --source-repository) + if [ "$#" -lt "2" ]; then + print_error "parameter --source-version is specified, but no value was provided" + print_usage + exit 1 + fi + + RM_GIT_REPO=$2 + shift 2 + ;; + --bootstrap) + BOOTSTRAP=true; + case "$(uname --hardware-platform)" in + x86_64) + DPKG_ARCHITECTURE="amd64"; + ;; + aarch64) + DPKG_ARCHITECTURE="arm64"; + ;; + *) + print_error "Unknown/Unsupported architecture '$(uname --hardware-platform)'." + exit 1 + ;; + esac + shift 1 + ;; + --sha512) + if [ "$#" -lt "2" ]; then + print_error "parameter --sha512 is specified, but no value was provided" + print_usage + exit 1 + fi + + MS_TARBALL_SHA512_HASH=$2 + shift 2 + ;; + --no-clean) + CLEANUP_SOURCE_TREE=false + shift 1 + ;; + *) + print_error "unexpected argument '$1'" + print_usage + exit 1 + ;; + esac +done + +if ! $CLONE_REPOSITORY && ! $REPACK; then + print_error "neither --upstream-version nor --repack was specified" + print_usage + exit 1 +fi + +if $REPACK && [ -z "$MS_TARBALL_SHA512_HASH" ]; then + echo "Warning: include a sha512 hash for tarball integrity verification" +fi + +MAJOR_VERSION_NUMBER=${UPSTREAM_VERSION%%.*} +PKG_NAME="dotnet$MAJOR_VERSION_NUMBER" +SOURCE_TREE_DIRECTORY_NAME="${PKG_NAME}_${UPSTREAM_VERSION}" +ORIG_TARBALL_FILENAME="${PKG_NAME}_$(dpkg-parsechangelog --show-field Version | rev | cut -d- -f2- | rev).orig.tar.xz" +TAG_NAME="" + +if [ -d "$SOURCE_TREE_DIRECTORY_NAME" ]; then + echo "Error an directory $SOURCE_TREE_DIRECTORY_NAME already exists; you may want to delete it" +fi + +if $CLONE_REPOSITORY; then + echo "Info: cloning repository..." + if ! git clone --no-checkout "$REPOSITORY" "$SOURCE_TREE_DIRECTORY_NAME"; then + print_error "failed to clone repository" + exit 1 + fi + + pushd "$SOURCE_TREE_DIRECTORY_NAME" + + if [ "$(git tag | grep --count "$UPSTREAM_VERSION")" -ne "1" ]; then + echo "WARNING: Found none or more than one tag that matches the upstream version." + echo " Please, insert the tag name manually." + echo "-------------------------------------------------------------------------" + echo "Available tags in the repo are:" + for tag in $(git tag); do + echo " - $tag" + done + read -rp "Upstream tag name: " TAG_NAME + + if [ -z "$TAG_NAME" ]; then + print_error "Tag name has not been specified. Exiting..." + exit 1 + fi + else + TAG_NAME=$(git tag | grep "$UPSTREAM_VERSION") + fi + + echo "Info: checkout upstream version..." + if ! git checkout "$TAG_NAME"; then + print_error "failed to checkout upstream version." + git tag | grep "$UPSTREAM_VERSION" + exit 1 + fi +elif $REPACK; then + mkdir "$SOURCE_TREE_DIRECTORY_NAME" + + if [ -e "$MS_TARBALL_FILENAME" ]; then + SHA512_FILEHASH=$(sha512sum "${MS_TARBALL_FILENAME}" | cut -d' ' -f1) + + if [ -n "$MS_TARBALL_SHA512_HASH" ] && + [ "$SHA512_FILEHASH" != "$MS_TARBALL_SHA512_HASH" ]; then + echo "Error: file $MS_TARBALL_SHA512_HASH already exists, but does not match the expected hashsum; maybe the file is corrupted and you want to delete it" + echo " Expected SHA512-HASH: $MS_TARBALL_SHA512_HASH" + echo " Actual SHA512-HASH: $SHA512_FILEHASH" + exit 1 + fi + else + echo "Info: downloading MS tarball..." + if ! wget --progress=bar "$MS_TARBALL_URL" -O "$MS_TARBALL_FILENAME"; then + print_error "wget failed" + exit 1 + fi + + SHA512_FILEHASH=$(sha512sum "${MS_TARBALL_FILENAME}" | cut -d' ' -f1) + + if [ "$SHA512_FILEHASH" != "$MS_TARBALL_SHA512_HASH" ]; then + echo "Error: downloaded file $MS_TARBALL_SHA512_HASH does not match the shasum provided" + echo " Expected SHA512-HASH: $MS_TARBALL_SHA512_HASH" + echo " Actual SHA512-HASH: $SHA512_FILEHASH" + exit 1 + fi + fi + + echo "Info: unpacking MS tarball..." + pushd "$SOURCE_TREE_DIRECTORY_NAME" + tar xvzf "../$MS_TARBALL_FILENAME" +fi + +if $BOOTSTRAP; then + echo "Info: prepare bootstraping..." + ./prep.sh +fi + +if [ -e "../$ORIG_TARBALL_FILENAME" ]; then + print_error "$ORIG_TARBALL_FILENAME already exists; maybe delete it?" + exit 1 +fi + +echo "Info: removing unneeded/unwanted files..." +# Remove files with funny licenses, crypto implementations and other +# not-very-useful artifacts to reduce tarball size +# This list concords with the File-Excluded stanza in the copyright + +# Binaries for gradle +rm -r src/aspnetcore/src/SignalR/clients/java/signalr/gradle* + +# Unnecessary crypto implementation: IDEA +rm -r src/runtime/src/tests/JIT/Performance/CodeQuality/Bytemark/ + +# https://github.com/dotnet/aspnetcore/issues/34785 +find src/aspnetcore/src -type d -name samples -print0 | xargs -0 rm -r + +# https://github.com/NuGet/Home/issues/11094 +rm -r src/nuget-client/test/EndToEnd + +# Checked that are not needed in the build: this only removes under roslyn: +# src/roslyn/src/Compilers/Test/Resources/Core/SymbolsTests/V?/*.dll +find src/roslyn/src/Compilers/Test/Resources -iname "*.dll" -exec rm -rf {} + + +# https://github.com/microsoft/ApplicationInsights-dotnet/issues/2670 +# we are applying a patch for this +# rm -r src/source-build-externals/src/application-insights/LOGGING/test/Shared/CustomTelemetryChannel.cs + +# Don't remove vendorized libunwind because we need it for arm64 archs +# rm -r src/runtime/src/coreclr/pal/src/libunwind + +# CPC-1578 prebuilts not used in build +rm src/roslyn/src/Compilers/Test/Resources/Core/DiagnosticTests/ErrTestMod01.netmodule +rm src/roslyn/src/Compilers/Test/Resources/Core/DiagnosticTests/ErrTestMod02.netmodule +rm src/roslyn/src/Compilers/Test/Resources/Core/ExpressionCompiler/LibraryA.winmd +rm src/roslyn/src/Compilers/Test/Resources/Core/ExpressionCompiler/LibraryB.winmd +rm src/roslyn/src/Compilers/Test/Resources/Core/ExpressionCompiler/Windows.Data.winmd +rm src/roslyn/src/Compilers/Test/Resources/Core/ExpressionCompiler/Windows.Storage.winmd +rm src/roslyn/src/Compilers/Test/Resources/Core/ExpressionCompiler/Windows.winmd +rm src/roslyn/src/Compilers/Test/Resources/Core/MetadataTests/Invalid/EmptyModuleTable.netmodule +rm src/roslyn/src/Compilers/Test/Resources/Core/MetadataTests/NetModule01/ModuleCS00.mod +rm src/roslyn/src/Compilers/Test/Resources/Core/MetadataTests/NetModule01/ModuleCS01.mod +rm src/roslyn/src/Compilers/Test/Resources/Core/MetadataTests/NetModule01/ModuleVB01.mod +rm src/roslyn/src/Compilers/Test/Resources/Core/SymbolsTests/CustomModifiers/Modifiers.netmodule +rm src/roslyn/src/Compilers/Test/Resources/Core/SymbolsTests/MultiModule/mod2.netmodule +rm src/roslyn/src/Compilers/Test/Resources/Core/SymbolsTests/MultiModule/mod3.netmodule +rm src/roslyn/src/Compilers/Test/Resources/Core/SymbolsTests/MultiTargeting/Source1Module.netmodule +rm src/roslyn/src/Compilers/Test/Resources/Core/SymbolsTests/MultiTargeting/Source3Module.netmodule +rm src/roslyn/src/Compilers/Test/Resources/Core/SymbolsTests/MultiTargeting/Source4Module.netmodule +rm src/roslyn/src/Compilers/Test/Resources/Core/SymbolsTests/MultiTargeting/Source5Module.netmodule +rm src/roslyn/src/Compilers/Test/Resources/Core/SymbolsTests/MultiTargeting/Source7Module.netmodule +rm src/roslyn/src/Compilers/Test/Resources/Core/SymbolsTests/RetargetingCycle/V1/ClassB.netmodule +rm src/roslyn/src/Compilers/Test/Resources/Core/SymbolsTests/TypeForwarders/Forwarded.netmodule +rm src/roslyn/src/Compilers/Test/Resources/Core/SymbolsTests/V1/MTTestModule1.netmodule +rm src/roslyn/src/Compilers/Test/Resources/Core/SymbolsTests/V1/MTTestModule2.netmodule +rm src/roslyn/src/Compilers/Test/Resources/Core/SymbolsTests/V2/MTTestModule1.netmodule +rm src/roslyn/src/Compilers/Test/Resources/Core/SymbolsTests/V2/MTTestModule3.netmodule +rm src/roslyn/src/Compilers/Test/Resources/Core/SymbolsTests/V3/MTTestModule1.netmodule +rm src/roslyn/src/Compilers/Test/Resources/Core/SymbolsTests/V3/MTTestModule4.netmodule +rm 'src/roslyn/src/Compilers/Test/Resources/Core/SymbolsTests/With Spaces.netmodule' +rm src/roslyn/src/Compilers/Test/Resources/Core/SymbolsTests/netModule/CrossRefModule1.netmodule +rm src/roslyn/src/Compilers/Test/Resources/Core/SymbolsTests/netModule/CrossRefModule2.netmodule +rm src/roslyn/src/Compilers/Test/Resources/Core/SymbolsTests/netModule/hash_module.netmodule +rm src/roslyn/src/Compilers/Test/Resources/Core/SymbolsTests/netModule/netModule1.netmodule +rm src/roslyn/src/Compilers/Test/Resources/Core/SymbolsTests/netModule/netModule2.netmodule +rm src/roslyn/src/Compilers/Test/Resources/Core/WinRt/W1.winmd +rm src/roslyn/src/Compilers/Test/Resources/Core/WinRt/W2.winmd +rm src/roslyn/src/Compilers/Test/Resources/Core/WinRt/WB.winmd +rm src/roslyn/src/Compilers/Test/Resources/Core/WinRt/WB_Version1.winmd +rm src/roslyn/src/Compilers/Test/Resources/Core/WinRt/WImpl.winmd +rm src/roslyn/src/Compilers/Test/Resources/Core/WinRt/WinMDPrefixing.winmd +rm src/roslyn/src/Compilers/Test/Resources/Core/WinRt/Windows.Languages.WinRTTest.winmd +rm src/roslyn/src/Compilers/Test/Resources/Core/WinRt/Windows.winmd +rm src/roslyn/src/ExpressionEvaluator/Core/Source/ExpressionCompiler/Resources/WindowsProxy.winmd +rm src/runtime/src/libraries/System.Reflection.Metadata/tests/Resources/NetModule/ModuleCS00.mod +rm src/runtime/src/libraries/System.Reflection.Metadata/tests/Resources/NetModule/ModuleCS01.mod +rm src/runtime/src/libraries/System.Reflection.Metadata/tests/Resources/NetModule/ModuleVB01.mod +rm src/runtime/src/libraries/System.Reflection.Metadata/tests/Resources/WinRT/Lib.winmd +rm src/cecil/Test/Resources/assemblies/ManagedWinmd.winmd +rm src/cecil/Test/Resources/assemblies/NativeWinmd.winmd +rm src/cecil/Test/Resources/assemblies/moda.netmodule +rm src/cecil/Test/Resources/assemblies/modb.netmodule +rm src/cecil/Test/Resources/assemblies/winrtcomp.winmd + +# Build release manifest file +# +# This repository information will be passed to the build script, which, in turn, will +# send this to SourceLink. This should always point to the public Github VMR repo +# (not a private one), otherwise SourceLink will not be able to fetch source code +# when doing assembly debugging. +# +# If the commit does not yet exist at build time in the repo, use it anyway if it +# will eventually exist. +# +# Commit SHAs from the Azure DevOps partners repo equal the ones from the Github dotnet/dotnet repo. +if $CLONE_REPOSITORY; then + if [ ! -d ".git" ]; then + print_err "This is not a git repository." + exit 1 + fi + + if [ -z "$RM_GIT_REPO" ]; then + print_err "No SourceLink Git repository was specified. Please use --source-repository to do so." + exit 1 + fi + + if [ -z "$RM_GIT_COMMIT" ]; then + RM_GIT_COMMIT="$(git log "${TAG_NAME}" -n 1 | grep commit -m 1 | cut -d ' ' -f 2)" + fi +elif $REPACK; then + if [ -z "$RM_GIT_REPO" ]; then + print_err "No SourceLink Git repository was specified. Please use --source-repository to do so." + exit 1 + elif [ -z "$RM_GIT_COMMIT" ]; then + print_err "No SourceLink Git commit was specified. Please use --source-version to do so." + fi +fi + +echo "Creating release.info file with:" +echo " Repo: ${RM_GIT_REPO}" +echo " Commit: ${RM_GIT_COMMIT}" + +tee -a release.info << END +RM_GIT_REPO=${RM_GIT_REPO} +RM_GIT_COMMIT=${RM_GIT_COMMIT} +END + +if [ -e release.info ]; then + echo "release.info created!" +else + print_err "release.info not created." + exit 1 +fi + +# Remove unnecessary git-related files +if [ -d ".git" ]; then + rm -rf .git +fi +rm .gitignore + +popd + +echo "Info: creating orig tarball..." +pushd "${SOURCE_TREE_DIRECTORY_NAME}" +tar --use-compress-program 'xz --threads 0' --create --file "../../${ORIG_TARBALL_FILENAME}" "." +popd +rsync -a --progress --remove-source-files "${SOURCE_TREE_DIRECTORY_NAME}/" "." --exclude ".git" +rm -rf "${SOURCE_TREE_DIRECTORY_NAME}" + +echo "Info: Done! orig tarball at ../${ORIG_TARBALL_FILENAME}" +exit 0 diff -Nru dotnet8-8.0.103-8.0.3/debian/eng/dotnet-version.py dotnet8-8.0.103-8.0.3/debian/eng/dotnet-version.py --- dotnet8-8.0.103-8.0.3/debian/eng/dotnet-version.py 1970-01-01 00:00:00.000000000 +0000 +++ dotnet8-8.0.103-8.0.3/debian/eng/dotnet-version.py 2024-03-18 12:48:03.000000000 +0000 @@ -0,0 +1,15 @@ +#!/usr/bin/env python3 + +import os +import sys + + +sys.path.append("debian/eng") +from versionlib.dotnet import SourcePackageVersion + + +if __name__ == "__main__": + version = SourcePackageVersion.ParseFromChangelog( + os.path.join("debian", "changelog")) + + print(f"{version.SdkVersion.Major}.{version.SdkVersion.Minor}") \ No newline at end of file diff -Nru dotnet8-8.0.103-8.0.3/debian/eng/source_build_artifact_path.py dotnet8-8.0.103-8.0.3/debian/eng/source_build_artifact_path.py --- dotnet8-8.0.103-8.0.3/debian/eng/source_build_artifact_path.py 1970-01-01 00:00:00.000000000 +0000 +++ dotnet8-8.0.103-8.0.3/debian/eng/source_build_artifact_path.py 2024-03-18 12:48:03.000000000 +0000 @@ -0,0 +1,39 @@ +#!/usr/bin/env python3 + +import os +import sys +from glob import glob + +sys.path.append("debian/eng") +from versionlib.dotnet import SourcePackageVersion, RuntimeIdentifier, SdkVersion + + +def GetSourceBuiltArtifactsTarball( + basePath: str, + sdkVersion: str, + runtimeIdentifier: str) -> str: + globPattern = (f"{basePath}/Private.SourceBuilt.Artifacts." + f"{sdkVersion}*.{runtimeIdentifier}.tar.gz") + + files = glob(globPattern) + + if len(files) == 0: + raise ValueError(f"Source built artifacts tarball not found " + f"(glob pattern: '{globPattern}').") + elif len(files) > 1: + raise ValueError(f"Multiple source built artifacts artifacts tarballs " + f"found (glob pattern: '{globPattern}').") + + return files[0] + + +if __name__ == "__main__": + version = SourcePackageVersion.ParseFromChangelog( + os.path.join("debian", "changelog")) + + runtimeIdentifier = RuntimeIdentifier.FromPlatformData() + + print(GetSourceBuiltArtifactsTarball( + basePath="/usr/lib/dotnet/source-built-artifacts", + sdkVersion=str(version.SdkVersion), + runtimeIdentifier=str(runtimeIdentifier))) diff -Nru dotnet8-8.0.103-8.0.3/debian/eng/strenum/LICENSE dotnet8-8.0.103-8.0.3/debian/eng/strenum/LICENSE --- dotnet8-8.0.103-8.0.3/debian/eng/strenum/LICENSE 1970-01-01 00:00:00.000000000 +0000 +++ dotnet8-8.0.103-8.0.3/debian/eng/strenum/LICENSE 2024-03-18 12:48:03.000000000 +0000 @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2019 James C Sinclair + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff -Nru dotnet8-8.0.103-8.0.3/debian/eng/strenum/README.md dotnet8-8.0.103-8.0.3/debian/eng/strenum/README.md --- dotnet8-8.0.103-8.0.3/debian/eng/strenum/README.md 1970-01-01 00:00:00.000000000 +0000 +++ dotnet8-8.0.103-8.0.3/debian/eng/strenum/README.md 2024-03-18 12:48:03.000000000 +0000 @@ -0,0 +1,39 @@ +# StrEnum + +A Python `enum.Enum` that inherits from `str` to complement +`enum.IntEnum` in the standard library. Supports python 3.7+. + +- [Repository](https://github.com/irgeek/StrEnum) +- [Doumentation](https://strenum.readthedocs.io/en/latest/index.html) +- [Project on Pip](https://pypi.org/project/StrEnum/) + +## Rationale + +Starting with Python 3.11, `enum.StrEnum` is available in the standard +library, but Ubuntu 22.04 (Jammy Jellyfish) only ships with Python 3.10. + +To keep the behaviour of a `enum.StrEnum` for Python 3.10+, a copy of this +popular backport is included. This especially allows to avoid adding `.value` +to every Enum instance to improve readability. + +## LICENSE + +Copyright (c) 2019 James C Sinclair + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff -Nru dotnet8-8.0.103-8.0.3/debian/eng/strenum/__init__.py dotnet8-8.0.103-8.0.3/debian/eng/strenum/__init__.py --- dotnet8-8.0.103-8.0.3/debian/eng/strenum/__init__.py 1970-01-01 00:00:00.000000000 +0000 +++ dotnet8-8.0.103-8.0.3/debian/eng/strenum/__init__.py 2024-03-18 12:48:03.000000000 +0000 @@ -0,0 +1,325 @@ +import enum +from ._version import get_versions +from ._name_mangler import _NameMangler + +__version__ = get_versions()["version"] +__version_info__ = tuple(int(n) for n in __version__.partition("+")[0].split(".")) +del get_versions + +_name_mangler = _NameMangler() + +# The first argument to the `_generate_next_value_` function of the `enum.Enum` +# class is documented to be the name of the enum member, not the enum class: +# +# https://docs.python.org/3.6/library/enum.html#using-automatic-values +# +# Pylint, though, doesn't know about this so we need to disable it's check for +# `self` arguments. +# pylint: disable=no-self-argument + + +class StrEnum(str, enum.Enum): + """ + StrEnum is a Python ``enum.Enum`` that inherits from ``str``. The default + ``auto()`` behavior uses the member name as its value. + + Example usage:: + + class Example(StrEnum): + UPPER_CASE = auto() + lower_case = auto() + MixedCase = auto() + + assert Example.UPPER_CASE == "UPPER_CASE" + assert Example.lower_case == "lower_case" + assert Example.MixedCase == "MixedCase" + """ + + def __new__(cls, value, *args, **kwargs): + if not isinstance(value, (str, enum.auto)): + raise TypeError( + f"Values of StrEnums must be strings: {value!r} is a {type(value)}" + ) + return super().__new__(cls, value, *args, **kwargs) + + def __str__(self): + return str(self.value) + + def _generate_next_value_(name, *_): + return name + + +class LowercaseStrEnum(StrEnum): + """ + A ``StrEnum`` where ``auto()`` will convert the name to `lowercase` to + produce each member's value. + + Example usage:: + + class Example(LowercaseStrEnum): + UPPER_CASE = auto() + lower_case = auto() + MixedCase = auto() + + assert Example.UPPER_CASE == "upper_case" + assert Example.lower_case == "lower_case" + assert Example.MixedCase == "mixedcase" + + .. versionadded:: 0.4.3 + """ + + def _generate_next_value_(name, *_): + return name.lower() + + +class UppercaseStrEnum(StrEnum): + """ + A ``StrEnum`` where ``auto()`` will convert the name to `UPPERCASE` to + produce each member's value. + + Example usage:: + + class Example(UppercaseStrEnum): + UPPER_CASE = auto() + lower_case = auto() + MixedCase = auto() + + assert Example.UPPER_CASE == "UPPER_CASE" + assert Example.lower_case == "LOWER_CASE" + assert Example.MixedCase == "MIXEDCASE" + + .. versionadded:: 0.4.3 + """ + + def _generate_next_value_(name, *_): + return name.upper() + + +class CamelCaseStrEnum(StrEnum): + """ + A ``StrEnum`` where ``auto()`` will convert the name to `camelCase` to + produce each member's value. + + Example usage:: + + class Example(CamelCaseStrEnum): + UPPER_CASE = auto() + lower_case = auto() + MixedCase = auto() + + assert Example.UPPER_CASE == "upperCase" + assert Example.lower_case == "lowerCase" + assert Example.MixedCase == "mixedCase" + + .. versionadded:: 0.4.5 + """ + + def _generate_next_value_(name, *_): + return _name_mangler.camel(name) + + +class PascalCaseStrEnum(StrEnum): + """ + A ``StrEnum`` where ``auto()`` will convert the name to `PascalCase` to + produce each member's value. + + Example usage:: + + class Example(PascalCaseStrEnum): + UPPER_CASE = auto() + lower_case = auto() + MixedCase = auto() + + assert Example.UPPER_CASE == "UpperCase" + assert Example.lower_case == "LowerCase" + assert Example.MixedCase == "MixedCase" + + .. versionadded:: 0.4.5 + """ + + def _generate_next_value_(name, *_): + return _name_mangler.pascal(name) + + +class KebabCaseStrEnum(StrEnum): + """ + A ``StrEnum`` where ``auto()`` will convert the name to `kebab-case` to + produce each member's value. + + Example usage:: + + class Example(KebabCaseStrEnum): + UPPER_CASE = auto() + lower_case = auto() + MixedCase = auto() + + assert Example.UPPER_CASE == "upper-case" + assert Example.lower_case == "lower-case" + assert Example.MixedCase == "mixed-case" + + .. versionadded:: 0.4.5 + """ + + def _generate_next_value_(name, *_): + return _name_mangler.kebab(name) + + +class SnakeCaseStrEnum(StrEnum): + """ + A ``StrEnum`` where ``auto()`` will convert the name to `snake_case` to + produce each member's value. + + Example usage:: + + class Example(SnakeCaseStrEnum): + UPPER_CASE = auto() + lower_case = auto() + MixedCase = auto() + + assert Example.UPPER_CASE == "upper_case" + assert Example.lower_case == "lower_case" + assert Example.MixedCase == "mixed_case" + + .. versionadded:: 0.4.5 + """ + + def _generate_next_value_(name, *_): + return _name_mangler.snake(name) + + +class MacroCaseStrEnum(StrEnum): + """ + A ``StrEnum`` where ``auto()`` will convert the name to `MACRO_CASE` to + produce each member's value. + + Example usage:: + + class Example(MacroCaseStrEnum): + UPPER_CASE = auto() + lower_case = auto() + MixedCase = auto() + + assert Example.UPPER_CASE == "UPPER_CASE" + assert Example.lower_case == "LOWER_CASE" + assert Example.MixedCase == "MIXED_CASE" + + .. versionadded:: 0.4.6 + """ + + def _generate_next_value_(name, *_): + return _name_mangler.macro(name) + + +class CamelSnakeCaseStrEnum(StrEnum): + """ + A ``StrEnum`` where ``auto()`` will convert the name to `camel_Snake_Case` to + produce each member's value. + + Example usage:: + + class Example(CamelSnakeCaseStrEnum): + UPPER_CASE = auto() + lower_case = auto() + MixedCase = auto() + + assert Example.UPPER_CASE == "upper_Case" + assert Example.lower_case == "lower_Case" + assert Example.MixedCase == "mixed_Case" + + .. versionadded:: 0.4.8 + """ + + def _generate_next_value_(name, *_): + return _name_mangler.camel_snake(name) + + +class PascalSnakeCaseStrEnum(StrEnum): + """ + A ``StrEnum`` where ``auto()`` will convert the name to `Pascal_Snake_Case` to + produce each member's value. + + Example usage:: + + class Example(PascalSnakeCaseStrEnum): + UPPER_CASE = auto() + lower_case = auto() + MixedCase = auto() + + assert Example.UPPER_CASE == "Upper_Case" + assert Example.lower_case == "Lower_Case" + assert Example.MixedCase == "Mixed_Case" + + .. versionadded:: 0.4.8 + """ + + def _generate_next_value_(name, *_): + return _name_mangler.pascal_snake(name) + + +class SpongebobCaseStrEnum(StrEnum): + """ + A ``StrEnum`` where ``auto()`` will convert the name to `SpONGEBob_CAse` to + produce each member's value. + + Example usage:: + + class Example(SpongebobCaseStrEnum): + UPPER_CASE = auto() + lower_case = auto() + MixedCase = auto() + + assert Example.UPPER_CASE == "uPpER_cAsE" + assert Example.lower_case == "lowER_CASe" + assert Example.MixedCase == "MixeD_CAse" + + .. versionadded:: 0.4.8 + """ + + def _generate_next_value_(name, *_): + return _name_mangler.spongebob(name) + + +class CobolCaseStrEnum(StrEnum): + """ + A ``StrEnum`` where ``auto()`` will convert the name to `COBOL-CASE` to + produce each member's value. + + Example usage:: + + class Example(CobolCaseStrEnum): + UPPER_CASE = auto() + lower_case = auto() + MixedCase = auto() + + assert Example.UPPER_CASE == "UPPER-CASE" + assert Example.lower_case == "LOWER-CASE" + assert Example.MixedCase == "MIXED-CASE" + + .. versionadded:: 0.4.8 + """ + + def _generate_next_value_(name, *_): + return _name_mangler.cobol(name) + + +class HttpHeaderCaseStrEnum(StrEnum): + """ + A ``StrEnum`` where ``auto()`` will convert the name to `Http-Header-Case` to + produce each member's value. + + Example usage:: + + class Example(HttpHeaderCaseStrEnum): + UPPER_CASE = auto() + lower_case = auto() + MixedCase = auto() + + assert Example.UPPER_CASE == "Upper-Case" + assert Example.lower_case == "Lower-Case" + assert Example.MixedCase == "Mixed-Case" + + .. versionadded:: 0.4.8 + """ + + def _generate_next_value_(name, *_): + return _name_mangler.http_header(name) diff -Nru dotnet8-8.0.103-8.0.3/debian/eng/strenum/__init__.pyi dotnet8-8.0.103-8.0.3/debian/eng/strenum/__init__.pyi --- dotnet8-8.0.103-8.0.3/debian/eng/strenum/__init__.pyi 1970-01-01 00:00:00.000000000 +0000 +++ dotnet8-8.0.103-8.0.3/debian/eng/strenum/__init__.pyi 2024-03-18 12:48:03.000000000 +0000 @@ -0,0 +1,43 @@ +import enum +from typing import Union, Sequence, Mapping, Any + +class StrEnum(str, enum.Enum): + def __new__(cls, value: Union[str, enum.auto], *args: Sequence[Any], **kwargs: Mapping[Any, Any]) -> StrEnum: ... + def __str__(self) -> str: ... + def _generate_next_value_(name: str, *_) -> str: ... + +class LowercaseStrEnum(StrEnum): + def _generate_next_value_(name: str, *_) -> str: ... + +class UppercaseStrEnum(StrEnum): + def _generate_next_value_(name: str, *_) -> str: ... + +class CamelCaseStrEnum(StrEnum): + def _generate_next_value_(name: str, *_) -> str: ... + +class PascalCaseStrEnum(StrEnum): + def _generate_next_value_(name: str, *_) -> str: ... + +class KebabCaseStrEnum(StrEnum): + def _generate_next_value_(name: str, *_) -> str: ... + +class SnakeCaseStrEnum(StrEnum): + def _generate_next_value_(name: str, *_) -> str: ... + +class MacroCaseStrEnum(StrEnum): + def _generate_next_value_(name: str, *_) -> str: ... + +class CamelSnakeCaseStrEnum(StrEnum): + def _generate_next_value_(name: str, *_) -> str: ... + +class PascalSnakeCaseStrEnum(StrEnum): + def _generate_next_value_(name: str, *_) -> str: ... + +class SpongebobCaseStrEnum(StrEnum): + def _generate_next_value_(name: str, *_) -> str: ... + +class CobolCaseStrEnum(StrEnum): + def _generate_next_value_(name: str, *_) -> str: ... + +class HttpHeaderCaseStrEnum(StrEnum): + def _generate_next_value_(name: str, *_) -> str: ... diff -Nru dotnet8-8.0.103-8.0.3/debian/eng/strenum/_name_mangler.py dotnet8-8.0.103-8.0.3/debian/eng/strenum/_name_mangler.py --- dotnet8-8.0.103-8.0.3/debian/eng/strenum/_name_mangler.py 1970-01-01 00:00:00.000000000 +0000 +++ dotnet8-8.0.103-8.0.3/debian/eng/strenum/_name_mangler.py 2024-03-18 12:48:03.000000000 +0000 @@ -0,0 +1,127 @@ +# pylint: disable=no-name-in-module +import re +from zlib import crc32 + + +class _NameMangler: + _regex = re.compile(r"([A-Z]?[a-z]+)|([A-Z]+(?![a-z]))") + + def words(self, name): + """ + Split a string into words. Should correctly handle splitting: + camelCase + PascalCase + kebab-case + snake_case + MACRO_CASE + camel_Snake_Case + Pascal_Snake_Case + COBOL-CASE + Http-Header-Case + + It _does not_ handle splitting spongebob case. + """ + yield from (m.group(0) for m in self._regex.finditer(name)) + + def camel(self, name): + """ + Convert a name to camelCase + """ + + def cased_words(word_iter): + yield next(word_iter, "").lower() + yield from (w.title() for w in word_iter) + + return "".join(cased_words(self.words(name))) + + def pascal(self, name): + """ + Convert a name to PascalCase + """ + + return "".join(w.title() for w in self.words(name)) + + def kebab(self, name): + """ + Convert a name to kebab-case + """ + + return "-".join(w.lower() for w in self.words(name)) + + def snake(self, name): + """ + Convert a name to snake_case + """ + + return "_".join(w.lower() for w in self.words(name)) + + def macro(self, name): + """ + Convert a name to MACRO_CASE + """ + + return "_".join(w.upper() for w in self.words(name)) + + # The following are inspired by examples in the Wikipedia + # [Naming convention](https://en.wikipedia.org/wiki/Naming_convention_(programming)) + # article + + def camel_snake(self, name): + """ + Convert a name to camel_Snake_Case + """ + + def cased_words(word_iter): + yield next(word_iter, "").lower() + yield from (w.title() for w in word_iter) + + return "_".join(cased_words(self.words(name))) + + def pascal_snake(self, name): + """ + Convert a name to Pascal_Snake_Case + """ + + return "_".join(w.title() for w in self.words(name)) + + def spongebob(self, name): + """ + Convert a name to SpOngEBOb_CASe + + The PRNG we use is seeded with the word to be scrambled. This produces + stable output so the same input will always produce in the same output. + It's not `truly` random, but your tests will thank me. + """ + + def prng(seed_word): + state = 1 << 31 | crc32(seed_word.encode("utf-8")) | 1 + + def step(state): + state = state >> 1 | (state & 0x01 ^ ((state & 0x02) >> 1)) << 31 + bit = state & 0x1 + return bit, state + + for _ in range(100): + _, state = step(state) + while True: + bit, state = step(state) + yield str.upper if bit else str.lower + + def scramble(word): + return "".join(f(ch) for ch, f in zip(word, prng(word))) + + return "_".join(scramble(w) for w in self.words(name)) + + def cobol(self, name): + """ + Convert a name to COBOL-CASE + """ + + return "-".join(w.upper() for w in self.words(name)) + + def http_header(self, name): + """ + Convert a name to Http-Header-Case + """ + + return "-".join(w.title() for w in self.words(name)) diff -Nru dotnet8-8.0.103-8.0.3/debian/eng/strenum/_name_mangler.pyi dotnet8-8.0.103-8.0.3/debian/eng/strenum/_name_mangler.pyi --- dotnet8-8.0.103-8.0.3/debian/eng/strenum/_name_mangler.pyi 1970-01-01 00:00:00.000000000 +0000 +++ dotnet8-8.0.103-8.0.3/debian/eng/strenum/_name_mangler.pyi 2024-03-18 12:48:03.000000000 +0000 @@ -0,0 +1,15 @@ +import re +from zlib import crc32 + +class _NameMangler: + def words(self, name: str) -> str: ... + def camel(self, name: str) -> str: ... + def pascal(self, name: str) -> str: ... + def kebab(self, name: str) -> str: ... + def snake(self, name: str) -> str: ... + def macro(self, name: str) -> str: ... + def camel_snake(self, name: str) -> str: ... + def pascal_snake(self, name: str) -> str: ... + def spongebob(self, name: str) -> str: ... + def cobol(self, name: str) -> str: ... + def http_header(self, name: str) -> str: ... diff -Nru dotnet8-8.0.103-8.0.3/debian/eng/strenum/_version.py dotnet8-8.0.103-8.0.3/debian/eng/strenum/_version.py --- dotnet8-8.0.103-8.0.3/debian/eng/strenum/_version.py 1970-01-01 00:00:00.000000000 +0000 +++ dotnet8-8.0.103-8.0.3/debian/eng/strenum/_version.py 2024-03-18 12:48:03.000000000 +0000 @@ -0,0 +1,520 @@ + +# This file helps to compute a version number in source trees obtained from +# git-archive tarball (such as those provided by githubs download-from-tag +# feature). Distribution tarballs (built by setup.py sdist) and build +# directories (produced by setup.py build) will contain a much shorter file +# that just contains the computed version number. + +# This file is released into the public domain. Generated by +# versioneer-0.18 (https://github.com/warner/python-versioneer) + +"""Git implementation of _version.py.""" + +import errno +import os +import re +import subprocess +import sys + + +def get_keywords(): + """Get the keywords needed to look up the version information.""" + # these strings will be replaced by git during git-archive. + # setup.py/versioneer.py will grep for the variable names, so they must + # each be defined on a line of their own. _version.py will just call + # get_keywords(). + git_refnames = "$Format:%d$" + git_full = "$Format:%H$" + git_date = "$Format:%ci$" + keywords = {"refnames": git_refnames, "full": git_full, "date": git_date} + return keywords + + +class VersioneerConfig: + """Container for Versioneer configuration parameters.""" + + +def get_config(): + """Create, populate and return the VersioneerConfig() object.""" + # these strings are filled in when 'setup.py versioneer' creates + # _version.py + cfg = VersioneerConfig() + cfg.VCS = "git" + cfg.style = "pep440" + cfg.tag_prefix = "v" + cfg.parentdir_prefix = "v" + cfg.versionfile_source = "strenum/_version.py" + cfg.verbose = False + return cfg + + +class NotThisMethod(Exception): + """Exception raised if a method is not valid for the current scenario.""" + + +LONG_VERSION_PY = {} +HANDLERS = {} + + +def register_vcs_handler(vcs, method): # decorator + """Decorator to mark a method as the handler for a particular VCS.""" + def decorate(f): + """Store f in HANDLERS[vcs][method].""" + if vcs not in HANDLERS: + HANDLERS[vcs] = {} + HANDLERS[vcs][method] = f + return f + return decorate + + +def run_command(commands, args, cwd=None, verbose=False, hide_stderr=False, + env=None): + """Call the given command(s).""" + assert isinstance(commands, list) + p = None + for c in commands: + try: + dispcmd = str([c] + args) + # remember shell=False, so use git.cmd on windows, not just git + p = subprocess.Popen([c] + args, cwd=cwd, env=env, + stdout=subprocess.PIPE, + stderr=(subprocess.PIPE if hide_stderr + else None)) + break + except EnvironmentError: + e = sys.exc_info()[1] + if e.errno == errno.ENOENT: + continue + if verbose: + print("unable to run %s" % dispcmd) + print(e) + return None, None + else: + if verbose: + print("unable to find command, tried %s" % (commands,)) + return None, None + stdout = p.communicate()[0].strip() + if sys.version_info[0] >= 3: + stdout = stdout.decode() + if p.returncode != 0: + if verbose: + print("unable to run %s (error)" % dispcmd) + print("stdout was %s" % stdout) + return None, p.returncode + return stdout, p.returncode + + +def versions_from_parentdir(parentdir_prefix, root, verbose): + """Try to determine the version from the parent directory name. + + Source tarballs conventionally unpack into a directory that includes both + the project name and a version string. We will also support searching up + two directory levels for an appropriately named parent directory + """ + rootdirs = [] + + for i in range(3): + dirname = os.path.basename(root) + if dirname.startswith(parentdir_prefix): + return {"version": dirname[len(parentdir_prefix):], + "full-revisionid": None, + "dirty": False, "error": None, "date": None} + else: + rootdirs.append(root) + root = os.path.dirname(root) # up a level + + if verbose: + print("Tried directories %s but none started with prefix %s" % + (str(rootdirs), parentdir_prefix)) + raise NotThisMethod("rootdir doesn't start with parentdir_prefix") + + +@register_vcs_handler("git", "get_keywords") +def git_get_keywords(versionfile_abs): + """Extract version information from the given file.""" + # the code embedded in _version.py can just fetch the value of these + # keywords. When used from setup.py, we don't want to import _version.py, + # so we do it with a regexp instead. This function is not used from + # _version.py. + keywords = {} + try: + f = open(versionfile_abs, "r") + for line in f.readlines(): + if line.strip().startswith("git_refnames ="): + mo = re.search(r'=\s*"(.*)"', line) + if mo: + keywords["refnames"] = mo.group(1) + if line.strip().startswith("git_full ="): + mo = re.search(r'=\s*"(.*)"', line) + if mo: + keywords["full"] = mo.group(1) + if line.strip().startswith("git_date ="): + mo = re.search(r'=\s*"(.*)"', line) + if mo: + keywords["date"] = mo.group(1) + f.close() + except EnvironmentError: + pass + return keywords + + +@register_vcs_handler("git", "keywords") +def git_versions_from_keywords(keywords, tag_prefix, verbose): + """Get version information from git keywords.""" + if not keywords: + raise NotThisMethod("no keywords at all, weird") + date = keywords.get("date") + if date is not None: + # git-2.2.0 added "%cI", which expands to an ISO-8601 -compliant + # datestamp. However we prefer "%ci" (which expands to an "ISO-8601 + # -like" string, which we must then edit to make compliant), because + # it's been around since git-1.5.3, and it's too difficult to + # discover which version we're using, or to work around using an + # older one. + date = date.strip().replace(" ", "T", 1).replace(" ", "", 1) + refnames = keywords["refnames"].strip() + if refnames.startswith("$Format"): + if verbose: + print("keywords are unexpanded, not using") + raise NotThisMethod("unexpanded keywords, not a git-archive tarball") + refs = set([r.strip() for r in refnames.strip("()").split(",")]) + # starting in git-1.8.3, tags are listed as "tag: foo-1.0" instead of + # just "foo-1.0". If we see a "tag: " prefix, prefer those. + TAG = "tag: " + tags = set([r[len(TAG):] for r in refs if r.startswith(TAG)]) + if not tags: + # Either we're using git < 1.8.3, or there really are no tags. We use + # a heuristic: assume all version tags have a digit. The old git %d + # expansion behaves like git log --decorate=short and strips out the + # refs/heads/ and refs/tags/ prefixes that would let us distinguish + # between branches and tags. By ignoring refnames without digits, we + # filter out many common branch names like "release" and + # "stabilization", as well as "HEAD" and "master". + tags = set([r for r in refs if re.search(r'\d', r)]) + if verbose: + print("discarding '%s', no digits" % ",".join(refs - tags)) + if verbose: + print("likely tags: %s" % ",".join(sorted(tags))) + for ref in sorted(tags): + # sorting will prefer e.g. "2.0" over "2.0rc1" + if ref.startswith(tag_prefix): + r = ref[len(tag_prefix):] + if verbose: + print("picking %s" % r) + return {"version": r, + "full-revisionid": keywords["full"].strip(), + "dirty": False, "error": None, + "date": date} + # no suitable tags, so version is "0+unknown", but full hex is still there + if verbose: + print("no suitable tags, using unknown + full revision id") + return {"version": "0+unknown", + "full-revisionid": keywords["full"].strip(), + "dirty": False, "error": "no suitable tags", "date": None} + + +@register_vcs_handler("git", "pieces_from_vcs") +def git_pieces_from_vcs(tag_prefix, root, verbose, run_command=run_command): + """Get version from 'git describe' in the root of the source tree. + + This only gets called if the git-archive 'subst' keywords were *not* + expanded, and _version.py hasn't already been rewritten with a short + version string, meaning we're inside a checked out source tree. + """ + GITS = ["git"] + if sys.platform == "win32": + GITS = ["git.cmd", "git.exe"] + + out, rc = run_command(GITS, ["rev-parse", "--git-dir"], cwd=root, + hide_stderr=True) + if rc != 0: + if verbose: + print("Directory %s not under git control" % root) + raise NotThisMethod("'git rev-parse --git-dir' returned error") + + # if there is a tag matching tag_prefix, this yields TAG-NUM-gHEX[-dirty] + # if there isn't one, this yields HEX[-dirty] (no NUM) + describe_out, rc = run_command(GITS, ["describe", "--tags", "--dirty", + "--always", "--long", + "--match", "%s*" % tag_prefix], + cwd=root) + # --long was added in git-1.5.5 + if describe_out is None: + raise NotThisMethod("'git describe' failed") + describe_out = describe_out.strip() + full_out, rc = run_command(GITS, ["rev-parse", "HEAD"], cwd=root) + if full_out is None: + raise NotThisMethod("'git rev-parse' failed") + full_out = full_out.strip() + + pieces = {} + pieces["long"] = full_out + pieces["short"] = full_out[:7] # maybe improved later + pieces["error"] = None + + # parse describe_out. It will be like TAG-NUM-gHEX[-dirty] or HEX[-dirty] + # TAG might have hyphens. + git_describe = describe_out + + # look for -dirty suffix + dirty = git_describe.endswith("-dirty") + pieces["dirty"] = dirty + if dirty: + git_describe = git_describe[:git_describe.rindex("-dirty")] + + # now we have TAG-NUM-gHEX or HEX + + if "-" in git_describe: + # TAG-NUM-gHEX + mo = re.search(r'^(.+)-(\d+)-g([0-9a-f]+)$', git_describe) + if not mo: + # unparseable. Maybe git-describe is misbehaving? + pieces["error"] = ("unable to parse git-describe output: '%s'" + % describe_out) + return pieces + + # tag + full_tag = mo.group(1) + if not full_tag.startswith(tag_prefix): + if verbose: + fmt = "tag '%s' doesn't start with prefix '%s'" + print(fmt % (full_tag, tag_prefix)) + pieces["error"] = ("tag '%s' doesn't start with prefix '%s'" + % (full_tag, tag_prefix)) + return pieces + pieces["closest-tag"] = full_tag[len(tag_prefix):] + + # distance: number of commits since tag + pieces["distance"] = int(mo.group(2)) + + # commit: short hex revision ID + pieces["short"] = mo.group(3) + + else: + # HEX: no tags + pieces["closest-tag"] = None + count_out, rc = run_command(GITS, ["rev-list", "HEAD", "--count"], + cwd=root) + pieces["distance"] = int(count_out) # total number of commits + + # commit date: see ISO-8601 comment in git_versions_from_keywords() + date = run_command(GITS, ["show", "-s", "--format=%ci", "HEAD"], + cwd=root)[0].strip() + pieces["date"] = date.strip().replace(" ", "T", 1).replace(" ", "", 1) + + return pieces + + +def plus_or_dot(pieces): + """Return a + if we don't already have one, else return a .""" + if "+" in pieces.get("closest-tag", ""): + return "." + return "+" + + +def render_pep440(pieces): + """Build up version string, with post-release "local version identifier". + + Our goal: TAG[+DISTANCE.gHEX[.dirty]] . Note that if you + get a tagged build and then dirty it, you'll get TAG+0.gHEX.dirty + + Exceptions: + 1: no tags. git_describe was just HEX. 0+untagged.DISTANCE.gHEX[.dirty] + """ + if pieces["closest-tag"]: + rendered = pieces["closest-tag"] + if pieces["distance"] or pieces["dirty"]: + rendered += plus_or_dot(pieces) + rendered += "%d.g%s" % (pieces["distance"], pieces["short"]) + if pieces["dirty"]: + rendered += ".dirty" + else: + # exception #1 + rendered = "0+untagged.%d.g%s" % (pieces["distance"], + pieces["short"]) + if pieces["dirty"]: + rendered += ".dirty" + return rendered + + +def render_pep440_pre(pieces): + """TAG[.post.devDISTANCE] -- No -dirty. + + Exceptions: + 1: no tags. 0.post.devDISTANCE + """ + if pieces["closest-tag"]: + rendered = pieces["closest-tag"] + if pieces["distance"]: + rendered += ".post.dev%d" % pieces["distance"] + else: + # exception #1 + rendered = "0.post.dev%d" % pieces["distance"] + return rendered + + +def render_pep440_post(pieces): + """TAG[.postDISTANCE[.dev0]+gHEX] . + + The ".dev0" means dirty. Note that .dev0 sorts backwards + (a dirty tree will appear "older" than the corresponding clean one), + but you shouldn't be releasing software with -dirty anyways. + + Exceptions: + 1: no tags. 0.postDISTANCE[.dev0] + """ + if pieces["closest-tag"]: + rendered = pieces["closest-tag"] + if pieces["distance"] or pieces["dirty"]: + rendered += ".post%d" % pieces["distance"] + if pieces["dirty"]: + rendered += ".dev0" + rendered += plus_or_dot(pieces) + rendered += "g%s" % pieces["short"] + else: + # exception #1 + rendered = "0.post%d" % pieces["distance"] + if pieces["dirty"]: + rendered += ".dev0" + rendered += "+g%s" % pieces["short"] + return rendered + + +def render_pep440_old(pieces): + """TAG[.postDISTANCE[.dev0]] . + + The ".dev0" means dirty. + + Eexceptions: + 1: no tags. 0.postDISTANCE[.dev0] + """ + if pieces["closest-tag"]: + rendered = pieces["closest-tag"] + if pieces["distance"] or pieces["dirty"]: + rendered += ".post%d" % pieces["distance"] + if pieces["dirty"]: + rendered += ".dev0" + else: + # exception #1 + rendered = "0.post%d" % pieces["distance"] + if pieces["dirty"]: + rendered += ".dev0" + return rendered + + +def render_git_describe(pieces): + """TAG[-DISTANCE-gHEX][-dirty]. + + Like 'git describe --tags --dirty --always'. + + Exceptions: + 1: no tags. HEX[-dirty] (note: no 'g' prefix) + """ + if pieces["closest-tag"]: + rendered = pieces["closest-tag"] + if pieces["distance"]: + rendered += "-%d-g%s" % (pieces["distance"], pieces["short"]) + else: + # exception #1 + rendered = pieces["short"] + if pieces["dirty"]: + rendered += "-dirty" + return rendered + + +def render_git_describe_long(pieces): + """TAG-DISTANCE-gHEX[-dirty]. + + Like 'git describe --tags --dirty --always -long'. + The distance/hash is unconditional. + + Exceptions: + 1: no tags. HEX[-dirty] (note: no 'g' prefix) + """ + if pieces["closest-tag"]: + rendered = pieces["closest-tag"] + rendered += "-%d-g%s" % (pieces["distance"], pieces["short"]) + else: + # exception #1 + rendered = pieces["short"] + if pieces["dirty"]: + rendered += "-dirty" + return rendered + + +def render(pieces, style): + """Render the given version pieces into the requested style.""" + if pieces["error"]: + return {"version": "unknown", + "full-revisionid": pieces.get("long"), + "dirty": None, + "error": pieces["error"], + "date": None} + + if not style or style == "default": + style = "pep440" # the default + + if style == "pep440": + rendered = render_pep440(pieces) + elif style == "pep440-pre": + rendered = render_pep440_pre(pieces) + elif style == "pep440-post": + rendered = render_pep440_post(pieces) + elif style == "pep440-old": + rendered = render_pep440_old(pieces) + elif style == "git-describe": + rendered = render_git_describe(pieces) + elif style == "git-describe-long": + rendered = render_git_describe_long(pieces) + else: + raise ValueError("unknown style '%s'" % style) + + return {"version": rendered, "full-revisionid": pieces["long"], + "dirty": pieces["dirty"], "error": None, + "date": pieces.get("date")} + + +def get_versions(): + """Get version information or return default if unable to do so.""" + # I am in _version.py, which lives at ROOT/VERSIONFILE_SOURCE. If we have + # __file__, we can work backwards from there to the root. Some + # py2exe/bbfreeze/non-CPython implementations don't do __file__, in which + # case we can only use expanded keywords. + + cfg = get_config() + verbose = cfg.verbose + + try: + return git_versions_from_keywords(get_keywords(), cfg.tag_prefix, + verbose) + except NotThisMethod: + pass + + try: + root = os.path.realpath(__file__) + # versionfile_source is the relative path from the top of the source + # tree (where the .git directory might live) to this file. Invert + # this to find the root from __file__. + for i in cfg.versionfile_source.split('/'): + root = os.path.dirname(root) + except NameError: + return {"version": "0+unknown", "full-revisionid": None, + "dirty": None, + "error": "unable to find root of source tree", + "date": None} + + try: + pieces = git_pieces_from_vcs(cfg.tag_prefix, root, verbose) + return render(pieces, cfg.style) + except NotThisMethod: + pass + + try: + if cfg.parentdir_prefix: + return versions_from_parentdir(cfg.parentdir_prefix, root, verbose) + except NotThisMethod: + pass + + return {"version": "0+unknown", "full-revisionid": None, + "dirty": None, + "error": "unable to compute version", "date": None} diff -Nru dotnet8-8.0.103-8.0.3/debian/eng/strenum/mixins.py dotnet8-8.0.103-8.0.3/debian/eng/strenum/mixins.py --- dotnet8-8.0.103-8.0.3/debian/eng/strenum/mixins.py 1970-01-01 00:00:00.000000000 +0000 +++ dotnet8-8.0.103-8.0.3/debian/eng/strenum/mixins.py 2024-03-18 12:48:03.000000000 +0000 @@ -0,0 +1,64 @@ +class Comparable: + """Customise how your Enum acts when compared to other objects. + + Your Enum must implement a ``_cmp_values`` method which takes the Enum + member's value and the other value and manipulates them into the actual + values that can be compared. + + A case-insensitive StrEnum might look like this:: + + class HttpHeader(Comparable, KebabCaseStrEnum): + ContentType = auto() + Host = auto() + Accept = auto() + XForwardedFor = auto() + + def _cmp_values(self, other): + return self.value.lower(), str(other).lower() + + You could then use these headers in case-insensitive comparisons:: + + assert "Content-Type" == HttpHeader.ContentType + assert "content-type" == HttpHeader.ContentType + assert "coNtEnt-tyPe" == HttpHeader.ContentType + + .. note:: + Your ``_cmp_values`` method *must not* return ``self`` as one of the + values to be compared -- that would result in infinite recursion. + Instead, perform operations on ``self.value`` and return that. + + .. warning:: + A bug in Python prior to 3.7.1 prevents mix-ins working with Enum + subclasses. + + .. versionadded:: 0.4.6 + """ + + def __eq__(self, other): + value, other = self._cmp_values(other) + return value == other + + def __ne__(self, other): + value, other = self._cmp_values(other) + return value != other + + def __lt__(self, other): + value, other = self._cmp_values(other) + return value < other + + def __le__(self, other): + value, other = self._cmp_values(other) + return value <= other + + def __gt__(self, other): + value, other = self._cmp_values(other) + return value > other + + def __ge__(self, other): + value, other = self._cmp_values(other) + return value >= other + + def _cmp_values(self, other): + raise NotImplementedError( + "Enum's using Comparable must implement their own _cmp_values function." + ) diff -Nru dotnet8-8.0.103-8.0.3/debian/eng/strenum/mixins.pyi dotnet8-8.0.103-8.0.3/debian/eng/strenum/mixins.pyi --- dotnet8-8.0.103-8.0.3/debian/eng/strenum/mixins.pyi 1970-01-01 00:00:00.000000000 +0000 +++ dotnet8-8.0.103-8.0.3/debian/eng/strenum/mixins.pyi 2024-03-18 12:48:03.000000000 +0000 @@ -0,0 +1,10 @@ +from typing import Tuple, Any + +class Comparable: + def __eq__(self, other: Any) -> bool: ... + def __ne__(self, other: Any) -> bool: ... + def __lt__(self, other: Any) -> bool: ... + def __le__(self, other: Any) -> bool: ... + def __gt__(self, other: Any) -> bool: ... + def __ge__(self, other: Any) -> bool: ... + def _cmp_values(self, other: Any) -> Tuple[str, str]: ... diff -Nru dotnet8-8.0.103-8.0.3/debian/eng/test-runner/.github/workflows/ci.yml.disabled dotnet8-8.0.103-8.0.3/debian/eng/test-runner/.github/workflows/ci.yml.disabled --- dotnet8-8.0.103-8.0.3/debian/eng/test-runner/.github/workflows/ci.yml.disabled 1970-01-01 00:00:00.000000000 +0000 +++ dotnet8-8.0.103-8.0.3/debian/eng/test-runner/.github/workflows/ci.yml.disabled 2024-03-18 12:48:03.000000000 +0000 @@ -0,0 +1,153 @@ +name: CI + +on: [push, pull_request] + +jobs: + unit-test: + name: Verify unit tests pass + + runs-on: ubuntu-latest + + timeout-minutes: 30 + + strategy: + fail-fast: false + matrix: + container_image: + - quay.io/centos/centos:stream8 + - quay.io/centos/centos:stream9 + - registry.fedoraproject.org/fedora:37 + - registry.fedoraproject.org/fedora:38 + - registry.fedoraproject.org/fedora:39 + - registry.fedoraproject.org/fedora:rawhide + - registry.access.redhat.com/ubi8 + - registry.access.redhat.com/ubi9 + dotnet_version: + - "6.0" + - "7.0" + include: + - container_image: quay.io/centos/centos:stream9 + dotnet_version: "8.0" + + container: + image: ${{ matrix.container_image }} + options: --security-opt seccomp=unconfined + + steps: + - name: Install build dependencies + timeout-minutes: 5 + run: | + set -euo pipefail + if command -v dnf; then + dnf install -y dotnet-sdk-${{ matrix.dotnet_version }} git make + elif command -v apk; then + apk add bash curl git icu-libs krb5-libs libgcc libintl libssl1.1 libstdc++ make zlib + curl -sSLO https://dot.net/v1/dotnet-install.sh + chmod +x ./dotnet-install.sh + ./dotnet-install.sh --channel ${{ matrix.dotnet_version }} + fi + + - uses: actions/checkout@v2 + with: + fetch-depth: 0 + + - name: Sanity check + run: | + set -euo pipefail + PATH=$PATH:$HOME/.dotnet/ + + git config --global safe.directory "$GITHUB_WORKSPACE" + + make + mkdir -p no-reproducers + dotnet turkey/Turkey.dll no-reproducers + + - name: Run tests + run: | + set -euo pipefail + PATH=$PATH:$HOME/.dotnet/ + + make check + + reproducers: + name: Verify reproducers work + + runs-on: ubuntu-latest + + timeout-minutes: 30 + + strategy: + fail-fast: false + matrix: + container_image: + - quay.io/centos/centos:stream8 + - quay.io/centos/centos:stream9 + - registry.fedoraproject.org/fedora:37 + - registry.fedoraproject.org/fedora:38 + - registry.fedoraproject.org/fedora:39 + - registry.fedoraproject.org/fedora:rawhide + - registry.access.redhat.com/ubi8 + - registry.access.redhat.com/ubi9 + dotnet_version: + - "6.0" + - "7.0" + include: + - container_image: quay.io/centos/centos:stream9 + dotnet_version: "8.0" + + + container: + image: ${{ matrix.container_image }} + options: --security-opt seccomp=unconfined + + steps: + - name: Install build dependencies + timeout-minutes: 5 + run: | + set -euo pipefail + dnf install -y dotnet-sdk-${{ matrix.dotnet_version }} git make + + # We need to fetch the tags, so 'git tag' in 'make publish' below works + - uses: actions/checkout@v2 + with: + fetch-depth: 0 + + - name: Build test runner + timeout-minutes: 2 + run: | + set -euo pipefail + git config --global --add safe.directory $(pwd) + make publish + + - name: Get reproducers + run: | + set -euo pipefail + git clone https://github.com/redhat-developer/dotnet-regular-tests/ + + - name: Install Test dependencies + timeout-minutes: 2 + run: | + dnf install -y python3 wget \ + $(grep '^Dependencies(dnf): ' dotnet-regular-tests/README.md | cut -d: -f2-) \ + --skip-broken + + - name: Run reproducers + run: | + set -euo pipefail + ### HACK: Filter tests that can't pass in Containers + rm -r dotnet-regular-tests/debugging-sos-lldb* dotnet-regular-tests/createdump-aspnet dotnet-regular-tests/cgroup-limit + + ### HACK: UBI 8 is missing strace and bash-completion packages for these tests + if [[ ${{ matrix.container_image }} == *ubi* ]] ; then + rm -r dotnet-regular-tests/telemetry-is-off-by-default dotnet-regular-tests/bash-completion dotnet-regular-tests/system-data-odbc + fi + + dotnet --info + + dotnet turkey/Turkey.dll dotnet-regular-tests -v --timeout 600 + + - name: Show Logs + if: ${{ always() }} + run: | + set -euo pipefail + find -iname '*.log' -exec echo {} \; -exec cat {} \; diff -Nru dotnet8-8.0.103-8.0.3/debian/eng/test-runner/.github/workflows/release.yml dotnet8-8.0.103-8.0.3/debian/eng/test-runner/.github/workflows/release.yml --- dotnet8-8.0.103-8.0.3/debian/eng/test-runner/.github/workflows/release.yml 1970-01-01 00:00:00.000000000 +0000 +++ dotnet8-8.0.103-8.0.3/debian/eng/test-runner/.github/workflows/release.yml 2024-03-18 12:48:03.000000000 +0000 @@ -0,0 +1,75 @@ +name: Create a release when a tag is pushed + +on: + push: + tags: + - 'v*' # Push events matching v*, i.e. v1, v20 + + # Allow running this workflow manually from the Actions tab + workflow_dispatch: + +jobs: + build: + name: Build + runs-on: ubuntu-22.04 + + steps: + - name: Install dependencies + run: | + sudo apt-get install --assume-yes dotnet6 git make + + - uses: actions/checkout@v3 + with: + fetch-depth: 0 + ref: ${{ github.ref }} + + - name: Run tests and publish binaries + run: | + set -euo pipefail + git config --global --add safe.directory "$(pwd)" + make check + make publish + + - name: Upload build artifact + uses: actions/upload-artifact@v2 + with: + name: release-binaries + path: turkey.tar.gz + + release: + name: Create Release + runs-on: ubuntu-latest + + needs: Build + + steps: + + - name: Download build artifacts + uses: actions/download-artifact@v2 + with: + name: release-binaries + + - name: Create Release + id: create_release + uses: softprops/action-gh-release@v2 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # This token is provided by Actions, you do not need to create your own token + with: + tag_name: ${{ github.ref }} + name: Version ${{ github.ref }} + body: | + Changes in this Release + - First Change + - Second Change + draft: true + prerelease: false + + - name: Upload Release Asset + uses: actions/upload-release-asset@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + upload_url: ${{ steps.create_release.outputs.upload_url }} # This pulls from the CREATE RELEASE step above, referencing it's ID to get its outputs object, which include a `upload_url`. See this blog post for more info: https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps + asset_path: turkey.tar.gz + asset_name: turkey.tar.gz + asset_content_type: application/gzip diff -Nru dotnet8-8.0.103-8.0.3/debian/eng/test-runner/GIT_COMMIT_ID dotnet8-8.0.103-8.0.3/debian/eng/test-runner/GIT_COMMIT_ID --- dotnet8-8.0.103-8.0.3/debian/eng/test-runner/GIT_COMMIT_ID 1970-01-01 00:00:00.000000000 +0000 +++ dotnet8-8.0.103-8.0.3/debian/eng/test-runner/GIT_COMMIT_ID 2024-03-18 12:48:03.000000000 +0000 @@ -0,0 +1 @@ +c988ad2 diff -Nru dotnet8-8.0.103-8.0.3/debian/eng/test-runner/GIT_TAG_VERSION dotnet8-8.0.103-8.0.3/debian/eng/test-runner/GIT_TAG_VERSION --- dotnet8-8.0.103-8.0.3/debian/eng/test-runner/GIT_TAG_VERSION 1970-01-01 00:00:00.000000000 +0000 +++ dotnet8-8.0.103-8.0.3/debian/eng/test-runner/GIT_TAG_VERSION 2024-03-18 12:48:03.000000000 +0000 @@ -0,0 +1 @@ +1.0.0 diff -Nru dotnet8-8.0.103-8.0.3/debian/eng/test-runner/LICENSE.txt dotnet8-8.0.103-8.0.3/debian/eng/test-runner/LICENSE.txt --- dotnet8-8.0.103-8.0.3/debian/eng/test-runner/LICENSE.txt 1970-01-01 00:00:00.000000000 +0000 +++ dotnet8-8.0.103-8.0.3/debian/eng/test-runner/LICENSE.txt 2024-03-18 12:48:03.000000000 +0000 @@ -0,0 +1,502 @@ + GNU LESSER GENERAL PUBLIC LICENSE + Version 2.1, February 1999 + + Copyright (C) 1991, 1999 Free Software Foundation, Inc. + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + +[This is the first released version of the Lesser GPL. It also counts + as the successor of the GNU Library Public License, version 2, hence + the version number 2.1.] + + Preamble + + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +Licenses are intended to guarantee your freedom to share and change +free software--to make sure the software is free for all its users. + + This license, the Lesser General Public License, applies to some +specially designated software packages--typically libraries--of the +Free Software Foundation and other authors who decide to use it. You +can use it too, but we suggest you first think carefully about whether +this license or the ordinary General Public License is the better +strategy to use in any particular case, based on the explanations below. + + When we speak of free software, we are referring to freedom of use, +not price. Our General Public Licenses are designed to make sure that +you have the freedom to distribute copies of free software (and charge +for this service if you wish); that you receive source code or can get +it if you want it; that you can change the software and use pieces of +it in new free programs; and that you are informed that you can do +these things. + + To protect your rights, we need to make restrictions that forbid +distributors to deny you these rights or to ask you to surrender these +rights. These restrictions translate to certain responsibilities for +you if you distribute copies of the library or if you modify it. + + For example, if you distribute copies of the library, whether gratis +or for a fee, you must give the recipients all the rights that we gave +you. You must make sure that they, too, receive or can get the source +code. If you link other code with the library, you must provide +complete object files to the recipients, so that they can relink them +with the library after making changes to the library and recompiling +it. And you must show them these terms so they know their rights. + + We protect your rights with a two-step method: (1) we copyright the +library, and (2) we offer you this license, which gives you legal +permission to copy, distribute and/or modify the library. + + To protect each distributor, we want to make it very clear that +there is no warranty for the free library. Also, if the library is +modified by someone else and passed on, the recipients should know +that what they have is not the original version, so that the original +author's reputation will not be affected by problems that might be +introduced by others. + + Finally, software patents pose a constant threat to the existence of +any free program. We wish to make sure that a company cannot +effectively restrict the users of a free program by obtaining a +restrictive license from a patent holder. Therefore, we insist that +any patent license obtained for a version of the library must be +consistent with the full freedom of use specified in this license. + + Most GNU software, including some libraries, is covered by the +ordinary GNU General Public License. This license, the GNU Lesser +General Public License, applies to certain designated libraries, and +is quite different from the ordinary General Public License. We use +this license for certain libraries in order to permit linking those +libraries into non-free programs. + + When a program is linked with a library, whether statically or using +a shared library, the combination of the two is legally speaking a +combined work, a derivative of the original library. The ordinary +General Public License therefore permits such linking only if the +entire combination fits its criteria of freedom. The Lesser General +Public License permits more lax criteria for linking other code with +the library. + + We call this license the "Lesser" General Public License because it +does Less to protect the user's freedom than the ordinary General +Public License. It also provides other free software developers Less +of an advantage over competing non-free programs. These disadvantages +are the reason we use the ordinary General Public License for many +libraries. However, the Lesser license provides advantages in certain +special circumstances. + + For example, on rare occasions, there may be a special need to +encourage the widest possible use of a certain library, so that it becomes +a de-facto standard. To achieve this, non-free programs must be +allowed to use the library. A more frequent case is that a free +library does the same job as widely used non-free libraries. In this +case, there is little to gain by limiting the free library to free +software only, so we use the Lesser General Public License. + + In other cases, permission to use a particular library in non-free +programs enables a greater number of people to use a large body of +free software. For example, permission to use the GNU C Library in +non-free programs enables many more people to use the whole GNU +operating system, as well as its variant, the GNU/Linux operating +system. + + Although the Lesser General Public License is Less protective of the +users' freedom, it does ensure that the user of a program that is +linked with the Library has the freedom and the wherewithal to run +that program using a modified version of the Library. + + The precise terms and conditions for copying, distribution and +modification follow. Pay close attention to the difference between a +"work based on the library" and a "work that uses the library". The +former contains code derived from the library, whereas the latter must +be combined with the library in order to run. + + GNU LESSER GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License Agreement applies to any software library or other +program which contains a notice placed by the copyright holder or +other authorized party saying it may be distributed under the terms of +this Lesser General Public License (also called "this License"). +Each licensee is addressed as "you". + + A "library" means a collection of software functions and/or data +prepared so as to be conveniently linked with application programs +(which use some of those functions and data) to form executables. + + The "Library", below, refers to any such software library or work +which has been distributed under these terms. A "work based on the +Library" means either the Library or any derivative work under +copyright law: that is to say, a work containing the Library or a +portion of it, either verbatim or with modifications and/or translated +straightforwardly into another language. (Hereinafter, translation is +included without limitation in the term "modification".) + + "Source code" for a work means the preferred form of the work for +making modifications to it. For a library, complete source code means +all the source code for all modules it contains, plus any associated +interface definition files, plus the scripts used to control compilation +and installation of the library. + + Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running a program using the Library is not restricted, and output from +such a program is covered only if its contents constitute a work based +on the Library (independent of the use of the Library in a tool for +writing it). Whether that is true depends on what the Library does +and what the program that uses the Library does. + + 1. You may copy and distribute verbatim copies of the Library's +complete source code as you receive it, in any medium, provided that +you conspicuously and appropriately publish on each copy an +appropriate copyright notice and disclaimer of warranty; keep intact +all the notices that refer to this License and to the absence of any +warranty; and distribute a copy of this License along with the +Library. + + You may charge a fee for the physical act of transferring a copy, +and you may at your option offer warranty protection in exchange for a +fee. + + 2. You may modify your copy or copies of the Library or any portion +of it, thus forming a work based on the Library, and copy and +distribute such modifications or work under the terms of Section 1 +above, provided that you also meet all of these conditions: + + a) The modified work must itself be a software library. + + b) You must cause the files modified to carry prominent notices + stating that you changed the files and the date of any change. + + c) You must cause the whole of the work to be licensed at no + charge to all third parties under the terms of this License. + + d) If a facility in the modified Library refers to a function or a + table of data to be supplied by an application program that uses + the facility, other than as an argument passed when the facility + is invoked, then you must make a good faith effort to ensure that, + in the event an application does not supply such function or + table, the facility still operates, and performs whatever part of + its purpose remains meaningful. + + (For example, a function in a library to compute square roots has + a purpose that is entirely well-defined independent of the + application. Therefore, Subsection 2d requires that any + application-supplied function or table used by this function must + be optional: if the application does not supply it, the square + root function must still compute square roots.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Library, +and can be reasonably considered independent and separate works in +themselves, then this License, and its terms, do not apply to those +sections when you distribute them as separate works. But when you +distribute the same sections as part of a whole which is a work based +on the Library, the distribution of the whole must be on the terms of +this License, whose permissions for other licensees extend to the +entire whole, and thus to each and every part regardless of who wrote +it. + +Thus, it is not the intent of this section to claim rights or contest +your rights to work written entirely by you; rather, the intent is to +exercise the right to control the distribution of derivative or +collective works based on the Library. + +In addition, mere aggregation of another work not based on the Library +with the Library (or with a work based on the Library) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + + 3. You may opt to apply the terms of the ordinary GNU General Public +License instead of this License to a given copy of the Library. To do +this, you must alter all the notices that refer to this License, so +that they refer to the ordinary GNU General Public License, version 2, +instead of to this License. (If a newer version than version 2 of the +ordinary GNU General Public License has appeared, then you can specify +that version instead if you wish.) Do not make any other change in +these notices. + + Once this change is made in a given copy, it is irreversible for +that copy, so the ordinary GNU General Public License applies to all +subsequent copies and derivative works made from that copy. + + This option is useful when you wish to copy part of the code of +the Library into a program that is not a library. + + 4. You may copy and distribute the Library (or a portion or +derivative of it, under Section 2) in object code or executable form +under the terms of Sections 1 and 2 above provided that you accompany +it with the complete corresponding machine-readable source code, which +must be distributed under the terms of Sections 1 and 2 above on a +medium customarily used for software interchange. + + If distribution of object code is made by offering access to copy +from a designated place, then offering equivalent access to copy the +source code from the same place satisfies the requirement to +distribute the source code, even though third parties are not +compelled to copy the source along with the object code. + + 5. A program that contains no derivative of any portion of the +Library, but is designed to work with the Library by being compiled or +linked with it, is called a "work that uses the Library". Such a +work, in isolation, is not a derivative work of the Library, and +therefore falls outside the scope of this License. + + However, linking a "work that uses the Library" with the Library +creates an executable that is a derivative of the Library (because it +contains portions of the Library), rather than a "work that uses the +library". The executable is therefore covered by this License. +Section 6 states terms for distribution of such executables. + + When a "work that uses the Library" uses material from a header file +that is part of the Library, the object code for the work may be a +derivative work of the Library even though the source code is not. +Whether this is true is especially significant if the work can be +linked without the Library, or if the work is itself a library. The +threshold for this to be true is not precisely defined by law. + + If such an object file uses only numerical parameters, data +structure layouts and accessors, and small macros and small inline +functions (ten lines or less in length), then the use of the object +file is unrestricted, regardless of whether it is legally a derivative +work. (Executables containing this object code plus portions of the +Library will still fall under Section 6.) + + Otherwise, if the work is a derivative of the Library, you may +distribute the object code for the work under the terms of Section 6. +Any executables containing that work also fall under Section 6, +whether or not they are linked directly with the Library itself. + + 6. As an exception to the Sections above, you may also combine or +link a "work that uses the Library" with the Library to produce a +work containing portions of the Library, and distribute that work +under terms of your choice, provided that the terms permit +modification of the work for the customer's own use and reverse +engineering for debugging such modifications. + + You must give prominent notice with each copy of the work that the +Library is used in it and that the Library and its use are covered by +this License. You must supply a copy of this License. If the work +during execution displays copyright notices, you must include the +copyright notice for the Library among them, as well as a reference +directing the user to the copy of this License. Also, you must do one +of these things: + + a) Accompany the work with the complete corresponding + machine-readable source code for the Library including whatever + changes were used in the work (which must be distributed under + Sections 1 and 2 above); and, if the work is an executable linked + with the Library, with the complete machine-readable "work that + uses the Library", as object code and/or source code, so that the + user can modify the Library and then relink to produce a modified + executable containing the modified Library. (It is understood + that the user who changes the contents of definitions files in the + Library will not necessarily be able to recompile the application + to use the modified definitions.) + + b) Use a suitable shared library mechanism for linking with the + Library. A suitable mechanism is one that (1) uses at run time a + copy of the library already present on the user's computer system, + rather than copying library functions into the executable, and (2) + will operate properly with a modified version of the library, if + the user installs one, as long as the modified version is + interface-compatible with the version that the work was made with. + + c) Accompany the work with a written offer, valid for at + least three years, to give the same user the materials + specified in Subsection 6a, above, for a charge no more + than the cost of performing this distribution. + + d) If distribution of the work is made by offering access to copy + from a designated place, offer equivalent access to copy the above + specified materials from the same place. + + e) Verify that the user has already received a copy of these + materials or that you have already sent this user a copy. + + For an executable, the required form of the "work that uses the +Library" must include any data and utility programs needed for +reproducing the executable from it. However, as a special exception, +the materials to be distributed need not include anything that is +normally distributed (in either source or binary form) with the major +components (compiler, kernel, and so on) of the operating system on +which the executable runs, unless that component itself accompanies +the executable. + + It may happen that this requirement contradicts the license +restrictions of other proprietary libraries that do not normally +accompany the operating system. Such a contradiction means you cannot +use both them and the Library together in an executable that you +distribute. + + 7. You may place library facilities that are a work based on the +Library side-by-side in a single library together with other library +facilities not covered by this License, and distribute such a combined +library, provided that the separate distribution of the work based on +the Library and of the other library facilities is otherwise +permitted, and provided that you do these two things: + + a) Accompany the combined library with a copy of the same work + based on the Library, uncombined with any other library + facilities. This must be distributed under the terms of the + Sections above. + + b) Give prominent notice with the combined library of the fact + that part of it is a work based on the Library, and explaining + where to find the accompanying uncombined form of the same work. + + 8. You may not copy, modify, sublicense, link with, or distribute +the Library except as expressly provided under this License. Any +attempt otherwise to copy, modify, sublicense, link with, or +distribute the Library is void, and will automatically terminate your +rights under this License. However, parties who have received copies, +or rights, from you under this License will not have their licenses +terminated so long as such parties remain in full compliance. + + 9. You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Library or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Library (or any work based on the +Library), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Library or works based on it. + + 10. Each time you redistribute the Library (or any work based on the +Library), the recipient automatically receives a license from the +original licensor to copy, distribute, link with or modify the Library +subject to these terms and conditions. You may not impose any further +restrictions on the recipients' exercise of the rights granted herein. +You are not responsible for enforcing compliance by third parties with +this License. + + 11. If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot +distribute so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you +may not distribute the Library at all. For example, if a patent +license would not permit royalty-free redistribution of the Library by +all those who receive copies directly or indirectly through you, then +the only way you could satisfy both it and this License would be to +refrain entirely from distribution of the Library. + +If any portion of this section is held invalid or unenforceable under any +particular circumstance, the balance of the section is intended to apply, +and the section as a whole is intended to apply in other circumstances. + +It is not the purpose of this section to induce you to infringe any +patents or other property right claims or to contest validity of any +such claims; this section has the sole purpose of protecting the +integrity of the free software distribution system which is +implemented by public license practices. Many people have made +generous contributions to the wide range of software distributed +through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing +to distribute software through any other system and a licensee cannot +impose that choice. + +This section is intended to make thoroughly clear what is believed to +be a consequence of the rest of this License. + + 12. If the distribution and/or use of the Library is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Library under this License may add +an explicit geographical distribution limitation excluding those countries, +so that distribution is permitted only in or among countries not thus +excluded. In such case, this License incorporates the limitation as if +written in the body of this License. + + 13. The Free Software Foundation may publish revised and/or new +versions of the Lesser General Public License from time to time. +Such new versions will be similar in spirit to the present version, +but may differ in detail to address new problems or concerns. + +Each version is given a distinguishing version number. If the Library +specifies a version number of this License which applies to it and +"any later version", you have the option of following the terms and +conditions either of that version or of any later version published by +the Free Software Foundation. If the Library does not specify a +license version number, you may choose any version ever published by +the Free Software Foundation. + + 14. If you wish to incorporate parts of the Library into other free +programs whose distribution conditions are incompatible with these, +write to the author to ask for permission. For software which is +copyrighted by the Free Software Foundation, write to the Free +Software Foundation; we sometimes make exceptions for this. Our +decision will be guided by the two goals of preserving the free status +of all derivatives of our free software and of promoting the sharing +and reuse of software generally. + + NO WARRANTY + + 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO +WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. +EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR +OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY +KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE +LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME +THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN +WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY +AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU +FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR +CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE +LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING +RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A +FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF +SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH +DAMAGES. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Libraries + + If you develop a new library, and you want it to be of the greatest +possible use to the public, we recommend making it free software that +everyone can redistribute and change. You can do so by permitting +redistribution under these terms (or, alternatively, under the terms of the +ordinary General Public License). + + To apply these terms, attach the following notices to the library. It is +safest to attach them to the start of each source file to most effectively +convey the exclusion of warranty; and each file should have at least the +"copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + +Also add information on how to contact you by electronic and paper mail. + +You should also get your employer (if you work as a programmer) or your +school, if any, to sign a "copyright disclaimer" for the library, if +necessary. Here is a sample; alter the names: + + Yoyodyne, Inc., hereby disclaims all copyright interest in the + library `Frob' (a library for tweaking knobs) written by James Random Hacker. + + , 1 April 1990 + Ty Coon, President of Vice + +That's all there is to it! diff -Nru dotnet8-8.0.103-8.0.3/debian/eng/test-runner/Makefile dotnet8-8.0.103-8.0.3/debian/eng/test-runner/Makefile --- dotnet8-8.0.103-8.0.3/debian/eng/test-runner/Makefile 1970-01-01 00:00:00.000000000 +0000 +++ dotnet8-8.0.103-8.0.3/debian/eng/test-runner/Makefile 2024-03-18 12:48:03.000000000 +0000 @@ -0,0 +1,62 @@ +CONFIGURATION:=Release +ARCH:=$(subst aarch64,arm64,$(subst x86_64,x64,$(shell uname -m))) +RUNTIME:=linux-$(ARCH) +FRAMEWORK:=net6.0 + +# Building Turkey with a source-built .NET SDK may fail if that SDK references a version for TargetFramework +# that is not yet released. Setting TargetBundledFramework to 'true' enables building with such SDKs by using +# the bundled framework instead. +ifeq ("${TargetBundledFramework}", "true") + ifndef BundledNETCoreAppTargetFrameworkVersion + $(error "BundledNETCoreAppTargetFrameworkVersion is not set") + endif + + FRAMEWORK:="net${BundledNETCoreAppTargetFrameworkVersion}" +endif + +all: publish + +f: + @echo "$(FRAMEWORK)" + +check: + dotnet test -f $(FRAMEWORK) -c Release --verbosity detailed Turkey.Tests + +run-samples: + rm -rf ~/.nuget.orig && mv ~/.nuget ~/.nuget.orig && mkdir -p ~/.nuget + cd Samples && test -f ../turkey/Turkey.dll && (dotnet ../turkey/Turkey.dll || true) + rm -rf ~/.nuget && mv ~/.nuget.orig ~/.nuget + +GIT_COMMIT_ID: + git rev-parse --short HEAD > GIT_COMMIT_ID + +GIT_TAG_VERSION: + git describe --abbrev=0 | sed -e 's/^v//' > GIT_TAG_VERSION + +publish: GIT_COMMIT_ID GIT_TAG_VERSION + cat GIT_COMMIT_ID + cat GIT_TAG_VERSION + (cd Turkey; \ + dotnet publish \ + -f $(FRAMEWORK) \ + -c $(CONFIGURATION) \ + -p:VersionPrefix=$$(cat ../GIT_TAG_VERSION) \ + -p:VersionSuffix=$$(cat ../GIT_COMMIT_ID) \ + -o $$(readlink -f $$(pwd)/../turkey)) + tar czf turkey.tar.gz turkey/ + +clean: + rm -f GIT_COMMIT_ID GIT_TAG_VERSION + rm -rf Turkey/bin Turkey/obj + rm -rf Turkey.Tests/bin Turkey.Tests/obj + rm -rf bin + rm -rf turkey turkey.tar.gz + find -iname '*.log' -delete + +fix-line-endings: + find -iname '*.cs' -exec dos2unix {} \; + find -iname '*.csproj' -exec dos2unix {} \; + find -iname 'nuget.config' -exec dos2unix {} \; + +list-todos: + grep -r -E 'TODO|FIXME' * diff -Nru dotnet8-8.0.103-8.0.3/debian/eng/test-runner/README.md dotnet8-8.0.103-8.0.3/debian/eng/test-runner/README.md --- dotnet8-8.0.103-8.0.3/debian/eng/test-runner/README.md 1970-01-01 00:00:00.000000000 +0000 +++ dotnet8-8.0.103-8.0.3/debian/eng/test-runner/README.md 2024-03-18 12:48:03.000000000 +0000 @@ -0,0 +1,272 @@ +# Turkey + +This is a test runner for running integration/regression tests for a +.NET SDK and Runtime on Linux. + +It uses the same format for identifying, selecting and running tests +as [dotnet-bunny](https://github.com/redhat-developer/dotnet-bunny/). + +It produces results in various forms, including a junit-compatible xml file. + +# Supported Platforms and Architectures + +This is fully usable on GNU libc-based and musl libc-based Linux distributions. + +This is used by Canonical to run .NET tests on Ubuntu on multiple architectures +including 64-bit ARM (`aarch64`), Intel x86_64 (`x86_64`). + +# Building + +Use the following command to build the `turkey` program and place it in the +`bin/` directory. + + make + +# Running Tests + +If you have a directory containing tests, you can run them via +running `dotnet turkey/Turkey.dll`. For example: + + $ dotnet turkey/Turkey.dll Samples + BashTestSpecificToDotNet2x [PASS] + BashTestSpecificToDotNet50 [SKIP] + DisabledBashTest [SKIP] + ... + +See `dotnet turkey/Turkey.dll --help` for more information on how to +select and run tests and how to show the test output. + +To get output compatible with (the old) `dotnet-bunny`, use `dotnet +turkey/Turkey.dll --compatible` + +A real example of a test-suite to use with this framework is: +https://github.com/canonical/dotnet-regular-tests/ + +# Writing Tests + +Two different types of tests are supported: xunit-style tests that are +executed with `dotnet test` and bash scripts that are executed directly. + +Each test must be stored in a unique directory. The test must contain +a `test.json` file. An example of this file: + + { + "name": "CVE-2018-0875", + "enabled": true, + "requiresSdk": true, + "version": "2.0", + "versionSpecific": false, + "type": "xunit", + "cleanup": true, + "timeoutMultiplier": 1.0, + "ignoredRIDs": [ + "fedora", + "fedora.29", + "fedora.34-s390x", + "rhel.7", + "rhel.7-arm64" + ], + "skipWhen": [ + "blue", + "os=fedora,arch=x64" + ] + } + +The `type` specifies how the test is executed. + +## Test Configuration Syntax + +`test.json` needs to be a `json` file containing a json object with +the following keys: + +- `name` + + The name of the test. It must be the same as the name of the + directory containing the test. + +- `enabled` + + Indicates whether a test is enabled. Useful for disabling specific + tests that are causing issues. + +- `requiresSdk` + + Indicates whether a test requires SDK to be installed. If false + the test will run even when there is no SDK present. + +- `version` + + The version of .NET Core runtime that this test is valid for. It can + be a complete major/minor version like `2.1` or a wildcard like + `1.x`. Unless `versionSpecific` is also set, this test will be + executed on all versions equal to or greater than the specified + version. For example, setting `version` to `2.0` will result in + tests being executed under .NET Core versions 2.0, 2.1, 3.0, and 5.0 + but not under 1.1. + +- `versionSpecific` + + If set, this test will only be executed if the .NET Core version + matches the version specified in `version`. + + For example, if `version` is `2.0` and `versionSpecific` is `true`, + the test will only be executed for .NET Core 2.0, not for 2.1, 1.1 + or 3.0. + + It is often useful to have a wildcard version with this. For + example, `version` of `1.x` and `versionSpecific` of `true`, means + that the tests will only be executed on .NET Core 1.0 and 1.1, and + on no other versions. + +- `type` + + Tests can be one of two `type`s: `xunit` or `bash`. `xunit` tests + are executed by running `dotnet test`. `bash` tests are executed by + executing a `test.sh` file directly. + +- `cleanup` + + Specifies whether directories like `obj` and `bin` should be deleted + before running the test. + +- `ignoredRIDs` + + This is a list of runtime-ids or platform names (optionally followed + by the version) where this test is invalid. The test will be skipped + on those platforms. + + Examples: + + - `["linux-arm64"]`: skip this test on `arm64` (aka `aarch64`) + - `["fedora"]`: skip this test on all Fedora platforms + - `["rhel.7"]` or `["rhel7"]`: skip this test on RHEL 7, but not on RHEL 8, or another RHEL version + - `["rhel.8-arm64"]`: skip this test on RHEL 8 on arm64 + + See https://docs.microsoft.com/en-us/dotnet/core/rid-catalog for + more details. Not all the RIDs are fully supported yet. + +- `skipWhen` + +This is a list of conditions. If one (or more) conditions in the list +match the test environment, then the test is skipped. + +A condition is a combination of traits separated by commas. + +The test runner injects a few traits based on the system. +Additional traits can be added using the `--trait` flag. + +Example: + +A test with the following `skipWhen` will be skipped if the +trait `blue` is set, or both `os=fedora` and `arch=x64` are set. + +``` + "skipWhen": [ + "blue", + "os=fedora,arch=x64" + ] +``` + +- `timeoutMultiplier` + +This is a number, that scales the default timeout for a specific test. +The default timeout can be set through the command-line `--timeout` +argument. + +Example: + +A test with the following `timeoutMultiplier` will be allowed to take twice +as long. + +``` + "timeoutMultiplier": 2.0 +``` + +## Notes on Writing Tests + +Some notes for writing tests: + +- The first argument passed to a `test.sh` is the version number of + .NET Core that's being tested. + +- All tests are run with the current working directory set to a + directory where all the test files are present. This may not be the + original directory of the tests, but a copy instead. + +- Tests should try and complete as quickly as possible. Long running + tests may hit a timeout and be marked as failed. + +- Tests are executed in multiple environments. Sometimes they are run + by the root user (eg, GitHub Actions) and sometimes as non-root (eg, + by devs working on tests). A test should make every effort to work + in both environments. It must not rely on being run as root. + + If a feature must be verified as non-root and the test is being run + by the root user, consider creating a `testrunner` user and `su`-ing + to that for the specific test. + +# Project Conventions + +- All warnings are displayed as: + + WARNING: foo bar baz + +# Releasing + +1. Tag the release + + $ git tag -a v# --sign + + Replease `#` with the real release version. Generally, use the previous + release version + 1. For example, if the last tag was `v99`, use `v100`. + + This produces a signed and annotated tag. Feel free to add details about the + release to the annotation. + + Signing requires a gpg key. If you don't have one, you can omit `--sign`. + +2. Push the tags to GitHub + + $ git push --tags remote-name + + OR, better: + + $ git push remote-name tag-name + +3. GitHub Actions will create a draft release corresponding to the tag. + + It will also attach the `turkey.tar.gz` release tarball to the release. + + Many tools use `wget + https://github.com/canonical/dotnet-test-runner/releases/latest/download/turkey.tar.gz` + to get the latest release. This keeps them working. + +4. Publish the release in GitHub + + 1. Select the tag created in step 1 + + 2. Write release notes + + 3. Publish the release + +# TODO + +- Do not modify original source files for xunit tests + +# License + +Copyright (C) 2024 Canonical Ltd. + +This library is free software; you can redistribute it and/or +modify it under the terms of the GNU Lesser General Public +License as published by the Free Software Foundation; either +version 2.1 of the License, or (at your option) any later version. + +This library is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +Lesser General Public License for more details. + +You should have received a copy of the GNU Lesser General Public +License along with this library; if not, write to the Free Software +Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA diff -Nru dotnet8-8.0.103-8.0.3/debian/eng/test-runner/Samples/BashTestSpecificToDotNet2x/test.json dotnet8-8.0.103-8.0.3/debian/eng/test-runner/Samples/BashTestSpecificToDotNet2x/test.json --- dotnet8-8.0.103-8.0.3/debian/eng/test-runner/Samples/BashTestSpecificToDotNet2x/test.json 1970-01-01 00:00:00.000000000 +0000 +++ dotnet8-8.0.103-8.0.3/debian/eng/test-runner/Samples/BashTestSpecificToDotNet2x/test.json 2024-03-18 12:48:03.000000000 +0000 @@ -0,0 +1,12 @@ +{ + "name": "BashTestSpecificToDotNet2x", + "enabled": true, + "requiresSdk": true, + "version": "2.x", + "versionSpecific": true, + "type": "bash", + "cleanup": true, + "ignoredRIDs":[ + ] +} + diff -Nru dotnet8-8.0.103-8.0.3/debian/eng/test-runner/Samples/BashTestSpecificToDotNet2x/test.sh dotnet8-8.0.103-8.0.3/debian/eng/test-runner/Samples/BashTestSpecificToDotNet2x/test.sh --- dotnet8-8.0.103-8.0.3/debian/eng/test-runner/Samples/BashTestSpecificToDotNet2x/test.sh 1970-01-01 00:00:00.000000000 +0000 +++ dotnet8-8.0.103-8.0.3/debian/eng/test-runner/Samples/BashTestSpecificToDotNet2x/test.sh 2024-03-18 12:48:03.000000000 +0000 @@ -0,0 +1,3 @@ +#!/bin/bash + +true diff -Nru dotnet8-8.0.103-8.0.3/debian/eng/test-runner/Samples/BashTestSpecificToDotNet50/test.json dotnet8-8.0.103-8.0.3/debian/eng/test-runner/Samples/BashTestSpecificToDotNet50/test.json --- dotnet8-8.0.103-8.0.3/debian/eng/test-runner/Samples/BashTestSpecificToDotNet50/test.json 1970-01-01 00:00:00.000000000 +0000 +++ dotnet8-8.0.103-8.0.3/debian/eng/test-runner/Samples/BashTestSpecificToDotNet50/test.json 2024-03-18 12:48:03.000000000 +0000 @@ -0,0 +1,12 @@ +{ + "name": "BashTestSpecificToDotNet50", + "enabled": true, + "requiresSdk": true, + "version": "50.0", + "versionSpecific": true, + "type": "bash", + "cleanup": true, + "ignoredRIDs":[ + ] +} + diff -Nru dotnet8-8.0.103-8.0.3/debian/eng/test-runner/Samples/BashTestSpecificToDotNet50/test.sh dotnet8-8.0.103-8.0.3/debian/eng/test-runner/Samples/BashTestSpecificToDotNet50/test.sh --- dotnet8-8.0.103-8.0.3/debian/eng/test-runner/Samples/BashTestSpecificToDotNet50/test.sh 1970-01-01 00:00:00.000000000 +0000 +++ dotnet8-8.0.103-8.0.3/debian/eng/test-runner/Samples/BashTestSpecificToDotNet50/test.sh 2024-03-18 12:48:03.000000000 +0000 @@ -0,0 +1,3 @@ +#!/bin/bash + +false diff -Nru dotnet8-8.0.103-8.0.3/debian/eng/test-runner/Samples/DisabledBashTest/test.json dotnet8-8.0.103-8.0.3/debian/eng/test-runner/Samples/DisabledBashTest/test.json --- dotnet8-8.0.103-8.0.3/debian/eng/test-runner/Samples/DisabledBashTest/test.json 1970-01-01 00:00:00.000000000 +0000 +++ dotnet8-8.0.103-8.0.3/debian/eng/test-runner/Samples/DisabledBashTest/test.json 2024-03-18 12:48:03.000000000 +0000 @@ -0,0 +1,12 @@ +{ + "name": "DisabledBashTest", + "enabled": false, + "requiresSdk": true, + "version": "1.x", + "versionSpecific": false, + "type": "bash", + "cleanup": true, + "ignoredRIDs":[ + ] +} + diff -Nru dotnet8-8.0.103-8.0.3/debian/eng/test-runner/Samples/FailingBashTest/test.json dotnet8-8.0.103-8.0.3/debian/eng/test-runner/Samples/FailingBashTest/test.json --- dotnet8-8.0.103-8.0.3/debian/eng/test-runner/Samples/FailingBashTest/test.json 1970-01-01 00:00:00.000000000 +0000 +++ dotnet8-8.0.103-8.0.3/debian/eng/test-runner/Samples/FailingBashTest/test.json 2024-03-18 12:48:03.000000000 +0000 @@ -0,0 +1,12 @@ +{ + "name": "FailingBashTest", + "enabled": true, + "requiresSdk": true, + "version": "1.0", + "versionSpecific": false, + "type": "bash", + "cleanup": true, + "ignoredRIDs":[ + ] +} + diff -Nru dotnet8-8.0.103-8.0.3/debian/eng/test-runner/Samples/FailingBashTest/test.sh dotnet8-8.0.103-8.0.3/debian/eng/test-runner/Samples/FailingBashTest/test.sh --- dotnet8-8.0.103-8.0.3/debian/eng/test-runner/Samples/FailingBashTest/test.sh 1970-01-01 00:00:00.000000000 +0000 +++ dotnet8-8.0.103-8.0.3/debian/eng/test-runner/Samples/FailingBashTest/test.sh 2024-03-18 12:48:03.000000000 +0000 @@ -0,0 +1,9 @@ +#!/bin/bash + +echo "${@}" + +echo "false" + +echo "true" + +false diff -Nru dotnet8-8.0.103-8.0.3/debian/eng/test-runner/Samples/FailingXUnitTest/FailingXUnitTest.cs dotnet8-8.0.103-8.0.3/debian/eng/test-runner/Samples/FailingXUnitTest/FailingXUnitTest.cs --- dotnet8-8.0.103-8.0.3/debian/eng/test-runner/Samples/FailingXUnitTest/FailingXUnitTest.cs 1970-01-01 00:00:00.000000000 +0000 +++ dotnet8-8.0.103-8.0.3/debian/eng/test-runner/Samples/FailingXUnitTest/FailingXUnitTest.cs 2024-03-18 12:48:03.000000000 +0000 @@ -0,0 +1,14 @@ +using System; +using Xunit; + +namespace Samples +{ + public class FailingXUnitTest + { + [Fact] + public void Test1() + { + Assert.True(false); + } + } +} diff -Nru dotnet8-8.0.103-8.0.3/debian/eng/test-runner/Samples/FailingXUnitTest/FailingXUnitTest.csproj dotnet8-8.0.103-8.0.3/debian/eng/test-runner/Samples/FailingXUnitTest/FailingXUnitTest.csproj --- dotnet8-8.0.103-8.0.3/debian/eng/test-runner/Samples/FailingXUnitTest/FailingXUnitTest.csproj 1970-01-01 00:00:00.000000000 +0000 +++ dotnet8-8.0.103-8.0.3/debian/eng/test-runner/Samples/FailingXUnitTest/FailingXUnitTest.csproj 2024-03-18 12:48:03.000000000 +0000 @@ -0,0 +1,17 @@ + + + + true + net6.0 + + false + + + + + + + + + + diff -Nru dotnet8-8.0.103-8.0.3/debian/eng/test-runner/Samples/FailingXUnitTest/test.json dotnet8-8.0.103-8.0.3/debian/eng/test-runner/Samples/FailingXUnitTest/test.json --- dotnet8-8.0.103-8.0.3/debian/eng/test-runner/Samples/FailingXUnitTest/test.json 1970-01-01 00:00:00.000000000 +0000 +++ dotnet8-8.0.103-8.0.3/debian/eng/test-runner/Samples/FailingXUnitTest/test.json 2024-03-18 12:48:03.000000000 +0000 @@ -0,0 +1,12 @@ +{ + "name": "FailingXUnitTest", + "enabled": true, + "requiresSdk": true, + "version": "1.0", + "versionSpecific": false, + "type": "xunit", + "cleanup": true, + "ignoredRIDs":[ + ] +} + diff -Nru dotnet8-8.0.103-8.0.3/debian/eng/test-runner/Samples/NonAlpineBashTest/test.json dotnet8-8.0.103-8.0.3/debian/eng/test-runner/Samples/NonAlpineBashTest/test.json --- dotnet8-8.0.103-8.0.3/debian/eng/test-runner/Samples/NonAlpineBashTest/test.json 1970-01-01 00:00:00.000000000 +0000 +++ dotnet8-8.0.103-8.0.3/debian/eng/test-runner/Samples/NonAlpineBashTest/test.json 2024-03-18 12:48:03.000000000 +0000 @@ -0,0 +1,13 @@ +{ + "name": "NonAlpineBashTest", + "enabled": true, + "requiresSdk": true, + "version": "1.0", + "versionSpecific": false, + "type": "bash", + "cleanup": true, + "ignoredRIDs":[ + "alpine" + ] +} + diff -Nru dotnet8-8.0.103-8.0.3/debian/eng/test-runner/Samples/NonAlpineBashTest/test.sh dotnet8-8.0.103-8.0.3/debian/eng/test-runner/Samples/NonAlpineBashTest/test.sh --- dotnet8-8.0.103-8.0.3/debian/eng/test-runner/Samples/NonAlpineBashTest/test.sh 1970-01-01 00:00:00.000000000 +0000 +++ dotnet8-8.0.103-8.0.3/debian/eng/test-runner/Samples/NonAlpineBashTest/test.sh 2024-03-18 12:48:03.000000000 +0000 @@ -0,0 +1,5 @@ +#!/bin/bash + +echo "${@}" + +true diff -Nru dotnet8-8.0.103-8.0.3/debian/eng/test-runner/Samples/NonFedoraBashTest/test.json dotnet8-8.0.103-8.0.3/debian/eng/test-runner/Samples/NonFedoraBashTest/test.json --- dotnet8-8.0.103-8.0.3/debian/eng/test-runner/Samples/NonFedoraBashTest/test.json 1970-01-01 00:00:00.000000000 +0000 +++ dotnet8-8.0.103-8.0.3/debian/eng/test-runner/Samples/NonFedoraBashTest/test.json 2024-03-18 12:48:03.000000000 +0000 @@ -0,0 +1,13 @@ +{ + "name": "NonFedoraBashTest", + "enabled": true, + "requiresSdk": true, + "version": "1.0", + "versionSpecific": false, + "type": "bash", + "cleanup": true, + "ignoredRIDs":[ + "fedora" + ] +} + diff -Nru dotnet8-8.0.103-8.0.3/debian/eng/test-runner/Samples/NonFedoraBashTest/test.sh dotnet8-8.0.103-8.0.3/debian/eng/test-runner/Samples/NonFedoraBashTest/test.sh --- dotnet8-8.0.103-8.0.3/debian/eng/test-runner/Samples/NonFedoraBashTest/test.sh 1970-01-01 00:00:00.000000000 +0000 +++ dotnet8-8.0.103-8.0.3/debian/eng/test-runner/Samples/NonFedoraBashTest/test.sh 2024-03-18 12:48:03.000000000 +0000 @@ -0,0 +1,5 @@ +#!/bin/bash + +echo "${@}" + +true diff -Nru dotnet8-8.0.103-8.0.3/debian/eng/test-runner/Samples/NonRHELBashTest/test.json dotnet8-8.0.103-8.0.3/debian/eng/test-runner/Samples/NonRHELBashTest/test.json --- dotnet8-8.0.103-8.0.3/debian/eng/test-runner/Samples/NonRHELBashTest/test.json 1970-01-01 00:00:00.000000000 +0000 +++ dotnet8-8.0.103-8.0.3/debian/eng/test-runner/Samples/NonRHELBashTest/test.json 2024-03-18 12:48:03.000000000 +0000 @@ -0,0 +1,13 @@ +{ + "name": "NonRHELBashTest", + "enabled": true, + "requiresSdk": true, + "version": "1.0", + "versionSpecific": false, + "type": "bash", + "cleanup": true, + "ignoredRIDs":[ + "rhel" + ] +} + diff -Nru dotnet8-8.0.103-8.0.3/debian/eng/test-runner/Samples/NonRHELBashTest/test.sh dotnet8-8.0.103-8.0.3/debian/eng/test-runner/Samples/NonRHELBashTest/test.sh --- dotnet8-8.0.103-8.0.3/debian/eng/test-runner/Samples/NonRHELBashTest/test.sh 1970-01-01 00:00:00.000000000 +0000 +++ dotnet8-8.0.103-8.0.3/debian/eng/test-runner/Samples/NonRHELBashTest/test.sh 2024-03-18 12:48:03.000000000 +0000 @@ -0,0 +1,5 @@ +#!/bin/bash + +echo "${@}" + +true diff -Nru dotnet8-8.0.103-8.0.3/debian/eng/test-runner/Samples/NonX64Test/test.json dotnet8-8.0.103-8.0.3/debian/eng/test-runner/Samples/NonX64Test/test.json --- dotnet8-8.0.103-8.0.3/debian/eng/test-runner/Samples/NonX64Test/test.json 1970-01-01 00:00:00.000000000 +0000 +++ dotnet8-8.0.103-8.0.3/debian/eng/test-runner/Samples/NonX64Test/test.json 2024-03-18 12:48:03.000000000 +0000 @@ -0,0 +1,13 @@ +{ + "name": "NonX64Test", + "enabled": true, + "requiresSdk": true, + "version": "1.0", + "versionSpecific": false, + "type": "bash", + "cleanup": true, + "ignoredRIDs":[ + "linux-x64" + ] +} + diff -Nru dotnet8-8.0.103-8.0.3/debian/eng/test-runner/Samples/NonX64Test/test.sh dotnet8-8.0.103-8.0.3/debian/eng/test-runner/Samples/NonX64Test/test.sh --- dotnet8-8.0.103-8.0.3/debian/eng/test-runner/Samples/NonX64Test/test.sh 1970-01-01 00:00:00.000000000 +0000 +++ dotnet8-8.0.103-8.0.3/debian/eng/test-runner/Samples/NonX64Test/test.sh 2024-03-18 12:48:03.000000000 +0000 @@ -0,0 +1,5 @@ +#!/bin/bash + +echo "${@}" + +true diff -Nru dotnet8-8.0.103-8.0.3/debian/eng/test-runner/Samples/PassingBashTest/test.json dotnet8-8.0.103-8.0.3/debian/eng/test-runner/Samples/PassingBashTest/test.json --- dotnet8-8.0.103-8.0.3/debian/eng/test-runner/Samples/PassingBashTest/test.json 1970-01-01 00:00:00.000000000 +0000 +++ dotnet8-8.0.103-8.0.3/debian/eng/test-runner/Samples/PassingBashTest/test.json 2024-03-18 12:48:03.000000000 +0000 @@ -0,0 +1,12 @@ +{ + "name": "PassingBashTest", + "enabled": true, + "requiresSdk": true, + "version": "1.0", + "versionSpecific": false, + "type": "bash", + "cleanup": true, + "ignoredRIDs":[ + ] +} + diff -Nru dotnet8-8.0.103-8.0.3/debian/eng/test-runner/Samples/PassingBashTest/test.sh dotnet8-8.0.103-8.0.3/debian/eng/test-runner/Samples/PassingBashTest/test.sh --- dotnet8-8.0.103-8.0.3/debian/eng/test-runner/Samples/PassingBashTest/test.sh 1970-01-01 00:00:00.000000000 +0000 +++ dotnet8-8.0.103-8.0.3/debian/eng/test-runner/Samples/PassingBashTest/test.sh 2024-03-18 12:48:03.000000000 +0000 @@ -0,0 +1,9 @@ +#!/bin/bash + +echo "${@}" + +echo "false" + +echo "true" + +true diff -Nru dotnet8-8.0.103-8.0.3/debian/eng/test-runner/Samples/PassingBashTestWithEnvironmentVariables/test.json dotnet8-8.0.103-8.0.3/debian/eng/test-runner/Samples/PassingBashTestWithEnvironmentVariables/test.json --- dotnet8-8.0.103-8.0.3/debian/eng/test-runner/Samples/PassingBashTestWithEnvironmentVariables/test.json 1970-01-01 00:00:00.000000000 +0000 +++ dotnet8-8.0.103-8.0.3/debian/eng/test-runner/Samples/PassingBashTestWithEnvironmentVariables/test.json 2024-03-18 12:48:03.000000000 +0000 @@ -0,0 +1,12 @@ +{ + "name": "PassingBashTestWithEnvironmentVariables", + "enabled": true, + "requiresSdk": true, + "version": "1.0", + "versionSpecific": false, + "type": "bash", + "cleanup": true, + "ignoredRIDs":[ + ] +} + diff -Nru dotnet8-8.0.103-8.0.3/debian/eng/test-runner/Samples/PassingBashTestWithEnvironmentVariables/test.sh dotnet8-8.0.103-8.0.3/debian/eng/test-runner/Samples/PassingBashTestWithEnvironmentVariables/test.sh --- dotnet8-8.0.103-8.0.3/debian/eng/test-runner/Samples/PassingBashTestWithEnvironmentVariables/test.sh 1970-01-01 00:00:00.000000000 +0000 +++ dotnet8-8.0.103-8.0.3/debian/eng/test-runner/Samples/PassingBashTestWithEnvironmentVariables/test.sh 2024-03-18 12:48:03.000000000 +0000 @@ -0,0 +1,8 @@ +#!/bin/bash + +env + +if [[ -n "${OPENSSL_CONF}" ]]; then + echo "error: OPENSSL_CONF should never be set" + exit 1 +fi diff -Nru dotnet8-8.0.103-8.0.3/debian/eng/test-runner/Samples/PassingXUnitTest/PassingXUnitTest.cs dotnet8-8.0.103-8.0.3/debian/eng/test-runner/Samples/PassingXUnitTest/PassingXUnitTest.cs --- dotnet8-8.0.103-8.0.3/debian/eng/test-runner/Samples/PassingXUnitTest/PassingXUnitTest.cs 1970-01-01 00:00:00.000000000 +0000 +++ dotnet8-8.0.103-8.0.3/debian/eng/test-runner/Samples/PassingXUnitTest/PassingXUnitTest.cs 2024-03-18 12:48:03.000000000 +0000 @@ -0,0 +1,14 @@ +using System; +using Xunit; + +namespace Samples +{ + public class PassingXUnitTest + { + [Fact] + public void Test1() + { + Assert.True(true); + } + } +} diff -Nru dotnet8-8.0.103-8.0.3/debian/eng/test-runner/Samples/PassingXUnitTest/PassingXUnitTest.csproj dotnet8-8.0.103-8.0.3/debian/eng/test-runner/Samples/PassingXUnitTest/PassingXUnitTest.csproj --- dotnet8-8.0.103-8.0.3/debian/eng/test-runner/Samples/PassingXUnitTest/PassingXUnitTest.csproj 1970-01-01 00:00:00.000000000 +0000 +++ dotnet8-8.0.103-8.0.3/debian/eng/test-runner/Samples/PassingXUnitTest/PassingXUnitTest.csproj 2024-03-18 12:48:03.000000000 +0000 @@ -0,0 +1,17 @@ + + + + true + net6.0 + + false + + + + + + + + + + diff -Nru dotnet8-8.0.103-8.0.3/debian/eng/test-runner/Samples/PassingXUnitTest/test.json dotnet8-8.0.103-8.0.3/debian/eng/test-runner/Samples/PassingXUnitTest/test.json --- dotnet8-8.0.103-8.0.3/debian/eng/test-runner/Samples/PassingXUnitTest/test.json 1970-01-01 00:00:00.000000000 +0000 +++ dotnet8-8.0.103-8.0.3/debian/eng/test-runner/Samples/PassingXUnitTest/test.json 2024-03-18 12:48:03.000000000 +0000 @@ -0,0 +1,12 @@ +{ + "name": "PassingXUnitTest", + "enabled": true, + "requiresSdk": true, + "version": "1.0", + "versionSpecific": false, + "type": "xunit", + "cleanup": true, + "ignoredRIDs":[ + ] +} + diff -Nru dotnet8-8.0.103-8.0.3/debian/eng/test-runner/Samples/PassingXUnitTestWithEnvironmentVariables/PassingXUnitTestWithEnvironmentVariables.cs dotnet8-8.0.103-8.0.3/debian/eng/test-runner/Samples/PassingXUnitTestWithEnvironmentVariables/PassingXUnitTestWithEnvironmentVariables.cs --- dotnet8-8.0.103-8.0.3/debian/eng/test-runner/Samples/PassingXUnitTestWithEnvironmentVariables/PassingXUnitTestWithEnvironmentVariables.cs 1970-01-01 00:00:00.000000000 +0000 +++ dotnet8-8.0.103-8.0.3/debian/eng/test-runner/Samples/PassingXUnitTestWithEnvironmentVariables/PassingXUnitTestWithEnvironmentVariables.cs 2024-03-18 12:48:03.000000000 +0000 @@ -0,0 +1,14 @@ +using System; +using Xunit; + +namespace Samples +{ + public class PassingXUnitTestWithEnvironmentVariables + { + [Fact] + public void Test1() + { + Assert.Null(Environment.GetEnvironmentVariable("OPENSSL_CONF")); + } + } +} diff -Nru dotnet8-8.0.103-8.0.3/debian/eng/test-runner/Samples/PassingXUnitTestWithEnvironmentVariables/PassingXUnitTestWithEnvironmentVariables.csproj dotnet8-8.0.103-8.0.3/debian/eng/test-runner/Samples/PassingXUnitTestWithEnvironmentVariables/PassingXUnitTestWithEnvironmentVariables.csproj --- dotnet8-8.0.103-8.0.3/debian/eng/test-runner/Samples/PassingXUnitTestWithEnvironmentVariables/PassingXUnitTestWithEnvironmentVariables.csproj 1970-01-01 00:00:00.000000000 +0000 +++ dotnet8-8.0.103-8.0.3/debian/eng/test-runner/Samples/PassingXUnitTestWithEnvironmentVariables/PassingXUnitTestWithEnvironmentVariables.csproj 2024-03-18 12:48:03.000000000 +0000 @@ -0,0 +1,17 @@ + + + + true + net6.0 + + false + + + + + + + + + + diff -Nru dotnet8-8.0.103-8.0.3/debian/eng/test-runner/Samples/PassingXUnitTestWithEnvironmentVariables/test.json dotnet8-8.0.103-8.0.3/debian/eng/test-runner/Samples/PassingXUnitTestWithEnvironmentVariables/test.json --- dotnet8-8.0.103-8.0.3/debian/eng/test-runner/Samples/PassingXUnitTestWithEnvironmentVariables/test.json 1970-01-01 00:00:00.000000000 +0000 +++ dotnet8-8.0.103-8.0.3/debian/eng/test-runner/Samples/PassingXUnitTestWithEnvironmentVariables/test.json 2024-03-18 12:48:03.000000000 +0000 @@ -0,0 +1,12 @@ +{ + "name": "PassingXUnitTestWithEnvironmentVariables", + "enabled": true, + "requiresSdk": true, + "version": "1.0", + "versionSpecific": false, + "type": "xunit", + "cleanup": true, + "ignoredRIDs":[ + ] +} + diff -Nru dotnet8-8.0.103-8.0.3/debian/eng/test-runner/Samples/TestThatReliesOnNuGetBeingEmpty/test.json dotnet8-8.0.103-8.0.3/debian/eng/test-runner/Samples/TestThatReliesOnNuGetBeingEmpty/test.json --- dotnet8-8.0.103-8.0.3/debian/eng/test-runner/Samples/TestThatReliesOnNuGetBeingEmpty/test.json 1970-01-01 00:00:00.000000000 +0000 +++ dotnet8-8.0.103-8.0.3/debian/eng/test-runner/Samples/TestThatReliesOnNuGetBeingEmpty/test.json 2024-03-18 12:48:03.000000000 +0000 @@ -0,0 +1,12 @@ +{ + "name": "TestThatReliesOnNuGetBeingEmpty", + "enabled": true, + "requiresSdk": true, + "version": "1.0", + "versionSpecific": false, + "type": "bash", + "cleanup": true, + "ignoredRIDs":[ + ] +} + diff -Nru dotnet8-8.0.103-8.0.3/debian/eng/test-runner/Samples/TestThatReliesOnNuGetBeingEmpty/test.sh dotnet8-8.0.103-8.0.3/debian/eng/test-runner/Samples/TestThatReliesOnNuGetBeingEmpty/test.sh --- dotnet8-8.0.103-8.0.3/debian/eng/test-runner/Samples/TestThatReliesOnNuGetBeingEmpty/test.sh 1970-01-01 00:00:00.000000000 +0000 +++ dotnet8-8.0.103-8.0.3/debian/eng/test-runner/Samples/TestThatReliesOnNuGetBeingEmpty/test.sh 2024-03-18 12:48:03.000000000 +0000 @@ -0,0 +1,7 @@ +#!/bin/bash + +if [[ -d ~/.nuget/packages ]]; then + exit 1 +else + exit 0 +fi diff -Nru dotnet8-8.0.103-8.0.3/debian/eng/test-runner/Samples/TimeOutBashTest/test.json dotnet8-8.0.103-8.0.3/debian/eng/test-runner/Samples/TimeOutBashTest/test.json --- dotnet8-8.0.103-8.0.3/debian/eng/test-runner/Samples/TimeOutBashTest/test.json 1970-01-01 00:00:00.000000000 +0000 +++ dotnet8-8.0.103-8.0.3/debian/eng/test-runner/Samples/TimeOutBashTest/test.json 2024-03-18 12:48:03.000000000 +0000 @@ -0,0 +1,12 @@ +{ + "name": "TimeOutBashTest", + "enabled": true, + "requiresSdk": true, + "version": "1.0", + "versionSpecific": false, + "type": "bash", + "cleanup": true, + "ignoredRIDs":[ + ] +} + diff -Nru dotnet8-8.0.103-8.0.3/debian/eng/test-runner/Samples/TimeOutBashTest/test.sh dotnet8-8.0.103-8.0.3/debian/eng/test-runner/Samples/TimeOutBashTest/test.sh --- dotnet8-8.0.103-8.0.3/debian/eng/test-runner/Samples/TimeOutBashTest/test.sh 1970-01-01 00:00:00.000000000 +0000 +++ dotnet8-8.0.103-8.0.3/debian/eng/test-runner/Samples/TimeOutBashTest/test.sh 2024-03-18 12:48:03.000000000 +0000 @@ -0,0 +1,5 @@ +#!/bin/bash + +echo "${@}" + +sleep 10000 diff -Nru dotnet8-8.0.103-8.0.3/debian/eng/test-runner/Samples/TimeOutXUnitTest/TimeOutXUnitTest.cs dotnet8-8.0.103-8.0.3/debian/eng/test-runner/Samples/TimeOutXUnitTest/TimeOutXUnitTest.cs --- dotnet8-8.0.103-8.0.3/debian/eng/test-runner/Samples/TimeOutXUnitTest/TimeOutXUnitTest.cs 1970-01-01 00:00:00.000000000 +0000 +++ dotnet8-8.0.103-8.0.3/debian/eng/test-runner/Samples/TimeOutXUnitTest/TimeOutXUnitTest.cs 2024-03-18 12:48:03.000000000 +0000 @@ -0,0 +1,16 @@ +using System; +using System.Threading; +using Xunit; + +namespace Samples +{ + public class PassingXUnitTest + { + [Fact] + public void Test1() + { + TimeSpan duration = new TimeSpan(hours: 1, minutes: 0, seconds: 0); + Thread.Sleep(duration); + } + } +} diff -Nru dotnet8-8.0.103-8.0.3/debian/eng/test-runner/Samples/TimeOutXUnitTest/TimeOutXUnitTest.csproj dotnet8-8.0.103-8.0.3/debian/eng/test-runner/Samples/TimeOutXUnitTest/TimeOutXUnitTest.csproj --- dotnet8-8.0.103-8.0.3/debian/eng/test-runner/Samples/TimeOutXUnitTest/TimeOutXUnitTest.csproj 1970-01-01 00:00:00.000000000 +0000 +++ dotnet8-8.0.103-8.0.3/debian/eng/test-runner/Samples/TimeOutXUnitTest/TimeOutXUnitTest.csproj 2024-03-18 12:48:03.000000000 +0000 @@ -0,0 +1,17 @@ + + + + true + net6.0 + + false + + + + + + + + + + diff -Nru dotnet8-8.0.103-8.0.3/debian/eng/test-runner/Samples/TimeOutXUnitTest/test.json dotnet8-8.0.103-8.0.3/debian/eng/test-runner/Samples/TimeOutXUnitTest/test.json --- dotnet8-8.0.103-8.0.3/debian/eng/test-runner/Samples/TimeOutXUnitTest/test.json 1970-01-01 00:00:00.000000000 +0000 +++ dotnet8-8.0.103-8.0.3/debian/eng/test-runner/Samples/TimeOutXUnitTest/test.json 2024-03-18 12:48:03.000000000 +0000 @@ -0,0 +1,12 @@ +{ + "name": "TimeOutXUnitTest", + "enabled": true, + "requiresSdk": true, + "version": "1.0", + "versionSpecific": false, + "type": "xunit", + "cleanup": true, + "ignoredRIDs":[ + ] +} + diff -Nru dotnet8-8.0.103-8.0.3/debian/eng/test-runner/Turkey/AssemblyInfo.cs dotnet8-8.0.103-8.0.3/debian/eng/test-runner/Turkey/AssemblyInfo.cs --- dotnet8-8.0.103-8.0.3/debian/eng/test-runner/Turkey/AssemblyInfo.cs 1970-01-01 00:00:00.000000000 +0000 +++ dotnet8-8.0.103-8.0.3/debian/eng/test-runner/Turkey/AssemblyInfo.cs 2024-03-18 12:48:03.000000000 +0000 @@ -0,0 +1,3 @@ +using System.Runtime.CompilerServices; + +[assembly:InternalsVisibleTo("Turkey.Tests")] diff -Nru dotnet8-8.0.103-8.0.3/debian/eng/test-runner/Turkey/BashTest.cs dotnet8-8.0.103-8.0.3/debian/eng/test-runner/Turkey/BashTest.cs --- dotnet8-8.0.103-8.0.3/debian/eng/test-runner/Turkey/BashTest.cs 1970-01-01 00:00:00.000000000 +0000 +++ dotnet8-8.0.103-8.0.3/debian/eng/test-runner/Turkey/BashTest.cs 2024-03-18 12:48:03.000000000 +0000 @@ -0,0 +1,46 @@ +using System; +using System.Collections.Generic; +using System.Diagnostics; +using System.IO; +using System.Threading; +using System.Threading.Tasks; + +namespace Turkey +{ + public class BashTest : Test + { + public BashTest(DirectoryInfo directory, SystemUnderTest system, string nuGetConfig, TestDescriptor test, bool enabled) + : base(directory, system, nuGetConfig, test, enabled) + { + } + + protected override async Task InternalRunAsync(Action logger, CancellationToken cancellationToken) + { + FileInfo testFile = new FileInfo(Path.Combine(Directory.FullName, "test.sh")); + if (!testFile.Exists) + { + logger($"Unable to find 'test.sh' in {Directory.FullName}"); + return TestResult.Failed; + } + + ProcessStartInfo startInfo = new ProcessStartInfo() + { + FileName = testFile.FullName, + Arguments = SystemUnderTest.RuntimeVersion.ToString(), + WorkingDirectory = Directory.FullName, + RedirectStandardOutput = true, + RedirectStandardError = true, + }; + + startInfo.EnvironmentVariables.Clear(); + foreach (var (key, value) in SystemUnderTest.EnvironmentVariables) + { + startInfo.EnvironmentVariables.Add(key, value); + } + + int exitCode = await ProcessRunner.RunAsync(startInfo, logger, cancellationToken); + + return exitCode == 0 ? TestResult.Passed : TestResult.Failed; + } + } +} diff -Nru dotnet8-8.0.103-8.0.3/debian/eng/test-runner/Turkey/Cleaner.cs dotnet8-8.0.103-8.0.3/debian/eng/test-runner/Turkey/Cleaner.cs --- dotnet8-8.0.103-8.0.3/debian/eng/test-runner/Turkey/Cleaner.cs 1970-01-01 00:00:00.000000000 +0000 +++ dotnet8-8.0.103-8.0.3/debian/eng/test-runner/Turkey/Cleaner.cs 2024-03-18 12:48:03.000000000 +0000 @@ -0,0 +1,95 @@ +using System; +using System.IO; +using System.Collections.Generic; +using System.Threading.Tasks; + +namespace Turkey +{ + public class Cleaner + { + /// These path must all be directories + public static IEnumerable CruftDirectoryGlobs() + { + yield return "~/.aspnet"; + yield return "~/.dotnet"; + yield return "~/.local/share/NuGet"; + yield return "~/.nuget/packages"; + yield return "~/.templatengine"; + + yield return "/tmp/clr-debug-pipe*"; + yield return "/tmp/CoreFxPipe*"; + yield return "/tmp/.dotnet"; + yield return "/tmp/.NETCore*"; + yield return "/tmp/.NETFramework*"; + yield return "/tmp/.NETStandard*"; + yield return "/tmp/NuGet"; + yield return "/tmp/NuGetScratch"; + yield return "/tmp/Razor-Server"; + yield return "/tmp/VBCSCompiler"; + } + + /// These path must all be directories + public static IEnumerable LocalProjectCruft() + { + yield return "bin"; + yield return "out"; + yield return "project.lock.json"; + } + + public async Task CleanProjectLocalDotNetCruftAsync() + { + + foreach(var name in LocalProjectCruft()) + { + // Console.WriteLine("Deleting: " + name); + if (Directory.Exists(name)) + { + Directory.Delete(name, true); + } + else if (File.Exists(name)) + { + File.Delete(name); + } + } + } + + public async Task CleanLocalDotNetCacheAsync() + { + foreach (var path in CruftDirectoryGlobs()) + { + try + { + foreach(var expanded in ExpandPath(path)) + { + // Console.WriteLine("Deleting: " + expanded); + try + { + Directory.Delete(expanded, true); + } + catch (IOException) + { + Console.WriteLine($"WARNING: unable to delete {expanded}"); + } + } + } + catch (DirectoryNotFoundException) + { + Console.WriteLine($"WARNING: unable to expand {path}"); + } + } + return; + } + + public IEnumerable ExpandPath(string pathWithGlob) + { + if (pathWithGlob.StartsWith("~")) + { + pathWithGlob = Environment.GetEnvironmentVariable("HOME") + pathWithGlob.Substring(1); + } + var parentDir = Path.GetDirectoryName(pathWithGlob); + var remainder = Path.GetFileName(pathWithGlob); + var result = Directory.GetDirectories(parentDir, remainder); + return result; + } + } +} diff -Nru dotnet8-8.0.103-8.0.3/debian/eng/test-runner/Turkey/CsprojCompatibilityPatcher.cs dotnet8-8.0.103-8.0.3/debian/eng/test-runner/Turkey/CsprojCompatibilityPatcher.cs --- dotnet8-8.0.103-8.0.3/debian/eng/test-runner/Turkey/CsprojCompatibilityPatcher.cs 1970-01-01 00:00:00.000000000 +0000 +++ dotnet8-8.0.103-8.0.3/debian/eng/test-runner/Turkey/CsprojCompatibilityPatcher.cs 2024-03-18 12:48:03.000000000 +0000 @@ -0,0 +1,33 @@ +using System; +using System.Collections.Generic; +using System.IO; +using System.Reflection; +using System.Text.RegularExpressions; +using System.Threading; +using System.Threading.Tasks; + +namespace Turkey +{ + public class CsprojCompatibilityPatcher + { + public string Patch(string originalCsprojContents, Version newRuntime) + { + var pattern = @"net(?:coreapp)?\d\.\d+"; + var versionString = newRuntime.MajorMinor; + string replacement = null; + if (newRuntime.Major < 4) + { + replacement = $"netcoreapp{versionString}"; + } + else + { + replacement = $"net{versionString}"; + } + var output = Regex.Replace(originalCsprojContents, pattern, replacement); + + return output; + } + + } + +} diff -Nru dotnet8-8.0.103-8.0.3/debian/eng/test-runner/Turkey/DotNet.cs dotnet8-8.0.103-8.0.3/debian/eng/test-runner/Turkey/DotNet.cs --- dotnet8-8.0.103-8.0.3/debian/eng/test-runner/Turkey/DotNet.cs 1970-01-01 00:00:00.000000000 +0000 +++ dotnet8-8.0.103-8.0.3/debian/eng/test-runner/Turkey/DotNet.cs 2024-03-18 12:48:03.000000000 +0000 @@ -0,0 +1,175 @@ +using System; +using System.Diagnostics; +using System.IO; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; +using System.Threading; + +namespace Turkey +{ + public class DotNet + { + private string _dotnetPath; + + public DotNet() + { + _dotnetPath = FindProgramInPath("dotnet"); + if (_dotnetPath is not null) + { + // resolve link target. + _dotnetPath = new FileInfo(_dotnetPath).ResolveLinkTarget(returnFinalTarget: true)?.FullName ?? _dotnetPath; + } + } + + private string DotnetFileName => _dotnetPath ?? throw new FileNotFoundException("dotnet"); + + private string DotnetRoot => Path.GetDirectoryName(DotnetFileName); + + public List RuntimeVersions + { + get + { + ProcessStartInfo startInfo = new ProcessStartInfo() + { + FileName = DotnetFileName, + RedirectStandardOutput = true, + RedirectStandardError = true, + Arguments = "--list-runtimes", + }; + using (Process p = Process.Start(startInfo)) + { + p.WaitForExit(); + string output = p.StandardOutput.ReadToEnd(); + var list = output + .Split("\n", StringSplitOptions.RemoveEmptyEntries) + .Where(line => line.StartsWith("Microsoft.NETCore.App")) + .Select(line => line.Split(" ")[1]) + .Select(versionString => Version.Parse(versionString)) + .OrderBy(x => x) + .ToList(); + return list; + } + } + } + + public Version LatestRuntimeVersion + { + get + { + return RuntimeVersions.Last(); + } + } + + public bool IsCoreClrRuntime(Version runtimeVersion) + => IsCoreClrRuntime(DotnetRoot, runtimeVersion); + + public bool IsMonoRuntime(Version runtimeVersion) + => !IsCoreClrRuntime(runtimeVersion); + + public List SdkVersions + { + get + { + ProcessStartInfo startInfo = new ProcessStartInfo() + { + FileName = DotnetFileName, + RedirectStandardOutput = true, + RedirectStandardError = true, + Arguments = "--list-sdks", + }; + using (Process p = Process.Start(startInfo)) + { + p.WaitForExit(); + string output = p.StandardOutput.ReadToEnd(); + var list = output + .Split("\n", StringSplitOptions.RemoveEmptyEntries) + .Select(line => line.Split(" ")[0]) + .Select(versionString => Version.Parse(versionString)) + .OrderBy(x => x) + .ToList(); + return list; + } + } + } + + public Version LatestSdkVersion + { + get + { + return SdkVersions.LastOrDefault(); + } + } + + public Task BuildAsync(DirectoryInfo workingDirectory, IReadOnlyDictionary environment, Action logger, CancellationToken token) + { + var arguments = new string[] + { + "build", + "-p:UseRazorBuildServer=false", + "-p:UseSharedCompilation=false", + "-m:1", + }; + return RunDotNetCommandAsync(workingDirectory, arguments, environment, logger, token); + } + + public Task RunAsync(DirectoryInfo workingDirectory, IReadOnlyDictionary environment, Action logger, CancellationToken token) + => RunDotNetCommandAsync(workingDirectory, new string[] { "run", "--no-restore", "--no-build"} , environment, logger, token); + + public Task TestAsync(DirectoryInfo workingDirectory, IReadOnlyDictionary environment, Action logger, CancellationToken token) + => RunDotNetCommandAsync(workingDirectory, new string[] { "test", "--no-restore", "--no-build"} , environment, logger, token); + + private async Task RunDotNetCommandAsync(DirectoryInfo workingDirectory, string[] commands, IReadOnlyDictionary environment, Action logger, CancellationToken token) + { + var arguments = string.Join(" ", commands); + ProcessStartInfo startInfo = new ProcessStartInfo() + { + FileName = DotnetFileName, + Arguments = arguments, + WorkingDirectory = workingDirectory.FullName, + RedirectStandardOutput = true, + RedirectStandardError = true, + }; + + startInfo.EnvironmentVariables.Clear(); + foreach (var (key, value) in environment) + { + startInfo.EnvironmentVariables.Add(key, value); + } + + return await ProcessRunner.RunAsync(startInfo, logger, token); + } + + private static bool IsCoreClrRuntime(string dotnetRoot, Version version) + { + string[] runtimeDirectories = Directory.GetDirectories(Path.Combine(dotnetRoot, "shared", "Microsoft.NETCore.App")) + .Where(dir => Version.Parse(Path.GetFileName(dir)) == version) + .ToArray(); + if (runtimeDirectories.Length == 0) + { + throw new DirectoryNotFoundException($"No runtime directory for {version} found in {dotnetRoot}."); + } + + if (runtimeDirectories.Length > 1) + { + throw new DirectoryNotFoundException($"Multiple runtime directories found for {version} in {dotnetRoot}."); + } + + string runtimeDir = runtimeDirectories[0]; + return File.Exists(Path.Combine(runtimeDir, "libcoreclrtraceptprovider.so")); + } + + private static string? FindProgramInPath(string program) + { + string[] paths = Environment.GetEnvironmentVariable("PATH")?.Split(':', StringSplitOptions.RemoveEmptyEntries) ?? Array.Empty(); + foreach (string p in paths) + { + if (Path.Combine(p, program) is var filename && File.Exists(filename)) + { + return filename; + } + } + return null; + } + } +} diff -Nru dotnet8-8.0.103-8.0.3/debian/eng/test-runner/Turkey/EnvironmentVariableSanitizer.cs dotnet8-8.0.103-8.0.3/debian/eng/test-runner/Turkey/EnvironmentVariableSanitizer.cs --- dotnet8-8.0.103-8.0.3/debian/eng/test-runner/Turkey/EnvironmentVariableSanitizer.cs 1970-01-01 00:00:00.000000000 +0000 +++ dotnet8-8.0.103-8.0.3/debian/eng/test-runner/Turkey/EnvironmentVariableSanitizer.cs 2024-03-18 12:48:03.000000000 +0000 @@ -0,0 +1,40 @@ +using System; +using System.Collections; +using System.Collections.Generic; +using System.Diagnostics; +using System.IO; +using System.Threading; +using System.Threading.Tasks; + +namespace Turkey +{ + public class EnvironmentVariableSanitizer + { + private readonly List ToFilter = new List() + { + "OPENSSL_CONF", + }; + + public Dictionary SanitizeCurrentEnvironmentVariables() + { + return SanitizeEnvironmentVariables(Environment.GetEnvironmentVariables()); + } + + public Dictionary SanitizeEnvironmentVariables(IDictionary environmentVariables) + { + var result = new Dictionary(); + + foreach (DictionaryEntry entry in environmentVariables) + { + if (ToFilter.Contains((string)entry.Key)) + { + continue; + } + + result.Add((string)entry.Key, (string)entry.Value); + } + + return result; + } + } +} diff -Nru dotnet8-8.0.103-8.0.3/debian/eng/test-runner/Turkey/IEnumerableExtensions.cs dotnet8-8.0.103-8.0.3/debian/eng/test-runner/Turkey/IEnumerableExtensions.cs --- dotnet8-8.0.103-8.0.3/debian/eng/test-runner/Turkey/IEnumerableExtensions.cs 1970-01-01 00:00:00.000000000 +0000 +++ dotnet8-8.0.103-8.0.3/debian/eng/test-runner/Turkey/IEnumerableExtensions.cs 2024-03-18 12:48:03.000000000 +0000 @@ -0,0 +1,17 @@ +using System; +using System.Collections.Generic; +using System.Threading.Tasks; + +namespace Turkey +{ + static class IEnumerableExtensions + { + public static async Task ForEachAsync(this IEnumerable items, Func task) + { + foreach (T item in items) + { + await task(item); + } + } + } +} diff -Nru dotnet8-8.0.103-8.0.3/debian/eng/test-runner/Turkey/NuGet.cs dotnet8-8.0.103-8.0.3/debian/eng/test-runner/Turkey/NuGet.cs --- dotnet8-8.0.103-8.0.3/debian/eng/test-runner/Turkey/NuGet.cs 1970-01-01 00:00:00.000000000 +0000 +++ dotnet8-8.0.103-8.0.3/debian/eng/test-runner/Turkey/NuGet.cs 2024-03-18 12:48:03.000000000 +0000 @@ -0,0 +1,75 @@ +using System; +using System.Collections.Generic; +using System.Net.Http; +using System.Linq; +using System.Threading.Tasks; + +using Newtonsoft.Json; +using Newtonsoft.Json.Linq; + +namespace Turkey +{ + public class NuGet + { + private readonly HttpClient _client; + + public NuGet(HttpClient client) + { + _client = client; + } + + public async Task IsPackageLiveAsync(string name, Version version) + { + var url = $"https://api-v2v3search-0.nuget.org/autocomplete?id={name}&prerelease=true"; + var result = await _client.GetStringAsync(url); + return await IsPackageLiveAsync(name, version, result); + } + + public async Task IsPackageLiveAsync(string name, Version version, string json) + { + JObject deserialized = (JObject) JsonConvert.DeserializeObject(json); + JArray versions = (JArray) deserialized.GetValue("data"); + var found = versions.Children() + .Where(v => v.Value().Equals(version.ToString())) + .Any(); + return found; + } + + public async Task GenerateNuGetConfig(List urls, string nugetConfig = null) + { + if( !urls.Any() && nugetConfig == null ) + throw new ArgumentNullException(); + + string sources = null; + if( urls.Any() ) + { + var sourceParts = new List(urls.Count); + for( int i = 0; i < urls.Count; i++ ) + { + sourceParts.Add($""); + } + + sources = string.Join("\n ", sourceParts); + if( !string.IsNullOrEmpty(sources) ) + { + sources = $" {sources}\n"; + } + } + + if( string.IsNullOrWhiteSpace(nugetConfig) ) + { + nugetConfig = "\n" + + "\n" + + " \n" + + " \n" + + ""; + } + + if( !string.IsNullOrWhiteSpace(sources) ) + nugetConfig = nugetConfig.Replace("", sources + ""); + + return nugetConfig; + } + + } +} diff -Nru dotnet8-8.0.103-8.0.3/debian/eng/test-runner/Turkey/PlatformId.cs dotnet8-8.0.103-8.0.3/debian/eng/test-runner/Turkey/PlatformId.cs --- dotnet8-8.0.103-8.0.3/debian/eng/test-runner/Turkey/PlatformId.cs 1970-01-01 00:00:00.000000000 +0000 +++ dotnet8-8.0.103-8.0.3/debian/eng/test-runner/Turkey/PlatformId.cs 2024-03-18 12:48:03.000000000 +0000 @@ -0,0 +1,99 @@ +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; +using System.Diagnostics; + +namespace Turkey +{ + public class PlatformId + { + public List CurrentIds + { + // TODO make this async? + get => ComputePlatformIds(File.ReadAllLines("/etc/os-release"), GetLddVersion()); + } + + public List ComputePlatformIds(string[] osReleaseLines, string lddVersionOutput) + { + string arch = Enum.GetName(typeof(Architecture), RuntimeInformation.OSArchitecture).ToLowerInvariant(); + return ComputePlatformIds(osReleaseLines, arch, lddVersionOutput); + } + + public List ComputePlatformIds(string[] osReleaseLines, string architecture, string lddVersionOutput) + { + var id = GetValue("ID", osReleaseLines); + id = Unquote(id); + var versionId = GetValue("VERSION_ID", osReleaseLines); + versionId = Unquote(versionId); + var needsLastVersionRemoved = new string[] { "almalinux", "alpine", "ol", "rhel", "rocky" } + .Any(os => id.Equals(os, StringComparison.Ordinal)); + if (needsLastVersionRemoved) + { + int indexOfDot = versionId.LastIndexOf(".", StringComparison.Ordinal); + if (indexOfDot > 0) + { + versionId = versionId.Substring(0, indexOfDot); + } + } + var platforms = new List() + { + "linux", + "linux" + "-" + architecture, + id, + id + "-" + architecture, + id + versionId, + id + "." + versionId, + id + "." + versionId + "-" + architecture + }; + + bool isMusl = lddVersionOutput.Contains("musl", StringComparison.Ordinal); + + if (isMusl) + { + platforms.AddRange(new [] + { + "linux-musl", + "linux-musl" + "-" + architecture, + }); + + } + return platforms.ToList(); + } + + private string GetValue(string key, string[] lines) + { + return lines.Where(line => line.StartsWith(key + "=", StringComparison.Ordinal)).Last().Substring((key + "=").Length); + } + + private string Unquote(string text) + { + // TODO implement proper un-escaping + // This is a limited shell-style syntax described at + // https://www.freedesktop.org/software/systemd/man/os-release.html + if (text.StartsWith("\"") && text.EndsWith("\"")) + { + return text.Substring(1, text.Length - 2); + } + + return text; + } + + internal string GetLddVersion() + { + using (Process p = new Process()) + { + p.StartInfo.FileName = "ldd"; + p.StartInfo.Arguments = "--version"; + p.StartInfo.RedirectStandardError = true; + p.StartInfo.RedirectStandardOutput = true; + p.Start(); + p.WaitForExit(); + + return string.Concat(p.StandardOutput.ReadToEnd(), p.StandardError.ReadToEnd()); + } + } + } +} diff -Nru dotnet8-8.0.103-8.0.3/debian/eng/test-runner/Turkey/ProcessExtensions.cs dotnet8-8.0.103-8.0.3/debian/eng/test-runner/Turkey/ProcessExtensions.cs --- dotnet8-8.0.103-8.0.3/debian/eng/test-runner/Turkey/ProcessExtensions.cs 1970-01-01 00:00:00.000000000 +0000 +++ dotnet8-8.0.103-8.0.3/debian/eng/test-runner/Turkey/ProcessExtensions.cs 2024-03-18 12:48:03.000000000 +0000 @@ -0,0 +1,69 @@ +using System; +using System.Diagnostics; +using System.IO; +using System.Threading; +using System.Threading.Tasks; + +namespace Turkey +{ + public static class ProcessRunner + { + public static async Task RunAsync(ProcessStartInfo psi, Action logger, CancellationToken token) + { + logger($"Executing {psi.FileName} with arguments {psi.Arguments} in working directory {psi.WorkingDirectory}"); + using var process = Process.Start(psi); + await process.WaitForExitAsync(logger, token); + return process.ExitCode; + } + } + + public static class ProcessExtensions + { + public static async Task WaitForExitAsync(this Process process, Action logger, CancellationToken token) + { + process.EnableRaisingEvents = true; + bool captureOutput = true; + DataReceivedEventHandler logToLogger = (sender, e) => + { + if (e.Data != null) + { + lock (logger) + { + if (captureOutput) + { + logger(e.Data); + } + } + } + }; + process.OutputDataReceived += logToLogger; + process.BeginOutputReadLine(); + process.ErrorDataReceived += logToLogger; + process.BeginErrorReadLine(); + + try + { + await process.WaitForExitAsync(token); + + logger($"Process Exit Code: {process.ExitCode}"); + } + catch (OperationCanceledException ex) + { + lock (logger) + { + captureOutput = false; + } + logger($"Process wait for exit cancelled."); + + try + { + process.Kill(entireProcessTree: true); + } + catch + { } + + throw; + } + } + } +} diff -Nru dotnet8-8.0.103-8.0.3/debian/eng/test-runner/Turkey/Program.cs dotnet8-8.0.103-8.0.3/debian/eng/test-runner/Turkey/Program.cs --- dotnet8-8.0.103-8.0.3/debian/eng/test-runner/Turkey/Program.cs 1970-01-01 00:00:00.000000000 +0000 +++ dotnet8-8.0.103-8.0.3/debian/eng/test-runner/Turkey/Program.cs 2024-03-18 12:48:03.000000000 +0000 @@ -0,0 +1,267 @@ +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Net.Http; +using System.Threading.Tasks; + +using System.CommandLine; +using System.CommandLine.Invocation; +using System.Threading; +using System.Runtime.InteropServices; + +namespace Turkey +{ + public class Program + { + public static readonly Option verboseOption = new Option( + new string[] { "--verbose", "-v" }, + "Show verbose output"); + + public static readonly Option logDirectoryOption = new Option( + new string[] { "--log-directory", "-l" }, + "Set directory for writing log files"); + + public static readonly Option additionalFeedOption = new Option( + new string[] { "--additional-feed", "-s" }, + "Additional nuget repository feed"); + + public static readonly Option timeoutOption = new Option( + new string[] { "--timeout", "-t" }, + "Set the timeout duration for test in seconds"); + + public static readonly Option> traitOption = new Option>( + new string[] { "--trait" }, + "Add a trait which is used to disable tests.") + { + Arity = ArgumentArity.ZeroOrMore + }; + + public static async Task Run(string testRoot, + bool verbose, + string logDirectory, + string additionalFeed, + IEnumerable trait, + int timeout) + { + TimeSpan defaultTimeout; + if (timeout == 0) + { + defaultTimeout = new TimeSpan(hours: 0, minutes: 5, seconds: 0); + } + else + { + defaultTimeout = new TimeSpan(hours: 0, minutes: 0, seconds: timeout); + } + + var currentDirectory = new DirectoryInfo(Directory.GetCurrentDirectory()); + + DirectoryInfo logDir; + if (string.IsNullOrEmpty(logDirectory)) + { + logDir = currentDirectory; + } + else + { + logDir = new DirectoryInfo(logDirectory); + } + + DirectoryInfo testRootDirectory; + if (string.IsNullOrEmpty(testRoot)) + { + testRootDirectory = currentDirectory; + } + else + { + testRootDirectory = new DirectoryInfo(testRoot); + if (!testRootDirectory.Exists) + { + Console.WriteLine($"error: Test root '{testRootDirectory.FullName}' does not exist"); + return 1; + } + } + Console.WriteLine($"Testing everything under {testRootDirectory.FullName}"); + + Cleaner cleaner = new Cleaner(); + + DotNet dotnet = new DotNet(); + Version runtimeVersion = dotnet.LatestRuntimeVersion; + + TestOutput defaultOutput = new TestOutputFormats.NewOutput(); + + TestOutput junitOutput = new TestOutputFormats.JUnitOutput(logDir); + + var testOutputs = new List() { + defaultOutput, + junitOutput, + }; + + List platformIds = new PlatformId().CurrentIds; + Console.WriteLine($"Current platform is: {string.Join(", ", platformIds)}"); + + var sanitizer = new EnvironmentVariableSanitizer(); + var envVars = sanitizer.SanitizeCurrentEnvironmentVariables(); + + var traits = CreateTraits(runtimeVersion, dotnet.LatestSdkVersion, platformIds, dotnet.IsMonoRuntime(runtimeVersion), trait); + Console.WriteLine($"Tests matching these traits will be skipped: {string.Join(", ", traits.OrderBy(s => s))}."); + + envVars["TestTargetFramework"] = $"net{runtimeVersion.Major}.{runtimeVersion.Minor}"; + + SystemUnderTest system = new SystemUnderTest( + dotnet, + runtimeVersion: runtimeVersion, + sdkVersion: dotnet.LatestSdkVersion, + platformIds: platformIds, + environmentVariables: envVars, + traits: traits + ); + + Version packageVersion = runtimeVersion; + string nuGetConfig = await GenerateNuGetConfigIfNeededAsync(additionalFeed, packageVersion, + useSourceBuildNuGetConfig: false); + if (verbose && nuGetConfig != null) + { + Console.WriteLine("Using nuget.config: "); + Console.WriteLine(nuGetConfig); + } + + TestRunner runner = new TestRunner( + cleaner: cleaner, + system: system, + root: testRootDirectory, + verboseOutput: verbose, + nuGetConfig: nuGetConfig); + + var results = await runner.ScanAndRunAsync(testOutputs, logDir.FullName, defaultTimeout); + + int exitCode = (results.Failed == 0) ? 0 : 1; + return exitCode; + } + + public static async Task GenerateNuGetConfigIfNeededAsync(string additionalFeed, Version netCoreAppVersion, bool useSourceBuildNuGetConfig) + { + var urls = new List(); + + if (!string.IsNullOrEmpty(additionalFeed)) + { + urls.Add(additionalFeed); + } + + using (HttpClient client = new HttpClient()) + { + var nuget = new NuGet(client); + var sourceBuild = new SourceBuild(client); + + if (netCoreAppVersion.Major < 4) + { + try + { + var prodConUrl = await GetProdConFeedUrlIfNeededAsync(nuget, sourceBuild, netCoreAppVersion); + if (!string.IsNullOrEmpty(prodConUrl)) + { + prodConUrl = prodConUrl.Trim(); + Console.WriteLine($"Packages are not live on nuget.org; using {prodConUrl} as additional package source"); + urls.Add(prodConUrl); + } + } + catch (HttpRequestException exception) + { + Console.WriteLine("WARNING: failed to get ProdCon url. Ignoring Exception:"); + Console.WriteLine(exception.ToString()); + } + } + + string nugetConfig = null; + if (useSourceBuildNuGetConfig) + { + try + { + nugetConfig = await sourceBuild.GetNuGetConfigAsync(netCoreAppVersion); + } + catch( HttpRequestException exception ) + { + Console.WriteLine("WARNING: failed to get NuGet.config from source-build. Ignoring Exception:"); + Console.WriteLine(exception.ToString()); + } + } + + if (urls.Any() || nugetConfig != null) + { + // Add the default nuget repo that customer should always + // be using anyway. This is the default, but still useful + // if the nugetConfig has a element that removes + // it. + urls.Add("https://api.nuget.org/v3/index.json"); + return await nuget.GenerateNuGetConfig(urls, nugetConfig); + } + } + + return null; + } + + public static IReadOnlySet CreateTraits(Version runtimeVersion, Version sdkVersion, List rids, bool isMonoRuntime, IEnumerable additionalTraits) + { + var traits = new HashSet(StringComparer.OrdinalIgnoreCase); + + // Add 'version=' traits. + traits.Add($"version={runtimeVersion.Major}.{runtimeVersion.Minor}"); + traits.Add($"version={runtimeVersion.Major}"); + + // Add 'os=', 'rid=' traits. + foreach (var rid in rids) + { + traits.Add($"rid={rid}"); + if (rid.LastIndexOf('-') is int offset && offset != -1) + { + traits.Add($"os={rid.Substring(0, offset)}"); + } + } + + // Add 'arch=' trait. + string arch = RuntimeInformation.OSArchitecture.ToString().ToLowerInvariant(); + traits.Add($"arch={arch}"); + + // Add 'runtime=' trait. + traits.Add($"runtime={(isMonoRuntime ? "mono" : "coreclr")}"); + + // Add additional traits. + foreach (var skipTrait in additionalTraits) + { + traits.Add(skipTrait); + } + + return traits; + } + + public static async Task GetProdConFeedUrlIfNeededAsync(NuGet nuget, SourceBuild sourceBuild, Version netCoreAppVersion) + { + bool live = await nuget.IsPackageLiveAsync("runtime.linux-x64.Microsoft.NetCore.DotNetAppHost", netCoreAppVersion); + if (!live) + { + return await sourceBuild.GetProdConFeedAsync(netCoreAppVersion); + } + + return null; + } + + static async Task Main(string[] args) + { + var rootCommand = new RootCommand(description: "A test runner for running standalone bash-based or xunit tests"); + rootCommand.Handler = CommandHandler.Create(Run); + + var testRootArgument = new Argument(); + testRootArgument.Name = "testRoot"; + testRootArgument.Description = "Root directory for searching for tests"; + testRootArgument.Arity = ArgumentArity.ZeroOrOne; + + rootCommand.AddArgument(testRootArgument); + rootCommand.AddOption(verboseOption); + rootCommand.AddOption(logDirectoryOption); + rootCommand.AddOption(additionalFeedOption); + rootCommand.AddOption(traitOption); + rootCommand.AddOption(timeoutOption); + + return await rootCommand.InvokeAsync(args); + } + } +} diff -Nru dotnet8-8.0.103-8.0.3/debian/eng/test-runner/Turkey/SourceBuild.cs dotnet8-8.0.103-8.0.3/debian/eng/test-runner/Turkey/SourceBuild.cs --- dotnet8-8.0.103-8.0.3/debian/eng/test-runner/Turkey/SourceBuild.cs 1970-01-01 00:00:00.000000000 +0000 +++ dotnet8-8.0.103-8.0.3/debian/eng/test-runner/Turkey/SourceBuild.cs 2024-03-18 12:48:03.000000000 +0000 @@ -0,0 +1,73 @@ +using System; +using System.Net.Http; +using System.Threading.Tasks; + +namespace Turkey +{ + /// + /// Work with https://github.com/dotnet/source-build + /// + public class SourceBuild + { + private readonly HttpClient _client; + + public SourceBuild(HttpClient client) + { + this._client = client; + } + + public string GetBranchContentUrl(Version version) + { + string url; + if (version.Major <= 3) + { + var branchName = "release/" + version.MajorMinor; + url = $"https://raw.githubusercontent.com/dotnet/source-build/{branchName}/"; + } + else + { + var branchName = "release/" + version.MajorMinor + ".1xx"; + url = $"https://raw.githubusercontent.com/dotnet/installer/{branchName}/"; + } + + return url; + } + + public async Task GetProdConFeedAsync(Version version) + { + if (version.Major > 4) + { + throw new ArgumentException("No prodcon for .NET 5 or later"); + } + + var url = GetBranchContentUrl(version) + "ProdConFeed.txt"; + var feedUrl = await _client.GetStringAsync(url); + + using(var response = await _client.GetAsync(feedUrl)) + { + if (!response.IsSuccessStatusCode) + { + return null; + } + } + return feedUrl; + } + + public async Task GetNuGetConfigAsync(Version version) + { + string url = GetBranchContentUrl(version) + "NuGet.config"; + + string nugetConfig = null; + try + { + nugetConfig = await _client.GetStringAsync(url); + } + catch( HttpRequestException e ) + { + Console.WriteLine($"WARNING: {e.ToString()}"); + } + + return nugetConfig; + } + } +} diff -Nru dotnet8-8.0.103-8.0.3/debian/eng/test-runner/Turkey/Test.cs dotnet8-8.0.103-8.0.3/debian/eng/test-runner/Turkey/Test.cs --- dotnet8-8.0.103-8.0.3/debian/eng/test-runner/Turkey/Test.cs 1970-01-01 00:00:00.000000000 +0000 +++ dotnet8-8.0.103-8.0.3/debian/eng/test-runner/Turkey/Test.cs 2024-03-18 12:48:03.000000000 +0000 @@ -0,0 +1,133 @@ +using System; +using System.Collections.Generic; +using System.IO; +using System.Reflection; +using System.Text.RegularExpressions; +using System.Threading; +using System.Threading.Tasks; + +namespace Turkey +{ + public class TestDescriptor + { + public string Name { get; set; } + public bool Enabled { get; set; } + public bool RequiresSdk { get; set; } + public string Version { get; set; } + public bool VersionSpecific { get; set; } + public string Type { get; set; } + public bool Cleanup { get; set; } + public double TimeoutMultiplier { get; set; } = 1.0; + public List IgnoredRIDs { get; set; } = new(); + public List SkipWhen { get; set; } = new(); + } + + // TODO is this a strongly-typed enum in C#? + public enum TestResult { + Passed, Failed, Skipped, + } + + public abstract class Test + { + public DirectoryInfo Directory { get; } + public SystemUnderTest SystemUnderTest { get; } + public string NuGetConfig { get; } + public TestDescriptor Descriptor { get; } + public bool Skip { get; } + + public Test(DirectoryInfo testDirectory, SystemUnderTest system, string nuGetConfig, TestDescriptor descriptor, bool enabled) + { + this.Directory = testDirectory; + this.SystemUnderTest = system; + this.NuGetConfig = nuGetConfig; + this.Descriptor = descriptor; + this.Skip = !enabled; + } + + public async Task RunAsync(Action logger, CancellationToken cancelltionToken) + { + if (Skip) + { + return TestResult.Skipped; + } + + var path = Path.Combine(Directory.FullName, "nuget.config"); + if (!string.IsNullOrEmpty(NuGetConfig)) + { + if (File.Exists(path)) + { + Console.WriteLine($"WARNING: overwriting {path}"); + } + await File.WriteAllTextAsync(path, NuGetConfig); + } + + UpdateProjectFilesIfPresent(); + + var testResult = await InternalRunAsync(logger, cancelltionToken); + + if (!string.IsNullOrEmpty(NuGetConfig)) + { + File.Delete(path); + } + + return testResult; + } + + private void UpdateProjectFilesIfPresent() + { + if (SystemUnderTest.RuntimeVersion < Version.Parse("2.0")) + { + var projectJsonPath = Path.Combine(this.Directory.FullName, "project.json"); + if (File.Exists(projectJsonPath)) + { + CopyProjectJsonFile(); + } + } + else + { + var csprojFile = $"{Directory.Name}.csproj"; + var csprojPath = Path.Combine(this.Directory.FullName, csprojFile); + if (File.Exists(csprojPath)) + { + UpdateCsprojVersion(csprojPath); + } + } + } + + private void CopyProjectJsonFile() + { + string majorMinor = "" + SystemUnderTest.RuntimeVersion.Major + SystemUnderTest.RuntimeVersion.Minor; + var fileName = $"resources/project{majorMinor}xunit.json"; + var resourceLocation = FindResourceFile(fileName); + var source = resourceLocation; + var dest = Path.Combine(this.Directory.FullName, "project.json"); + File.Copy(source, dest); + } + + private static string FindResourceFile(string name) + { + var assemblyLocation = Assembly.GetExecutingAssembly().Location; + var dir = Path.GetDirectoryName(assemblyLocation); + var resourceLocation = Path.Combine(dir, name); + if (!File.Exists(resourceLocation)) + { + throw new Exception($"Resource {name} at location {resourceLocation} does not exist"); + } + return resourceLocation; + } + + private void UpdateCsprojVersion(string csprojPath) + { + var contents = File.ReadAllText(csprojPath); + var updatedContents = UpdateCsprojContents(contents); + + File.WriteAllText(csprojPath, updatedContents); + } + + private string UpdateCsprojContents(string contents) => + new CsprojCompatibilityPatcher().Patch(contents, this.SystemUnderTest.RuntimeVersion); + + protected abstract Task InternalRunAsync(Action logger, CancellationToken cancellationToken); + + } +} diff -Nru dotnet8-8.0.103-8.0.3/debian/eng/test-runner/Turkey/TestOutputFormat.cs dotnet8-8.0.103-8.0.3/debian/eng/test-runner/Turkey/TestOutputFormat.cs --- dotnet8-8.0.103-8.0.3/debian/eng/test-runner/Turkey/TestOutputFormat.cs 1970-01-01 00:00:00.000000000 +0000 +++ dotnet8-8.0.103-8.0.3/debian/eng/test-runner/Turkey/TestOutputFormat.cs 2024-03-18 12:48:03.000000000 +0000 @@ -0,0 +1,179 @@ +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Runtime.CompilerServices; +using System.Text; +using System.Text.RegularExpressions; +using System.Threading.Tasks; +using System.Xml; +using System.Xml.Serialization; + +namespace Turkey +{ + public class TestOutputFormats + { + public class NewOutput : TestOutput + { + public class FailedTest + { + public string Name{ set; get;} + public string Duration{ set; get;} + } + + private List failedTests = new List(); + + public async override Task AtStartupAsync(){ + Console.WriteLine("Running tests:"); + } + public async override Task AfterParsingTestAsync(string name, bool enabled) + { + var nameText = string.Format("{0,-60}", name); + Console.Write(nameText); + } + + public async override Task AfterRunningTestAsync(string name, TestResult result, StringBuilder testLog, TimeSpan testTime) + { + int minutes = (int)testTime.TotalMinutes; + int seconds = (int)Math.Ceiling(testTime.TotalSeconds - 60 * minutes); + string elapsedTime = minutes == 0 ? $"{seconds}s" + : $"{minutes}m {seconds}s"; + string resultOutput = null; + if (Console.IsOutputRedirected || Console.IsErrorRedirected) + { + switch (result) + { + case TestResult.Passed: resultOutput = "PASS"; break; + case TestResult.Failed: resultOutput = "FAIL"; failedTests.Add(new FailedTest {Name = name, Duration = elapsedTime}); break; + case TestResult.Skipped: resultOutput = "SKIP"; break; + } + Console.WriteLine($"[{resultOutput}]\t({elapsedTime})"); + } + else + { + switch (result) + { + case TestResult.Passed: resultOutput = "\u001b[32mPASS\u001b[0m"; break; + case TestResult.Failed: resultOutput = "\u001b[31mFAIL\u001b[0m"; failedTests.Add(new FailedTest {Name = name, Duration = elapsedTime}); break; + case TestResult.Skipped: resultOutput = "SKIP"; break; + } + Console.WriteLine($"[{resultOutput}]\t({elapsedTime})"); + } + } + + public async override Task PrintFailedTests() + { + Console.WriteLine(); + Console.WriteLine("The following tests failed: "); + foreach(var test in failedTests) + { + Console.WriteLine($"{string.Format("{0,-30}", test.Name)}({test.Duration})"); + } + } + + public async override Task AfterRunningAllTestsAsync(TestResults results) + { + Console.WriteLine(); + Console.WriteLine($"Total: {results.Total} Passed: {results.Passed} Failed: {results.Failed}"); + } + } + + public class JUnitOutput : TestOutput + { + private struct TestCase { + public string Name; + public string ClassName; + public bool Failed; + public bool Skipped; + public string Message; + public StringBuilder Log; + } + + private List _testCases = new List(); + private FileInfo _resultsFile; + + public JUnitOutput(DirectoryInfo logDirectory) + : this(new FileInfo(Path.Combine(logDirectory.FullName, "results.xml"))) + { + } + + public JUnitOutput(FileInfo resultsFile) + { + _resultsFile = resultsFile; + } + + public async override Task AfterRunningTestAsync(string name, TestResult result, StringBuilder testLog, TimeSpan testTime) + { + var testCase = new TestCase(); + testCase.Name = name; + testCase.ClassName = "TestSuite"; + testCase.Failed = result == TestResult.Failed; + testCase.Skipped = result == TestResult.Skipped; + testCase.Message = "see log"; + testCase.Log = testLog; + + _testCases.Add(testCase); + } + + public async override Task AfterRunningAllTestsAsync(TestResults results) + { + var settings = new XmlWriterSettings(); + settings.Indent = true; + + using (var writer = XmlWriter.Create(_resultsFile.FullName, settings)) + { + writer.WriteStartDocument(); + + writer.WriteStartElement("testsuite"); + writer.WriteAttributeString("name", "dotnet"); + writer.WriteAttributeString("tests", _testCases.Count.ToString()); + writer.WriteAttributeString("failures", _testCases.Where(t => t.Failed).Count().ToString()); + writer.WriteAttributeString("errors", "0"); + + foreach (var testCase in _testCases) + { + writer.WriteStartElement("testcase"); + writer.WriteAttributeString("name", testCase.Name); + writer.WriteAttributeString("classname", testCase.ClassName); + + if (testCase.Skipped) + { + writer.WriteStartElement("skipped"); + writer.WriteAttributeString("message", testCase.Message); + writer.WriteEndElement(); + } + + if (testCase.Failed) + { + writer.WriteStartElement("failure"); + writer.WriteAttributeString("message", testCase.Message); + writer.WriteAttributeString("type", "AssertionError"); + writer.WriteEndElement(); + } + + if (testCase.Log != null) + { + writer.WriteStartElement("system-out"); + string standardOutput = RemoveInvalidXmlCharacters(testCase.Log.ToString()); + writer.WriteString(standardOutput); + writer.WriteEndElement(); + } + + writer.WriteEndElement(); + + } + + writer.WriteEndElement(); + + writer.WriteEndDocument(); + writer.Close(); + } + } + + private string RemoveInvalidXmlCharacters(string input) + { + return Regex.Replace(input, @"[\u0000-\u0008,\u000B,\u000C,\u000E-\u001F]", ""); + } + } + } +} diff -Nru dotnet8-8.0.103-8.0.3/debian/eng/test-runner/Turkey/TestParser.cs dotnet8-8.0.103-8.0.3/debian/eng/test-runner/Turkey/TestParser.cs --- dotnet8-8.0.103-8.0.3/debian/eng/test-runner/Turkey/TestParser.cs 1970-01-01 00:00:00.000000000 +0000 +++ dotnet8-8.0.103-8.0.3/debian/eng/test-runner/Turkey/TestParser.cs 2024-03-18 12:48:03.000000000 +0000 @@ -0,0 +1,128 @@ +using System; +using System.IO; +using System.Linq; +using System.Threading.Tasks; + +using Newtonsoft.Json; + +namespace Turkey +{ + public class TestParser + { + public Task<(bool Success, Test Test)> TryParseAsync(SystemUnderTest system, string nuGetConfig, FileInfo testConfiguration) + { + var dir = testConfiguration.Directory; + return TryParseAsync(system, nuGetConfig, dir, File.ReadAllText(testConfiguration.FullName)); + } + + public async Task<(bool Success, Test Test)> TryParseAsync(SystemUnderTest system, string nuGetConfig, DirectoryInfo directory, string testConfiguration) + { + // TODO: async + var fileName = Path.Combine(directory.FullName, "test.json"); + var descriptor = JsonConvert.DeserializeObject(File.ReadAllText(fileName)); + + if (!directory.Name.Equals(descriptor.Name, StringComparison.Ordinal)) + { + Console.WriteLine($"WARNING: mismatch in directory name (\"{directory.Name}\") vs test name (\"{descriptor.Name}\")"); + } + + var enabled = ShouldRunTest(system, descriptor); + Test test = null; + switch (descriptor.Type) + { + case "xunit": + test = new XUnitTest(directory, system, nuGetConfig, descriptor, enabled); + return (true, test); + case "bash": + test = new BashTest(directory, system, nuGetConfig, descriptor, enabled); + return (true, test); + default: + return (false, null); + } + } + + public bool ShouldRunTest(SystemUnderTest system, TestDescriptor test) + { + if (!test.Enabled) + { + return false; + } + + if (!VersionMatches(test, system.RuntimeVersion)) + { + return false; + } + + if (system.SdkVersion == null && test.RequiresSdk) + { + return false; + } + + if (test.IgnoredRIDs != null) + { + var skipped = system.CurrentPlatformIds + .Where(rid => test.IgnoredRIDs.Contains(rid)) + .Any(); + + if (skipped) + { + return false; + } + } + + foreach (var skipCondition in test.SkipWhen) + { + // a skipCondition is formatted as comma-separated traits: 'green,age=21' + // the condition is true when all traits are present in the test environment. + + bool skipConditionMatches = true; + + foreach (var skipConditionTrait in skipCondition.Split(',', StringSplitOptions.RemoveEmptyEntries) + .Select(s => s.Trim()) + .Where(s => s.Length > 0)) + { + if (!system.Traits.Contains(skipConditionTrait)) + { + skipConditionMatches = false; + break; + } + } + + if (skipConditionMatches) + { + return false; + } + } + + return true; + } + + + private bool VersionMatches(TestDescriptor test, Version runtimeVersion) + { + if (test.VersionSpecific) + { + if ((runtimeVersion.Major + ".x").Equals(test.Version, StringComparison.Ordinal)) + { + return true; + } + else if (runtimeVersion.MajorMinor.Equals(test.Version, StringComparison.Ordinal)) + { + return true; + } + + return false; + } + else + { + var testVersion = Version.Parse(test.Version); + if (runtimeVersion >= testVersion) + { + return true; + } + + return false; + } + } + } +} diff -Nru dotnet8-8.0.103-8.0.3/debian/eng/test-runner/Turkey/TestRunner.cs dotnet8-8.0.103-8.0.3/debian/eng/test-runner/Turkey/TestRunner.cs --- dotnet8-8.0.103-8.0.3/debian/eng/test-runner/Turkey/TestRunner.cs 1970-01-01 00:00:00.000000000 +0000 +++ dotnet8-8.0.103-8.0.3/debian/eng/test-runner/Turkey/TestRunner.cs 2024-03-18 12:48:03.000000000 +0000 @@ -0,0 +1,162 @@ +using System; +using System.Collections.Generic; +using System.Diagnostics; +using System.IO; +using System.Linq; +using System.Text; +using System.Threading; +using System.Threading.Tasks; + +namespace Turkey +{ + public class TestResults + { + public int Passed { get; set; } + public int Failed { get; set; } + public int Skipped { get; set; } + public int Total { get; set; } + } + + public class SystemUnderTest + { + public Version RuntimeVersion { get; } + public Version SdkVersion { get; } + public List CurrentPlatformIds { get; } + public IReadOnlyDictionary EnvironmentVariables; + public IReadOnlySet Traits { get; } + public DotNet Dotnet { get; } + + public SystemUnderTest(DotNet dotnet, + Version runtimeVersion, + Version sdkVersion, + List platformIds, + IReadOnlyDictionary environmentVariables, + IReadOnlySet traits) + { + Dotnet = dotnet; + RuntimeVersion = runtimeVersion; + SdkVersion = sdkVersion; + CurrentPlatformIds = platformIds ?? new List(); + EnvironmentVariables = environmentVariables; + Traits = traits ?? new HashSet(); + } + } + + public class TestOutput + { + public async virtual Task AtStartupAsync() {} + public async virtual Task BeforeTestAsync() {} + public async virtual Task AfterParsingTestAsync(string name, bool enabled) {} + public async virtual Task AfterRunningTestAsync(string name, TestResult result, StringBuilder testLog, TimeSpan testTime) {} + public async virtual Task PrintFailedTests() {} + public async virtual Task AfterRunningAllTestsAsync(TestResults results) {} + } + + public class TestRunner + { + private SystemUnderTest system; + private DirectoryInfo root; + private bool verboseOutput; + private Cleaner cleaner; + private string nuGetConfig; + + public TestRunner(SystemUnderTest system, DirectoryInfo root, bool verboseOutput, Cleaner cleaner, string nuGetConfig) + { + this.root = root; + this.system = system; + this.verboseOutput = verboseOutput; + this.cleaner = cleaner; + this.nuGetConfig = nuGetConfig; + } + + public async Task ScanAndRunAsync(List outputs, string logDir, TimeSpan defaultTimeout) + { + + await outputs.ForEachAsync(output => output.AtStartupAsync()); + + TestResults results = new TestResults(); + + Stopwatch testTimeWatch = new Stopwatch(); + + var options = new EnumerationOptions + { + RecurseSubdirectories = true, + }; + + TestParser parser = new TestParser(); + + // sort tests before running to keep test order the same everywhere + var sortedFiles = root + .EnumerateFiles("test.json", options) + .OrderBy(f => f.DirectoryName); + + foreach (var file in sortedFiles) + { + testTimeWatch.Reset(); + await cleaner.CleanLocalDotNetCacheAsync(); + + testTimeWatch.Start(); + var parsedTest = await parser.TryParseAsync(system, nuGetConfig, file); + if (!parsedTest.Success) + { + Console.WriteLine($"WARNING: Unable to parse {file}"); + continue; + } + var test = parsedTest.Test; + string testName = test.Descriptor.Name; + + await outputs.ForEachAsync(output => output.AfterParsingTestAsync(testName, !test.Skip)); + + TimeSpan testTimeout = test.Descriptor.TimeoutMultiplier * defaultTimeout; + using var cts = testTimeout == TimeSpan.Zero ? null : new CancellationTokenSource(testTimeout); + var cancellationToken = cts is null ? default : cts.Token; + Action testLogger = null; + + // Log to a file. + string logFileName = Path.Combine(logDir, $"logfile-{testName}.log"); + using var logFile = new StreamWriter(logFileName) { AutoFlush = true }; + Action logToLogFile = s => logFile.WriteLine(s); + testLogger += logToLogFile; + + // Log to a StringBuilder. + StringBuilder testLog = new(); + Action logToTestLog = s => testLog.AppendLine(s); + testLogger += logToTestLog; + + if (test.Descriptor.Cleanup) + { + await cleaner.CleanProjectLocalDotNetCruftAsync(); + } + + TestResult testResult; + try + { + testResult = await test.RunAsync(testLogger, cancellationToken); + } + catch (OperationCanceledException) + { + testLogger("[[TIMEOUT]]"); + testResult = TestResult.Failed; + } + + testTimeWatch.Stop(); + + results.Total++; + switch (testResult) + { + case TestResult.Passed: results.Passed++; break; + case TestResult.Failed: results.Failed++; break; + case TestResult.Skipped: results.Skipped++; break; + } + + await outputs.ForEachAsync(output => output.AfterRunningTestAsync(testName, testResult, testLog, testTimeWatch.Elapsed)); + } + + await outputs.ForEachAsync(outputs => outputs.PrintFailedTests()); + + await outputs.ForEachAsync(output => output.AfterRunningAllTestsAsync(results)); + + return results; + } + } +} diff -Nru dotnet8-8.0.103-8.0.3/debian/eng/test-runner/Turkey/Turkey.csproj dotnet8-8.0.103-8.0.3/debian/eng/test-runner/Turkey/Turkey.csproj --- dotnet8-8.0.103-8.0.3/debian/eng/test-runner/Turkey/Turkey.csproj 1970-01-01 00:00:00.000000000 +0000 +++ dotnet8-8.0.103-8.0.3/debian/eng/test-runner/Turkey/Turkey.csproj 2024-03-18 12:48:03.000000000 +0000 @@ -0,0 +1,26 @@ + + + + Exe + net6.0 + + net$(BundledNETCoreAppTargetFrameworkVersion) + false + Major + + + + + + + + + + + + + + + diff -Nru dotnet8-8.0.103-8.0.3/debian/eng/test-runner/Turkey/Version.cs dotnet8-8.0.103-8.0.3/debian/eng/test-runner/Turkey/Version.cs --- dotnet8-8.0.103-8.0.3/debian/eng/test-runner/Turkey/Version.cs 1970-01-01 00:00:00.000000000 +0000 +++ dotnet8-8.0.103-8.0.3/debian/eng/test-runner/Turkey/Version.cs 2024-03-18 12:48:03.000000000 +0000 @@ -0,0 +1,141 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Globalization; + +namespace Turkey +{ + public class Version: IComparable + { + public int Major { get; } + public int Minor { get; } + public string MajorMinor { get; } + + private List parts = null; + + public static Version Parse(string input) + { + if( string.IsNullOrEmpty(input) ) + { + return null; + } + + var parts = input.Split('.').ToList(); + bool invalidParts = (from part in parts where part.Count() == 0 select part).Count() != 0; + if (invalidParts) + { + throw new FormatException(); + } + if (parts.Count() == 1) + { + parts.Add("0"); + } + int.Parse(parts[0], CultureInfo.InvariantCulture); + int.Parse(parts[1], CultureInfo.InvariantCulture); + var version = new Version(parts); + return version; + } + + private Version(List parts) + { + this.parts = parts; + this.Major = int.Parse(parts[0], CultureInfo.InvariantCulture); + this.Minor = int.Parse(parts[1], CultureInfo.InvariantCulture); + this.MajorMinor = this.Major + "." + this.Minor; + } + + public override string ToString() + { + return string.Join('.', parts); + } + + private static int CompareTo(Version v1, Version v2) + { + var minCount = Math.Min(v1.parts.Count(), v2.parts.Count()); + var maxCount = Math.Max(v1.parts.Count(), v2.parts.Count()); + + for (int i = 0; i < minCount; i++) + { + string part1 = v1.parts[i]; + string part2 = v2.parts[i]; + + var success1 = int.TryParse(part1, out int intPart1); + var success2 = int.TryParse(part2, out int intPart2); + if (success1 && success2) + { + if (intPart1.CompareTo(intPart2) != 0) + { + return intPart1.CompareTo(intPart2); + } + } + else + { + if (string.Compare(part1, part2, StringComparison.Ordinal) != 0) + { + return string.Compare(part1, part2, StringComparison.Ordinal); + } + } + } + + for (int i = minCount; i < maxCount; i++) + { + string part1 = v1.parts.Count() == maxCount ? v1.parts[i] : "0"; + string part2 = v2.parts.Count() == maxCount ? v2.parts[i] : "0"; + + var success1 = int.TryParse(part1, out int intPart1); + var success2 = int.TryParse(part2, out int intPart2); + if (success1 && success2) + { + if (intPart1.CompareTo(intPart2) != 0) + { + return intPart1.CompareTo(intPart2); + } + } + else + { + if (string.Compare(part1, part2, StringComparison.Ordinal) != 0) + { + return string.Compare(part1, part2, StringComparison.Ordinal); + } + } + } + + return 0; + } + + public int CompareTo(Version x) { return CompareTo(this, x); } + + public bool Equals(Version x) { return CompareTo(this, x) == 0; } + + public static bool operator <(Version x, Version y) { return CompareTo(x, y) < 0; } + + public static bool operator >(Version x, Version y) { return CompareTo(x, y) > 0; } + + public static bool operator <=(Version x, Version y) { return CompareTo(x, y) <= 0; } + + public static bool operator >=(Version x, Version y) { return CompareTo(x, y) >= 0; } + + public static bool operator ==(Version x, Version y) + { + if (object.ReferenceEquals(x, null) && object.ReferenceEquals(y, null)) + { + return true; + } + else if (object.ReferenceEquals(x, null) || object.ReferenceEquals(y, null)) + { + return false; + } + return CompareTo(x, y) == 0; + } + + public static bool operator !=(Version x, Version y) { return CompareTo(x, y) != 0; } + + public override bool Equals(object obj) { return (obj is Version) && (CompareTo(this, (Version)obj) == 0); } + + public override int GetHashCode() + { + throw new NotImplementedException(); + } + + } +} diff -Nru dotnet8-8.0.103-8.0.3/debian/eng/test-runner/Turkey/XUnitTest.cs dotnet8-8.0.103-8.0.3/debian/eng/test-runner/Turkey/XUnitTest.cs --- dotnet8-8.0.103-8.0.3/debian/eng/test-runner/Turkey/XUnitTest.cs 1970-01-01 00:00:00.000000000 +0000 +++ dotnet8-8.0.103-8.0.3/debian/eng/test-runner/Turkey/XUnitTest.cs 2024-03-18 12:48:03.000000000 +0000 @@ -0,0 +1,32 @@ +using System; +using System.Collections.Generic; +using System.IO; +using System.Threading; +using System.Threading.Tasks; + +namespace Turkey +{ + + public class XUnitTest : Test + { + public XUnitTest(DirectoryInfo directory, SystemUnderTest system, string nuGetConfig, TestDescriptor descriptor, bool enabled) + : base(directory, system, nuGetConfig, descriptor, enabled) + { + } + + protected override async Task InternalRunAsync(Action logger, CancellationToken cancellationToken) + { + bool success = await BuildProjectAsync(logger, cancellationToken) == 0 + && await RunTestProjectAsync(logger, cancellationToken) == 0; + + return success ? TestResult.Passed : TestResult.Failed; + } + + + private Task BuildProjectAsync(Action logger, CancellationToken token) + => SystemUnderTest.Dotnet.BuildAsync(Directory, SystemUnderTest.EnvironmentVariables, logger, token); + + private Task RunTestProjectAsync(Action logger, CancellationToken token) + => SystemUnderTest.Dotnet.TestAsync(Directory, SystemUnderTest.EnvironmentVariables, logger, token); + } +} diff -Nru dotnet8-8.0.103-8.0.3/debian/eng/test-runner/Turkey/resources/project10.json dotnet8-8.0.103-8.0.3/debian/eng/test-runner/Turkey/resources/project10.json --- dotnet8-8.0.103-8.0.3/debian/eng/test-runner/Turkey/resources/project10.json 1970-01-01 00:00:00.000000000 +0000 +++ dotnet8-8.0.103-8.0.3/debian/eng/test-runner/Turkey/resources/project10.json 2024-03-18 12:48:03.000000000 +0000 @@ -0,0 +1,20 @@ +{ + "version": "1.0.0-*", + "buildOptions": { + "warningsAsErrors": true, + "debugType": "portable", + "emitEntryPoint": true + }, + "dependencies": {}, + "frameworks": { + "netcoreapp1.0": { + "dependencies": { + "Microsoft.NETCore.App": { + "type": "platform", + "version": "1.0.10" + } + }, + "imports": "dnxcore50" + } + } +} diff -Nru dotnet8-8.0.103-8.0.3/debian/eng/test-runner/Turkey/resources/project10xunit.json dotnet8-8.0.103-8.0.3/debian/eng/test-runner/Turkey/resources/project10xunit.json --- dotnet8-8.0.103-8.0.3/debian/eng/test-runner/Turkey/resources/project10xunit.json 1970-01-01 00:00:00.000000000 +0000 +++ dotnet8-8.0.103-8.0.3/debian/eng/test-runner/Turkey/resources/project10xunit.json 2024-03-18 12:48:03.000000000 +0000 @@ -0,0 +1,27 @@ +{ + "version": "1.0.0-*", + "buildOptions": { + "warningsAsErrors": true, + "debugType": "portable" + }, + "dependencies": { + "System.Runtime.Serialization.Primitives": "4.1.1", + "xunit": "2.1.0", + "dotnet-test-xunit": "1.0.0-rc2-192208-24" + }, + "testRunner": "xunit", + "frameworks": { + "netcoreapp1.0": { + "dependencies": { + "Microsoft.NETCore.App": { + "type": "platform", + "version": "1.0.10" + } + }, + "imports": [ + "dotnet5.4", + "portable-net451+win8" + ] + } + } +} diff -Nru dotnet8-8.0.103-8.0.3/debian/eng/test-runner/Turkey/resources/project11.json dotnet8-8.0.103-8.0.3/debian/eng/test-runner/Turkey/resources/project11.json --- dotnet8-8.0.103-8.0.3/debian/eng/test-runner/Turkey/resources/project11.json 1970-01-01 00:00:00.000000000 +0000 +++ dotnet8-8.0.103-8.0.3/debian/eng/test-runner/Turkey/resources/project11.json 2024-03-18 12:48:03.000000000 +0000 @@ -0,0 +1,20 @@ +{ + "version": "1.0.0-*", + "buildOptions": { + "warningsAsErrors": true, + "debugType": "portable", + "emitEntryPoint": true + }, + "dependencies": {}, + "frameworks": { + "netcoreapp1.1": { + "dependencies": { + "Microsoft.NETCore.App": { + "type": "platform", + "version": "1.1.7" + } + }, + "imports": "dnxcore50" + } + } +} diff -Nru dotnet8-8.0.103-8.0.3/debian/eng/test-runner/Turkey/resources/project11xunit.json dotnet8-8.0.103-8.0.3/debian/eng/test-runner/Turkey/resources/project11xunit.json --- dotnet8-8.0.103-8.0.3/debian/eng/test-runner/Turkey/resources/project11xunit.json 1970-01-01 00:00:00.000000000 +0000 +++ dotnet8-8.0.103-8.0.3/debian/eng/test-runner/Turkey/resources/project11xunit.json 2024-03-18 12:48:03.000000000 +0000 @@ -0,0 +1,27 @@ +{ + "version": "1.0.0-*", + "buildOptions": { + "warningsAsErrors": true, + "debugType": "portable" + }, + "dependencies": { + "System.Runtime.Serialization.Primitives": "4.3.0", + "xunit": "2.1.0", + "dotnet-test-xunit": "1.0.0-rc2-192208-24" + }, + "testRunner": "xunit", + "frameworks": { + "netcoreapp1.1": { + "dependencies": { + "Microsoft.NETCore.App": { + "type": "platform", + "version": "1.1.7" + } + }, + "imports": [ + "dotnet5.4", + "portable-net451+win8" + ] + } + } +} diff -Nru dotnet8-8.0.103-8.0.3/debian/eng/test-runner/Turkey.Tests/BashTestTest.cs dotnet8-8.0.103-8.0.3/debian/eng/test-runner/Turkey.Tests/BashTestTest.cs --- dotnet8-8.0.103-8.0.3/debian/eng/test-runner/Turkey.Tests/BashTestTest.cs 1970-01-01 00:00:00.000000000 +0000 +++ dotnet8-8.0.103-8.0.3/debian/eng/test-runner/Turkey.Tests/BashTestTest.cs 2024-03-18 12:48:03.000000000 +0000 @@ -0,0 +1,7 @@ +namespace Turkey.Tests +{ + public class BashTestTest + { + + } +} diff -Nru dotnet8-8.0.103-8.0.3/debian/eng/test-runner/Turkey.Tests/CleanerTest.cs dotnet8-8.0.103-8.0.3/debian/eng/test-runner/Turkey.Tests/CleanerTest.cs --- dotnet8-8.0.103-8.0.3/debian/eng/test-runner/Turkey.Tests/CleanerTest.cs 1970-01-01 00:00:00.000000000 +0000 +++ dotnet8-8.0.103-8.0.3/debian/eng/test-runner/Turkey.Tests/CleanerTest.cs 2024-03-18 12:48:03.000000000 +0000 @@ -0,0 +1,45 @@ +using System; +using System.IO; +using System.Linq; + +using Xunit; + +namespace Turkey.Tests +{ + public class CleanerTest + { + [Fact] + public void StarAtEndIsExpandedCorrectly() + { + var temp = Environment.GetEnvironmentVariable("XDG_RUNTIME_DIR") ?? "/tmp/"; + var testRoot = Path.Combine(temp, "turkey-test-" + new Random().Next()); + Directory.CreateDirectory(testRoot); + + try + { + var testDir = Path.Combine(testRoot, ".dotnet"); + Directory.CreateDirectory(testDir + "1"); + Directory.CreateDirectory(testDir + "2"); + + Cleaner cleaner = new Cleaner(); + var expanded = cleaner.ExpandPath(testDir + "*"); + + Assert.Equal(new string[] { testDir + "1", testDir + "2" }.OrderBy(s => s), + expanded.OrderBy(s => s)); + } + finally + { + Directory.Delete(testRoot, true); + } + } + + [Fact] + public void TildeIsExpandedToUserHome() + { + Cleaner cleaner = new Cleaner(); + var expanded = cleaner.ExpandPath("~"); + Assert.Single(expanded); + Assert.Equal(Environment.GetEnvironmentVariable("HOME"), expanded.First()); + } + } +} diff -Nru dotnet8-8.0.103-8.0.3/debian/eng/test-runner/Turkey.Tests/CsprojCompatibilityPatcherTest.cs dotnet8-8.0.103-8.0.3/debian/eng/test-runner/Turkey.Tests/CsprojCompatibilityPatcherTest.cs --- dotnet8-8.0.103-8.0.3/debian/eng/test-runner/Turkey.Tests/CsprojCompatibilityPatcherTest.cs 1970-01-01 00:00:00.000000000 +0000 +++ dotnet8-8.0.103-8.0.3/debian/eng/test-runner/Turkey.Tests/CsprojCompatibilityPatcherTest.cs 2024-03-18 12:48:03.000000000 +0000 @@ -0,0 +1,36 @@ +using System; + +using Turkey; + +using Xunit; + +namespace Turkey.Tests +{ + public class CsprojCompatibilityPatcherTest + { + [Theory] + [InlineData("netcoreapp1.0", "2.1", "netcoreapp2.1")] + [InlineData("netcoreapp2.1", "3.1", "netcoreapp3.1")] + [InlineData("netcoreapp3.1", "3.1", "netcoreapp3.1")] + [InlineData("net5.0", "3.1", "netcoreapp3.1")] + [InlineData("net5.0", "2.1", "netcoreapp2.1")] + public void TargetFrameworksAreReplacedCorrectly(string currentTfm, string runtimeVersion, string expectedTfm) + { + Version newRuntimeVersion = Version.Parse(runtimeVersion); + string csproj = $@" + + + + {currentTfm} + + +"; + string patched = new CsprojCompatibilityPatcher().Patch(csproj, newRuntimeVersion); + Assert.Contains(expectedTfm, patched); + if (currentTfm != expectedTfm) + { + Assert.DoesNotContain(currentTfm, patched); + } + } + } +} diff -Nru dotnet8-8.0.103-8.0.3/debian/eng/test-runner/Turkey.Tests/DotNetTest.cs dotnet8-8.0.103-8.0.3/debian/eng/test-runner/Turkey.Tests/DotNetTest.cs --- dotnet8-8.0.103-8.0.3/debian/eng/test-runner/Turkey.Tests/DotNetTest.cs 1970-01-01 00:00:00.000000000 +0000 +++ dotnet8-8.0.103-8.0.3/debian/eng/test-runner/Turkey.Tests/DotNetTest.cs 2024-03-18 12:48:03.000000000 +0000 @@ -0,0 +1,38 @@ +using System; +using Xunit; + +namespace Turkey.Tests +{ + public class DotNetTest + { + [Fact] + public void GetRuntimeVersions() + { + var runtimeVersions = new DotNet().RuntimeVersions; + Assert.NotNull(runtimeVersions); + Assert.NotEmpty(runtimeVersions); + } + + [Fact] + public void GetLatestRuntimeVersion() + { + var runtimeVersion = new DotNet().LatestRuntimeVersion; + Assert.NotNull(runtimeVersion); + } + + [Fact] + public void GetSdkVersions() + { + var sdkVersions = new DotNet().SdkVersions; + Assert.NotNull(sdkVersions); + Assert.NotEmpty(sdkVersions); + } + + [Fact] + public void GetLatestSdkVersion() + { + var sdkVersion = new DotNet().LatestSdkVersion; + Assert.NotNull(sdkVersion); + } + } +} diff -Nru dotnet8-8.0.103-8.0.3/debian/eng/test-runner/Turkey.Tests/EnvironmentVariableSanitizerTest.cs dotnet8-8.0.103-8.0.3/debian/eng/test-runner/Turkey.Tests/EnvironmentVariableSanitizerTest.cs --- dotnet8-8.0.103-8.0.3/debian/eng/test-runner/Turkey.Tests/EnvironmentVariableSanitizerTest.cs 1970-01-01 00:00:00.000000000 +0000 +++ dotnet8-8.0.103-8.0.3/debian/eng/test-runner/Turkey.Tests/EnvironmentVariableSanitizerTest.cs 2024-03-18 12:48:03.000000000 +0000 @@ -0,0 +1,54 @@ +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; + +using Xunit; + +namespace Turkey.Tests +{ + public class EnvironmentVariableSanitizerTest + { + [Theory] + // TODO enable these too + // [InlineData("ASPNETCORE_URLS")] + // [InlineData("COREHOST_TRACE")] + // [InlineData("DOTNET_FOO_BAR")] + // [InlineData("DOTNET_ROLL_FORWARD")] + // [InlineData("DOTNET_RUNTIME_ID")] + // [InlineData("DOTNET_STARTUP_HOOKS")] + // [InlineData("NUGET_PACKAGES")] + [InlineData("OPENSSL_CONF")] + public void EnvironmentVariablesAreRemoved(string name) + { + var environment = new Dictionary() + { + { name, "foobar" }, + }; + + var sanitizer = new EnvironmentVariableSanitizer(); + var result = sanitizer.SanitizeEnvironmentVariables(environment); + + Assert.DoesNotContain(name, result.Keys); + } + + [InlineData("DOTNET_ROOT")] + [InlineData("DOTNET_CLI_TELEMETRY_OPTOUT")] + [InlineData("PATH")] + [InlineData("USER")] + [InlineData("HOME")] + public void EnvironmentVariablesAreKept(string name) + { + var environment = new Dictionary() + { + { name, "foobar" }, + }; + + var sanitizer = new EnvironmentVariableSanitizer(); + var result = sanitizer.SanitizeEnvironmentVariables(environment); + + Assert.Contains(name, result.Keys); + + } + } +} diff -Nru dotnet8-8.0.103-8.0.3/debian/eng/test-runner/Turkey.Tests/NuGetTest.cs dotnet8-8.0.103-8.0.3/debian/eng/test-runner/Turkey.Tests/NuGetTest.cs --- dotnet8-8.0.103-8.0.3/debian/eng/test-runner/Turkey.Tests/NuGetTest.cs 1970-01-01 00:00:00.000000000 +0000 +++ dotnet8-8.0.103-8.0.3/debian/eng/test-runner/Turkey.Tests/NuGetTest.cs 2024-03-18 12:48:03.000000000 +0000 @@ -0,0 +1,80 @@ +using System.Collections.Generic; +using System.Linq; +using System.Net.Http; +using System.Text.RegularExpressions; +using System.Threading.Tasks; + +using Xunit; + +namespace Turkey.Tests +{ + public class NuGetTest + { + [Theory(Skip="Uses network")] + [InlineData("Microsoft.NETCore.App", "1.0.0", true)] + [InlineData("Microsoft.NETCore.App", "1.1.0", true)] + [InlineData("Microsoft.NETCore.App", "1.2.0", false)] + [InlineData("Microsoft.NETCore.App", "1.3.0", false)] + [InlineData("Microsoft.NETCore.App", "2.0.0", true)] + [InlineData("Microsoft.NETCore.App", "2.1.0", true)] + [InlineData("Microsoft.NETCore.App", "2.1.11", true)] + [InlineData("Microsoft.NETCore.App", "2.2.0", true)] + [InlineData("Microsoft.NETCore.App", "2.2.1", true)] + [InlineData("Microsoft.NETCore.App", "2.3.0", false)] + [InlineData("Microsoft.NETCore.App", "3.9.0", false)] + public async Task LivePackagesAreIdentifiedCorrectlyFromNetwork(string name, string version, bool live) + { + using (var http = new HttpClient()) + { + NuGet nuget = new NuGet(http); + var ver = Version.Parse(version); + Assert.Equal(live, await nuget.IsPackageLiveAsync(name, ver)); + } + } + + // curl 'https://api-v2v3search-0.nuget.org/autocomplete?id=microsoft.netcore.app&prerelease=true' | sed 's/"/\\"/g' + private readonly string json = "{\"@context\":{\"@vocab\":\"http://schema.nuget.org/schema#\"},\"totalHits\":1,\"lastReopen\":\"2019-05-23T23:28:54.6740419Z\",\"index\":\"v3-lucene2-v2v3-20171018\",\"data\":[\"1.0.0-rc2-3002702\",\"1.0.0\",\"1.0.1\",\"1.0.3\",\"1.0.4\",\"1.0.5\",\"1.0.7\",\"1.0.8\",\"1.0.9\",\"1.0.10\",\"1.0.11\",\"1.0.12\",\"1.0.13\",\"1.0.14\",\"1.0.15\",\"1.0.16\",\"1.1.0-preview1-001100-00\",\"1.1.0\",\"1.1.1\",\"1.1.2\",\"1.1.4\",\"1.1.5\",\"1.1.6\",\"1.1.7\",\"1.1.8\",\"1.1.9\",\"1.1.10\",\"1.1.11\",\"1.1.12\",\"1.1.13\",\"2.0.0-preview1-002111-00\",\"2.0.0-preview2-25407-01\",\"2.0.0\",\"2.0.3\",\"2.0.4\",\"2.0.5\",\"2.0.6\",\"2.0.7\",\"2.0.9\",\"2.1.0-preview1-26216-03\",\"2.1.0-preview2-26406-04\",\"2.1.0-rc1\",\"2.1.0\",\"2.1.1\",\"2.1.2\",\"2.1.3\",\"2.1.4\",\"2.1.5\",\"2.1.6\",\"2.1.7\",\"2.1.8\",\"2.1.9\",\"2.1.10\",\"2.1.11\",\"2.2.0-preview-26820-02\",\"2.2.0-preview2-26905-02\",\"2.2.0-preview3-27014-02\",\"2.2.0\",\"2.2.1\",\"2.2.2\",\"2.2.3\",\"2.2.4\",\"2.2.5\",\"3.0.0-preview-27122-01\",\"3.0.0-preview-27324-5\",\"3.0.0-preview3-27503-5\",\"3.0.0-preview4-27615-11\",\"3.0.0-preview5-27626-15\"]}"; + + [Theory] + [InlineData("Microsoft.NETCore.App", "1.0.0", true)] + [InlineData("Microsoft.NETCore.App", "1.1.0", true)] + [InlineData("Microsoft.NETCore.App", "1.2.0", false)] + [InlineData("Microsoft.NETCore.App", "1.3.0", false)] + [InlineData("Microsoft.NETCore.App", "2.0.0", true)] + [InlineData("Microsoft.NETCore.App", "2.1.0", true)] + [InlineData("Microsoft.NETCore.App", "2.1.11", true)] + [InlineData("Microsoft.NETCore.App", "2.2.0", true)] + [InlineData("Microsoft.NETCore.App", "2.2.1", true)] + [InlineData("Microsoft.NETCore.App", "2.3.0", false)] + [InlineData("Microsoft.NETCore.App", "3.9.0", false)] + public async Task LivePackagesAreIdentifiedCorrectly(string name, string version, bool live) + { + using (var http = new HttpClient()) + { + NuGet nuget = new NuGet(http); + var ver = Version.Parse(version); + Assert.Equal(live, await nuget.IsPackageLiveAsync(name, ver, json)); + } + } + + [Theory] + // FIXME [InlineData(new string[] { }, "")] + [InlineData(new string[] { "foo" }, "")] + [InlineData(new string[] { "foo" , "bar"}, " ")] + public async Task NuGetConfigIsGeneratedCorrectly(string[] urls, string feedParts) + { + using (var http = new HttpClient()) + { + NuGet nuget = new NuGet(http); + + var expectedConfig = " " + feedParts + " "; + var cleanedExpectedConfig = Regex.Replace(expectedConfig, @"\s+", " "); + + var actualConfig = await nuget.GenerateNuGetConfig(urls.ToList()); + var cleanedActualConfig = Regex.Replace(actualConfig, @"\s+", " "); + + Assert.Equal(cleanedExpectedConfig, cleanedActualConfig); + } + } + } +} diff -Nru dotnet8-8.0.103-8.0.3/debian/eng/test-runner/Turkey.Tests/PlatformIdTest.cs dotnet8-8.0.103-8.0.3/debian/eng/test-runner/Turkey.Tests/PlatformIdTest.cs --- dotnet8-8.0.103-8.0.3/debian/eng/test-runner/Turkey.Tests/PlatformIdTest.cs 1970-01-01 00:00:00.000000000 +0000 +++ dotnet8-8.0.103-8.0.3/debian/eng/test-runner/Turkey.Tests/PlatformIdTest.cs 2024-03-18 12:48:03.000000000 +0000 @@ -0,0 +1,39 @@ +using System.Linq; +using System; + +using Xunit; + +namespace Turkey.Tests +{ + public class PlatformIdTest + { + [Theory] + [InlineData(new string[] { "ID=fedora", "VERSION_ID=9" }, "x64", "", new string[] { "linux", "linux-x64", "fedora", "fedora-x64", "fedora9", "fedora.9", "fedora.9-x64" })] + [InlineData(new string[] { "ID=fedora", "VERSION_ID=30" }, "x64", "", new string[] { "linux", "linux-x64", "fedora", "fedora-x64", "fedora30", "fedora.30", "fedora.30-x64" })] + [InlineData(new string[] { "ID=fedora", "VERSION_ID=30" }, "arm64", "", new string[] { "linux", "linux-arm64", "fedora", "fedora-arm64", "fedora30", "fedora.30", "fedora.30-arm64" })] + [InlineData(new string[] { "ID=rocky", "VERSION_ID=8.5" }, "x64", "", new string[] { "linux", "linux-x64", "rocky", "rocky-x64", "rocky8", "rocky.8", "rocky.8-x64" })] + [InlineData(new string[] { "ID=rhel", "VERSION_ID=7" }, "x64", "", new string[] { "linux", "linux-x64", "rhel", "rhel-x64", "rhel7", "rhel.7", "rhel.7-x64" })] + [InlineData(new string[] { "ID=rhel", "VERSION_ID=7.3" }, "x64", "", new string[] { "linux", "linux-x64", "rhel", "rhel-x64", "rhel7", "rhel.7", "rhel.7-x64" })] + [InlineData(new string[] { "ID=rhel", "VERSION_ID=8" }, "x64", "", new string[] { "linux", "linux-x64", "rhel", "rhel-x64", "rhel8", "rhel.8", "rhel.8-x64" })] + [InlineData(new string[] { "ID=rhel", "VERSION_ID=8.0" }, "x64", "", new string[] { "linux", "linux-x64", "rhel", "rhel-x64", "rhel8", "rhel.8", "rhel.8-x64" })] + [InlineData(new string[] { "ID=rhel", "VERSION_ID=8.1" }, "x64", "", new string[] { "linux", "linux-x64", "rhel", "rhel-x64", "rhel8", "rhel.8", "rhel.8-x64" })] + [InlineData(new string[] { "ID=\"rhel\"", "VERSION_ID=\"8.1\"" }, "x64", "", new string[] { "linux", "linux-x64", "rhel", "rhel-x64", "rhel8", "rhel.8", "rhel.8-x64" })] + [InlineData(new string[] { "ID=centos", "VERSION_ID=8" }, "x64", "", new string[] { "linux", "linux-x64", "centos", "centos-x64", "centos8", "centos.8", "centos.8-x64" })] + [InlineData(new string[] { "ID=alpine", "VERSION_ID=3.15.2" }, "x64", "", new string[] { "linux", "linux-x64", "alpine", "alpine-x64", "alpine3.15", "alpine.3.15", "alpine.3.15-x64" })] + [InlineData(new string[] { "ID=alpine", "VERSION_ID=3.15.2" }, "x64", "musl libc", new string[] { "linux", "linux-x64", "alpine", "alpine-x64", "alpine3.15", "alpine.3.15", "alpine.3.15-x64", "linux-musl", "linux-musl-x64" })] + [InlineData(new string[] { "ID=fedora", "VERSION_ID=39" }, "x64", "GNU libc", new string[] { "linux", "linux-x64", "fedora", "fedora-x64", "fedora39", "fedora.39", "fedora.39-x64" })] + public void BasicPlatformIds(string[] osReleaseLines, string architecture, string lddOutput, string[] expectedIds) + { + var result = new PlatformId().ComputePlatformIds(osReleaseLines, architecture, lddOutput); + Assert.Equal(expectedIds.ToList(), result); + } + + [Fact] + public void LddWorks() + { + string version = new PlatformId().GetLddVersion(); + Assert.NotNull(version); + Assert.NotEmpty(version); + } + } +} diff -Nru dotnet8-8.0.103-8.0.3/debian/eng/test-runner/Turkey.Tests/ProcessExtensionsTest.cs dotnet8-8.0.103-8.0.3/debian/eng/test-runner/Turkey.Tests/ProcessExtensionsTest.cs --- dotnet8-8.0.103-8.0.3/debian/eng/test-runner/Turkey.Tests/ProcessExtensionsTest.cs 1970-01-01 00:00:00.000000000 +0000 +++ dotnet8-8.0.103-8.0.3/debian/eng/test-runner/Turkey.Tests/ProcessExtensionsTest.cs 2024-03-18 12:48:03.000000000 +0000 @@ -0,0 +1,51 @@ +using Xunit; +using System.IO; +using System.Diagnostics; +using System.Threading; +using System.Threading.Tasks; +using System; + +namespace Turkey.Tests +{ + public class ProcessExtensiosnTests + { + [Fact] + public async Task WaitForExitAsync_DoesNotHangForOrphanedGrandChildren() + { + const int WaitTimeoutSeconds = 3; + const int GrandChildAgeSeconds = 3 * WaitTimeoutSeconds; + + string filename = Path.GetTempFileName(); + try + { + // This script creates a 'sleep' grandchild that outlives its parent. + File.WriteAllText(filename, +$@"#!/bin/bash + +sleep {GrandChildAgeSeconds} & +"); + Process chmodProcess = Process.Start("chmod", $"+x {filename}"); + chmodProcess.WaitForExit(); + Assert.Equal(0, chmodProcess.ExitCode); + + var psi = new ProcessStartInfo() + { + FileName = filename, + RedirectStandardOutput = true, + RedirectStandardError = true, + }; + using Process process = Process.Start(psi); + + // Use a shorter timeout for WaitForExitAsync than the grandchild lives. + using var cts = new CancellationTokenSource(TimeSpan.FromSeconds(WaitTimeoutSeconds)); + + // The WaitForExit completes by cancellation. + await Assert.ThrowsAsync(() => process.WaitForExitAsync(logger: msg => { }, cts.Token)); + } + finally + { + File.Delete(filename); + } + } + } +} diff -Nru dotnet8-8.0.103-8.0.3/debian/eng/test-runner/Turkey.Tests/ProgramTest.cs dotnet8-8.0.103-8.0.3/debian/eng/test-runner/Turkey.Tests/ProgramTest.cs --- dotnet8-8.0.103-8.0.3/debian/eng/test-runner/Turkey.Tests/ProgramTest.cs 1970-01-01 00:00:00.000000000 +0000 +++ dotnet8-8.0.103-8.0.3/debian/eng/test-runner/Turkey.Tests/ProgramTest.cs 2024-03-18 12:48:03.000000000 +0000 @@ -0,0 +1,101 @@ +using System; +using System.Collections.Generic; +using System.Runtime.InteropServices; +using System.Linq; +using Xunit; + +namespace Turkey.Tests +{ + public class ProgramTest + { + + class MockNuGet : NuGet + { + public bool PackagesAreLive { get; set; } + + public MockNuGet(): base(null) + { + } + + } + + class MockSourceBuild : SourceBuild + { + public MockSourceBuild(): base(null) + { + + } + } + + [Fact] + public void CheckOptions() + { + // TODO + } + + [Fact] + public void GetNuGetWorking() + { + + var nuget = new MockNuGet(); + var sourceBuild = new MockSourceBuild(); + var netCoreAppVersion = Version.Parse("2.1.5"); + + // TODO + // var nugetConfig = Program.GetNuGetConfigIfNeeded(nuget, sourceBuild, netCoreAppVersion); + } + + public static IEnumerable SystemTraits_MemberData() + { + // note: the version numbers are intentionally chosen to be different. + Version runtimeVersion = Version.Parse("6.5"); + Version sdkVersion = Version.Parse("3.1"); + + string[] expectedVersionTraits = new[] { "version=6.5", "version=6" }; + string expectedArch = $"arch={OSArchitectureName}"; + + // default traits. + yield return new object[] { runtimeVersion, sdkVersion, Array.Empty(), false, Array.Empty(), CombineTraits() }; + + // 'runtime=mono' + yield return new object[] { runtimeVersion, sdkVersion, Array.Empty(), true, Array.Empty(), CombineTraits(isMonoRuntime: true) }; + + // 'os=..' and 'rid=...' are added for the platform rids. + yield return new object[] { runtimeVersion, sdkVersion, new[] { "linux-x64", "fedora.37-x64", "linux-musl-x64" }, false, Array.Empty(), + CombineTraits(new[] { "os=linux", "os=fedora.37", "os=linux-musl", + "rid=linux-x64", "rid=fedora.37-x64", "rid=linux-musl-x64" } ) }; + + // additional traits are added. + yield return new object[] { runtimeVersion, sdkVersion, Array.Empty(), false, new[] { "blue", "green" }, + CombineTraits(new[] { "blue", "green" } ) }; + + string[] CombineTraits(string[] expectedAdditionalTraits = null, bool isMonoRuntime = false) + => expectedVersionTraits + .Concat(new[] { expectedArch }) + .Concat(isMonoRuntime ? new[] { "runtime=mono" } : new[] { "runtime=coreclr" }) + .Concat(expectedAdditionalTraits ?? Array.Empty()) + .ToArray(); + } + + [Theory] + [MemberData(nameof(SystemTraits_MemberData))] + public void SystemTraits(Version runtimeVersion, Version sdkVersion, string[] rids, bool isMonoRuntime, string[] additionalTraits, string[] expectedTraits) + { + IReadOnlySet systemTraits = Program.CreateTraits(runtimeVersion, sdkVersion, new List(rids), isMonoRuntime, additionalTraits); + + Assert.Equal(expectedTraits.OrderBy(s => s), systemTraits.OrderBy(s => s)); + } + + private static string OSArchitectureName + => RuntimeInformation.OSArchitecture switch + { + Architecture.X86 => "x86", + Architecture.X64 => "x64", + Architecture.Arm => "arm", + Architecture.Arm64 => "arm64", + Architecture.S390x => "s390x", + (Architecture)8 => "ppc64le", // not defined for 'net6.0' target. + _ => throw new NotSupportedException(), + }; + } +} diff -Nru dotnet8-8.0.103-8.0.3/debian/eng/test-runner/Turkey.Tests/SourceBuildTest.cs dotnet8-8.0.103-8.0.3/debian/eng/test-runner/Turkey.Tests/SourceBuildTest.cs --- dotnet8-8.0.103-8.0.3/debian/eng/test-runner/Turkey.Tests/SourceBuildTest.cs 1970-01-01 00:00:00.000000000 +0000 +++ dotnet8-8.0.103-8.0.3/debian/eng/test-runner/Turkey.Tests/SourceBuildTest.cs 2024-03-18 12:48:03.000000000 +0000 @@ -0,0 +1,74 @@ +using System; +using System.Net; +using System.Net.Http; +using System.Threading; +using System.Threading.Tasks; + +using Xunit; + +namespace Turkey.Tests +{ + public class SourceBuildTest + { + private static readonly string FAKE_FEED = "https://myget.org/my/secret/3.1/feed.json"; + + public class ProdConHandler : HttpMessageHandler + { + protected override Task SendAsync(HttpRequestMessage message, CancellationToken token) + { + if (message.Method == HttpMethod.Get) + { + if (message.RequestUri.AbsoluteUri.Equals("https://raw.githubusercontent.com/dotnet/source-build/release/3.1/ProdConFeed.txt")) + { + return Task.FromResult(new HttpResponseMessage(HttpStatusCode.OK) + { + Content = new StringContent(FAKE_FEED) + }); + + } + else if (message.RequestUri.AbsoluteUri.Equals(FAKE_FEED)) + { + return Task.FromResult(new HttpResponseMessage(HttpStatusCode.OK) + { + Content = new StringContent("ignore") + }); + } + } + Assert.True(false); + return null; + } + } + + public class NoProdConHandler : HttpMessageHandler + { + protected override Task SendAsync(HttpRequestMessage message, CancellationToken token) + { + Assert.True(false); + return null; + } + } + + [Fact] + public async Task VerifyProdConFeedIsLookedUpAndThenTheFeedIsVerifiedToResolve() + { + var messageHandler = new ProdConHandler(); + var client = new HttpClient(messageHandler); + var sourceBuild = new SourceBuild(client); + + var feed = await sourceBuild.GetProdConFeedAsync(Version.Parse("3.1")); + + Assert.Equal(FAKE_FEED, feed); + } + + [Fact] + public async Task VerifyProdConFeedIsNotUsedForNewReleases() + { + var messageHandler = new NoProdConHandler(); + var client = new HttpClient(messageHandler); + var sourceBuild = new SourceBuild(client); + + await Assert.ThrowsAsync(() => sourceBuild.GetProdConFeedAsync(Version.Parse("6.1"))); + } + + } +} diff -Nru dotnet8-8.0.103-8.0.3/debian/eng/test-runner/Turkey.Tests/TestOutputFormatTest.cs dotnet8-8.0.103-8.0.3/debian/eng/test-runner/Turkey.Tests/TestOutputFormatTest.cs --- dotnet8-8.0.103-8.0.3/debian/eng/test-runner/Turkey.Tests/TestOutputFormatTest.cs 1970-01-01 00:00:00.000000000 +0000 +++ dotnet8-8.0.103-8.0.3/debian/eng/test-runner/Turkey.Tests/TestOutputFormatTest.cs 2024-03-18 12:48:03.000000000 +0000 @@ -0,0 +1,75 @@ +using System; +using System.IO; +using System.Text; +using System.Threading.Tasks; +using Xunit; + +namespace Turkey.Tests +{ + public class JUnitOutputTest + { + [Fact] + public async Task EmptyResultsProduceBasicXml() + { + var resultsFile = new FileInfo(Path.GetTempFileName()); + + var j = new TestOutputFormats.JUnitOutput(resultsFile); + await j.AfterRunningAllTestsAsync(null); + var xml = File.ReadAllText(resultsFile.FullName); + + var expectedXml = @" +"; + + Assert.Equal(expectedXml, xml); + + resultsFile.Delete(); + } + + [Fact] + public async Task SingleTestWithPassingResultProducesValidXml() + { + var resultsFile = new FileInfo(Path.GetTempFileName()); + + var j = new TestOutputFormats.JUnitOutput(resultsFile); + var result = TestResult.Passed; + await j.AfterRunningTestAsync("foo", result, new StringBuilder(), new TimeSpan(0)); + await j.AfterRunningAllTestsAsync(null); + var xml = File.ReadAllText(resultsFile.FullName); + + var expectedXml = @" + + + + +"; + + Assert.Equal(expectedXml, xml); + + resultsFile.Delete(); + } + + [Fact] + public async Task ControlCharactersInTestOutputAreNotPresentInXml() + { + var resultsFile = new FileInfo(Path.GetTempFileName()); + + var j = new TestOutputFormats.JUnitOutput(resultsFile); + var result = TestResult.Passed; + var testLog = new StringBuilder("\u0001\u0002\u0003\u0004\u0005aaa\u0006\u0007\u0008\u001A\u001B\u001Cbbb\u001d"); + await j.AfterRunningTestAsync("foo", result, testLog, new TimeSpan(0)); + await j.AfterRunningAllTestsAsync(null); + var xml = File.ReadAllText(resultsFile.FullName); + + var expectedXml = @" + + + aaabbb + +"; + + Assert.Equal(expectedXml, xml); + + resultsFile.Delete(); + } + } +} diff -Nru dotnet8-8.0.103-8.0.3/debian/eng/test-runner/Turkey.Tests/TestParserTest.cs dotnet8-8.0.103-8.0.3/debian/eng/test-runner/Turkey.Tests/TestParserTest.cs --- dotnet8-8.0.103-8.0.3/debian/eng/test-runner/Turkey.Tests/TestParserTest.cs 1970-01-01 00:00:00.000000000 +0000 +++ dotnet8-8.0.103-8.0.3/debian/eng/test-runner/Turkey.Tests/TestParserTest.cs 2024-03-18 12:48:03.000000000 +0000 @@ -0,0 +1,278 @@ +using System; +using System.Collections.Generic; +using System.Linq; + +using Xunit; + +namespace Turkey.Tests +{ + public class TestParserTests + { + + [Fact] + public void DisabledTestShouldBeSkipped() + { + TestParser parser = new TestParser(); + SystemUnderTest system = new SystemUnderTest(null, null, null, null, null, null); + TestDescriptor test = new TestDescriptor() + { + Enabled = false, + }; + + var shouldRun = parser.ShouldRunTest(system, test); + + Assert.False(shouldRun); + } + + [Theory] + [InlineData("1.0.1", false)] + [InlineData("1.1", false)] + [InlineData("1.1.1", false)] + [InlineData("2.0", false)] + [InlineData("2.0.9", false)] + [InlineData("2.1", true)] + [InlineData("2.1.0", true)] + [InlineData("2.1.1", true)] + [InlineData("2.2", true)] + [InlineData("2.3", true)] + [InlineData("3.0", true)] + public void TestShouldBeRunForSameOrHigherVersions(string version, bool expectedToRun) + { + TestParser parser = new TestParser(); + SystemUnderTest system = new SystemUnderTest( + dotnet: null, + runtimeVersion: Version.Parse(version), + sdkVersion: null, + platformIds: new List(), + environmentVariables: null, + traits: null); + + TestDescriptor test = new TestDescriptor() + { + Enabled = true, + RequiresSdk = false, + VersionSpecific = false, + Version = "2.1", + }; + + var shouldRun = parser.ShouldRunTest(system, test); + + Assert.Equal(expectedToRun, shouldRun); + } + + [Theory] + [InlineData("1.0.1", false)] + [InlineData("1.1", false)] + [InlineData("1.1.1", false)] + [InlineData("2.0", false)] + [InlineData("2.0.9", false)] + [InlineData("2.1", true)] + [InlineData("2.1.0", true)] + [InlineData("2.1.1", true)] + [InlineData("2.1.99", true)] + [InlineData("2.2", false)] + [InlineData("2.3", false)] + [InlineData("3.0", false)] + public void VersionSpecificTestShouldBeRunForSameMajorMinorVersion(string version, bool expectedToRun) + { + TestParser parser = new TestParser(); + SystemUnderTest system = new SystemUnderTest( + dotnet: null, + runtimeVersion: Version.Parse(version), + sdkVersion: null, + platformIds: new List(), + environmentVariables: null, + traits: null); + TestDescriptor test = new TestDescriptor() + { + Enabled = true, + RequiresSdk = false, + VersionSpecific = true, + Version = "2.1", + }; + + var shouldRun = parser.ShouldRunTest(system, test); + + Assert.Equal(expectedToRun, shouldRun); + } + + [Theory] + [InlineData("1.0.1", false)] + [InlineData("1.1", false)] + [InlineData("1.1.1", false)] + [InlineData("2.0", true)] + [InlineData("2.0.9", true)] + [InlineData("2.1", true)] + [InlineData("2.1.0", true)] + [InlineData("2.1.1", true)] + [InlineData("2.1.99", true)] + [InlineData("2.2", true)] + [InlineData("2.2.99", true)] + [InlineData("2.3", true)] + [InlineData("2.9", true)] + [InlineData("3.0", false)] + [InlineData("3.2", false)] + public void VersionSpecificTestWithWildcardShouldBeRunForSameMajorVersion(string version, bool expectedToRun) + { + TestParser parser = new TestParser(); + SystemUnderTest system = new SystemUnderTest( + dotnet: null, + runtimeVersion: Version.Parse(version), + sdkVersion: null, + platformIds: new List(), + environmentVariables: null, + traits: null); + TestDescriptor test = new TestDescriptor() + { + Enabled = true, + RequiresSdk = false, + VersionSpecific = true, + Version = "2.x", + }; + + var shouldRun = parser.ShouldRunTest(system, test); + + Assert.Equal(expectedToRun, shouldRun); + } + + [Fact] + public void MissingIgnoredRIDsIsOkay() + { + TestParser parser = new TestParser(); + SystemUnderTest system = new SystemUnderTest( + dotnet: null, + runtimeVersion: Version.Parse("2.1"), + sdkVersion: null, + platformIds: new string[] { "linux" }.ToList(), + environmentVariables: null, + traits: null); + TestDescriptor test = new TestDescriptor() + { + Enabled = true, + RequiresSdk = false, + Version = "2.1", + IgnoredRIDs = null, + }; + + var shouldRun = parser.ShouldRunTest(system, test); + + Assert.Equal(true, shouldRun); + } + [Theory] + [InlineData(new string[] { "linux" }, new string[] { }, true)] + [InlineData(new string[] { "linux" }, new string[] { "fedora" }, true)] + [InlineData(new string[] { "fedora" }, new string[] { }, true)] + [InlineData(new string[] { "fedora99" }, new string[] { }, true)] + [InlineData(new string[] { "fedora99" }, new string[] { "fedora10" }, true)] + [InlineData(new string[] { "fedora" }, new string[] { "fedora" }, false)] + [InlineData(new string[] { "fedora", "fedora99" }, new string[] { "fedora" }, false)] + public void TestShouldNotRunOnIgnoredPlatforms(string[] currentPlatforms, string[] ignoredRIDs, bool expectedToRun) + { + TestParser parser = new TestParser(); + SystemUnderTest system = new SystemUnderTest( + dotnet: null, + runtimeVersion: Version.Parse("2.1"), + sdkVersion: null, + platformIds: currentPlatforms.ToList(), + environmentVariables: null, + traits: null); + TestDescriptor test = new TestDescriptor() + { + Enabled = true, + RequiresSdk = false, + Version = "2.1", + IgnoredRIDs = ignoredRIDs.ToList(), + }; + + var shouldRun = parser.ShouldRunTest(system, test); + + Assert.Equal(expectedToRun, shouldRun); + } + + [Theory] + [InlineData("3.1.104", true, true)] + [InlineData(null, false, true)] + [InlineData(null, true, false)] + public void SdkTestsShouldRunOnlyWithSdk(string sdkVersion, bool requiresSdk, bool expectedToRun) + { + TestParser parser = new TestParser(); + SystemUnderTest system = new SystemUnderTest( + dotnet: null, + runtimeVersion: Version.Parse("3.1"), + sdkVersion: Version.Parse(sdkVersion), + platformIds: new List(), + environmentVariables: null, + traits: null); + TestDescriptor test = new TestDescriptor() + { + Enabled = true, + RequiresSdk = requiresSdk, + VersionSpecific = false, + Version = "2.1", + }; + + var shouldRun = parser.ShouldRunTest(system, test); + + Assert.Equal(expectedToRun, shouldRun); + } + + public static IEnumerable SkipTestForTraits_MemberData() + { + const string Trait1 = nameof(Trait1); + const string Trait2 = nameof(Trait2); + string[] Empty = Array.Empty(); + + // Empty 'skipWhen' has no skips. + yield return new object[] { Empty, Empty, false }; + yield return new object[] { new [] { Trait1 }, Empty, false }; + yield return new object[] { new string [] { Trait1, Trait2 }, Empty, false }; + + // Single match gets skipped. + yield return new object[] { new [] { Trait1 }, new string [] { Trait1 }, true }; + yield return new object[] { new [] { Trait1, Trait2 }, new string [] { Trait1 }, true }; + + // No match is enabled. + yield return new object[] { Empty, new string [] { Trait1 }, false }; + yield return new object[] { new [] { Trait2 }, new string [] { Trait1 }, false }; + + // Comma separated traits work as AND. + yield return new object[] { Empty, new string [] { $"{Trait1},{Trait2}" }, false }; + yield return new object[] { new [] { Trait1 }, new string [] { $"{Trait1},{Trait2}" }, false }; + yield return new object[] { new [] { Trait2 }, new string [] { $"{Trait1},{Trait2}" }, false }; + yield return new object[] { new [] { Trait1, Trait2 }, new string [] { $"{Trait1},{Trait2}" }, true }; + + // Items work as OR. + yield return new object[] { Empty, new string [] { Trait1, Trait2 }, false }; + yield return new object[] { new [] { Trait1 }, new string [] { Trait1, Trait2 }, true }; + yield return new object[] { new [] { Trait2 }, new string [] { Trait1, Trait2 }, true }; + yield return new object[] { new [] { Trait1, Trait2 }, new string [] { Trait1, Trait2 }, true }; + } + + + [Theory] + [MemberData(nameof(SkipTestForTraits_MemberData))] + public void SkipTestForTraits(string[] systemTraits, string[] skipWhen, bool expectedToSkip) + { + TestParser parser = new TestParser(); + + SystemUnderTest system = new SystemUnderTest( + dotnet: null, + runtimeVersion: Version.Parse("3.1"), + sdkVersion: null, + platformIds: null, + environmentVariables: null, + traits: new HashSet(systemTraits)); + TestDescriptor test = new TestDescriptor() + { + Enabled = true, + VersionSpecific = false, + SkipWhen = new List(skipWhen), + Version = "2.1" + }; + + var shouldRun = parser.ShouldRunTest(system, test); + + Assert.Equal(expectedToSkip, !shouldRun); + } + } +} diff -Nru dotnet8-8.0.103-8.0.3/debian/eng/test-runner/Turkey.Tests/Turkey.Tests.csproj dotnet8-8.0.103-8.0.3/debian/eng/test-runner/Turkey.Tests/Turkey.Tests.csproj --- dotnet8-8.0.103-8.0.3/debian/eng/test-runner/Turkey.Tests/Turkey.Tests.csproj 1970-01-01 00:00:00.000000000 +0000 +++ dotnet8-8.0.103-8.0.3/debian/eng/test-runner/Turkey.Tests/Turkey.Tests.csproj 2024-03-18 12:48:03.000000000 +0000 @@ -0,0 +1,23 @@ + + + + net6.0 + + net$(BundledNETCoreAppTargetFrameworkVersion) + false + Major + + + + + + + + + + + + + diff -Nru dotnet8-8.0.103-8.0.3/debian/eng/test-runner/Turkey.Tests/VersionTest.cs dotnet8-8.0.103-8.0.3/debian/eng/test-runner/Turkey.Tests/VersionTest.cs --- dotnet8-8.0.103-8.0.3/debian/eng/test-runner/Turkey.Tests/VersionTest.cs 1970-01-01 00:00:00.000000000 +0000 +++ dotnet8-8.0.103-8.0.3/debian/eng/test-runner/Turkey.Tests/VersionTest.cs 2024-03-18 12:48:03.000000000 +0000 @@ -0,0 +1,108 @@ +using System; +using Xunit; + +using Version = Turkey.Version; + +namespace Turkey.Tests +{ + public class VersionTest + { + [Fact] + public void SimpleParse() + { + var version = Version.Parse("2.1"); + Assert.NotNull(version); + Assert.Equal(2, version.Major); + Assert.Equal(1, version.Minor); + Assert.Equal("2.1", version.MajorMinor); + } + + [Theory] + [InlineData("1")] + [InlineData("1.0")] + [InlineData("1.0.0")] + [InlineData("1.0.0.0")] + [InlineData("1.0.0.preview3")] + [InlineData("1.0.0.a1")] + [InlineData("1.0.0.a.1")] + public void ParseableVersions(string input) + { + Version.Parse(input); + } + + [Fact] + public void Equality() + { + var v1 = Version.Parse("1.0"); + var v2 = Version.Parse("1.0"); + + Assert.Equal(v1, v2); + Assert.True(v1 == v2); + Assert.False(v1 != v2); + } + + [Theory] + [InlineData(".1")] + public void InvalidVersionsThrow(string version) + { + Assert.Throws(() => Version.Parse(version)); + } + + [Theory] + [InlineData("1")] + [InlineData("1.0")] + [InlineData("1.0.0")] + [InlineData("1.0.0.0.0")] + [InlineData("1.0.0.0.0.0")] + public void TrailingZerosDoNotMatter(string version) + { + var v1 = Version.Parse("1.0"); + var v2 = Version.Parse(version); + + Assert.Equal(v1, v2); + Assert.True(v1 == v2); + Assert.False(v1 != v2); + } + + [Theory] + [InlineData("0.0.1")] + [InlineData("0.0.0.1")] + public void LeadingZerosMatter(string version) + { + var v1 = Version.Parse("0.1"); + var v2 = Version.Parse(version); + + Assert.NotEqual(v1, v2); + Assert.False(v1 == v2); + Assert.True(v1 != v2); + } + + [Fact] + public void VersionComparisons() + { + var v1 = Version.Parse("1.0"); + var v2 = Version.Parse("1.0.1"); + var v3 = Version.Parse("1.0.2"); + var v4 = Version.Parse("0.1.2"); + var v5 = Version.Parse("0.9.2"); + var v6 = Version.Parse("0.10.2"); + + Assert.True(v1 < v2); + Assert.True(v2 < v3); + Assert.True(v3 > v2); + Assert.True(v2 > v1); + Assert.True(v4 < v1); + Assert.True(v4 < v5); + Assert.True(v6 > v5); + Assert.True(v6 > v4); + Assert.True(v6 < v1); + } + + [Fact] + public void TestToString() + { + var v1 = Version.Parse("1.0"); + Assert.Equal("1.0", v1.ToString()); + } + } +} diff -Nru dotnet8-8.0.103-8.0.3/debian/eng/test-runner/Turkey.sln dotnet8-8.0.103-8.0.3/debian/eng/test-runner/Turkey.sln --- dotnet8-8.0.103-8.0.3/debian/eng/test-runner/Turkey.sln 1970-01-01 00:00:00.000000000 +0000 +++ dotnet8-8.0.103-8.0.3/debian/eng/test-runner/Turkey.sln 2024-03-18 12:48:03.000000000 +0000 @@ -0,0 +1,48 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 15 +VisualStudioVersion = 15.0.26124.0 +MinimumVisualStudioVersion = 15.0.26124.0 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Turkey", "Turkey\Turkey.csproj", "{A16358D4-D37D-4E4D-92A5-142A3D81972A}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Turkey.Tests", "Turkey.Tests\Turkey.Tests.csproj", "{AA784CA2-3D2D-4B17-A5D9-40647E1518BF}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Debug|x64 = Debug|x64 + Debug|x86 = Debug|x86 + Release|Any CPU = Release|Any CPU + Release|x64 = Release|x64 + Release|x86 = Release|x86 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {A16358D4-D37D-4E4D-92A5-142A3D81972A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {A16358D4-D37D-4E4D-92A5-142A3D81972A}.Debug|Any CPU.Build.0 = Debug|Any CPU + {A16358D4-D37D-4E4D-92A5-142A3D81972A}.Debug|x64.ActiveCfg = Debug|Any CPU + {A16358D4-D37D-4E4D-92A5-142A3D81972A}.Debug|x64.Build.0 = Debug|Any CPU + {A16358D4-D37D-4E4D-92A5-142A3D81972A}.Debug|x86.ActiveCfg = Debug|Any CPU + {A16358D4-D37D-4E4D-92A5-142A3D81972A}.Debug|x86.Build.0 = Debug|Any CPU + {A16358D4-D37D-4E4D-92A5-142A3D81972A}.Release|Any CPU.ActiveCfg = Release|Any CPU + {A16358D4-D37D-4E4D-92A5-142A3D81972A}.Release|Any CPU.Build.0 = Release|Any CPU + {A16358D4-D37D-4E4D-92A5-142A3D81972A}.Release|x64.ActiveCfg = Release|Any CPU + {A16358D4-D37D-4E4D-92A5-142A3D81972A}.Release|x64.Build.0 = Release|Any CPU + {A16358D4-D37D-4E4D-92A5-142A3D81972A}.Release|x86.ActiveCfg = Release|Any CPU + {A16358D4-D37D-4E4D-92A5-142A3D81972A}.Release|x86.Build.0 = Release|Any CPU + {AA784CA2-3D2D-4B17-A5D9-40647E1518BF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {AA784CA2-3D2D-4B17-A5D9-40647E1518BF}.Debug|Any CPU.Build.0 = Debug|Any CPU + {AA784CA2-3D2D-4B17-A5D9-40647E1518BF}.Debug|x64.ActiveCfg = Debug|Any CPU + {AA784CA2-3D2D-4B17-A5D9-40647E1518BF}.Debug|x64.Build.0 = Debug|Any CPU + {AA784CA2-3D2D-4B17-A5D9-40647E1518BF}.Debug|x86.ActiveCfg = Debug|Any CPU + {AA784CA2-3D2D-4B17-A5D9-40647E1518BF}.Debug|x86.Build.0 = Debug|Any CPU + {AA784CA2-3D2D-4B17-A5D9-40647E1518BF}.Release|Any CPU.ActiveCfg = Release|Any CPU + {AA784CA2-3D2D-4B17-A5D9-40647E1518BF}.Release|Any CPU.Build.0 = Release|Any CPU + {AA784CA2-3D2D-4B17-A5D9-40647E1518BF}.Release|x64.ActiveCfg = Release|Any CPU + {AA784CA2-3D2D-4B17-A5D9-40647E1518BF}.Release|x64.Build.0 = Release|Any CPU + {AA784CA2-3D2D-4B17-A5D9-40647E1518BF}.Release|x86.ActiveCfg = Release|Any CPU + {AA784CA2-3D2D-4B17-A5D9-40647E1518BF}.Release|x86.Build.0 = Release|Any CPU + EndGlobalSection +EndGlobal diff -Nru dotnet8-8.0.103-8.0.3/debian/eng/test-runner/nuget.config dotnet8-8.0.103-8.0.3/debian/eng/test-runner/nuget.config --- dotnet8-8.0.103-8.0.3/debian/eng/test-runner/nuget.config 1970-01-01 00:00:00.000000000 +0000 +++ dotnet8-8.0.103-8.0.3/debian/eng/test-runner/nuget.config 2024-03-18 12:48:03.000000000 +0000 @@ -0,0 +1,6 @@ + + + + + + diff -Nru dotnet8-8.0.103-8.0.3/debian/eng/test-runner/run-tests.py dotnet8-8.0.103-8.0.3/debian/eng/test-runner/run-tests.py --- dotnet8-8.0.103-8.0.3/debian/eng/test-runner/run-tests.py 1970-01-01 00:00:00.000000000 +0000 +++ dotnet8-8.0.103-8.0.3/debian/eng/test-runner/run-tests.py 2024-03-18 12:48:03.000000000 +0000 @@ -0,0 +1,55 @@ +#!/usr/bin/env python3 + +# Wrapper for compatiblity with older users of this repository. If you are a +# new user, look at using bin/turkey directly. +# +# We download a known-to-work prebuilt binary instead of compiling using the +# sourcecode ourselves. + +import json +import os +import re +import sys +import subprocess +from urllib.request import urlopen + + +def download_turkey(binary): + os.makedirs(os.path.dirname(binary), 0o755) + release_url = "https://api.github.com/repos/redhat-developer/dotnet-bunny/releases/latest" + with urlopen(release_url) as response: + json_response = json.load(response) + download_url = json_response['assets'][0]['browser_download_url'] + print('Downloading ' + download_url + ' to ' + binary) + with urlopen(download_url) as download: + with open(binary, 'wb') as f: + f.write(download.read()) + os.chmod(binary, 0o755) + +def main(args): + binary = os.path.realpath(os.path.join('bin', 'turkey')) + if not os.path.exists(binary): + download_turkey(binary) + + p = subprocess.run([binary, '--version'], stdout=subprocess.PIPE, stderr=subprocess.STDOUT, universal_newlines=True, shell=False) + print(p.stdout) + if p.returncode != 0: + return returncode + + test_args = [] + test_args.append(binary) + # remove first two args + # first arg is name of program + # second arg is the .NET Core version + test_args.extend(args[2:]) + test_args.append('-c') + + print('Running: ' + str(test_args)) + + p = subprocess.run(test_args, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, universal_newlines=True, shell=False) + print(p.stdout) + if p.returncode != 0: + return p.returncode + +if __name__ == '__main__': + sys.exit(main(sys.argv)) diff -Nru dotnet8-8.0.103-8.0.3/debian/eng/versionlib/README.md dotnet8-8.0.103-8.0.3/debian/eng/versionlib/README.md --- dotnet8-8.0.103-8.0.3/debian/eng/versionlib/README.md 1970-01-01 00:00:00.000000000 +0000 +++ dotnet8-8.0.103-8.0.3/debian/eng/versionlib/README.md 2024-03-18 12:48:03.000000000 +0000 @@ -0,0 +1,97 @@ +# versionlib + +This library has the goal to make complex version parsing scenarios easy. + +## Getting started + +```python +import os +import sys + +sys.path.append("debian/eng") +from versionlib.dotnet import SourcePackageVersion, RuntimeIdentifier + +version = SourcePackageVersion.ParseFromChangelog( + os.path.join("debian", "changelog")) + +runtimeIdentifier = RuntimeIdentifier.FromPlatformData() + +print(version) +# 6.0.128-0ubuntu1~23.10.1 + +print(version.SdkVersion) +# 6.0.128 + +print(version.SdkVersion.Major) +# 6 + +print(version.SdkVersion.Minor) +# 0 + +print(version.SdkVersion.FeatureBand) +# 100 + +print(version.SdkVersion.Patch) +# 28 + +print(version.SdkVersion.Revision) +# 128 + +print(version.RuntimeVersion) +# 6.0.28 + +print(version.RuntimeVersion.Major) +# 6 + +print(version.RuntimeVersion.Minor) +# 0 + +print(version.RuntimeVersion.Patch) +# 28 + +print(version.DebRevision) +# 0ubuntu1~23.10.1 + +print(version.DebRevision.DebianRevision) +# 0 + +print(version.DebRevision.UbuntuRevision) +# 1~23.10.1 + +print(version.IsFO127Compliant) +# False + +print(runtimeIdentifier) +# ubuntu.23.10-x64 + +print(runtimeIdentifier.OperatingSystemIdentifier) +# ubuntu.23.10 + +print(runtimeIdentifier.OperatingSystemIdentifier.Name) +# ubuntu + +print(runtimeIdentifier.OperatingSystemIdentifier.Version) +# 23.10 + +print(runtimeIdentifier.ArchitectureIdentifier) +# x64 +``` + +Alternatively add `"debian/eng"` to the +[`PYTHONPATH`](https://docs.python.org/3/using/cmdline.html#envvar-PYTHONPATH) +environemnt variable if you do not want to use the `sys.path.append` +mechanism before importing this module. + +```bash +PYTHONPATH="debian/eng:$PYTHONPATH" +``` + +## Quirks + +If you used the module localy a `__pycache__` directory will be created (at +`debian/eng/versionlib/__pycache__`). Do not forget to delete this directory +before building the source-package or commiting changes to `git-ubuntu`. + +## Author + +Dominik Viererbe \ diff -Nru dotnet8-8.0.103-8.0.3/debian/eng/versionlib/dotnet.py dotnet8-8.0.103-8.0.3/debian/eng/versionlib/dotnet.py --- dotnet8-8.0.103-8.0.3/debian/eng/versionlib/dotnet.py 1970-01-01 00:00:00.000000000 +0000 +++ dotnet8-8.0.103-8.0.3/debian/eng/versionlib/dotnet.py 2024-03-18 12:48:03.000000000 +0000 @@ -0,0 +1,280 @@ +from strenum import StrEnum +import platform +import re + +from . import dpkg + + +class PreReleaseType(StrEnum): + Alpha = "alpha" + Beta = "beta" + Preview = "preview" + ReleaseCandidate = "rc" + + +class PrereleaseVersion: + def __init__(self, + type: PreReleaseType, + revision: int | None, + buildMetadata: list[str] | None) -> None: + self.Type = type + self.Revision = revision + self.BuildMetadata = buildMetadata + + def __str__(self) -> str: + prereleaseVersion = str(self.Type) + + if self.Revision is not None: + prereleaseVersion += "." + str(self.Revision) + + if self.BuildMetadata is not None: + for buildMetadataPart in self.BuildMetadata: + prereleaseVersion += "." + buildMetadataPart + + return prereleaseVersion + + def __eq__(self, __value: object) -> bool: + if __value is None: + return False + + if self.Type != __value.Type: + return False + + if self.Revision != __value.Revision: + return False + + if (self.BuildMetadata is None) != (__value.BuildMetadata is None): + return False + elif self.BuildMetadata is None: + return True + elif len(self.BuildMetadata) != len(__value.BuildMetadata): + return False + + for i in range(self.BuildMetadata): + if self.BuildMetadata[i] != __value.BuildMetadata[i]: + return False + + return True + + +class SdkVersion: + def __init__(self, + major: int, + minor: int, + featureBand: int, + patch: int, + preReleaseVersion: PrereleaseVersion) -> None: + if major < 1: + raise ValueError(".NET SDK major version number can't be " + f"non-positive (major = {major}).") + if minor < 0: + raise ValueError(".NET SDK minor version number can't be " + f"negative (minor = {minor}).") + if featureBand < 100 or featureBand > 900 or (featureBand % 100) != 0: + raise ValueError(".NET SDK feature band has to be a " + "multiple of 100 between (inclusive) 100 and 900 " + f"(featureBand = {featureBand}).") + if patch < 0 or patch > 99: + raise ValueError(".NET SDK patch number has to be " + "between (inclusive) 0 and 99 " + f"(patch = {patch}).") + + self.Major = major + self.Minor = minor + self.FeatureBand = featureBand + self.Patch = patch + self.Revision = featureBand + patch + self.PreReleaseVersion = preReleaseVersion + + def __str__(self) -> str: + sdkVersion = f"{self.Major}.{self.Minor}.{self.Revision}" + + if self.PreReleaseVersion is not None: + sdkVersion += "-" + str(self.PreReleaseVersion) + + return sdkVersion + + +class RuntimeVersion: + def __init__(self, + major: int, + minor: int, + patch: int, + preReleaseVersion: PrereleaseVersion) -> None: + if major < 1: + raise ValueError(".NET Runtime major version number can't be " + f"non-positive (major = {major}).") + if minor < 0: + raise ValueError(".NET Runtime minor version number can't be " + f"negative (minor = {minor}).") + if patch < 0 or patch > 99: + raise ValueError(".NET Runtime patch number has to be " + f"between 0 and 99 (patch = {patch}).") + + self.Major = major + self.Minor = minor + self.Patch = patch + self.PreReleaseVersion = preReleaseVersion + + def __str__(self) -> str: + runtimeVersion = f"{self.Major}.{self.Minor}.{self.Patch}" + + if self.PreReleaseVersion is not None: + runtimeVersion += "-" + str(self.PreReleaseVersion) + + return runtimeVersion + + +class SourcePackageVersion: + Pattern = r"\A(?P[1-9]\d*)\." \ + r"(?P\d+)\." \ + r"(?P[1-9])" \ + r"(?P\d\d)" \ + r"(?:-" \ + r"(?P=Major)\." \ + r"(?P=Minor)\." \ + r"(?P0|[1-9]\d?)" \ + r")?" \ + r"(?:~" \ + r"(?Prc|preview|beta|alpha)" \ + r"(?P[1-9]\d*)" \ + r"(?P(?:\.[0-9a-z]+)+)?" \ + r")?" \ + r"(?:-" \ + r"(?P[A-Za-z0-9.+:~]+)" \ + r"(?:ubuntu(?P[A-Za-z0-9.+:~]+))" \ + r")\Z" + + def __init__(self, + sdkVersion, + runtimeVersion, + debRevision, + raw, + isFO127Compliant) -> None: + self.SdkVersion = sdkVersion + self.RuntimeVersion = runtimeVersion + self.DebRevision = debRevision + self.Raw = raw + self.IsFO127Compliant = isFO127Compliant + + @staticmethod + def Parse(value: str) -> 'SourcePackageVersion': + parsingResult = re.search(SourcePackageVersion.Pattern, value) + + if parsingResult is None: + raise ValueError("The format of the provided .NET source package " + "version identifier could not be recognized " + f"(value=\"{value}\").") + + if parsingResult.group("PreReleaseType") is not None: + preReleaseType = parsingResult.group("PreReleaseType") + preReleaseRevision = parsingResult.group("PreReleaseRevision") + buildMetadata = parsingResult.group("BuildMetadata") + + if preReleaseRevision is not None: + preReleaseRevision = int(preReleaseRevision) + + if buildMetadata is not None: + buildMetadata = buildMetadata.split('.')[1:] + + preReleaseVersion = PrereleaseVersion( + preReleaseType, preReleaseRevision, buildMetadata) + else: + preReleaseVersion = None + + major = int(parsingResult.group("Major")) + minor = int(parsingResult.group("Minor")) + sdkFeatureBand = int(parsingResult.group("SdkFeatureBand")) * 100 + sdkPatch = int(parsingResult.group("SdkPatch")) + sdkVersion = SdkVersion( + major, minor, sdkFeatureBand, sdkPatch, preReleaseVersion) + + if parsingResult.group("RuntimePatch") is not None: + isFO127Compliant = True + runtimePatch = int(parsingResult.group("RuntimePatch")) + else: + isFO127Compliant = False + runtimePatch = sdkPatch + + runtimeVersion = RuntimeVersion( + major, minor, runtimePatch, preReleaseVersion) + + debianRevision = parsingResult.group("DebianRevision") + ubuntuRevision = parsingResult.group("UbuntuRevision") + debRevision = dpkg.DebRevision(debianRevision, ubuntuRevision) + + return SourcePackageVersion( + sdkVersion, runtimeVersion, debRevision, value, isFO127Compliant) + + def ParseFromChangelog(path: str) -> 'SourcePackageVersion': + version = dpkg.Changelog(path).ParseFieldOfLatestEntry(dpkg.ChangelogEntryField.VERSION) + + return SourcePackageVersion.Parse(version) + + def __str__(self) -> str: + return self.Raw + + +class OperatingSystemIdentifier: + def __init__(self, name, version): + self.Name = name + self.Version = version + + @staticmethod + def Current() -> 'OperatingSystemIdentifier': + osReleaseData = platform.freedesktop_os_release() + + osId = OperatingSystemIdentifier( + osReleaseData["ID"], + osReleaseData["VERSION_ID"]) + + return osId + + def __str__(self) -> str: + return f"{self.Name}.{self.Version}" + + +class ArchitectureIdentifier(StrEnum): + X64 = "x64" + ARM64 = "arm64" + S390X = "s390x" + + @staticmethod + def ParseMachineIdentifier(machineIdentifier: str) -> 'ArchitectureIdentifier': # noqa: E501 + match machineIdentifier: + case "x86_64": + return ArchitectureIdentifier.X64 + case "aarch64": + return ArchitectureIdentifier.ARM64 + case "s390x": + return ArchitectureIdentifier.S390X + case _: + raise RuntimeError(f"{machineIdentifier} is an " + "unknown/unsupported system architecture.") + + @staticmethod + def Current() -> 'ArchitectureIdentifier': + machineIdentifier = platform.machine() + return ArchitectureIdentifier.ParseMachineIdentifier(machineIdentifier) + + +class RuntimeIdentifier: + def __init__(self, + osIdentifier: OperatingSystemIdentifier, + architecture: ArchitectureIdentifier | None) -> None: + self.OperatingSystemIdentifier = osIdentifier + self.ArchitectureIdentifier = architecture + + @staticmethod + def FromPlatformData() -> 'RuntimeIdentifier': + return RuntimeIdentifier( + OperatingSystemIdentifier.Current(), + ArchitectureIdentifier.Current()) + + def __str__(self) -> str: + rid = str(self.OperatingSystemIdentifier) + + if self.ArchitectureIdentifier is not None: + rid += '-' + str(self.ArchitectureIdentifier) + + return rid diff -Nru dotnet8-8.0.103-8.0.3/debian/eng/versionlib/dpkg.py dotnet8-8.0.103-8.0.3/debian/eng/versionlib/dpkg.py --- dotnet8-8.0.103-8.0.3/debian/eng/versionlib/dpkg.py 1970-01-01 00:00:00.000000000 +0000 +++ dotnet8-8.0.103-8.0.3/debian/eng/versionlib/dpkg.py 2024-03-18 12:48:03.000000000 +0000 @@ -0,0 +1,45 @@ +from strenum import StrEnum +import errno +import os +import subprocess + + +class DebRevision: + def __init__( + self, + debianRevision: str, + ubuntuRevision: str | None = None) -> None: + self.DebianRevision = debianRevision + self.UbuntuRevision = ubuntuRevision + + def __str__(self) -> str: + if self.UbuntuRevision is None: + return f"{self.DebianRevision}" + else: + return f"{self.DebianRevision}ubuntu{self.UbuntuRevision}" + + +class ChangelogEntryField(StrEnum): + VERSION = "Version" + DISTRIBUTION = "Distribution" + URGENCY = "Urgency" + MAINTAINER = "Maintainer" + CHANGES = "Changes" + + +class Changelog: + def __init__(self, path: str) -> None: + if not os.path.exists(path): + raise FileNotFoundError( + errno.ENOENT, os.strerror(errno.ENOENT), path) + + self.Path = path + + def ParseFieldOfLatestEntry(self, field: ChangelogEntryField) -> str: + field = subprocess.check_output( + "dpkg-parsechangelog " + f"--show-field {str(field.value)} " + f"--file {self.Path}", + text=True, shell=True) + + return field[:-1] # remove trailing \n diff -Nru dotnet8-8.0.103-8.0.3/debian/eng/watch-script.sh dotnet8-8.0.103-8.0.3/debian/eng/watch-script.sh --- dotnet8-8.0.103-8.0.3/debian/eng/watch-script.sh 1970-01-01 00:00:00.000000000 +0000 +++ dotnet8-8.0.103-8.0.3/debian/eng/watch-script.sh 2024-03-18 12:48:03.000000000 +0000 @@ -0,0 +1,153 @@ +#!/usr/bin/env bash + +# This script is expects to be called by uscan(1). There are some +# safeguards this script will check for, but please only invoke +# this script manually if you know what you are doing. + +# What does this script do? +# 1. extract orig tarball +# 2. parse sdk version number +# 3. rename extracted source tree to "8.0.XXX-8.0.X" pattern +# 4. repack source tree +# 5. delete temprary uscan(1) files +# 6. copy debian folder to new source tree +# 7. create changelog entry + +old_source_tree="$PWD" +log_file="$(realpath "../$(basename "$PWD").watch-script.log")" +default_changelog_entry_msg="New upstream release." + +function log() +{ + # The logs are writen to a log file, because uscan + # swallows the output if the exit code is not 0. + echo "$0 $1: $2" | tee --append "$log_file" +} + +function log_error() +{ + log "error" "$1" +} + +function log_warn() +{ + log "warning" "$1" +} + +function log_info() +{ + log "info" "$1" +} + +function log_debug() +{ + log "debug" "$1" +} + +log_debug "started on $(date)" + +if [ "$#" != "2" ]; then + log_debug "parameters: $*" + log_error "expected 2 parameters; got $#" + exit 1 +elif [ "$1" != "--upstream-version" ]; then + log_debug "parameters: $*" + log_error "expected --upstream-version as first parameter; got $1" + exit 1 +else + version="$2" + log_debug "version=$version" +fi + +# just check if we are at the root of a source tree +if [ ! -d "./debian" ]; then + log_error "could not find a debian folder; expected to be inside a debian source tree" + exit 1 +elif [ ! -s "./debian/changelog" ]; then + log_error "could not find a debian/changelog file; expected to be inside a debian source tree" + exit 1 +elif [ ! -s "./debian/copyright" ]; then + log_error "could not find a debian/copyright file; expected to be inside a debian source tree" + exit 1 +fi + +cd .. + +orig_tarball="dotnet8_$version.orig.tar.xz" +log_debug "orig_tarball=$orig_tarball" +if [ ! -s "$orig_tarball" ]; then + log_error "could not find orig tarball that should have been created by uscan(1)" + exit 1 +fi + +log_info "extracting orig tarball" +if ! tar --extract --xz --file "$orig_tarball" ; then + log_error "failed to extract orig tarball ../$orig_tarball" + exit 1 +fi + +# parses the SDK version +source_tree="dotnet8-$version" +if [ ! -d "$source_tree" ]; then + log_error "extracted source tree ../$source_tree could not be found" + exit 1 +elif ! sdk_version="$(grep --only-matching \ + --perl-regexp '(?<=)8\.0\.1\d\d(\.\d+)*(?=.*<\/OutputPackageVersion>)' \ + "$source_tree/prereqs/git-info/sdk.props")" +then + log_error "failed to parse sdk metadata from extracted orig tarball" + log_info "deleting extracted source tree" + rm -rf "$source_tree" || log_warn "failed to delete extracted source tree" + exit 1 +elif [ -z "$sdk_version" ]; then + log_error "sdk_version is empty; must have been a parsing error; maybe the format of prereqs/git-info/sdk.props has changed" + log_info "deleting extracted source tree" + rm -rf "$source_tree" || log_warn "failed to delete extracted source tree" + exit 1 +else + log_debug "sdk_version=$sdk_version" +fi + +# rename the source tree from a "8.0.X" pattern to a "8.0.XXX-8.0.X" pattern +new_source_tree="${source_tree/$version/$sdk_version-$version}" +if mv "$source_tree" "$new_source_tree"; then + echo "$0 info: renamed '../$source_tree' to '../$new_source_tree'" + source_tree="$new_source_tree" + version="${source_tree/dotnet8-/}" +else + log_debug "failed to rename '../$source_tree' to '../$new_source_tree'" + log_info "deleting extracted source tree" + rm -rf "$source_tree" || log_warn "failed to delete extracted source tree" + exit 1 +fi + +# repack source tree, because top-level dir in the orig tarball has also the "8.0.X" pattern +log_info "repack source tree" +if ! tar --create --use-compress-program 'xz --threads 0' --file "dotnet8_$version.orig.tar.xz" "$new_source_tree"; then + log_debug "failed to repack orig tarball" + log_info "deleting extracted source tree" + rm -rf "$source_tree" || log_warn "failed to delete extracted source tree" + exit 1 +fi + +log_info "cleaning up uscan(1) temporary artifacts" +rm -rf "dotnet8-temporary.*.git" || log_warn "failed to delete temporary bare git repository" +rm -f "$orig_tarball" || log_warn "failed to delete temporary orig tarball $orig_tarball" +rm -f "dotnet8-${version/8\.0\.1[0-9][0-9]-/}.tar.xz" || log_warn "failed to delete temporary tarball" + +log_info "copy debian folder" +if ! cp -r "$old_source_tree/debian" "$source_tree/"; then + log_warn "failed to copy the debian folder to the new source tree" + exit 1 +fi + +if ! cd "$source_tree"; then + log_warn "failed to change working directory to new source tree" + exit 1 +fi + +log_info "new source tree at $PWD" + +log_info "create changelog entry" +debchange --newversion "$version-0ubuntu1" "$default_changelog_entry_msg" \ + || log_warn "failed to create changelog entry" diff -Nru dotnet8-8.0.103-8.0.3/debian/repack-dotnet-tarball.sh dotnet8-8.0.103-8.0.3/debian/repack-dotnet-tarball.sh --- dotnet8-8.0.103-8.0.3/debian/repack-dotnet-tarball.sh 2024-03-08 08:25:53.000000000 +0000 +++ dotnet8-8.0.103-8.0.3/debian/repack-dotnet-tarball.sh 1970-01-01 00:00:00.000000000 +0000 @@ -1,202 +0,0 @@ -#!/bin/bash - -# Usage: -# repack-dotnet-tarball link_to_ms_tarball -# -# Download the tarball from MS and erase some files -# not needed for the Ubuntu building. -# Recompression in xz format. - -trap on_exit TERM -trap on_exit EXIT - -set -euo pipefail -IFS=$'\n\t' - -function print_usage { - echo "Usage:" - echo "$0 link" - echo "" - echo "Repack a source archive tarball for dotnet7" - echo "" - echo " link: http address from where we can download the tarball from MS" - echo "" -# echo " version (X.X.XXX): dotnet version to be cloned" -# echo "" - echo "example: $0 https://dotnetclimsrc.blob.core.[...]/[...]" -} - -function on_exit { - rm -rf dotnet - rm -rf "${dir_name}" -} - -function clean_uscan_download { - find .. -name "dotnet*${version}*.tar.*" -delete -} - -set -x - -if [[ "$#" -gt 0 ]]; then - if [ "${1}" = "-h" ] || [ "${1}" = "--help" ]; then - print_usage - exit 0 - else - download_url="${1}" - tarball_name=$(echo "${download_url}" | sed -r 's|.*/([^/]+tar.gz)\?.*|\1|') - version=$(echo "${tarball_name}" | sed -r 's|.*-(.*).tar.gz|\1|') - major_version=${version%%.*} - fi -else - echo "Not enought arguments to run properly:" - print_usage - exit 1 -fi - -#we are not using uscan at the moment, because azure repo is not compatible -#with the protocols we can use in the watch file -#clean_uscan_download - -#Change this for incorporating dotnet or new architecture to a Ubuntu series -bootstrapping=1 - -dir_name="dotnet${major_version}-${version}" -tarball_suffix=".tar.xz" - -if [ "${bootstrapping}" -eq "1" ]; then - tarball_name="dotnet${major_version}_${version}.orig" -else - tarball_name="dotnet${major_version}_${version}~{arch}-bootstrap.orig" -fi - -tarball="${tarball_name}${tarball_suffix}" - -if [ -f "${tarball_name}${tarball_suffix}" ]; then - echo "error: ${tarball_name}${tarball_suffix} already exists" - exit 1 -fi - -# The below code avoids download the tarball if it has happened before -# sha512 has to be manually calculated on a single download and updated for every microrelease -# or provided by upstream. -download_mstarball=0 -if [ -s "${tarball_name}" ]; then - sha512="6d0283431e04b227a04979b05c20d95727fcaebcbdd50e8c0a7e654b35a23eba07417afb484b0eedd29208f2476b12874aaa8f2fc522eb2a57fbfeeae3e48c05" - existing_sha512sum=$(sha512sum "${tarball_name}" | cut -d' ' -f1) - if [ "${sha512}" == "${existing_sha512sum}" ]; then - download_mstarball=1 - else - rm "{ms_tarball}" - fi -fi - -download_succeeded=1 -if [ "$download_mstarball" -eq "0" ]; then - wget "${download_url}" -O "${tarball_name}" - download_succeeded=$? -fi - -# Clean the tarball -if [ "${download_succeeded}" -eq "0" ] || [ "${download_mstarball}" -eq "1" ]; then - - if [ -d "${dir_name}" ]; then - rm -rf "${dir_name}" - fi - - mkdir "${dir_name}" - pushd "${dir_name}" - tar xvzf ../"${tarball_name}" - - - if [ "$bootstrapping" -eq "0" ]; then - ./prep.sh --bootstrap - fi - - # Remove files with funny licenses, crypto implementations and other - # not-very-useful artifacts to reduce tarball size - # This list concords with the File-Excluded stanza in the copyright - - # Binaries for gradle - rm -r src/aspnetcore/src/SignalR/clients/java/signalr/gradle* - - # Unnecessary crypto implementation: IDEA - rm -r src/runtime/src/tests/JIT/Performance/CodeQuality/Bytemark/ - - # https://github.com/dotnet/aspnetcore/issues/34785 - find src/aspnetcore/src -type d -name samples -print0 | xargs -0 rm -r - - # https://github.com/NuGet/Home/issues/11094 - rm -r src/nuget-client/test/EndToEnd - - #Checked that are not needed in the build: this only removes under roslyn: - #src/roslyn/src/Compilers/Test/Resources/Core/SymbolsTests/V?/*.dll - find src/roslyn/src/Compilers/Test/Resources -iname "*.dll" -exec rm -rf {} + - - # https://github.com/microsoft/ApplicationInsights-dotnet/issues/2670 - #we are applying a patch for this - #rm -r src/source-build-externals/src/application-insights/LOGGING/test/Shared/CustomTelemetryChannel.cs - - #Don't remove vendorized libunwind because we need it for arm64 archs - #rm -r src/runtime/src/coreclr/pal/src/libunwind - - #CPC-1578 prebuilts not used in build - rm src/roslyn/src/Compilers/Test/Resources/Core/DiagnosticTests/ErrTestMod01.netmodule - rm src/roslyn/src/Compilers/Test/Resources/Core/DiagnosticTests/ErrTestMod02.netmodule - rm src/roslyn/src/Compilers/Test/Resources/Core/ExpressionCompiler/LibraryA.winmd - rm src/roslyn/src/Compilers/Test/Resources/Core/ExpressionCompiler/LibraryB.winmd - rm src/roslyn/src/Compilers/Test/Resources/Core/ExpressionCompiler/Windows.Data.winmd - rm src/roslyn/src/Compilers/Test/Resources/Core/ExpressionCompiler/Windows.Storage.winmd - rm src/roslyn/src/Compilers/Test/Resources/Core/ExpressionCompiler/Windows.winmd - rm src/roslyn/src/Compilers/Test/Resources/Core/MetadataTests/Invalid/EmptyModuleTable.netmodule - rm src/roslyn/src/Compilers/Test/Resources/Core/MetadataTests/NetModule01/ModuleCS00.mod - rm src/roslyn/src/Compilers/Test/Resources/Core/MetadataTests/NetModule01/ModuleCS01.mod - rm src/roslyn/src/Compilers/Test/Resources/Core/MetadataTests/NetModule01/ModuleVB01.mod - rm src/roslyn/src/Compilers/Test/Resources/Core/SymbolsTests/CustomModifiers/Modifiers.netmodule - rm src/roslyn/src/Compilers/Test/Resources/Core/SymbolsTests/MultiModule/mod2.netmodule - rm src/roslyn/src/Compilers/Test/Resources/Core/SymbolsTests/MultiModule/mod3.netmodule - rm src/roslyn/src/Compilers/Test/Resources/Core/SymbolsTests/MultiTargeting/Source1Module.netmodule - rm src/roslyn/src/Compilers/Test/Resources/Core/SymbolsTests/MultiTargeting/Source3Module.netmodule - rm src/roslyn/src/Compilers/Test/Resources/Core/SymbolsTests/MultiTargeting/Source4Module.netmodule - rm src/roslyn/src/Compilers/Test/Resources/Core/SymbolsTests/MultiTargeting/Source5Module.netmodule - rm src/roslyn/src/Compilers/Test/Resources/Core/SymbolsTests/MultiTargeting/Source7Module.netmodule - rm src/roslyn/src/Compilers/Test/Resources/Core/SymbolsTests/RetargetingCycle/V1/ClassB.netmodule - rm src/roslyn/src/Compilers/Test/Resources/Core/SymbolsTests/TypeForwarders/Forwarded.netmodule - rm src/roslyn/src/Compilers/Test/Resources/Core/SymbolsTests/V1/MTTestModule1.netmodule - rm src/roslyn/src/Compilers/Test/Resources/Core/SymbolsTests/V1/MTTestModule2.netmodule - rm src/roslyn/src/Compilers/Test/Resources/Core/SymbolsTests/V2/MTTestModule1.netmodule - rm src/roslyn/src/Compilers/Test/Resources/Core/SymbolsTests/V2/MTTestModule3.netmodule - rm src/roslyn/src/Compilers/Test/Resources/Core/SymbolsTests/V3/MTTestModule1.netmodule - rm src/roslyn/src/Compilers/Test/Resources/Core/SymbolsTests/V3/MTTestModule4.netmodule - rm 'src/roslyn/src/Compilers/Test/Resources/Core/SymbolsTests/With Spaces.netmodule' - rm src/roslyn/src/Compilers/Test/Resources/Core/SymbolsTests/netModule/CrossRefModule1.netmodule - rm src/roslyn/src/Compilers/Test/Resources/Core/SymbolsTests/netModule/CrossRefModule2.netmodule - rm src/roslyn/src/Compilers/Test/Resources/Core/SymbolsTests/netModule/hash_module.netmodule - rm src/roslyn/src/Compilers/Test/Resources/Core/SymbolsTests/netModule/netModule1.netmodule - rm src/roslyn/src/Compilers/Test/Resources/Core/SymbolsTests/netModule/netModule2.netmodule - rm src/roslyn/src/Compilers/Test/Resources/Core/WinRt/W1.winmd - rm src/roslyn/src/Compilers/Test/Resources/Core/WinRt/W2.winmd - rm src/roslyn/src/Compilers/Test/Resources/Core/WinRt/WB.winmd - rm src/roslyn/src/Compilers/Test/Resources/Core/WinRt/WB_Version1.winmd - rm src/roslyn/src/Compilers/Test/Resources/Core/WinRt/WImpl.winmd - rm src/roslyn/src/Compilers/Test/Resources/Core/WinRt/WinMDPrefixing.winmd - rm src/roslyn/src/Compilers/Test/Resources/Core/WinRt/Windows.Languages.WinRTTest.winmd - rm src/roslyn/src/Compilers/Test/Resources/Core/WinRt/Windows.winmd - rm src/roslyn/src/ExpressionEvaluator/Core/Source/ExpressionCompiler/Resources/WindowsProxy.winmd - rm src/runtime/src/libraries/System.Reflection.Metadata/tests/Resources/NetModule/ModuleCS00.mod - rm src/runtime/src/libraries/System.Reflection.Metadata/tests/Resources/NetModule/ModuleCS01.mod - rm src/runtime/src/libraries/System.Reflection.Metadata/tests/Resources/NetModule/ModuleVB01.mod - rm src/runtime/src/libraries/System.Reflection.Metadata/tests/Resources/WinRT/Lib.winmd - rm src/linker/external/cecil/Test/Resources/assemblies/ManagedWinmd.winmd - rm src/linker/external/cecil/Test/Resources/assemblies/NativeWinmd.winmd - rm src/linker/external/cecil/Test/Resources/assemblies/moda.netmodule - rm src/linker/external/cecil/Test/Resources/assemblies/modb.netmodule - rm src/linker/external/cecil/Test/Resources/assemblies/winrtcomp.winmd - - popd -else - echo "An error ocurred when downloading MS tarball" - exit 1 -fi - -tar -I 'xz -T 0' -cf "${tarball}" "${dir_name}" -rm "${tarball_name}" diff -Nru dotnet8-8.0.103-8.0.3/debian/rules dotnet8-8.0.103-8.0.3/debian/rules --- dotnet8-8.0.103-8.0.3/debian/rules 2024-03-08 08:25:53.000000000 +0000 +++ dotnet8-8.0.103-8.0.3/debian/rules 2024-03-18 12:48:03.000000000 +0000 @@ -91,6 +91,9 @@ /p:ContinueOnPrebuiltBaselineError=true endif +override_dh_auto_test: + python3 ./debian/tests/build-time-tests/tests.py --verbose --purge-after + override_dh_gencontrol: dh_gencontrol dh_gencontrol -paspnetcore-runtime-8.0 -- -v$(_FULL_RUNTIME_VERSION) diff -Nru dotnet8-8.0.103-8.0.3/debian/source/include-binaries dotnet8-8.0.103-8.0.3/debian/source/include-binaries --- dotnet8-8.0.103-8.0.3/debian/source/include-binaries 1970-01-01 00:00:00.000000000 +0000 +++ dotnet8-8.0.103-8.0.3/debian/source/include-binaries 2024-03-18 12:48:03.000000000 +0000 @@ -0,0 +1 @@ +debian/tests/regular-tests/libuv-kestrel-sample-app-2x/testCert.pfx \ No newline at end of file diff -Nru dotnet8-8.0.103-8.0.3/debian/tests/.tests.rc.d/CheckIfRuntimeJsonContainsUbuntuRIDs.fsx dotnet8-8.0.103-8.0.3/debian/tests/.tests.rc.d/CheckIfRuntimeJsonContainsUbuntuRIDs.fsx --- dotnet8-8.0.103-8.0.3/debian/tests/.tests.rc.d/CheckIfRuntimeJsonContainsUbuntuRIDs.fsx 2024-03-08 08:25:53.000000000 +0000 +++ dotnet8-8.0.103-8.0.3/debian/tests/.tests.rc.d/CheckIfRuntimeJsonContainsUbuntuRIDs.fsx 1970-01-01 00:00:00.000000000 +0000 @@ -1,30 +0,0 @@ -#load "UbuntuRuntimeIdentifiers.Library.fsx" -#load "GetRuntimeJsonPath.fsx" -open System -open GetRuntimeJsonPath -open UbuntuRuntimeIdentifiers.Library - -let runtimeJsonFilePath = getRuntimeJsonPath() - -let dotnetRIDs = parseRuntimeIdentifiersFromRuntimeJsonFile runtimeJsonFilePath - -let ridIsMissingInRuntimeJson rid = - not (Set.contains rid dotnetRIDs) - -let missingRIDs = - ubuntuDotnetRIDsSinceTrustyTahr - |> Seq.where ridIsMissingInRuntimeJson - -if (Seq.isEmpty missingRIDs) then - printfn "INFO: Okay (No missing RID found)" -else - missingRIDs - |> Seq.iter (fun missingRid -> - Console.ForegroundColor <- ConsoleColor.Red - eprintfn $"ERROR: RID (Runtime Identifier) '{missingRid}' is missing in '{runtimeJsonFilePath}'!" - Console.ResetColor() - eprintfn $"INFO: This means that dotnet developers are unable to target '{missingRid}' for their application." - eprintfn $"INFO: Possible solution: add '{missingRid}' RID as a patch and create Pull Request upstream." - eprintfn "") - - Environment.Exit(-1) diff -Nru dotnet8-8.0.103-8.0.3/debian/tests/.tests.rc.d/GetRuntimeJsonPath.fsx dotnet8-8.0.103-8.0.3/debian/tests/.tests.rc.d/GetRuntimeJsonPath.fsx --- dotnet8-8.0.103-8.0.3/debian/tests/.tests.rc.d/GetRuntimeJsonPath.fsx 2024-03-08 08:25:53.000000000 +0000 +++ dotnet8-8.0.103-8.0.3/debian/tests/.tests.rc.d/GetRuntimeJsonPath.fsx 1970-01-01 00:00:00.000000000 +0000 @@ -1,48 +0,0 @@ -open System - -let RuntimeJsonPathEnvironmentVariableName = "DOTNET_RUNTIME_JSON_PATH" - -let printUsage() = - printfn "Usage:" - printfn $" dotnet fsi {fsi.CommandLineArgs[0]} help" - printfn $" dotnet fsi {fsi.CommandLineArgs[0]} " - printfn "" - printfn "Commands:" - printfn " help Shows this usage info." - printfn "" - printfn "Arguments:" - printfn " path File path of the json file that contains all dotnet runtime" - printfn " identifiers structured as json." - printfn "" - -let printErrorMessageAndTerminate errorMessage = - Console.ForegroundColor <- ConsoleColor.Red - eprintfn errorMessage - Console.ResetColor() - printfn "" - printUsage() - Environment.Exit(-1) - -let getRuntimeJsonPath() = - let containsAny array values = - array - |> Array.exists (fun x -> Array.contains x values) - - if fsi.CommandLineArgs.Length < 2 then - printErrorMessageAndTerminate "Too few arguments!" - String.Empty - elif (containsAny fsi.CommandLineArgs [|"-h"; "--help"; "help"|]) then - printUsage() - Environment.Exit(0) - String.Empty - elif fsi.CommandLineArgs.Length > 2 then - printErrorMessageAndTerminate "Too many arguments!" - String.Empty - else - let path = fsi.CommandLineArgs[1] - - if IO.File.Exists(path) then - path - else - printErrorMessageAndTerminate $"File '{path}' does not exist!" - String.Empty diff -Nru dotnet8-8.0.103-8.0.3/debian/tests/.tests.rc.d/PrintSupportedRuntimeIdentifiers.fsx dotnet8-8.0.103-8.0.3/debian/tests/.tests.rc.d/PrintSupportedRuntimeIdentifiers.fsx --- dotnet8-8.0.103-8.0.3/debian/tests/.tests.rc.d/PrintSupportedRuntimeIdentifiers.fsx 2024-03-08 08:25:53.000000000 +0000 +++ dotnet8-8.0.103-8.0.3/debian/tests/.tests.rc.d/PrintSupportedRuntimeIdentifiers.fsx 1970-01-01 00:00:00.000000000 +0000 @@ -1,9 +0,0 @@ -#load "UbuntuRuntimeIdentifiers.Library.fsx" -#load "GetRuntimeJsonPath.fsx" -open GetRuntimeJsonPath -open UbuntuRuntimeIdentifiers.Library - -let jsonFilePath = getRuntimeJsonPath() - -parseSupportedBuildRuntimeIdentifiersFromRuntimeCompatiblityJsonFile jsonFilePath -|> Seq.iter (fun x -> (printfn "%s" x)) diff -Nru dotnet8-8.0.103-8.0.3/debian/tests/.tests.rc.d/UbuntuRuntimeIdentifiers.Library.fsx dotnet8-8.0.103-8.0.3/debian/tests/.tests.rc.d/UbuntuRuntimeIdentifiers.Library.fsx --- dotnet8-8.0.103-8.0.3/debian/tests/.tests.rc.d/UbuntuRuntimeIdentifiers.Library.fsx 2024-03-08 08:25:53.000000000 +0000 +++ dotnet8-8.0.103-8.0.3/debian/tests/.tests.rc.d/UbuntuRuntimeIdentifiers.Library.fsx 1970-01-01 00:00:00.000000000 +0000 @@ -1,130 +0,0 @@ -open System.IO -open System.Text.Json - -let parseRuntimeIdentifiersFromRuntimeJsonFile (jsonFilePath : string) = - use jsonFileStream = File.OpenRead(jsonFilePath) - use jsonDocument = JsonDocument.Parse(jsonFileStream) - - jsonDocument.RootElement.GetProperty("runtimes").EnumerateObject() - |> Seq.map (fun element -> element.Name) - // save sequence as Set because jsonDocument and jsonFileStream - // will get disposed after this function call - |> Set.ofSeq - -let parseSupportedBuildRuntimeIdentifiersFromRuntimeCompatiblityJsonFile (jsonFilePath : string) = - // TODO: "win-arm" not building for .NET 8 preview 5 release, add it on future releases - let supportedBaseRIDs = [| "linux-x64"; "linux-arm"; "linux-arm64"; "win-x64"; "win-x86"; "osx-arm64"; "osx-x64"; "win-arm64";|] - - use jsonFileStream = File.OpenRead(jsonFilePath) - use jsonDocument = JsonDocument.Parse(jsonFileStream) - - jsonDocument.RootElement.EnumerateObject() - |> Seq.where (fun element -> - if element.Name = "rhel.6-x64" then - false - else - let dependsOn = - element.Value.EnumerateArray() - |> Seq.map (fun arrayElement -> arrayElement.GetString()) - |> Seq.toArray - - let hasSupportedBaseId = - dependsOn |> Array.exists (fun value -> (Array.contains value supportedBaseRIDs)) - - let dependsOnLinuxBionic = - dependsOn |> Array.contains "linux-bionic" - - hasSupportedBaseId && not dependsOnLinuxBionic) - |> Seq.map (fun element -> element.Name) - // save sequence as Set because jsonDocument and jsonFileStream - // will get disposed after this function call - |> Set.ofSeq - -type Month = - | January = 1 - | Febuary = 2 - | March = 3 - | April = 4 - | May = 5 - | June = 6 - | July = 7 - | August = 8 - | September = 9 - | October = 10 - | November = 11 - | December = 12 - -type UbuntuReleaseDate = { Year: uint; Month: Month } - -let TrustyTahr = { Year = 2014u; Month = Month.April; } -let XenialXerus = { Year = 2016u; Month = Month.April; } - -let isReleaseSmallerThan releaseA releaseB = - (releaseA.Year < releaseB.Year) || - ( - releaseA.Year = releaseB.Year && - (int releaseA.Month) < (int releaseB.Month) - ) - -let addSixMonths release = - let zeroBasedReleaseMonth = (int release.Month) - 1 - let offsetFromStartOfReleaseYearInMonths = zeroBasedReleaseMonth + 6 - - let yearOffset = offsetFromStartOfReleaseYearInMonths / 12 - let month = (offsetFromStartOfReleaseYearInMonths % 12) + 1 - - { - Year = release.Year + (uint yearOffset) - Month = enum(month) - } - -let asDotnetRuntimePlatformId releaseDate = - let twoDigitYear = releaseDate.Year % 100u - let monthValue = (int releaseDate.Month) - - $"ubuntu.{twoDigitYear:D2}.{monthValue:D2}" - -let dotnetRIDsOf release = - let dotnetRuntimePlatformId = asDotnetRuntimePlatformId release - - let supportedArchitectureSuffixes = - if (isReleaseSmallerThan release XenialXerus) then - [|""; "-arm"; "-x64"; "-x86"|] - else - [|""; "-arm"; "-arm64"; "-x64"; "-x86"|] - - supportedArchitectureSuffixes - |> Seq.map (fun architectureSuffix -> dotnetRuntimePlatformId + architectureSuffix) - -let ubuntuDotnetRIDsSinceUntil since until = - since - |> Seq.unfold (fun release -> - let isReleaseSmallerThanUntil = - isReleaseSmallerThan release until - - if isReleaseSmallerThanUntil then - let dotnetRIDs = dotnetRIDsOf release - let nextRelease = addSixMonths release - - Some(dotnetRIDs, nextRelease) - else - None) - |> Seq.concat - -let ubuntuDotnetRIDsSinceTrustyTahr = - // I use a 5 instead of 6 month for a conservative estimation. - // Depending on when this test will run automatically there may - // be no release announced yet. - // There is no harm if we forget to patch the RID for a devel - // ubuntu version within the release cycle, but it is a pain in - // the butt to keep a field like 'LatestRelease' up to date or - // care about a flaky test - - let nowInFiveMonth = System.DateTime.Now.AddMonths(5) - let nowInFiveMonthAsReleaseDate = - { - Year = (uint nowInFiveMonth.Year) - Month = enum(nowInFiveMonth.Month) - } - - ubuntuDotnetRIDsSinceUntil TrustyTahr nowInFiveMonthAsReleaseDate diff -Nru dotnet8-8.0.103-8.0.3/debian/tests/.tests.rc.d/init.sh dotnet8-8.0.103-8.0.3/debian/tests/.tests.rc.d/init.sh --- dotnet8-8.0.103-8.0.3/debian/tests/.tests.rc.d/init.sh 2024-03-08 08:25:53.000000000 +0000 +++ dotnet8-8.0.103-8.0.3/debian/tests/.tests.rc.d/init.sh 1970-01-01 00:00:00.000000000 +0000 @@ -1,142 +0,0 @@ -#!/usr/bin/env bash - -###################################################################### -### Common settings/variables/functionality used by the testcases ### -###################################################################### - -set -eo pipefail - -function Log -{ - LogLevel=$1 - LogMessage=$2 - - echo "$LOG_SOURCE [$LogLevel] $(date '+%H:%M:%S'): $LogMessage"; -} - -function LogDebug -{ - LogMessage=$1 - Log "DEBUG" "$LogMessage"; -} - -function LogInfo -{ - LogMessage=$1 - Log "INFO" "$LogMessage"; -} - -function LogWarning -{ - LogMessage=$1 - Log "WARNING" "$LogMessage"; -} - -function LogErrorAndTerminate -{ - LogMessage=$1 - Log "ERROR" "$LogMessage" 1>&2; - - # makes shure that the shell terminates even from a subshell - kill -SIGPIPE "$$" -} - -function GetUbuntuVersionIdentifier -{ - echo "$(source /etc/os-release && echo "$VERSION_ID")"; -} - -function GetSystemArchitecture -{ - ARCH="$(uname -i)"; - - case "$ARCH" in - x86_64) - echo "x64"; - ;; - aarch64) - echo "arm64"; - ;; - *) - LogErrorAndTerminate "Unknown/Unsupported architecture '$ARCH'."; - ;; - esac -} - -function GetDotnetRuntimeIdentifier -{ - echo "ubuntu.$(GetUbuntuVersionIdentifier)-$(GetSystemArchitecture)"; -} - -function GetSdkVersion -{ - dotnet --version; -} - -function SetupEnvironmentVariables -{ - LogInfo "Setup Environment Variables" - - export DOTNET_SDK_VERSION="$(GetSdkVersion)"; - LogDebug "DOTNET_SDK_VERSION = $DOTNET_SDK_VERSION"; - - export DOTNET_MAJOR_VERSION_NUMBER="$(echo "$DOTNET_SDK_VERSION" | cut -d '.' -f 1)" - LogDebug "DOTNET_MAJOR_VERSION_NUMBER = $DOTNET_MAJOR_VERSION_NUMBER"; - - export DOTNET_MINOR_VERSION_NUMBER="$(echo "$DOTNET_SDK_VERSION" | cut -d '.' -f 2)" - LogDebug "DOTNET_MINOR_VERSION_NUMBER = $DOTNET_MINOR_VERSION_NUMBER"; - - export DOTNET_REVISION_VERSION_NUMBER="$(echo "$DOTNET_SDK_VERSION" | cut -d '.' -f 3 | cut -d '-' -f 1)" - LogDebug "DOTNET_REVISION_VERSION_NUMBER = $DOTNET_REVISION_VERSION_NUMBER"; - - export DOTNET_PRERELEASE_SUFFIX="$(echo "$DOTNET_SDK_VERSION" | cut -d- -f 2)" - LogDebug "DOTNET_PRERELEASE_SUFFIX = $DOTNET_PRERELEASE_SUFFIX"; - - export DOTNET_VERSION_NAME="net$DOTNET_MAJOR_VERSION_NUMBER.$DOTNET_MINOR_VERSION_NUMBER" - LogDebug "DOTNET_VERSION_NAME = $DOTNET_VERSION_NAME"; - - DOTNET_RUNTIME_REVISION_NUMBER=$(echo "$DOTNET_REVISION_VERSION_NUMBER" | grep -Po '(?<=^1)[1-9][0-9]$|(?<=^10)[0-9]$') - export DOTNET_RUNTIME_VERSION="${DOTNET_MAJOR_VERSION_NUMBER}.${DOTNET_MINOR_VERSION_NUMBER}.${DOTNET_RUNTIME_REVISION_NUMBER}" - LogDebug "DOTNET_RUNTIME_VERSION = $DOTNET_RUNTIME_VERSION"; - - export DOTNET_RUNTIME_IDENTIFIER="$(GetDotnetRuntimeIdentifier)" - LogDebug "DOTNET_RUNTIME_IDENTIFIER = $DOTNET_RUNTIME_IDENTIFIER"; - - export DOTNET_LANGUAGES=("C#" "F#" "VB") - LogDebug "$(echo "DOTNET_LANGUAGES = (${DOTNET_LANGUAGES[@]})")"; - - # supress welcome banner on first run of a dotnet command - export DOTNET_NOLOGO=true - LogDebug "DOTNET_NOLOGO = $DOTNET_NOLOGO"; - export DOTNET_SKIP_FIRST_TIME_EXPERIENCE=true - LogDebug "DOTNET_SKIP_FIRST_TIME_EXPERIENCE = $DOTNET_SKIP_FIRST_TIME_EXPERIENCE"; -} - -function ShowDotnetDebugInfo -{ - LogDebug "Show Debug Infos" - echo "$ dotnet --info" - dotnet --info -} - -function ChangeToAutopkgtestTmpFolder -{ - # to run the test without the autopkgtest runner - if [[ -z $AUTOPKGTEST_TMP ]]; then - export AUTOPKGTEST_TMP="$(mktemp -d /tmp/autopkgtest.XXXXXX)" - LogDebug "Created autopkgtest temporary folder '$AUTOPKGTEST_TMP'." - fi - - cd "$AUTOPKGTEST_TMP" - LogInfo "Changed to autopkgtest temporary folder '$AUTOPKGTEST_TMP'." -} - -# Set LOG_SOURCE to this script -export LOG_SOURCE='debian/tests/.tests.rc' - -SetupEnvironmentVariables -ShowDotnetDebugInfo - -# Set LOG_SOURCE to the script that called this script. This assumes that this -# script gets called by a test inside the debian/tests folder. -export LOG_SOURCE="$(echo $0 | grep -oE "debian/.+$")" diff -Nru dotnet8-8.0.103-8.0.3/debian/tests/001-essential-binaries-and-config-files-should-be-present dotnet8-8.0.103-8.0.3/debian/tests/001-essential-binaries-and-config-files-should-be-present --- dotnet8-8.0.103-8.0.3/debian/tests/001-essential-binaries-and-config-files-should-be-present 2024-03-08 08:25:53.000000000 +0000 +++ dotnet8-8.0.103-8.0.3/debian/tests/001-essential-binaries-and-config-files-should-be-present 1970-01-01 00:00:00.000000000 +0000 @@ -1,33 +0,0 @@ -#!/usr/bin/env bash - -set -eo pipefail -source debian/tests/.tests.rc.d/init.sh - -function CheckForPresenceOfEssentialDotnetBinaries -{ - LogInfo "Check if '/usr/bin/dotnet' is present." - test -e "/usr/bin/dotnet" - - LogInfo "Check if '/usr/lib/dotnet/dotnet' is present." - test -e "/usr/lib/dotnet/dotnet" - - LogInfo "Check if '/usr/bin/dotnet' points to '/usr/lib/dotnet/dotnet'." - test "$(readlink -f /usr/bin/dotnet)" = "/usr/lib/dotnet/dotnet" - - LogInfo "Check if '/usr/lib/dotnet/sdk/$DOTNET_SDK_VERSION' folder is present." - test -d "/usr/lib/dotnet/sdk/$DOTNET_SDK_VERSION" -} - -function CheckForPresenceOfEssentialDotnetConfigFiles -{ - LogInfo "Check if '/etc/dotnet/install_location' is present." - test -e "/etc/dotnet/install_location" - - LogInfo "Check if '/etc/profile.d/dotnet.sh' is present." - test -e "/etc/profile.d/dotnet.sh" -} - -CheckForPresenceOfEssentialDotnetBinaries -CheckForPresenceOfEssentialDotnetConfigFiles - -LogInfo "Test Ok!" diff -Nru dotnet8-8.0.103-8.0.3/debian/tests/002-cli-metadata-should-be-correct dotnet8-8.0.103-8.0.3/debian/tests/002-cli-metadata-should-be-correct --- dotnet8-8.0.103-8.0.3/debian/tests/002-cli-metadata-should-be-correct 2024-03-08 08:25:53.000000000 +0000 +++ dotnet8-8.0.103-8.0.3/debian/tests/002-cli-metadata-should-be-correct 1970-01-01 00:00:00.000000000 +0000 @@ -1,95 +0,0 @@ -#!/usr/bin/env bash - -set -eo pipefail -source debian/tests/.tests.rc.d/init.sh - -function IsDotnet6And7Installed -{ - test "$(dpkg-query -W -f='${Status}\n' dotnet6 dotnet7 2>/dev/null | grep -qc "ok installed")" = "2" -} - -function CheckDotnetVersionOutput -{ - LogInfo "Check if 'dotnet --version' shows correct version number." - DOTNET_VERSION_OUTPUT="$(dotnet --version)" - - if [[ ! "$DOTNET_VERSION_OUTPUT" = "$DOTNET_SDK_VERSION" ]]; then - LogErrorAndTerminate "'dotnet --version' showed version number '$DOTNET_VERSION_OUTPUT' instead of expected version number '$DOTNET_SDK_VERSION'." - fi -} - -function CheckDotnetInfoOutput -{ - LogInfo "Checking 'dotnet --info' output." - - DOTNET_INFO_OUTPUT="$(dotnet --info)" - - case "$DOTNET_VERSION_NAME" in - net6.0) - expected="4" - ;; - net7.0) - expected="5" - ;; - net8.0) - expected="4" - ;; - *) - LogErrorAndTerminate "DOTNET_VERSION_NAME should either be 'net6.0' or 'net7.0' or 'net8.0'. Found '$DOTNET_VERSION_NAME'." - ;; - esac - - count=$(echo "$DOTNET_INFO_OUTPUT" | grep "/usr/lib/dotnet" -c || true) - if [[ "${count}" == "$expected" ]]; then - LogDebug "'dotnet --info' contained the path '/usr/lib/dotnet' $count times. Ok!" - else - LogErrorAndTerminate "'dotnet --info' contained the path '/usr/lib/dotnet' $count times. Expected was $expected times." - fi - - count=$(echo "$DOTNET_INFO_OUTPUT" | grep -E "Version:\s+$DOTNET_SDK_VERSION" -c || true) - if [[ "${count}" == "1" ]]; then - LogDebug "'dotnet --info' contains the SDK version number '$DOTNET_SDK_VERSION'. Ok!" - else - LogErrorAndTerminate "'dotnet --info' did not contain the SDK version number '$DOTNET_SDK_VERSION'." - fi - - count=$(echo "$DOTNET_INFO_OUTPUT" | grep -Pz "Host:\s+Version:\s+$DOTNET_RUNTIME_VERSION" -c || true) - if [[ "${count}" == "1" ]]; then - LogDebug "'dotnet --info' contains the Runtime version (Host Version) number '$DOTNET_RUNTIME_VERSION'. Ok!" - else - LogErrorAndTerminate "'dotnet --info' did not contain the Runtime version (Host Version) number '$DOTNET_RUNTIME_VERSION'." - fi - - count=$(echo "$DOTNET_INFO_OUTPUT" | grep -E "RID:\s+$DOTNET_RUNTIME_IDENTIFIER" -c || true) - - if [[ "${count}" == "1" ]]; then - LogDebug "'dotnet --info' contains the Runtime Identifier (RID) '$DOTNET_RUNTIME_IDENTIFIER'. Ok!" - else - actual=$(echo "$DOTNET_INFO_OUTPUT" | grep "RID" || true) - LogErrorAndTerminate "'dotnet --info' did not contain the Runtime Identifier (RID) '$DOTNET_RUNTIME_IDENTIFIER'. Found $(echo "$actual" | tr -s ' ')" - fi - - expected='global.json file: - Not found' # this is no formatting error! - actual="$(echo "$DOTNET_INFO_OUTPUT" | grep "global.json file:" -A1)" - if [[ "$actual" == "$expected" ]]; then - LogDebug "'dotnet --info' contains status information that the global.json file was not found. Ok!" - else - LogErrorAndTerminate "'dotnet --info' did not contain status information that the global.json file was not found." - fi -} - -if IsDotnet6And7Installed; then - # Notice that this test will fail for dotnet6 if dotnet7 is installed - # in parallel, because "dotnet --version" will show the dotnet7 version. - # - # It may also fail for dotnet7, because the expected count's (see - # CheckDotnetInfoOutput below) are incorrect when both versions are installed. - LogWarning "Skipping Test, because dotnet6 and dotnet7 are both installed. This test is expected to fail when both are installed." - exit 77 # Skip Test -fi - -CheckDotnetVersionOutput -CheckDotnetInfoOutput - -LogInfo "Test Ok!" diff -Nru dotnet8-8.0.103-8.0.3/debian/tests/003-global-json-should-be-detected dotnet8-8.0.103-8.0.3/debian/tests/003-global-json-should-be-detected --- dotnet8-8.0.103-8.0.3/debian/tests/003-global-json-should-be-detected 2024-03-08 08:25:53.000000000 +0000 +++ dotnet8-8.0.103-8.0.3/debian/tests/003-global-json-should-be-detected 1970-01-01 00:00:00.000000000 +0000 @@ -1,25 +0,0 @@ -#!/usr/bin/env bash - -set -eo pipefail -source debian/tests/.tests.rc.d/init.sh - -ChangeToAutopkgtestTmpFolder - -LogInfo "Creating demo global.json file" -cat <global.json -{ - "sdk": { - "version": "$DOTNET_SDK_VERSION", - "rollForward": "latestFeature" - } -} -EOF - -LogInfo "Testing if 'dotnet --info' shows path of global.json file" -path=$PWD/global.json -count=$(echo "$(dotnet --info)" | grep "$path" -nc) -if [[ "${count}" != "1" ]]; then - LogErrorAndTerminate "The global.json file path was expected once in the 'dotnet --info' output. Actually found ${count} occurences." -fi - -LogInfo "Test Ok!" diff -Nru dotnet8-8.0.103-8.0.3/debian/tests/004-console-template-should-build-and-run dotnet8-8.0.103-8.0.3/debian/tests/004-console-template-should-build-and-run --- dotnet8-8.0.103-8.0.3/debian/tests/004-console-template-should-build-and-run 2024-03-08 08:25:53.000000000 +0000 +++ dotnet8-8.0.103-8.0.3/debian/tests/004-console-template-should-build-and-run 1970-01-01 00:00:00.000000000 +0000 @@ -1,37 +0,0 @@ -#!/usr/bin/env bash - -set -eo pipefail -source debian/tests/.tests.rc.d/init.sh - -ChangeToAutopkgtestTmpFolder - -for LANGUAGE in "${DOTNET_LANGUAGES[@]}"; do - LogInfo "Creating $LANGUAGE console template" - dotnet new console --name "HelloWorld" --language $LANGUAGE - cd "HelloWorld" - - LogInfo "Building Project" - dotnet build - - LogInfo "Running Project" - dotnet run | tee stdout.log - - LogInfo "Comparing with expected output" - case "$LANGUAGE" in - C#) - test "$(< stdout.log)" = "$(echo -e 'Hello, World!\n')" - ;; - F#) - test "$(< stdout.log)" = "$(echo -e 'Hello from F#\n')" - ;; - VB) - test "$(< stdout.log)" = "$(echo -e 'Hello World!\n')" - ;; - esac - - LogInfo "Cleaning up" - cd .. - rm -r "HelloWorld" -done - -LogInfo "Test Ok!" diff -Nru dotnet8-8.0.103-8.0.3/debian/tests/005-dotnet-help-should-show-output dotnet8-8.0.103-8.0.3/debian/tests/005-dotnet-help-should-show-output --- dotnet8-8.0.103-8.0.3/debian/tests/005-dotnet-help-should-show-output 2024-03-08 08:25:53.000000000 +0000 +++ dotnet8-8.0.103-8.0.3/debian/tests/005-dotnet-help-should-show-output 1970-01-01 00:00:00.000000000 +0000 @@ -1,18 +0,0 @@ -#!/usr/bin/env bash - -set -eo pipefail -source debian/tests/.tests.rc.d/init.sh - -LogInfo "Run 'dotnet help'" -dotnet help -test "$(dotnet help)" != "" - -LogInfo "Run 'dotnet -h'" -dotnet -h -test "$(dotnet -h)" != "" - -LogInfo "Run 'dotnet --help'" -dotnet --help -test "$(dotnet --help)" != "" - -LogInfo "Test Ok!" diff -Nru dotnet8-8.0.103-8.0.3/debian/tests/006-dotnet-project-management-cli-should-work dotnet8-8.0.103-8.0.3/debian/tests/006-dotnet-project-management-cli-should-work --- dotnet8-8.0.103-8.0.3/debian/tests/006-dotnet-project-management-cli-should-work 2024-03-08 08:25:53.000000000 +0000 +++ dotnet8-8.0.103-8.0.3/debian/tests/006-dotnet-project-management-cli-should-work 1970-01-01 00:00:00.000000000 +0000 @@ -1,40 +0,0 @@ -#!/usr/bin/env bash - -set -eo pipefail -source debian/tests/.tests.rc.d/init.sh - -ChangeToAutopkgtestTmpFolder - -LogInfo "Setup project file structure" -dotnet new sln --name Project - -dotnet new console --language C# --name HelloCsharp -dotnet new classlib --language C# --name CsharpLibrary -dotnet add HelloCsharp/HelloCsharp.csproj reference CsharpLibrary/CsharpLibrary.csproj -dotnet sln Project.sln add HelloCsharp/HelloCsharp.csproj - -dotnet new console --language F# --name HelloFsharp -dotnet sln add HelloFsharp/HelloFsharp.fsproj - -dotnet new console --language VB --name HelloVisualBasic -dotnet sln add HelloVisualBasic/HelloVisualBasic.vbproj - -LogInfo "Showing File structure" -echo "$ ls -lR" -ls -lR - -LogInfo "Build Solution" -dotnet build Project.sln - -LogInfo "Checking if build binaries exist" - -test -e "CsharpLibrary/bin/Debug/$DOTNET_VERSION_NAME/CsharpLibrary.dll" -test -e "HelloVisualBasic/bin/Debug/$DOTNET_VERSION_NAME/HelloVisualBasic.dll" -test -e "HelloCsharp/bin/Debug/$DOTNET_VERSION_NAME/HelloCsharp.dll" -test -e "HelloFsharp/bin/Debug/$DOTNET_VERSION_NAME/HelloFsharp.dll" - -LogInfo "Showing File structure again (after build)" -echo "$ ls -lR" -ls -lR - -LogInfo "Test Ok!" diff -Nru dotnet8-8.0.103-8.0.3/debian/tests/007-example-fsharp-script-output-should-equal-expected-values dotnet8-8.0.103-8.0.3/debian/tests/007-example-fsharp-script-output-should-equal-expected-values --- dotnet8-8.0.103-8.0.3/debian/tests/007-example-fsharp-script-output-should-equal-expected-values 2024-03-08 08:25:53.000000000 +0000 +++ dotnet8-8.0.103-8.0.3/debian/tests/007-example-fsharp-script-output-should-equal-expected-values 1970-01-01 00:00:00.000000000 +0000 @@ -1,25 +0,0 @@ -#!/usr/bin/env bash - -set -eo pipefail -source debian/tests/.tests.rc.d/init.sh - -ChangeToAutopkgtestTmpFolder - -LogInfo "Creating example.fsx (F# Script)" -cat < example.fsx -let getOddSquares xs = - xs - |> List.filter (fun x -> x % 2 <> 0) - |> List.map (fun x -> x * x) - -printfn "%A" (getOddSquares [1..10]) -EOF - -LogInfo "Running example.fsx" -echo '$ dotnet fsi example.fsx' -dotnet fsi example.fsx | tee stdout.log - -LogInfo "Comparing output against expected output" -test "$(< stdout.log)" = "$(echo -e '[1; 9; 25; 49; 81]\n')" - -LogInfo "Test Ok!" diff -Nru dotnet8-8.0.103-8.0.3/debian/tests/008-building-hello-world-for-all-supported-rids-should-work dotnet8-8.0.103-8.0.3/debian/tests/008-building-hello-world-for-all-supported-rids-should-work --- dotnet8-8.0.103-8.0.3/debian/tests/008-building-hello-world-for-all-supported-rids-should-work 2024-03-08 08:25:53.000000000 +0000 +++ dotnet8-8.0.103-8.0.3/debian/tests/008-building-hello-world-for-all-supported-rids-should-work 1970-01-01 00:00:00.000000000 +0000 @@ -1,107 +0,0 @@ -#!/usr/bin/env bash -# Note that this test only checks if the project builds without an error; NOT if the build artifacts run for the intended platforms. - -set -eo pipefail -source debian/tests/.tests.rc.d/init.sh - -case "$RUN_MINIMAL_TEST" in - [Tt][Rr][Uu][Ee]|'1') # TRUE - LogDebug "RUN_MINIMAL_TEST is set to TRUE." - RUN_MINIMAL_TEST=true - ;; - [Ff][Aa][Ll][Ss][Ee]|0) # FALSE - LogDebug "RUN_MINIMAL_TEST is set to FALSE." - RUN_MINIMAL_TEST=false - ;; - '') - LogDebug "RUN_MINIMAL_TEST is null, empty or unset." - - # save time and avoid potential timeouts on arm64 autopkgtest cloud runners - if [[ "$(GetSystemArchitecture)" == "arm64" ]]; then - RUN_MINIMAL_TEST=true - else - RUN_MINIMAL_TEST=false - fi - ;; - *) - LogErrorAndTerminate "RUN_MINIMAL_TEST is defined as unknown value '$RUN_MINIMAL_TEST'." - ;; -esac - -if $RUN_MINIMAL_TEST; then - LogInfo "Running minimal test case." -fi - -LogDebug "Reading supported .NET Runtime Identifiers" -mapfile -t SupportedDotnetRuntimeIdentifiers < <(dotnet fsi \ - "debian/tests/.tests.rc.d/PrintSupportedRuntimeIdentifiers.fsx" \ - "src/runtime/src/libraries/Microsoft.NETCore.Platforms/src/runtime.compatibility.json") -for RID in "${SupportedDotnetRuntimeIdentifiers[@]}"; do - echo " - '$RID'" -done -echo - -ChangeToAutopkgtestTmpFolder - -declare -A LanguageProjectFileExtension -LanguageProjectFileExtension["C#"]=".csproj" -LanguageProjectFileExtension["F#"]=".fsproj" -LanguageProjectFileExtension["VB"]=".vbproj" - -if $RUN_MINIMAL_TEST; then - LANGUAGES=(C#) -else - LANGUAGES=("${DOTNET_LANGUAGES[@]}") -fi - -LogDebug "$(echo "Testing for Languages: ${LANGUAGES[@]}")"; - -for LANGUAGE in "${LANGUAGES[@]}"; do - LogDebug "Creating $LANGUAGE console template" - dotnet new console --name "HelloWorld-$LANGUAGE" --language "$LANGUAGE" -done - -for RID in "${SupportedDotnetRuntimeIdentifiers[@]}"; do - for LANGUAGE in "${LANGUAGES[@]}"; do - ProjectName="HelloWorld-${LANGUAGE}" - ProjectFile="${ProjectName}/${ProjectName}${LanguageProjectFileExtension["${LANGUAGE}"]}" - - ArtifactRoot="${ProjectName}/bin/Release/${DOTNET_VERSION_NAME}/${RID}" - Artifact1="${ArtifactRoot}/${ProjectName}.dll" - Artifact2="${ArtifactRoot}/publish" - - LogInfo "Building $LANGUAGE Project for ${RID} with --self-contained" - dotnet publish -c Release -r "${RID}" --self-contained "$ProjectFile" - - LogInfo "Check if build artifacts for ${RID} exists."; - if [[ ! -e "$Artifact1" ]]; then - LogErrorAndTerminate "Build artifact was not found: '$Artifact1'" - fi - - if [[ ! -d "$Artifact2" ]]; then - LogErrorAndTerminate "Directory that would contain build artifacts was not found: '$Artifact2'" - fi - - LogDebug "Cleaning build artifacts" - rm -r "$ArtifactRoot" - - if ! $RUN_MINIMAL_TEST; then - LogInfo "Building $LANGUAGE Project for ${RID} with --no-self-contained" - dotnet publish -c Release -r "${RID}" --no-self-contained "$ProjectFile" - - LogInfo "Check if build artifacts for ${RID} exists."; - if [[ ! -e "$Artifact1" ]]; then - LogErrorAndTerminate "Build artifact was not found: '$Artifact1'" - fi - - if [[ ! -d "$Artifact2" ]]; then - LogErrorAndTerminate "Directory that would contain build artifacts was not found: '$Artifact2'" - fi - - LogDebug "Cleaning build artifacts" - rm -r "$ArtifactRoot" - fi - done -done - -LogInfo "Test Ok!" diff -Nru dotnet8-8.0.103-8.0.3/debian/tests/009-dotnet-runtime-json-contains-ubuntu-rids dotnet8-8.0.103-8.0.3/debian/tests/009-dotnet-runtime-json-contains-ubuntu-rids --- dotnet8-8.0.103-8.0.3/debian/tests/009-dotnet-runtime-json-contains-ubuntu-rids 2024-03-08 08:25:53.000000000 +0000 +++ dotnet8-8.0.103-8.0.3/debian/tests/009-dotnet-runtime-json-contains-ubuntu-rids 1970-01-01 00:00:00.000000000 +0000 @@ -1,12 +0,0 @@ -#!/usr/bin/env bash - -set -eo pipefail -source debian/tests/.tests.rc.d/init.sh - -CheckIfRuntimeJsonContainsUbuntuRIDs="debian/tests/.tests.rc.d/CheckIfRuntimeJsonContainsUbuntuRIDs.fsx" -DotnetRuntimeJsonPath="src/runtime/src/libraries/Microsoft.NETCore.Platforms/src/runtime.json" - -LogInfo "Checking if '$DotnetRuntimeJsonPath' contains ubuntu runtime identifiers (RIDs)" -dotnet fsi $CheckIfRuntimeJsonContainsUbuntuRIDs $DotnetRuntimeJsonPath - -LogInfo "Test Ok!" diff -Nru dotnet8-8.0.103-8.0.3/debian/tests/010-dotnet-xunit-tests-should-work dotnet8-8.0.103-8.0.3/debian/tests/010-dotnet-xunit-tests-should-work --- dotnet8-8.0.103-8.0.3/debian/tests/010-dotnet-xunit-tests-should-work 2024-03-08 08:25:53.000000000 +0000 +++ dotnet8-8.0.103-8.0.3/debian/tests/010-dotnet-xunit-tests-should-work 1970-01-01 00:00:00.000000000 +0000 @@ -1,15 +0,0 @@ -#!/usr/bin/env bash - -set -eo pipefail -source debian/tests/.tests.rc.d/init.sh - -ChangeToAutopkgtestTmpFolder - -#unfortuantly we need internet to resolve the xunit dependencies :/ -LogInfo "Create XUnit Project" -dotnet new xunit - -LogInfo "Run XUnit Project" -dotnet test - -LogInfo "Test Ok!" diff -Nru dotnet8-8.0.103-8.0.3/debian/tests/011-nuget-cli-should-be-able-to-consume-packages-from-nuget-gallery dotnet8-8.0.103-8.0.3/debian/tests/011-nuget-cli-should-be-able-to-consume-packages-from-nuget-gallery --- dotnet8-8.0.103-8.0.3/debian/tests/011-nuget-cli-should-be-able-to-consume-packages-from-nuget-gallery 2024-03-08 08:25:53.000000000 +0000 +++ dotnet8-8.0.103-8.0.3/debian/tests/011-nuget-cli-should-be-able-to-consume-packages-from-nuget-gallery 1970-01-01 00:00:00.000000000 +0000 @@ -1,62 +0,0 @@ -#!/usr/bin/env bash - -set -e -source debian/tests/.tests.rc.d/init.sh - -ChangeToAutopkgtestTmpFolder - -LogInfo "Create C# Console Project" -dotnet new console --name Testing -cd Testing - -LogInfo "Overwrite program.cs with demo code" -cat <Program.cs -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using Google.Apis; - -namespace TestProject -{ - class Program - { - static void Main(string[] args) - { - Stack myStack = new Stack(); - var th = new Thread(()=>WaitAndPrint(myStack)); - th.Start(); - Console.WriteLine("Me first!"); - myStack.Push(1); - Console.WriteLine("Finished tasks: {0}", myStack.Count); - Thread.Sleep(1000); - Console.WriteLine("Finished tasks: {0}", myStack.Count); - } - - private static void WaitAndPrint(Stack myStack) - { - Thread.Sleep(1000); - Console.WriteLine("Me second!"); - myStack.Push(2); - } - } -} -EOF - -LogInfo "Try to run without Nuget Package" -(dotnet run 2>&1 && LogErrorAndTerminate "'dotnet run' succeeded although nuget package is missing") || true - -LogInfo "Add Nuget Package" -dotnet add Testing.csproj package Google.Apis - -LogInfo "Run Application" -dotnet run - -LogInfo "Remove Nuget Package" -dotnet remove Testing.csproj package Google.Apis - -LogInfo "Try to run without Nuget Package again" -(dotnet run 2>&1 && LogErrorAndTerminate "'dotnet run' succeeded although nuget package is missing") || true - -LogInfo "Test Ok!" diff -Nru dotnet8-8.0.103-8.0.3/debian/tests/012-crossbuild-for-windows-x64-should-run dotnet8-8.0.103-8.0.3/debian/tests/012-crossbuild-for-windows-x64-should-run --- dotnet8-8.0.103-8.0.3/debian/tests/012-crossbuild-for-windows-x64-should-run 2024-03-08 08:25:53.000000000 +0000 +++ dotnet8-8.0.103-8.0.3/debian/tests/012-crossbuild-for-windows-x64-should-run 1970-01-01 00:00:00.000000000 +0000 @@ -1,41 +0,0 @@ -#!/usr/bin/env bash - -set -eo pipefail -source debian/tests/.tests.rc.d/init.sh - -ChangeToAutopkgtestTmpFolder - -for LANGUAGE in "${DOTNET_LANGUAGES[@]}"; do - LogInfo "Creating $LANGUAGE HelloWorld Project" - dotnet new console --name "HelloWorld" --language "$LANGUAGE" - cd "HelloWorld" - - LogInfo "Crossbuilding $LANGUAGE HelloWorld Project for ''" - dotnet publish -c Release -r win-x64 --self-contained - - LogInfo "Checking if binary exists" - BINARY_PATH="bin/Release/$DOTNET_VERSION_NAME/win-x64/HelloWorld.exe" - test -e "$BINARY_PATH" - - LogInfo "Running binary with wine" - wine "$BINARY_PATH" - - LogInfo "Comparing with expected output" - case "$LANGUAGE" in - C#) - test "$(< stdout.log)" = "$(echo -e 'Hello, World!\r\n')" - ;; - F#) - test "$(< stdout.log)" = "$(echo -e 'Hello from F#\r\n')" - ;; - VB) - test "$(< stdout.log)" = "$(echo -e 'Hello World!\r\n')" - ;; - esac - - LogInfo "Cleaning up" - cd .. - rm -r "HelloWorld" -done - -LogInfo "Test Ok!" diff -Nru dotnet8-8.0.103-8.0.3/debian/tests/013-dotnet6-and-dotnet7-and-dotnet8-should-work-together dotnet8-8.0.103-8.0.3/debian/tests/013-dotnet6-and-dotnet7-and-dotnet8-should-work-together --- dotnet8-8.0.103-8.0.3/debian/tests/013-dotnet6-and-dotnet7-and-dotnet8-should-work-together 2024-03-08 08:25:53.000000000 +0000 +++ dotnet8-8.0.103-8.0.3/debian/tests/013-dotnet6-and-dotnet7-and-dotnet8-should-work-together 1970-01-01 00:00:00.000000000 +0000 @@ -1,44 +0,0 @@ -#!/usr/bin/env bash - -set -eo pipefail -source debian/tests/.tests.rc.d/init.sh - -ChangeToAutopkgtestTmpFolder - -LogInfo "Setup multi framework Project" -cat < Project.csproj - - - Exe - net6.0;net7.0;net8.0 - enable - enable - - -EOF -cat < Program.cs -Console.WriteLine("Hello, World!"); -EOF - -LogInfo "Building Project" -dotnet build -r linux-x64 - -LogInfo "Testing if net6.0 build artifact is present" -test -e bin/Debug/net6.0/linux-x64/Project.dll - -LogInfo "Testing if net7.0 build artifact is present" -test -e bin/Debug/net7.0/linux-x64/Project.dll - -LogInfo "Testing if net8.0 build artifact is present" -test -e bin/Debug/net8.0/linux-x64/Project.dll - -LogInfo "Running net6.0 build artifact" -dotnet bin/Debug/net6.0/linux-x64/Project.dll - -LogInfo "Running net7.0 build artifact" -dotnet bin/Debug/net7.0/linux-x64/Project.dll - -LogInfo "Running net8.0 build artifact" -dotnet bin/Debug/net8.0/linux-x64/Project.dll - -LogInfo "Test Ok!" diff -Nru dotnet8-8.0.103-8.0.3/debian/tests/01_regular-tests dotnet8-8.0.103-8.0.3/debian/tests/01_regular-tests --- dotnet8-8.0.103-8.0.3/debian/tests/01_regular-tests 1970-01-01 00:00:00.000000000 +0000 +++ dotnet8-8.0.103-8.0.3/debian/tests/01_regular-tests 2024-03-18 12:48:03.000000000 +0000 @@ -0,0 +1,115 @@ +#!/usr/bin/env bash + +# ENVIRONMENT VARIABLES: +# - REGULAR_TESTS_RUNNER_VERSION +# Set the release version of https://github.com/canonical/dotnet-test-runner/ +# to download. When unset it will use the included version. +# +# - REGULAR_TESTS_REF +# Set the git ref of https://github.com/canonical/dotnet-regular-tests/ +# to check out. When unset it will use the included version. +# +# - REGULAR_TESTS_TESTCASE_TIMEOUT_IN_SECONDS: +# Sets the default timeout of a testcase (default: 720 seconds). +# +# - REGULAR_TESTS_IGNORE_NU1102_ERRORS: +# Set to any value to ignore NU1102 errors (package not found). +# This is useful to test .NET builds during embargo time when certain +# packages are not published yet. + +set -euo pipefail + +PACKAGE_ROOT="$(pwd)" + +# HOME is used by the .NET SDK +export HOME="${AUTOPKGTEST_TMP}" + +set -x + +echo "INFO: extract source build artifacts" +mkdir -p "${AUTOPKGTEST_TMP}/packages" +tar --extract --gzip \ + --directory "${AUTOPKGTEST_TMP}/packages" \ + --file "$(debian/eng/source_build_artifact_path.py)" + +echo "INFO: add source build artifacts to global NuGet config" +mkdir -p ~/.nuget/NuGet/ +cat < ~/.nuget/NuGet/NuGet.Config + + + + + + + + +EOF + +if [[ -z "${REGULAR_TESTS_RUNNER_VERSION:-}" ]]; then + echo "INFO: copy test-runner to test directory" + cp --recursive "debian/eng/test-runner" "${AUTOPKGTEST_TMP}" + + echo "INFO: copy regular-tests to test directory" + cp --recursive "debian/tests/regular-tests" "${AUTOPKGTEST_TMP}" + + export TargetBundledFramework='true' + export BundledNETCoreAppTargetFrameworkVersion="$(debian/eng/dotnet-version.py)" + + pushd "${AUTOPKGTEST_TMP}/test-runner" + + echo "INFO: run test-runner self-tests" + make check + + echo "INFO: build test-runner" + make + + popd +else + mkdir -p "${AUTOPKGTEST_TMP}/test-runner" + pushd "${AUTOPKGTEST_TMP}/test-runner" + + echo "INFO: download test-runner to test directory" + wget "https://github.com/canonical/dotnet-test-runner/releases/${TEST_RUNNER_VERSION}/download/turkey.tar.gz" + + echo "INFO: extracting test-runner" + tar --extract --gzip --file "turkey.tar.gz" + + popd +fi + +if [[ -z "${REGULAR_TESTS_REF:-}" ]]; then + echo "INFO: copy regular-tests" + cp --recursive "debian/tests/regular-tests" "${AUTOPKGTEST_TMP}" +else + pushd "${AUTOPKGTEST_TMP}" + + echo "INFO: clone regular-tests" + git clone "https://github.com/canonical/dotnet-regular-tests" "regular-tests" + + echo "INFO: checking out regular-tests ref '$REGULAR_TESTS_REF'" + git checkout "$REGULAR_TESTS_REF" + + popd +fi + +cd "${AUTOPKGTEST_TMP}" + +echo "INFO: create test user" +chmod --recursive 777 "${AUTOPKGTEST_TMP}" +useradd testrunner --create-home +mkdir -p /home/testuser/.nuget/NuGet/ +cp ~/.nuget/NuGet/NuGet.Config /home/testuser/.nuget/NuGet/ +chown --recursive testrunner:testrunner /home/testuser/ + +echo "INFO: run regular-tests" +mkdir -p "${AUTOPKGTEST_ARTIFACTS}/regular-tests" +dotnet test-runner/turkey/Turkey.dll --version +set +e +dotnet test-runner/turkey/Turkey.dll regular-tests \ + --trait ubuntu-autopkgtest-cloud \ + --timeout "${REGULAR_TESTS_TESTCASE_TIMEOUT_IN_SECONDS:-720}" \ + --log-directory "${AUTOPKGTEST_ARTIFACTS}/regular-tests" +set -e + +echo "INFO: check results of regular-tests run" +regular-tests/check-test-results "${AUTOPKGTEST_ARTIFACTS}/regular-tests/results.xml" diff -Nru dotnet8-8.0.103-8.0.3/debian/tests/build-time-tests/README.md dotnet8-8.0.103-8.0.3/debian/tests/build-time-tests/README.md --- dotnet8-8.0.103-8.0.3/debian/tests/build-time-tests/README.md 1970-01-01 00:00:00.000000000 +0000 +++ dotnet8-8.0.103-8.0.3/debian/tests/build-time-tests/README.md 2024-03-18 12:48:03.000000000 +0000 @@ -0,0 +1,67 @@ +# Build time tests + +A minimal smoke test suite for source-build .NET on Ubuntu designed to run +after build-time. + +This test-suite requires access to build artifacts generated after a +successfull build. + +## Rationale + +Introduced as part of the Ubuntu main inclusion (see also: MIR process) to +increase quaality assurance. + +## Usage + +``` +tests.py [-h] [-v] [--clean-sdk | --no-clean-sdk] + [--clean-packages | --no-clean-packages] + [--clean-home | --no-clean-home] + [--clean-test-project | --no-clean-test-project] + [--clean-all] [--force-clean | --no-force-clean] + [--purge-after | --no-purge-after] + [--test-directory PATH] [--source-package-root PATH] +``` + +Run with `--help` for more information: + +```bash +python3 debian/tests/build-time-tests/tests.py --help +``` + +## Examples + + +Run the tests using the current working directory: +```bash +python3 debian/tests/build-time-tests/tests.py \ + --verbose --purge-after +``` +- `--verbose` will print additional debug information to STDOUT +- `--purge-after` delete the test data after a successful run + +This kind of command is useful during feature development of the build time +test: +```bash +python3 debian/tests/build-time-tests/tests.py \ + --verbose \ + --test-directory 'test-dir' \ + --clean-all --no-clean-sdk --no-clean-packages +``` +- `--verbose` will print additional debug information to STDOUT +- `--test-directory 'test-dir'` will set the test directory to a fixed path + between test-runs (Note: the directory will be created if it does not exists) +- `--clean-all` will delete all previous test data before running tests +- `--no-clean-sdk` will reuse the extracted sdk artifact of a previous test + run +- `--no-clean-packages` will reuse the extracted nuget package artifacts of + a previous test run + +NOTE: The order of `--clean-*` flags is important. The flags +`--no-clean-sdk` and `--no-clean-packages` after `--clean-all` have higher +priority. You can specify as many flags as you want. Only the last +respective flag will take effect. + +## Author + +Dominik Viererbe \ diff -Nru dotnet8-8.0.103-8.0.3/debian/tests/build-time-tests/tests.py dotnet8-8.0.103-8.0.3/debian/tests/build-time-tests/tests.py --- dotnet8-8.0.103-8.0.3/debian/tests/build-time-tests/tests.py 1970-01-01 00:00:00.000000000 +0000 +++ dotnet8-8.0.103-8.0.3/debian/tests/build-time-tests/tests.py 2024-03-18 12:48:03.000000000 +0000 @@ -0,0 +1,522 @@ +#!/usr/bin/env python3 + +import argparse +import os +import sys +import subprocess +import tempfile +import re +import shutil + +sys.path.append("debian/eng") + +from versionlib.dotnet import SourcePackageVersion, RuntimeIdentifier # noqa: E402, E501 +from source_build_artifact_path import GetSourceBuiltArtifactsTarball # noqa: E402, E501 + +def ParseArguments(): + class MultiStoreTrue(argparse.Action): + def __init__(self, + option_strings, + dest, + help=None): + super(MultiStoreTrue, self).__init__( + option_strings=option_strings, + dest=dest, + nargs=0, + const=None, + default=None, + required=False, + help=help) + + def __call__(self, parser, namespace, values, option_string=None): + for destination in self.dest.split(','): + setattr(namespace, destination, True) + + argumentParser = argparse.ArgumentParser( + description="Runs the minimal smoke test suite designed to run " + "during build time.", + epilog="See the README file for further details.") + + argumentParser.add_argument("-v", "--verbose", "--debug", + action="store_true", + dest="Verbose", + help="log debug information") + argumentParser.add_argument("--clean-sdk", + action=argparse.BooleanOptionalAction, + default=False, + dest="CleanSDK", + help="deletes SDK artifacts of a previous " + "test run before executing the minimal " + "smoke test suite") + argumentParser.add_argument("--clean-packages", + action=argparse.BooleanOptionalAction, + default=False, + dest="CleanPackages", + help="deletes NuGet package artifacts of a" + "previous test run before executing the " + "minimal smoke test suite") + argumentParser.add_argument("--clean-home", + action=argparse.BooleanOptionalAction, + default=False, + dest="CleanHome", + help="deletes the fake HOME directory of a" + "previous test run before executing the " + "minimal smoke test suite") + argumentParser.add_argument("--clean-test-project", + action=argparse.BooleanOptionalAction, + default=False, + dest="CleanTestProject", + help="deletes the test project of a" + "previous test run before executing the " + "minimal smoke test suite") + argumentParser.add_argument("--clean-all", + action=MultiStoreTrue, + dest="CleanSDK," + "CleanPackages," + "CleanHome," + "CleanTestProject", + help="equivalent to setting all --clean-* " + "flags") + argumentParser.add_argument("--force-clean", + action=argparse.BooleanOptionalAction, + default=False, + dest="ForceClean", + help="warnings do not stop the execution of " + "clean actions") + argumentParser.add_argument("--purge-after", + action=argparse.BooleanOptionalAction, + default=False, + dest="PurgeAfter", + help="purge the minimal smoke test suite " + "files after a successful test run") + argumentParser.add_argument("--test-directory", + metavar="PATH", + dest="TestDirectory", + help="the root directory that is used for " + "generating files while running the " + "minimal smoke test suite (default: " + "a temporary directory will be created)") + argumentParser.add_argument("--source-package-root", + metavar="PATH", + dest="SourcePackageRoot", + help="the root directory of the source package" + " (default: current working directory)") + + return argumentParser.parse_args() + + +class TestContext: + def __init__( + self, + verbose: bool, + cleanSdk: bool, + cleanPackages: bool, + cleanHome: bool, + cleanTestProject: bool, + forceClean: bool, + purgeAfter: bool, + testDirectory: str | None, + sourcePackageRoot: str | None) -> None: + self.Verbose = verbose + self.CleanSDK = cleanSdk + self.CleanPackages = cleanPackages + self.CleanHome = cleanHome + self.CleanTestProject = cleanTestProject + self.ForceClean = forceClean + self.PurgeAfter = purgeAfter + self.TestDirectory = testDirectory + self.SourcePackageRoot = sourcePackageRoot + + self.LogDebug("Parameters:\n" + f"- Verbose: {self.Verbose}\n" + f"- CleanSDK: {self.CleanSDK}\n" + f"- CleanPackages: {self.CleanPackages}\n" + f"- CleanHome: {self.CleanHome}\n" + f"- CleanTestProject: {self.CleanTestProject}\n" + f"- ForceClean: {self.ForceClean}\n" + f"- PurgeAfter: {self.PurgeAfter}\n" + f"- TestDirectory: {self.TestDirectory}\n" + f"- SourcePackageRoot: {self.SourcePackageRoot}") + + self.__CheckSourcePackageRoot() + + version: SourcePackageVersion = \ + SourcePackageVersion.ParseFromChangelog( + os.path.join(self.SourcePackageRoot, "debian", "changelog")) + + runtimeIdentifier = RuntimeIdentifier.FromPlatformData() + + self.DotnetSdkVersion = str(version.SdkVersion) + self.DotnetRuntimeVersion = str(version.RuntimeVersion) + self.DotnetRuntimeIdentifier = str(runtimeIdentifier) + self.DotnetArchitecture = str(runtimeIdentifier.ArchitectureIdentifier) + self.UbuntuVersion = str( + runtimeIdentifier.OperatingSystemIdentifier.Version) + + self.__InitializeTestDirectory() + + self.DotnetRoot = os.path.join( + self.TestDirectory, "dotnet") + self.NuGetPackagesDirectory = os.path.join( + self.TestDirectory, "packages") + self.FakeHome = os.path.join( + self.TestDirectory, "home") + self.TestProjectDirectory = os.path.join( + self.TestDirectory, "test-project") + self.TestProjectName = "hello" + self.TestProjectFile = os.path.join( + self.TestProjectDirectory, f"{self.TestProjectName}.csproj") + + self.LogDebug( + "Full Context:\n" + f"- TestDirectory: {self.TestDirectory}\n" + f"- SourcePackageRoot: {self.SourcePackageRoot}\n" + f"- DotnetRoot: {self.DotnetRoot}\n" + f"- NuGetPackagesDirectory: {self.NuGetPackagesDirectory}\n" + f"- FakeHome: {self.FakeHome}\n" + f"- TestProjectDirectory: {self.TestProjectDirectory}\n" + f"- TestProjectName: {self.TestProjectName}\n" + f"- TestProjectFile: {self.TestProjectFile}\n" + f"- UbuntuVersion: {self.UbuntuVersion}\n" + f"- DotnetSdkVersion: {self.DotnetSdkVersion}\n" + f"- DotnetRuntimeVersion: {self.DotnetRuntimeVersion}\n" + f"- DotnetRuntimeIdentifier: {self.DotnetRuntimeIdentifier}\n" + f"- DotnetArchitecture: {self.DotnetArchitecture}") + + def LogDebug(self, msg) -> None: + if self.Verbose: + print("DEBUG: " + msg, flush=True) + + def LogInfo(self, msg) -> None: + print("INFO: " + msg, flush=True) + + def LogWarning(self, msg) -> None: + print("WARNING: " + msg, flush=True) + + def LogErrorAndDie(self, msg) -> None: + print("ERROR: " + msg, file=sys.stderr) + self.LogWarning("Test directory does not get purged") + sys.exit(1) + + def __CheckSourcePackageRoot(self): + if self.SourcePackageRoot is None: + self.LogDebug("No source package root specified. " + "Assuming current working directory.") + + self.SourcePackageRoot = os.path.realpath(os.curdir) + else: + if not os.path.isdir(self.SourcePackageRoot): + self.LogErrorAndDie("Could not find specified source package " + "directory.") + + self.SourcePackageRoot = os.path.realpath(self.SourcePackageRoot) + + debianDirectory = os.path.join(self.SourcePackageRoot, "debian") + if not os.path.isdir(debianDirectory): + self.LogErrorAndDie("Source package root does not have a " + "debian directory.") + + self.LogInfo(f"SourcePackageRoot='{self.SourcePackageRoot}'") + + def __InitializeTestDirectory(self): + if self.TestDirectory is None: + self.LogDebug("No test directory specified. " + "Creating temporary directory.") + + self.TestDirectory = tempfile.mkdtemp() + else: + if not os.path.isdir(self.TestDirectory): + self.LogWarning("Could not find specified test directory.") + self.LogDebug("Attempting to create it...") + + os.makedirs(self.TestDirectory) + + self.TestDirectory = os.path.realpath(self.TestDirectory) + + self.LogInfo(f"TestDirectory='{self.TestDirectory}'") + + def RunTests(self): + self.__CleanSDK() + self.__CleanPackages() + self.__CleanHome() + self.__CleanTestProject() + + self.__ExtractSdk() + + output = self.__RunDotnet(["--info"]) + self.__ValidateDotnetInfoOutput(output) + + output = self.__RunDotnet(["--version"]) + self.__ValidateDotnetVersionOutput(output) + + output = self.__RunDotnet(["--help"]) + self.__ValidateDotnetHelpOutput(output) + + self.__ExtractPackages() + self.__CreateTestProject() + output = self.__RunDotnet(["run", "--no-restore", + "--project", self.TestProjectFile]) + self.__ValidateDotnetTestProjectOutput(output) + + self.LogInfo("Test succeeded!") + self.__PurgeTestDirectory() + + def __CleanSDK(self) -> None: + if self.CleanSDK: + self.__Clean(self.DotnetRoot, ".NET root directory") + + def __CleanPackages(self) -> None: + if self.CleanPackages: + self.__Clean(self.NuGetPackagesDirectory, + "NuGet packages directory") + + def __CleanHome(self) -> None: + if self.CleanHome: + self.__Clean(self.FakeHome, + "fake HOME directory") + + def __CleanTestProject(self) -> None: + if self.CleanTestProject: + self.__Clean(self.TestProjectDirectory, + ".NET test project directory") + + def __Clean(self, path, displayName) -> None: + if not os.path.exists(path): + self.LogDebug(f"{displayName} ({path}) not found. " + "Nothing to clean.") + return + if not os.path.isdir(path): + self.LogWarning(f"{displayName} ({path}) is a file.") + self.LogInfo("This is unexpected, because this should be a " + "directory from previous test runs and not a file.") + + if self.ForceClean: + self.LogInfo("Forecfully cleaning file...") + os.remove(path) + else: + sys.exit(1) + + self.LogInfo(f"Cleaning {displayName} ({path}).") + os.rmdir(path) + + def __ExtractSdk(self) -> None: + if os.path.exists(self.DotnetRoot): + self.LogWarning("Dotnet root already exists. " + "SDK does not get extracted.") + self.LogInfo("Consider using the --clean-sdk flag.") + return + + self.__ExtractGZipTarball( + tarPath=f"{self.SourcePackageRoot}/artifacts/" + f"{self.DotnetArchitecture}/Release/dotnet-sdk-" + f"{self.DotnetSdkVersion}-" + f"{self.DotnetRuntimeIdentifier}.tar.gz", + humanReadableName=".NET SDK build artifacts", + targetDirectory=self.DotnetRoot) + + def __ExtractPackages(self) -> None: + if os.path.exists(self.NuGetPackagesDirectory): + self.LogWarning("NuGet packages already exist. NuGet packages do " + "NOT get extracted.") + self.LogInfo("Consider using the --clean-packages flag.") + return + + tarPath = GetSourceBuiltArtifactsTarball( + basePath=(f"{self.SourcePackageRoot}/artifacts/" + f"{self.DotnetArchitecture}/Release"), + sdkVersion=self.DotnetSdkVersion, + runtimeIdentifier=self.DotnetRuntimeIdentifier) + + self.__ExtractGZipTarball( + tarPath=tarPath, + humanReadableName="NuGet packages artifacts", + targetDirectory=self.NuGetPackagesDirectory) + + def __ExtractGZipTarball( + self, + tarPath: str, + humanReadableName: str, + targetDirectory: str) -> None: + if not os.path.exists(tarPath): + self.LogErrorAndDie(f"Could not find tarball {tarPath}") + + self.LogDebug(f"Creating target directory ('{targetDirectory}')") + os.mkdir(targetDirectory) + + self.LogInfo(f"Extracting {humanReadableName} tarball") + self.LogDebug(f"- tarPath='{tarPath}'") + self.LogDebug(f"- targetDirectory='{targetDirectory}'") + + if self.Verbose: + stdout = None # no redirection; print to stdout + else: + stdout = subprocess.DEVNULL + + try: + subprocess.check_call(["tar", "--extract", "--gzip", + "--file", tarPath, + "--directory", targetDirectory], + stdout=stdout) + except subprocess.CalledProcessError as error: + self.LogErrorAndDie(f"Extraction of {humanReadableName} failed " + f"(ExitCode {error.returncode})!") + + def __RunDotnet(self, args: [str]) -> None: + args = [f"{self.DotnetRoot}/dotnet"] + args + + env = { + 'HOME': self.FakeHome, + 'DOTNET_ROOT': self.DotnetRoot, + 'DOTNET_NOLOGO': 'true', + 'DOTNET_SKIP_FIRST_TIME_EXPERIENCE': 'true' + } + + self.LogDebug("Executing: " + str(args)) + try: + output = subprocess.check_output(cwd=self.TestDirectory, + stderr=subprocess.STDOUT, + args=args, env=env, text=True) + except subprocess.CalledProcessError as error: + self.LogErrorAndDie("Execution failure!\n" + f"- Exit Code: {error.returncode}\n" + f"- Args: {str(args)}\n" + f"- Output:\n{output}") + + self.LogInfo(f"Output:\n=======\n{output}") + return output + + def __CreateTestProject(self) -> None: + if os.path.exists(self.TestProjectDirectory): + self.LogWarning("Test project already exist. Test project " + "does NOT get created.") + self.LogInfo("Consider using the --clean-test-project flag.") + return + + self.LogDebug("Creating test project from C# .NET console template.") + self.__RunDotnet(["new", "console", "--no-restore", + "--name", self.TestProjectName, + "--output", self.TestProjectDirectory]) + + self.LogDebug("Restore test project dependencies.") + self.__RunDotnet(["restore", + "--source", self.NuGetPackagesDirectory, + self.TestProjectDirectory]) + + def __ValidateDotnetHelpOutput(self, output: str) -> None: + if len(output) == 0: + self.LogErrorAndDie(".NET help output is empty") + + def __ValidateDotnetVersionOutput(self, output: str) -> None: + if len(output) == 0: + self.LogErrorAndDie(".NET version output is empty") + + match = re.match(rf"^{re.escape(self.DotnetSdkVersion)}\s*$", output, + re.DOTALL | re.MULTILINE) + if match is None: + self.LogErrorAndDie(".NET version output does not match the SDK " + "version number " + f"(expected: '{self.DotnetSdkVersion}', " + f"actual: '{output}').") + + def __ValidateOutputMatchesPattern( + self, + value: str, + pattern: str, + description: str) -> None: + self.LogDebug(f"Testing {description}\n- pattern='{pattern}'") + match = re.match(pattern, value, re.DOTALL) + + if match is None: + self.LogErrorAndDie(f"{description} output does not match the " + f"expected pattern ('{pattern}').") + + def __ValidateDotnetInfoOutput(self, output): + if len(output) == 0: + self.LogErrorAndDie(".NET info output is empty") + + UbuntuVersion = re.escape(self.UbuntuVersion) + DotnetSdkVersion = re.escape(self.DotnetSdkVersion) + DotnetRuntimeVersion = re.escape(self.DotnetRuntimeVersion) + DotnetRuntimeIdentifier = re.escape(self.DotnetRuntimeIdentifier) + DotnetArchitecture = re.escape(self.DotnetArchitecture) + DotnetRoot = re.escape(self.DotnetRoot) + + self.__ValidateOutputMatchesPattern( + output, + pattern=r".*" + r"\.NET SDK( \(reflecting any global\.json\))?:.+" + rf"Version:\s+{DotnetSdkVersion}.+" + r"Commit:\s+[a-f0-9]{10}", + description=".NET SDK info") + + self.__ValidateOutputMatchesPattern( + output, + pattern=r".*" + r"Runtime Environment:.+" + r"OS Name:\s+ubuntu.+" + rf"OS Version:\s+{UbuntuVersion}.+" + r"OS Platform:\s+Linux.+" + rf"RID:\s+{DotnetRuntimeIdentifier}.+" + rf"Base Path:\s+{DotnetRoot}/sdk/{DotnetSdkVersion}/", + description=".NET runtime info") + + self.__ValidateOutputMatchesPattern( + output, + pattern=r".*" + r"Host:.+" + rf"Version:\s+{DotnetRuntimeVersion}.+" + rf"Architecture:\s+{DotnetArchitecture}.+" + r"Commit:\s+[a-f0-9]{10}", + description=".NET host info") + + self.__ValidateOutputMatchesPattern( + output, + pattern=r".*" + r".NET SDKs installed:.+" + rf"{DotnetSdkVersion} \[{DotnetRoot}/sdk\]", + description=".NET SDK install info") + + self.__ValidateOutputMatchesPattern( + output, + pattern=r".*" + r".NET runtimes installed:.+" + rf"Microsoft\.AspNetCore\.App\s+{DotnetRuntimeVersion}\s+" + rf"\[{DotnetRoot}/shared/Microsoft\.AspNetCore\.App\].+" + rf"Microsoft\.NETCore\.App\s+{DotnetRuntimeVersion}\s+" + rf"\[{DotnetRoot}/shared/Microsoft\.NETCore\.App\]", + description=".NET runtime install info") + + def __ValidateDotnetTestProjectOutput(self, output: str) -> None: + if len(output) == 0: + self.LogErrorAndDie("dotnet test project output is empty") + + match = re.match(r"^Hello, World!\s*$", output, + re.DOTALL | re.MULTILINE) + if match is None: + self.LogErrorAndDie(".NET test project does not output " + "\"Hello, World!\".") + + def __PurgeTestDirectory(self) -> None: + if not self.PurgeAfter: + return + + self.LogDebug(f"Purging test directory ({self.TestDirectory})") + + try: + shutil.rmtree(self.TestDirectory, ignore_errors=True) + except: # noqa: E722 + self.LogWarning("While pruging the test directory " + "an exception occured.") + + +arguments = ParseArguments() +testContext = TestContext(verbose=arguments.Verbose, + cleanSdk=arguments.CleanSDK, + cleanPackages=arguments.CleanPackages, + cleanHome=arguments.CleanHome, + cleanTestProject=arguments.CleanTestProject, + forceClean=arguments.ForceClean, + purgeAfter=arguments.PurgeAfter, + testDirectory=arguments.TestDirectory, + sourcePackageRoot=arguments.SourcePackageRoot) +testContext.RunTests() diff -Nru dotnet8-8.0.103-8.0.3/debian/tests/control dotnet8-8.0.103-8.0.3/debian/tests/control --- dotnet8-8.0.103-8.0.3/debian/tests/control 2024-03-08 08:25:53.000000000 +0000 +++ dotnet8-8.0.103-8.0.3/debian/tests/control 2024-03-18 12:48:03.000000000 +0000 @@ -1,35 +1,30 @@ -Tests: - 001-essential-binaries-and-config-files-should-be-present, -Depends: dotnet8 -Restrictions: superficial - Tests: - 002-cli-metadata-should-be-correct, -Depends: dotnet8 -Restrictions: skippable - -Tests: - 003-global-json-should-be-detected, - 004-console-template-should-build-and-run, - 005-dotnet-help-should-show-output, - 006-dotnet-project-management-cli-should-work, - 007-example-fsharp-script-output-should-equal-expected-values, - 008-building-hello-world-for-all-supported-rids-should-work, - 009-dotnet-runtime-json-contains-ubuntu-rids, -Depends: dotnet8 - -Tests: - 010-dotnet-xunit-tests-should-work, - 011-nuget-cli-should-be-able-to-consume-packages-from-nuget-gallery, -Depends: dotnet8 -Restrictions: needs-internet - -Tests: - 012-crossbuild-for-windows-x64-should-run, -Depends: dotnet8, wine -Architecture: amd64 -Restrictions: flaky - -Tests: - 013-dotnet6-and-dotnet7-and-dotnet8-should-work-together, -Depends: dotnet6, dotnet7, dotnet8 + 01_regular-tests, +Depends: + babeltrace, + bash, + bash-completion, + bc, + build-essential, + coreutils, + dotnet8, + dotnet-sdk-8.0-source-built-artifacts, + file, + findutils, + git, + jq, + lldb, + lttng-tools, + npm, + postgresql, + python3, + sed, + strace, + tar, + unixodbc, + wget, + zlib1g-dev, +Restrictions: + allow-stderr, + needs-internet, + needs-root, diff -Nru dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/.github/workflows/ci.yml dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/.github/workflows/ci.yml --- dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/.github/workflows/ci.yml 1970-01-01 00:00:00.000000000 +0000 +++ dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/.github/workflows/ci.yml 2024-03-18 12:48:03.000000000 +0000 @@ -0,0 +1,126 @@ +name: Confirm tests run successfully + +on: + push: + branches: + - main + pull_request: + +jobs: + build: + name: Verify tests pass + + runs-on: ubuntu-latest + + timeout-minutes: 30 + + strategy: + fail-fast: false + matrix: + container_image: + - docker.io/library/alpine:latest + - docker.io/library/alpine:edge + - quay.io/centos/centos:stream8 + - quay.io/centos/centos:stream9 + - registry.fedoraproject.org/fedora:38 + - registry.fedoraproject.org/fedora:39 + - registry.fedoraproject.org/fedora:40 + - registry.fedoraproject.org/fedora:rawhide + - registry.access.redhat.com/ubi8 + - registry.access.redhat.com/ubi9 + dotnet_version: + - "6.0" + - "7.0" + - "8.0" + exclude: + - container_image: docker.io/library/alpine:edge + dotnet_version: "7.0" + - container_image: docker.io/library/alpine:latest + dotnet_version: "8.0" + - container_image: registry.fedoraproject.org/fedora:40 + dotnet_version: "7.0" + - container_image: registry.fedoraproject.org/fedora:rawhide + dotnet_version: "7.0" + + container: + image: ${{ matrix.container_image }} + options: --security-opt seccomp=unconfined + + + steps: + - uses: actions/checkout@v4 + + - name: Install .NET ${{ matrix.dotnet_version }} + timeout-minutes: 5 + run: | + set -euo pipefail + cat /etc/os-release + if grep fedora /etc/os-release ; then + dnf install -y dotnet-sdk-${{ matrix.dotnet_version }} + if [[ ! ${{ matrix.dotnet_version }} == *6* ]] && [[ ! ${{ matrix.dotnet_version }} == *7* ]]; then + dnf install -y \ + dotnet-sdk-dbg-${{ matrix.dotnet_version }} \ + dotnet-runtime-dbg-${{ matrix.dotnet_version }} \ + aspnetcore-runtime-dbg-${{ matrix.dotnet_version }} + fi + elif grep alpine /etc/os-release; then + if grep edge /etc/os-release; then + echo "https://dl-cdn.alpinelinux.org/alpine/edge/testing" >> /etc/apk/repositories + fi + apk add dotnet-sdk-${{ matrix.dotnet_version }} dotnet-doc + if [[ ! ${{ matrix.dotnet_version }} == *6* ]] && [[ ! ${{ matrix.dotnet_version }} == *7* ]]; then + apk add \ + dotnet-sdk-dbg-${{ matrix.dotnet_version }} \ + dotnet-runtime-dbg-${{ matrix.dotnet_version }} \ + aspnetcore-runtime-dbg-${{ matrix.dotnet_version }} + fi + fi + + - name: Install Test dependencies + timeout-minutes: 2 + run: | + if grep fedora /etc/os-release ; then + dnf install -y python3 wget $(grep '^Dependencies(dnf): ' README.md | cut -d: -f2-) --skip-broken + elif grep alpine /etc/os-release; then + apk add python3 wget curl $(grep '^Dependencies(apk): ' README.md | cut -d: -f2-) + echo -e '[PostgreSQL]\nDescription=PostgreSQL Unicode\nDriver=/usr/lib/psqlodbcw.so\nUsageCount=1' > /etc/odbcinst.ini + fi + + - name: Download test runner + run: | + set -euo pipefail + wget --no-verbose https://github.com/redhat-developer/dotnet-bunny/releases/latest/download/turkey.tar.gz + tar xf turkey.tar.gz + + - name: Run tests + run: | + set -euo pipefail + + ### This is very questionable, but making our CI fail because distro + ### .NET versions are out of date doesn't sound nice. + rm -rf release-version-sane + + ### HACK: Filter tests that can't pass in Containers + rm -rf debugging-sos-lldb* createdump-aspnet cgroup-limit + + ### HACK: RID parsing is broken on alpine:edge, so these tests fail + if [[ ${{ matrix.container_image }} == *'alpine:edge'* ]] ; then + rm -rf system-data-odbc + fi + + ### HACK: UBI 8 is missing bash-completion, postgres, and strace packages for tests + if [[ ${{ matrix.container_image }} == *ubi8* ]] ; then + rm -rf bash-completion system-data-odbc telemetry-is-off-by-default + fi + ### HACK: UBI 9 is missing postsgres and strace package for tests + if [[ ${{ matrix.container_image }} == *ubi9* ]] ; then + rm -rf system-data-odbc telemetry-is-off-by-default + fi + + dotnet turkey/Turkey.dll -v --timeout 600 + + - name: Show Logs + if: ${{ always() }} + run: | + set -euo pipefail + find -iname '*.log' -exec echo {} \; -exec cat {} \; diff -Nru dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/Directory.Build.props dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/Directory.Build.props --- dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/Directory.Build.props 1970-01-01 00:00:00.000000000 +0000 +++ dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/Directory.Build.props 2024-03-18 12:48:03.000000000 +0000 @@ -0,0 +1,12 @@ + + + + net6.0 + + 6.0.0 + 17.4.0 + 2.4.1 + 2.4.3 + + diff -Nru dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/LICENSE dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/LICENSE --- dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/LICENSE 1970-01-01 00:00:00.000000000 +0000 +++ dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/LICENSE 2024-03-18 12:48:03.000000000 +0000 @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2018 Radka Janeková + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff -Nru dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/README.md dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/README.md --- dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/README.md 1970-01-01 00:00:00.000000000 +0000 +++ dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/README.md 2024-03-18 12:48:03.000000000 +0000 @@ -0,0 +1,31 @@ +### These tests are written for the .NET test runner. + +Please see the repository for more details: https://github.com/canonical/dotnet-test-runner + +### Quick clone + +If you forked it, replace `canonical` with your username. + +``` +$ git clone https://github.com/canonical/dotnet-test-runner && cd dotnet-test-runner && git clone https://github.com/canonical/dotnet-regular-tests +``` + +### Dependencies + +#### apk + +``` +babeltrace bash bash-completion binutils coreutils file findutils g++ jq libstdc++-dev lldb lttng-ust lttng-tools npm postgresql psqlodbc sed strace unixodbc zlib-dev +``` + +#### apt + +``` +babeltrace bash bash-completion build-essential coreutils file findutils jq lldb sed strace npm postgresql unixodbc zlib1g-dev +``` + +#### dnf + +```` +babeltrace bash-completion bc findutils gcc-c++ jq libstdc++-devel lttng-ust lttng-tools npm postgresql-odbc postgresql-server strace unixODBC /usr/bin/file /usr/bin/free /usr/bin/lldb /usr/bin/readelf /usr/bin/su which zlib-devel +```` diff -Nru dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/apphost-framework-lookup/test.json dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/apphost-framework-lookup/test.json --- dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/apphost-framework-lookup/test.json 1970-01-01 00:00:00.000000000 +0000 +++ dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/apphost-framework-lookup/test.json 2024-03-18 12:48:03.000000000 +0000 @@ -0,0 +1,17 @@ +{ + "name": "apphost-framework-lookup", + "enabled": true, + "requiresSdk": true, + "version": "2.2", + "versionSpecific": false, + "type": "bash", + "cleanup": true, + "skipWhen": [ + "vmr-ci" // portable runtime packs not published + ], + "ignoredRIDs":[ + "linux-s390x", + "linux-ppc64le" + ] +} + diff -Nru dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/apphost-framework-lookup/test.sh dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/apphost-framework-lookup/test.sh --- dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/apphost-framework-lookup/test.sh 1970-01-01 00:00:00.000000000 +0000 +++ dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/apphost-framework-lookup/test.sh 2024-03-18 12:48:03.000000000 +0000 @@ -0,0 +1,29 @@ +#!/usr/bin/env bash + +if [ -f /etc/profile ]; then + source /etc/profile +fi + +# Enable "unofficial strict mode" only after loading /etc/profile +# because that usually contains lots of "errors". + +set -euo pipefail +IFS=$'\n\t' +set -x + +runtime_id="$(../runtime-id --portable)" + +test_publish() +{ + name=$1 + mkdir $name && pushd $name + dotnet new console + dotnet publish -c Release -r "$runtime_id" --self-contained $2 + ./bin/Release/net*/"$runtime_id"/publish/$name + popd +} + +test_publish "framework-dependent" false +test_publish "self-contained" true + +echo "PASS" diff -Nru dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/aspnet-same-runtime-version/test.json dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/aspnet-same-runtime-version/test.json --- dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/aspnet-same-runtime-version/test.json 1970-01-01 00:00:00.000000000 +0000 +++ dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/aspnet-same-runtime-version/test.json 2024-03-18 12:48:03.000000000 +0000 @@ -0,0 +1,14 @@ +{ + "name": "aspnet-same-runtime-version", + "enabled": true, + "requiresSdk": true, + "version": "3.0", + "versionSpecific": false, + "type": "bash", + "cleanup": true, + "skipWhen": [ + "vmr-ci" // CI builds may have different versions for runtime and ASP.NET Core. + ], + "ignoredRIDs":[ + ] +} diff -Nru dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/aspnet-same-runtime-version/test.sh dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/aspnet-same-runtime-version/test.sh --- dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/aspnet-same-runtime-version/test.sh 1970-01-01 00:00:00.000000000 +0000 +++ dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/aspnet-same-runtime-version/test.sh 2024-03-18 12:48:03.000000000 +0000 @@ -0,0 +1,29 @@ +#!/usr/bin/env bash + +set -euo pipefail +IFS=$'\n\t' + +# Check Microsoft.AspNetCore.App's version matches that of Microsoft.NETCore.App + +runtime_version=$(dotnet --info | grep ' Microsoft.NETCore.App' | awk '{ print $2 }' | sort -rh | head -1) +echo "Latest runtime version: $runtime_version" + +runtime_version_major_minor=$(echo "$runtime_version" | cut -d'.' -f-2) +echo "Latest runtime major/mior version: $runtime_version_major_minor" + +aspnetcore_runtime_version=$(dotnet --info | grep ' Microsoft.AspNetCore.App' | awk '{ print $2 }' | sort -rh | head -1) +echo "Latest ASP.NET Core runtime version: $aspnetcore_runtime_version" + +# If these are pre-release versions, they need normalization +if [[ $runtime_version == *preview* ]] || [[ $runtime_version == *rc* ]] ; then + runtime_version=$(echo $runtime_version | sed -E 's#(preview[0-9]*|rc[0-9]*).*#\1#') + aspnetcore_runtime_version=$(echo $aspnetcore_runtime_version | sed -E 's#(preview[0-9]*|rc[0-9]*).*#\1#') +fi + +if [[ $runtime_version == $aspnetcore_runtime_version ]]; then + echo "Runtime version $runtime_version and ASP.NET Core version $aspnetcore_runtime_version match." + echo OK +else + echo "error: Runtime version $runtime_version and ASP.NET Core version $aspnetcore_runtime_version don't match." + exit 1 +fi diff -Nru dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/aspnet-same-runtime-version-2x/test.json dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/aspnet-same-runtime-version-2x/test.json --- dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/aspnet-same-runtime-version-2x/test.json 1970-01-01 00:00:00.000000000 +0000 +++ dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/aspnet-same-runtime-version-2x/test.json 2024-03-18 12:48:03.000000000 +0000 @@ -0,0 +1,11 @@ +{ + "name": "aspnet-same-runtime-version-2x", + "enabled": true, + "requiresSdk": true, + "version": "2.x", + "versionSpecific": true, + "type": "bash", + "cleanup": true, + "ignoredRIDs":[ + ] +} diff -Nru dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/aspnet-same-runtime-version-2x/test.sh dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/aspnet-same-runtime-version-2x/test.sh --- dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/aspnet-same-runtime-version-2x/test.sh 1970-01-01 00:00:00.000000000 +0000 +++ dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/aspnet-same-runtime-version-2x/test.sh 2024-03-18 12:48:03.000000000 +0000 @@ -0,0 +1,82 @@ +#!/usr/bin/env bash + +set -euo pipefail +IFS=$'\n\t' +set -x + +# There's always a version of Microsoft.AspNetCore.App for each +# version of Microsoft.NetCore.App. Make sure this is true for us too. + +wget https://github.com/stedolan/jq/releases/download/jq-1.6/jq-linux64 +chmod +x jq-linux64 + +runtime_version=$(dotnet --info | grep ' Microsoft.NETCore.App' | awk '{ print $2 }' | sort -rh | head -1) +echo "Latest runtime version: $runtime_version" + +runtime_version_major_minor=$(echo "$runtime_version" | cut -d'.' -f-2) +echo "Latest runtime major/mior version: $runtime_version_major_minor" + +test_folder=testapp + +function create_project_for_package() +{ + local package=$1 + + # create folder + rm -rf $test_folder + mkdir $test_folder + + # csproj file + cat >$test_folder/testapp.csproj < + + \$(TestTargetFramework) + + + + + +EOF + + # Program.cs file + cat >$test_folder/Program.cs <$test_folder/global.json <$test_folder/testapp.csproj < + + \$(TestTargetFramework) + + + + + +EOF + + # Program.cs file + cat >$test_folder/Program.cs < assemblies = FindAssemblyFiles(searchRootDirectory); + + bool allOkay = true; + foreach (var assembly in assemblies) + { + bool ignored = IgnoredFileNames.Any(basename => new FileInfo(assembly).Name == basename); + + if (!ignored) { + using (var file = File.Open(assembly, FileMode.Open, FileAccess.Read)) + { + var reader = new PEReader(file); + bool hasAot = AssemblyHasAot(assembly, reader, machine); + bool inReleaseMode = AssemblyIfNgenIsInReleaseMode(assembly, reader); + bool hasMethods = AssemblyHasMethods(reader); + + bool valid = true; + if (!inReleaseMode) + { + valid = false; + } + if (hasMethods && !hasAot) + { + // 32-bit arm doesn't have AOT and niehter do s390x and ppc64le (which use mono). That's okay for now. + if (architecture != Architecture.Arm +#if NET7_0_OR_GREATER + && architecture != Architecture.Ppc64le +#endif +#if NET6_0_OR_GREATER + && architecture != Architecture.S390x +#endif + ) + { + valid = false; + } + } + + if (valid) + { + Console.WriteLine($"{assembly}: OK"); + } + else + { + Console.WriteLine($"error: {assembly} hasMethods: {hasMethods}, hasAot: {hasAot}, inReleaseMode: {inReleaseMode}"); + allOkay = false; + } + } + } + } + + Assert.True(allOkay); + } + + static int RunProcessAndGetOutput(string[] processAndArguments, out string standardOutput) + { + ProcessStartInfo startInfo = new ProcessStartInfo(); + startInfo.FileName = processAndArguments[0]; + foreach (string arg in processAndArguments.Skip(1)) + { + startInfo.ArgumentList.Add(arg); + } + startInfo.RedirectStandardOutput = true; + + using (Process p = Process.Start(startInfo)) + { + p.WaitForExit(); + using (StreamReader r = p.StandardOutput) + { + standardOutput = r.ReadToEnd(); + } + return p.ExitCode; + } + } + + static Machine GetCurrentMachine(Architecture arch) + { + switch (arch) + { + case Architecture.Arm: + return Machine.Arm; + case Architecture.Arm64: + return Machine.Arm64; +#if NET7_0_OR_GREATER + case Architecture.Ppc64le: + return Machine.Unknown; +#endif +#if NET6_0_OR_GREATER + case Architecture.S390x: + return Machine.Unknown; +#endif + case Architecture.X64: + return Machine.Amd64; + case Architecture.X86: + return Machine.I386; + default: + throw new InvalidOperationException($"Unknown architecture {arch}"); + } + } + + static ICollection FindAssemblyFiles(DirectoryInfo searchRoot) + { + var assemblies = new List(); + var directoryStack = new Stack(); + + directoryStack.Push(searchRoot); + + while (directoryStack.TryPop(out DirectoryInfo dir)) + { + foreach(var aDirectory in dir.EnumerateDirectories()) + { + directoryStack.Push(aDirectory); + } + + foreach (var fileInfo in dir.EnumerateFiles("*.dll")) + { + if (!IgnoredPaths.Any(pattern => pattern.IsMatch(fileInfo.FullName))) + { + assemblies.Add(fileInfo.FullName); + } + } + } + + assemblies.Sort(StringComparer.Ordinal); + return assemblies; + } + + static bool AssemblyHasAot(string assemblyPath, + PEReader reader, + Machine expectedArchitecture) + { + var managedNativeHeaderDirectory = reader.PEHeaders.CorHeader.ManagedNativeHeaderDirectory; + if (managedNativeHeaderDirectory.Size != 0) + { + var rva = managedNativeHeaderDirectory.RelativeVirtualAddress; + var data = reader.GetSectionData(rva); + byte[] magicBytes = data.GetContent(0, 4).ToArray(); + int magic = BinaryPrimitives.ReadInt32LittleEndian(magicBytes); + if (magic == READYTORUN_SIGNATURE) + { + Machine machine = reader.PEHeaders.CoffHeader.Machine; + Machine actualArchitecture = (Machine)((int)machine ^ IMAGE_FILE_MACHINE_NATIVE_OS_OVERRIDE_LINUX); + if (expectedArchitecture != actualArchitecture) + { + return false; + } + + return true; + } + } + + return false; + } + + static bool AssemblyHasMethods(PEReader reader) + { + var metadataReader = reader.GetMetadataReader(); + return metadataReader.MethodDefinitions.Count > 0; + } + + static bool AssemblyIfNgenIsInReleaseMode(string assemblyPath, PEReader reader) + { + var managedNativeHeaderDirectory = reader.PEHeaders.CorHeader.ManagedNativeHeaderDirectory; + if (managedNativeHeaderDirectory.Size != 0) + { + var rva = managedNativeHeaderDirectory.RelativeVirtualAddress; + var data = reader.GetSectionData(rva); + byte[] magicBytes = data.GetContent(0, 4).ToArray(); + int magic = BinaryPrimitives.ReadInt32LittleEndian(magicBytes); + if (magic == CORCOMPILE_SIGNATURE) + { + // Extract CORCOMPILE_VERSION_INFO + byte[] versionInfoHeader = data.GetContent(40, 8).ToArray(); + int corVersionRva = BinaryPrimitives.ReadInt32LittleEndian(versionInfoHeader); + var corVersionData = reader.GetSectionData(corVersionRva); + + byte[] wBuildData = corVersionData.GetContent(16, 2).ToArray(); + int wBuild = BinaryPrimitives.ReadInt16LittleEndian(wBuildData); + + if (wBuild == 0) + { + return false; + } + } + } + + return true; + } + + } +} diff -Nru dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/assemblies-valid/assemblies-valid.csproj dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/assemblies-valid/assemblies-valid.csproj --- dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/assemblies-valid/assemblies-valid.csproj 1970-01-01 00:00:00.000000000 +0000 +++ dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/assemblies-valid/assemblies-valid.csproj 2024-03-18 12:48:03.000000000 +0000 @@ -0,0 +1,16 @@ + + + + true + $(TestTargetFramework) + + false + + + + + + + + + diff -Nru dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/assemblies-valid/test.json dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/assemblies-valid/test.json --- dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/assemblies-valid/test.json 1970-01-01 00:00:00.000000000 +0000 +++ dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/assemblies-valid/test.json 2024-03-18 12:48:03.000000000 +0000 @@ -0,0 +1,14 @@ +{ + "name": "assemblies-valid", + "enabled": true, + "requiresSdk": true, + "version": "2.0", + "versionSpecific": false, + "type": "xunit", + "cleanup": true, + "skipWhen": [ + "runtime=mono,arch=x64" // test assumes x64 means coreclr + ], + "ignoredRIDs":[ + ] +} diff -Nru dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/bash-completion/get-completions.sh dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/bash-completion/get-completions.sh --- dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/bash-completion/get-completions.sh 1970-01-01 00:00:00.000000000 +0000 +++ dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/bash-completion/get-completions.sh 2024-03-18 12:48:03.000000000 +0000 @@ -0,0 +1,41 @@ +#!/usr/bin/env bash + +get_completion_function_name_from_complete_output() +{ + local output=("$@") + local i + for ((i = 0; i < "${#output[@]}"; i++)); do + if [[ "${output[i]}" == "-F" ]]; then + echo "${output[((i+1))]}" + return 0 + fi + done + return 1 +} + +get_completions() +{ + COMP_WORDS=("$@") # completion to test + #echo "COMP_WORDS: '${COMP_WORDS[@]}'" + COMP_LINE="$(local IFS=" "; echo "${COMP_WORDS[@]}")" + #echo "COMP_LINE: '$COMP_LINE'" + COMP_CWORD=$((${#COMP_WORDS[@]} - 1)) # index into COMP_WORDS + #echo "COMP_CWORD: '$COMP_CWORD'" + COMP_POINT="${#COMP_LINE}" # index of cursor position + #echo "COMP_POINT: '$COMP_POINT'" + + source /usr/share/bash-completion/bash_completion + + local cmd=${COMP_WORDS[0]} + _completion_loader "$cmd" + + local output=($(complete -p "$cmd")) + local func=$(get_completion_function_name_from_complete_output "${output[@]}") + + #_dotnet_bash_complete + "$func" + + echo "${COMPREPLY[@]}" +} + +get_completions "$@" diff -Nru dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/bash-completion/test.json dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/bash-completion/test.json --- dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/bash-completion/test.json 1970-01-01 00:00:00.000000000 +0000 +++ dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/bash-completion/test.json 2024-03-18 12:48:03.000000000 +0000 @@ -0,0 +1,14 @@ +{ + "name": "bash-completion", + "enabled": true, + "requiresSdk": true, + "version": "2.1", + "versionSpecific": false, + "type": "bash", + "cleanup": true, + "skipWhen": [ + "vmr-ci" // bash completion script not installed + ], + "ignoredRIDs":[ + ] +} diff -Nru dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/bash-completion/test.sh dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/bash-completion/test.sh --- dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/bash-completion/test.sh 1970-01-01 00:00:00.000000000 +0000 +++ dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/bash-completion/test.sh 2024-03-18 12:48:03.000000000 +0000 @@ -0,0 +1,39 @@ +#!/usr/bin/env bash + +set -euo pipefail +IFS=$'\n\t' + +DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )" + +echo "$-" + +echo "Step 0" +# If this is the first time a dotnet cli command (via dotnet suggest) is +# executed we could get the welcome message as the "completion", which most +# shells then ignore. We end up with a blank completion. So trigger a cli +# command manually. +dotnet help + +echo "Step 1" +"$DIR"/get-completions.sh dotnet n | grep new +if [ $? -eq 1 ]; then + echo 'Bash completion "dotnet n" FAIL' + exit 1 +fi + +echo "Step 2" +"$DIR"/get-completions.sh dotnet pac | grep pack +if [ $? -eq 1 ]; then + echo 'Bash completion "dotnet pac" FAIL' + exit 1 +fi + +echo "Step 3" +"$DIR"/get-completions.sh dotnet cle | grep clean +if [ $? -eq 1 ]; then + echo 'Bash completion "dotnet cle" FAIL' + exit 1 +fi + +echo "Bash completion PASS" + diff -Nru dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/bundled-libunwind/test.json dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/bundled-libunwind/test.json --- dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/bundled-libunwind/test.json 1970-01-01 00:00:00.000000000 +0000 +++ dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/bundled-libunwind/test.json 2024-03-18 12:48:03.000000000 +0000 @@ -0,0 +1,19 @@ +{ + "name": "bundled-libunwind", + "enabled": true, + "requiresSdk": false, + "version": "2.0", + "versionSpecific": false, + "type": "bash", + "cleanup": true, + "skipWhen": [ + "runtime=mono", // mono does not use libunwind + "os=ubuntu,version=6", // see https://github.com/canonical/dotnet-regular-tests/issues/7 + ], + "ignoredRIDs":[ + "alpine", + "fedora", + "linux-arm", + "rhel7" + ] +} diff -Nru dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/bundled-libunwind/test.sh dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/bundled-libunwind/test.sh --- dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/bundled-libunwind/test.sh 1970-01-01 00:00:00.000000000 +0000 +++ dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/bundled-libunwind/test.sh 2024-03-18 12:48:03.000000000 +0000 @@ -0,0 +1,31 @@ +#!/usr/bin/env bash + +set -euo pipefail +IFS=$'\n\t' +set -x + +framework_dir=$(../dotnet-directory --framework "$1") + +set +e +ldd "${framework_dir}/libcoreclr.so" | grep -F 'libunwind.so' +retval=$? +set -e +if [ $retval -eq 1 ]; then + echo "pass: libunwind not found, assuming it is bundled" +else + echo "fail: libunwind found" + exit 1 +fi + +set +e +ldd "${framework_dir}/libcoreclr.so" | grep -F "libunwind-$(uname -m).so" +retval=$? +set -e +if [ $retval -eq 1 ]; then + echo "pass: libunwind-$(uname -m) not found, assuming it is bundled" +else + echo "fail: libunwind-$(uname -m) found" + exit 1 +fi + +echo "bundled-libunwind PASS" diff -Nru dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/cgroup-limit/Program.cs dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/cgroup-limit/Program.cs --- dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/cgroup-limit/Program.cs 1970-01-01 00:00:00.000000000 +0000 +++ dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/cgroup-limit/Program.cs 2024-03-18 12:48:03.000000000 +0000 @@ -0,0 +1,11 @@ +using System; + +class Program +{ + public static void Main() + { + Console.WriteLine("Limits:"); + Console.WriteLine(Environment.ProcessorCount); + Console.WriteLine(GC.GetGCMemoryInfo().TotalAvailableMemoryBytes); + } +} diff -Nru dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/cgroup-limit/cgroup-limit.csproj dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/cgroup-limit/cgroup-limit.csproj --- dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/cgroup-limit/cgroup-limit.csproj 1970-01-01 00:00:00.000000000 +0000 +++ dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/cgroup-limit/cgroup-limit.csproj 2024-03-18 12:48:03.000000000 +0000 @@ -0,0 +1,7 @@ + + + + $(TestTargetFramework) + + + diff -Nru dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/cgroup-limit/test.json dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/cgroup-limit/test.json --- dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/cgroup-limit/test.json 1970-01-01 00:00:00.000000000 +0000 +++ dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/cgroup-limit/test.json 2024-03-18 12:48:03.000000000 +0000 @@ -0,0 +1,14 @@ +{ + "name": "cgroup-limit", + "enabled": true, + "requiresSdk": true, + "version": "3.0", + "versionSpecific": false, + "type": "bash", + "cleanup": true, + "skipWhen": [ + "vmr-ci,os=rhel.7" // test doesn't work when it needs sudo on rhel7 because DOTNET_ROOT isn't passed through. + ], + "ignoredRIDs":[ + ] +} diff -Nru dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/cgroup-limit/test.sh dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/cgroup-limit/test.sh --- dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/cgroup-limit/test.sh 1970-01-01 00:00:00.000000000 +0000 +++ dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/cgroup-limit/test.sh 2024-03-18 12:48:03.000000000 +0000 @@ -0,0 +1,62 @@ +#!/usr/bin/env bash + +set -euo pipefail +set -x + +runtime_id="$(../runtime-id)" + +cat /proc/self/mountinfo + +cat /proc/self/cgroup + +if [[ "$(stat -f -c "%T" /sys/fs/cgroup)" == "cgroup2fs" ]] && [[ $(dotnet --version) == "3."* ]]; then + echo "cgroup v2 is not fully supported on .NET Core 3.x. Skipping." + exit 0 +fi + +# For mono-based runtimes (ppc64le, s390x), cgroup support is only functional +# on .NET 7.0 and later. +if [[ "$(uname -m)" == "s390x" ]] || [[ "$(uname -m)" == "ppc64le" ]] ; then + IFS='.-' read -ra VERSION <<< "${1:-$(dotnet --version)}" + if [[ "${VERSION[0]}" -lt "7" ]]; then + echo "cgroup support is not available on Mono-based runtimes before .NET 7. Skipping." + exit 0 + fi +fi + +if [ -z "$(command -v systemctl)" ]; then + echo "Environment does not use systemd" + exit 0 +fi + +dotnet publish -c Release + +SYSTEMD_RUN="systemd-run" +if [ "$UID" != "0" ]; then + if ! grep -q "cpu" "/sys/fs/cgroup/user.slice/user-$UID.slice/user@$UID.service/cgroup.controllers" ; then + # user can't set cpu limits, use sudo. + SYSTEMD_RUN="sudo -n $SYSTEMD_RUN" + + # Pass DOTNET_ROOT to support testing against a dotnet tarball. + # On RHEL 7 we don't pass the envvar because systemd-run doesn't support '-E' yet and the envvar is passed by default. + if [[ "$runtime_id" != "rhel.7"* ]]; then + SYSTEMD_RUN="$SYSTEMD_RUN -E DOTNET_ROOT=$DOTNET_ROOT" + fi + else + # run on behalf of user. + SYSTEMD_RUN="$SYSTEMD_RUN --user" + fi +fi + +mapfile -t DOTNET_LIMITS < <($SYSTEMD_RUN -q --scope -p CPUQuota=100% -p MemoryLimit=100M bin/Release/net*/cgroup-limit) + +if [ "${DOTNET_LIMITS[0]}" == "Limits:" ] && # Application ran. + [ "${DOTNET_LIMITS[1]}" == "1" ] && # Available processors is 1. + [ "${DOTNET_LIMITS[2]}" -lt 100000000 ]; then # Available memory less is than 100M. + echo ".NET Runtime uses cgroup limits PASS" + exit 0 +fi + +printf 'error: unexpected limits: %s\n' "${DOTNET_LIMITS[@]}" +echo ".NET Runtime uses cgroup limits FAIL" +exit 1 diff -Nru dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/check-test-results dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/check-test-results --- dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/check-test-results 1970-01-01 00:00:00.000000000 +0000 +++ dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/check-test-results 2024-03-18 12:48:03.000000000 +0000 @@ -0,0 +1,143 @@ +#!/usr/bin/env python3 + +import os +import sys +import re +import argparse +from xml.etree import ElementTree + + +def ContainsNU1102Error(name, stdout): + if name == "workload": + match = re.search(r"Workload installation failed: " + r"[a-zA-Z0-9.\-_]+::[0-9.]+ " + r"is not found in NuGet feeds", stdout) + else: + match = re.search(r"error NU1102: Unable to find package " + r"Microsoft\.NETCore\.App\.Runtime\." + r"(linux-\w+|Mono.browser-wasm) " + r"with version", stdout) + + return match is not None + + +argumentParser = argparse.ArgumentParser( + description="Checks the results of a test-runner run file and " + "evaluates if the test suite passes or fails.") + +argumentParser.add_argument("--ignore-nu1102-errors", + action="store_true", + dest="IgnoreNU1102Errors", + help="Ignores .NET NU1102 errors (unable to find " + "package). These failures are often caused " + "when the build version is not released yet " + "and therefore the corresponding packages " + "are not available yet. NOTE: Instead of " + "specifing this flag, the environment " + "variable REGULAR_TESTS_IGNORE_NU1102_ERRORS " + "can be defined.") +argumentParser.add_argument("ResultsFilePath", + nargs="?", + metavar="", + default="results.xml", + help="File path of the results.xml file. " + "(Default: 'results.xml')") + +arguments = argumentParser.parse_args() + +ResultsFilePath = arguments.ResultsFilePath + +if "REGULAR_TESTS_IGNORE_NU1102_ERRORS" in os.environ: + IgnoreNU1102Errors = True + print("INFO: Environment variable 'REGULAR_TESTS_IGNORE_NU1102_ERRORS' is " + "defined. Ignoring testcase failures caused by NU1102 (unable to " + "find package) error.") +elif arguments.IgnoreNU1102Errors: + IgnoreNU1102Errors = True + print("INFO: Command line flag '--ignore-nu1102-errors' is " + "defined. Ignoring testcase failures caused by NU1102 " + "(unable to find package) error.") +else: + IgnoreNU1102Errors = False + +if not os.path.exists(ResultsFilePath): + print(f"ERROR: The specified results.xml file path '{ResultsFilePath}' " + "does not exist.") + +tree = ElementTree.parse(ResultsFilePath) +testsuite = tree.getroot() + +if testsuite.tag != "testsuite": + raise ValueError(f"Root element has unexpected tag '{testsuite.tag}'. " + "Expected 'testsuite'.") + +PassedTestCases = 0 +SkipedTestCases = 0 +IgnoredTestCases = 0 +FailedTestCases = 0 + +for testcase in testsuite: + if testcase.tag != "testcase": + raise ValueError(f"Unexpected element tag '{testcase.tag}'. " + "Expected 'testcase'.") + + match len(testcase): + case 0: + raise ValueError("Testcase does not have child element. " + "This is unexpected.") + case 1: + if testcase[0].tag == "system-out": + PassedTestCases += 1 + continue + else: + raise ValueError(f"Unexpected element '{testcase[0].tag}'. " + "Expected 'system-out'.") + case 2: + match [testcase[0].tag, testcase[1].tag]: + case ["skipped", "system-out"]: + SkipedTestCases += 1 + case ["failure", "system-out"]: + name = testcase.attrib["name"] + stdout = testcase[1].text + + isNU1102Error = ContainsNU1102Error(name, stdout) + + if isNU1102Error and IgnoreNU1102Errors: + IgnoredTestCases += 1 + print(f"INFO: Ignoring failed of testcase '{name}', " + "caused by NU1102 (unable to find package) " + "error.") + else: + FailedTestCases += 1 + msg = f"ERROR: Testcase '{name}' failed." + + if isNU1102Error: + msg += (" [Note: Failure is caused by NU1102 " + "(unable to find package) error.]") + + print(msg) + case [tag1, tag2]: + print("DEBUG: ", testcase) + raise ValueError( + f"Unexpected elements '{tag1}', '{tag2}'.") + case elementCount: + print("DEBUG: ", testcase) + raise ValueError("Testcase has more elements than expected " + f"(element count: {elementCount}).") + + +TotalTestCases = (PassedTestCases + SkipedTestCases + + IgnoredTestCases + FailedTestCases) + +print("\n" + f"Total: {TotalTestCases} " + f"Passed: {PassedTestCases} " + f"Skiped: {SkipedTestCases} " + f"Ignored: {IgnoredTestCases} " + f"Failed: {FailedTestCases}") + +if FailedTestCases == 0: + print("\nPASSED!") +else: + print("\nFAILED!") + sys.exit(1) diff -Nru dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/commit-ids-in-binaries/test.json dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/commit-ids-in-binaries/test.json --- dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/commit-ids-in-binaries/test.json 1970-01-01 00:00:00.000000000 +0000 +++ dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/commit-ids-in-binaries/test.json 2024-03-18 12:48:03.000000000 +0000 @@ -0,0 +1,11 @@ +{ + "name": "commit-ids-in-binaries", + "enabled": true, + "requiresSdk": false, + "version": "2.1", + "versionSpecific": false, + "type": "bash", + "cleanup": true, + "ignoredRIDs":[ + ] +} diff -Nru dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/commit-ids-in-binaries/test.sh dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/commit-ids-in-binaries/test.sh --- dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/commit-ids-in-binaries/test.sh 1970-01-01 00:00:00.000000000 +0000 +++ dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/commit-ids-in-binaries/test.sh 2024-03-18 12:48:03.000000000 +0000 @@ -0,0 +1,31 @@ +#!/usr/bin/env bash + +# .NET Core native binaries (coreclr.so, System.Native.so) contain a +# commit id as text somewhere in the binary. For example +# +# $ strings System.Native.so | grep '@(#)' +# @(#)Version 2.1.27618.01 @BuiltBy: mockbuild-d3cc2d304ed840d29d7a302f41e3a589 @SrcCode: https://github.com/dotnet/core-setup/tree/ccea2e606d948094cf861b81e15245833bfb7006 +# +# This is then used in various places but specially when porting .NET +# Core different architectures or bootstrapping on new platforms. For +# an example, see https://github.com/dotnet/source-build/issues/651 + +set -euo pipefail +IFS=$'\n\t' +set -x + +dotnet_home="$(dirname "$(readlink -f "$(command -v dotnet)")")" +test -d "${dotnet_home}" +strings -v + +find ${dotnet_home} -type f -name '*.so' -print0 | while IFS= read -r -d '' file; do + # TODO: is this a bug in this library? + if [ "$(basename "${file}")" == libcoreclrtraceptprovider.so ]; then + continue; + fi + + echo "${file}" + strings "${file}" | grep '@(#)' | grep -o '[a-f0-9]\{40\}' +done + +echo "OK" diff -Nru dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/createdump-aspnet/test.json dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/createdump-aspnet/test.json --- dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/createdump-aspnet/test.json 1970-01-01 00:00:00.000000000 +0000 +++ dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/createdump-aspnet/test.json 2024-03-18 12:48:03.000000000 +0000 @@ -0,0 +1,14 @@ +{ + "name": "createdump-aspnet", + "enabled": true, + "requiresSdk": true, + "version": "2.2", + "versionSpecific": false, + "type": "bash", + "cleanup": true, + "skipWhen": [ + "runtime=mono" // 'createdump' is not included with mono + ], + "ignoredRIDs":[ + ] +} diff -Nru dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/createdump-aspnet/test.sh dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/createdump-aspnet/test.sh --- dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/createdump-aspnet/test.sh 1970-01-01 00:00:00.000000000 +0000 +++ dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/createdump-aspnet/test.sh 2024-03-18 12:48:03.000000000 +0000 @@ -0,0 +1,53 @@ +#!/usr/bin/env bash + +# Enable "unofficial bash strict mode" +set -euo pipefail +IFS=$'\n\t' +set -x + +IFS='.-' read -ra VERSION_SPLIT <<< "$1" + +version=${VERSION_SPLIT[0]}.${VERSION_SPLIT[1]} + +dotnet new web --force + +sed -i -e 's|.UseStartup|.UseUrls("http://localhost:5000").UseStartup|' Program.cs + +# Do not kick off compiler servers that hang around after a build +dotnet build -p:UseRazorBuildServer=false -p:UseSharedCompilation=false /m:1 + +dotnet run --no-build --no-restore & +sleep 5 +root_pid=$! + +mapfile -t pids < <(pgrep -P "${root_pid}") +pids+=("${root_pid}") + +failed=0 + +dotnet_home="$(dirname "$(readlink -f "$(command -v dotnet)")")" +for pid in "${pids[@]}"; do + if "${dotnet_home}"/shared/Microsoft.NETCore.App/"${version}"*/createdump -f "$(pwd)"/'coredump.%d' "${pid}"; then + echo "createdump worked" + else + echo "createdump failed" + failed=1 + fi +done + +for pid in "${pids[@]}"; do + kill -s SIGTERM "${pid}" +done +sleep 1 +for pid in "${pids[@]}"; do + if ps -p "${pid}"; then + kill "${pid}" + fi +done + +if [ ${failed} -eq 1 ]; then + echo "FAIL: createdump failed" + exit 1 +fi + +echo "PASS: createdump worked" diff -Nru dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/debugging-sos-lldb-via-core/test.json dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/debugging-sos-lldb-via-core/test.json --- dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/debugging-sos-lldb-via-core/test.json 1970-01-01 00:00:00.000000000 +0000 +++ dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/debugging-sos-lldb-via-core/test.json 2024-03-18 12:48:03.000000000 +0000 @@ -0,0 +1,16 @@ +{ + "name": "debugging-sos-lldb-via-core", + "enabled": true, + "requiresSdk": true, + "version": "3.0", + "versionSpecific": false, + "type": "bash", + "cleanup": true, + "ignoredRIDs": [ + "linux-arm", // lldb sos relies on features not implemented on arm + ], + "skipWhen": [ + "runtime=mono", // lldb sos relies on coreclr features + "ubuntu-autopkgtest-cloud,version=8,arch=arm64", // see https://github.com/canonical/dotnet-regular-tests/issues/12 + ] +} diff -Nru dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/debugging-sos-lldb-via-core/test.sh dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/debugging-sos-lldb-via-core/test.sh --- dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/debugging-sos-lldb-via-core/test.sh 1970-01-01 00:00:00.000000000 +0000 +++ dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/debugging-sos-lldb-via-core/test.sh 2024-03-18 12:48:03.000000000 +0000 @@ -0,0 +1,242 @@ +#!/usr/bin/env bash + +# Check whether coredumps produced by .NET Core can be used by sos +# successfully. This test uses the `dotnet sos` global tool. + +# Ensure global tools are on PATH. +export PATH=~/.dotnet/tools:$PATH + +# Enable "unofficial strict mode" only after loading /etc/profile +# because that usually contains lots of "errors". +set -euo pipefail +IFS=$'\n\t' + +# https://stackoverflow.com/questions/3173131/redirect-copy-of-stdout-to-log-file-from-within-bash-script-itself +exec > >(tee -i sos-lldb-core.log) +exec 2>&1 + +lldb-core () { + commands=() + while [[ "$#" -ne 0 ]]; do + command=$1 + commands+=('--one-line' "${command}") + shift + done + lldb --batch \ + -c "${coredump}" \ + "${commands[@]}" +} + +sdk_version=$1 + +set -x + +dotnet tool uninstall -g dotnet-sos || true +dotnet tool uninstall -g dotnet-dump || true +# For GA releases +dotnet tool install -g dotnet-sos +dotnet tool install -g dotnet-dump +# For preview releases: +#dotnet tool install -g dotnet-dump --add-source https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-tools/nuget/v3/index.json +#dotnet tool install -g dotnet-sos --add-source https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-tools/nuget/v3/index.json + +dotnet sos install + +framework_dir=$(../dotnet-directory --framework "${sdk_version}") +test -f "${framework_dir}/createdump" + +if ! command -v lldb ; then + echo "lldb is not installed" + exit 1 +fi + +no_server=("/nodeReuse:false" "/p:UseSharedCompilation=false" "/p:UseRazorBuildServer=false") + +# Create a dump + +rm -rf TestDir +mkdir TestDir +cd TestDir + +dotnet new web +sed -i -e 's|.UseStartup|.UseUrls("http://localhost:5000").UseStartup|' Program.cs +dotnet build "${no_server[@]}" + +dotnet bin/Debug/net*/TestDir.dll & +run_pid=$! + +sleep 5 + +dotnet dump collect --output "coredump.${run_pid}" --process-id "${run_pid}" | tee run.pid + +kill -9 "${run_pid}" || true + +coredump="coredump.${run_pid}" +test -f "${coredump}" + +# Object Inspection + +echo "[dumpobj]" +lldb-core 'dso' > lldb.out +cat lldb.out +mapfile -t object_ids < <(grep -F 'System.String[]' lldb.out | awk '{ print $2 }') +id="${object_ids[0]}" +lldb-core "dumpobj ${id}" > lldb.out +cat lldb.out +grep 'Array: Rank 1,' lldb.out + +echo "[dso]" +lldb-core 'dso' > lldb.out +cat lldb.out +# TODO: enable this +# if grep '' lldb.out; then +# echo 'fail: found in dso output.' +# exit 2 +# fi + +echo "[dumpheap]" +lldb-core "dumpheap -stat" > lldb.out +cat lldb.out +# TODO: enable this +# if grep UNKNOWN lldb.out; then +# echo 'fail: UNKNOWN classes found in dumpheap' +# exit 2 +# fi + +echo "[gcroot]" +lldb-core 'dso' > lldb.out +cat lldb.out +# FIXME enable on aarch64 when https://github.com/dotnet/diagnostics/issues/3726 is fixed +if [[ $(uname -m) != "aarch64" ]]; then + mapfile -t object_ids < <(grep -F 'System.Threading.Tasks' lldb.out | awk '{ print $2 }') + id="${object_ids[0]}" + lldb-core "gcroot ${id}" > lldb.out + cat lldb.out + grep 'Found [[:digit:]]* unique roots' lldb.out + count=$(grep 'Found [[:digit:]]* unique roots' lldb.out | sed -E 's|Found ([[:digit:]]*) unique roots.*|\1|') + if [[ $count -le 0 ]]; then + echo "fail: $count unique roots found" + exit 2 + fi + # TODO: enable + # if grep -F '' lldb.out; then + # echo 'fail: found in gcroot output' + # exit 2 + # fi +fi + +echo "[pe]" + +# Examining code and stacks + +echo "[clrthreads]" +lldb-core "clrthreads" > lldb.out +cat lldb.out +# TODO: fail if there are any "Ukn" at all +# if grep Ukn lldb.out; then +# echo 'fail: Ukn found in clrthreads' +# exit 2 +# fi + +echo "[ip2md]" +lldb-core 'clrstack -all' > lldb.out +cat lldb.out +ip=$(grep 'Program.
' lldb.out | cut -d' ' -f2) +lldb-core "ip2md ${ip}" > lldb.out +cat lldb.out +if ! grep 'IsJitted' lldb.out ; then + echo 'IsJitted field not found in ip2md' + exit 2 +fi + +echo "[clru]" +lldb-core "clru ${ip}" > lldb.out +cat lldb.out +if grep 'Unmanaged code' lldb.out; then + echo 'fail: clru thinks IP points to unmanaged code' + exit 2 +fi + +echo "[dumpstack]" +lldb-core 'clrstack' > lldb.out +cat lldb.out +stack_pointer=$(grep 'OS Thread Id' lldb.out -A3 | tail -1 | awk '{ print $1}') +lldb-core "dumpstack ${stack_pointer}" +cat lldb.out + +echo "[eestack]" +lldb-core 'eestack' > lldb.out +cat lldb.out +grep -E 'Child(-SP|FP)\s+RetAddr\s+Caller, Callee' lldb.out + +echo "[clrstack]" +lldb-core 'clrstack' > lldb.out +cat lldb.out +grep 'Program.
' lldb.out + +echo "[bpmd] breakpoints make no sense for core files" + +# Examining CLR data structures + +echo "[eeheap]" +lldb-core 'eeheap' > lldb.out +cat lldb.out +grep 'GC Committed Heap Size: Size: 0x' lldb.out +# TODO: enable this +# if grep 'Error getting' lldb.out; then +# echo 'fail: Error getting some parts of eeheap' +# exit 2 +# fi + +echo "[name2ee]" +lldb-core 'name2ee *!System.String' > lldb.out +cat lldb.out +grep 'MethodTable: ' lldb.out +grep 'EEClass: ' lldb.out +grep 'Name: ' lldb.out +string_module=$(grep 'Module: ' lldb.out | head -1 | awk '{print $2}') +string_method_table=$(grep 'MethodTable:' lldb.out | awk '{print $2}') +string_eeclass=$(grep 'EEClass:' lldb.out | head -1 | awk '{print $2}') + +lldb-core 'name2ee *!System.String.ToString' > lldb.out +cat lldb.out +grep 'TestDir.dll' lldb.out +grep 'System.Runtime.dll' lldb.out +grep 'Microsoft.AspNetCore.dll' lldb.out +to_string_method_descriptor=$(grep 'MethodDesc:' lldb.out | head -1 | awk '{print $2}') + +# https://github.com/dotnet/diagnostics/issues/3757 +# echo "[dumpmt]" +# lldb-core "dumpmt ${string_method_table}" > lldb.out +# cat lldb.out +# grep 'Name: System.String' lldb.out +# grep -F "File: ${framework_dir}" lldb.out + +echo "[dumpclass]" +lldb-core "dumpclass ${string_eeclass}" > lldb.out +cat lldb.out +grep 'Class Name: System.String' lldb.out + +echo "[dumpmd]" +lldb-core "dumpmd ${to_string_method_descriptor}" > lldb.out +cat lldb.out +grep -F 'Method Name: System.String.ToString()' lldb.out +grep 'IsJitted: yes' lldb.out +grep 'Version History:' lldb.out + +echo "[dumpmodule]" +lldb-core "dumpmodule ${string_module}" > lldb.out +cat lldb.out +grep "Name: *${framework_dir}" lldb.out +grep 'Attributes: *PEFile' lldb.out +grep 'MetaData start address: *0' lldb.out + +echo "[dumpil]" +lldb-core "dumpil ${to_string_method_descriptor}" > lldb.out +cat lldb.out +grep 'IL_0000: ldarg.0' lldb.out +grep 'IL_0001: ret ' lldb.out + +echo "[dumplog]" + +echo "PASS" diff -Nru dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/debugging-via-dotnet-dump/test.json dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/debugging-via-dotnet-dump/test.json --- dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/debugging-via-dotnet-dump/test.json 1970-01-01 00:00:00.000000000 +0000 +++ dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/debugging-via-dotnet-dump/test.json 2024-03-18 12:48:03.000000000 +0000 @@ -0,0 +1,17 @@ +{ + "name": "debugging-via-dotnet-dump", + "enabled": true, + "requiresSdk": true, + "version": "6.0", + "versionSpecific": false, + "type": "bash", + "cleanup": true, + "timeoutMultiplier": 2, + "ignoredRIDs": [ + "linux-arm" // dotnet-dump relies on features not implemented on arm + ], + "skipWhen": [ + "runtime=mono" // dotnet-dump relies on coreclr features + ] +} + diff -Nru dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/debugging-via-dotnet-dump/test.sh dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/debugging-via-dotnet-dump/test.sh --- dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/debugging-via-dotnet-dump/test.sh 1970-01-01 00:00:00.000000000 +0000 +++ dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/debugging-via-dotnet-dump/test.sh 2024-03-18 12:48:03.000000000 +0000 @@ -0,0 +1,719 @@ +#!/usr/bin/env bash + +# Check whether dotnet-dump, and its subcommands like `ps`, `collect` +# and `analyze` are working + +# Ensure global tools are on PATH. +export PATH=~/.dotnet/tools:$PATH + +# Enable "unofficial strict mode" only after loading /etc/profile +# because that usually contains lots of "errors". +set -euo pipefail +IFS=$'\n\t' + +heading () { + set +x + echo + echo "## $1" + echo "---${1//?/-}" + echo + set -x +} + +dump-analyze () { + first_word_in_first_command=${1%% *} + + commands=() + while [[ "$#" -ne 0 ]]; do + command=$1 + commands+=('--command' "${command}") + shift + done + commands+=('--command' 'exit') + dotnet dump analyze \ + "${coredump}" \ + "${commands[@]}" > output.temporary + set +x + if grep -i 'unrecognized command' output.temporary ; then + echo "fail: unrecognized command" >&2 + cat output.temporary >&2 + exit 1 + fi + if grep -i 'invalid parameter' output.temporary ; then + echo "fail: invalid parameter" >&2 + cat output.temporary >&2 + exit 1 + fi + if grep -i 'argument is missing' output.temporary ; then + echo "fail: missing arguments" >&2 + cat output.temporary >&2 + exit 1 + fi + if grep -i 'Usage: ' output.temporary ; then + echo "fail: invalid usage" >&2 + cat output.temporary >&2 + exit 1 + fi + if grep -i 'Must pass a valid' output.temporary ; then + echo "fail: invalid usage" >&2 + cat output.temporary >&2 + exit 1 + fi + if grep -i ' is not a valid object' output.temporary ; then + echo "fail: invalid usage" >&2 + cat output.temporary >&2 + exit 1 + fi + if grep -i -E "^${first_word_in_first_command}" output.temporary ; then + echo "fail: invalid usage" >&2 + cat output.temporary >&2 + exit 1 + fi + if grep -F '' output.temporary; then + echo 'fail: found in output' >&2 + cat output.temporary >&2 + exit 1 + fi + set -x + + cat output.temporary + rm output.temporary +} + +sdk_version=${1:-$(dotnet --version)} + +set -x + +heading "Installing dotnet-dump" + +dotnet tool uninstall -g dotnet-dump || true +dotnet tool install -g dotnet-dump +# For preview releases: +#dotnet tool install -g dotnet-dump --add-source https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-tools/nuget/v3/index.json + +framework_dir=$(../dotnet-directory --framework "${sdk_version}") +test -f "${framework_dir}/createdump" + +no_server=("/nodeReuse:false" "/p:UseSharedCompilation=false" "/p:UseRazorBuildServer=false") + +heading "Running test application" + +rm -rf TestDir +mkdir TestDir +cd TestDir + +dotnet new web +sed -i -e 's|.UseStartup|.UseUrls("http://localhost:5000").UseStartup|' Program.cs +dotnet build "${no_server[@]}" + +dotnet bin/Debug/net*/TestDir.dll & +run_pid=$! +trap "kill ${run_pid}" EXIT + +sleep 5 + +heading "Testing dotnet dump ps" + +dotnet dump ps > ps.out +cat ps.out +if [[ $(grep -cvE '^[ \t]*$' ps.out) -lt 2 ]]; then + echo 'fail: dotnet dump ps produced less than expected lines of output' + exit 2 +fi +grep -F 'dotnet dump ps' ps.out + +heading "Creating a dump" + +dotnet dump collect --type full --output "coredump.${run_pid}" --process-id "${run_pid}" | tee run.pid +#"${framework_dir}"/createdump --full --name "$(pwd)/coredump.${run_pid}" "${run_pid}" | tee run.pid + +kill "${run_pid}" || ( sleep 1; kill -9 "${run_pid}" ) +trap - EXIT + +coredump="coredump.${run_pid}" +test -f "${coredump}" + +heading "Testing dotnet dump analyze subcommands" + +# Test all subcommands. Keep list alphabetically sorted. Prefer long +# names over short aliases, so `registers` instead of `r`. + +heading "analyzeoom" +dump-analyze 'analyzeoom' > dump.out +cat dump.out +grep -F 'no managed OOM due to allocations on the GC heap' dump.out + + +heading "clrmodules" +dump-analyze 'clrmodules' > dump.out +cat dump.out +grep -F System.Net.Sockets.dll dump.out +grep -F System.Memory.dll dump.out +grep -F Microsoft.AspNetCore.dll dump.out + + +heading "clrstack" +dump-analyze 'clrstack -a -f -r -all' > dump.out +cat dump.out +grep -F 'Program.
' dump.out +grep -F 'Microsoft.AspNetCore' dump.out +grep -F 'PARAMETERS:' dump.out +grep -F 'LOCALS:' dump.out +dump-analyze 'clrthreads' > dump.out +cat dump.out +thread_id=$(grep -A5 'ID *OSID *ThreadOBJ' dump.out | tail -4 | grep -vE 'Finalizer|Threadpool' | { head -1; cat > /dev/null; } | awk '{print $1}') +dump-analyze "threads ${thread_id}" 'clrstack' > dump.out +cat dump.out +grep -E 'System\.Threading|DebuggerU2MCatchHandlerFrame' dump.out + + +heading "clrthreads" +dump-analyze "clrthreads" > dump.out +cat dump.out +grep -E 'ThreadCount: *[[:digit:]]+' dump.out +grep -E 'BackgroundThread: *[[:digit:]]' dump.out +grep -E 'Hosted Runtime: *no' dump.out + + +dump-analyze 'clrstack -a' > dump.out +grep -E 'this \([^)]+\) = 0x[0-9a-f]+' dump.out +addr=$(grep -E 'this \([^)]+\) = 0x[0-9a-f]+' dump.out | cut -d'=' -f2 | { head -1; cat > /dev/null; } ) +dump-analyze "dumpalc $addr" > dump.out +cat dump.out + + +heading "dumpasync" +dump-analyze 'dumpasync' > dump.out +cat dump.out +grep -E 'Awaiting: [a-zA-Z0-9]+ [a-zA-Z0-9]+ System.Runtime.CompilerServices.ValueTaskAwaiter' dump.out + + +# TODO: dumpconcurrentdictionary + +# TODO: dumpconcurrentqueue + + +heading "dumpgen" +for gen in gen0 gen1 gen2 loh poh; do + dump-analyze "dumpgen $gen" > dump.out + cat dump.out + total=$( (grep -E '00[0-9a-fA-F]+ +[[:digit:]]+ +[[:digit:]]+ +' dump.out | awk '{print $2}' | paste -sd+ | bc) || echo 0) + grep -F "Total ${total} objects" dump.out +done + + +heading "dumparray" +dump-analyze 'dumpstackobjects' > dump.out +cat dump.out +mapfile -t object_ids < <(grep -F 'System.String[]' dump.out | awk '{ print $2 }') +echo '' > dump.out +for id in "${object_ids[@]}"; do + dump-analyze "dumparray -details ${id}" > single.dump.out + cat single.dump.out + cat single.dump.out >> dump.out + grep 'Array: Rank 1,' dump.out +done +if grep 'Number of elements' dump.out | grep -cv 'Number of elements 0'; then + grep -E '^\[0\]' dump.out + grep -F '_stringLength' dump.out +fi + + +# TODO "dumpassembly" + +# TODO: dumpasync + + +heading "dumpclass" +dump-analyze 'name2ee *!System.String' > dump.out +cat dump.out +grep 'EEClass: ' dump.out +string_eeclass=$(grep 'EEClass:' dump.out | { head -1; cat > /dev/null; } | awk '{print $2}') +dump-analyze "dumpclass ${string_eeclass}" > dump.out +cat dump.out +grep 'Class Name: System.String' dump.out + + +# TODO "dumpdelegate" + + +heading "dumpdomain" +dump-analyze 'dumpdomain' > dump.out +cat dump.out +grep -F 'System Domain:' dump.out +grep -F 'Domain 1:' dump.out +if [[ $(grep -c 'Name: ' dump.out) -lt 2 ]]; then + echo 'fail: too few domains in dump' + exit 2 +fi + +# FIXME: why are all data values 0 here? +heading "dumpgcdata" +dump-analyze 'dumpgcdata' > dump.out +cat dump.out + + +heading "dumpheap" +dump-analyze "dumpheap -stat" > dump.out +cat dump.out +if grep UNKNOWN dump.out; then + echo 'fail: UNKNOWN classes found in dumpheap' + exit 2 +fi +grep -E '^[0-9a-fA-F]+ +([[:digit:]]+,)?[[:digit:]]+ +([[:digit:]]+,)?[[:digit:]]+ +System.Object\[\]' dump.out +grep -E '^[0-9a-fA-F]+ +([[:digit:]]+,)?[[:digit:]]+ +([[:digit:]]+,)?[[:digit:]]+ +System.Char\[\]' dump.out +grep -E '^[0-9a-fA-F]+ +([[:digit:]]+,)?[[:digit:]]+ +([[:digit:]]+,)?[[:digit:]]+ +System.String$' dump.out + + +heading "dumpil" +dump-analyze 'name2ee *!System.String.ToString' > dump.out +cat dump.out +mapfile -t to_string_method_descriptors < <(grep 'MethodDesc:' dump.out | awk '{print $2}') +for desc in "${to_string_method_descriptors[@]}"; do + dump-analyze "dumpil ${desc}" > dump.out + cat dump.out +done +dump-analyze "dumpil ${to_string_method_descriptors[0]}" > dump.out +cat dump.out +grep 'IL_0000: ldarg.0' dump.out +grep 'IL_0001: ret ' dump.out + + +# TODO "dumplog" + + +heading "dumpmd" +dump-analyze 'clrthreads' > dump.out +cat dump.out +thread_id=$(grep -A5 'ID *OSID *ThreadOBJ' dump.out | tail -4 | grep -vE 'Finalizer|Threadpool' | { head -1; cat > /dev/null; } | awk '{print $1}') +dump-analyze "threads ${thread_id}" 'clrstack' > dump.out +cat dump.out +ip=$(grep 'OS Thread Id:' dump.out -A5 | tail -n3 | grep -v -F '[Prestub' | { head -1; cat > /dev/null; } | cut -d' ' -f2) +dump-analyze "dumpmd ${ip}" > dump.out +cat dump.out +if grep 'Unmanaged code' dump.out; then + echo 'fail: dumpmd thinks IP points to unmanaged code' + exit 2 +fi +dump-analyze 'name2ee *!System.String.ToString' > dump.out +cat dump.out +grep 'TestDir.dll' dump.out +grep 'System.Runtime.dll' dump.out +grep 'Microsoft.AspNetCore.dll' dump.out +to_string_method_descriptor=$(grep 'MethodDesc:' dump.out | { head -1; cat > /dev/null; } | awk '{print $2}') +dump-analyze "dumpmd ${to_string_method_descriptor}" > dump.out +cat dump.out +grep -F 'Method Name: System.String.ToString()' dump.out +grep 'IsJitted: yes' dump.out +grep 'Version History:' dump.out + + +heading "dumpmodule" +dump-analyze 'name2ee *!System.String' > dump.out +cat dump.out +string_module=$(grep 'Module: ' dump.out | { head -1; cat > /dev/null; } | awk '{print $2}') +dump-analyze "dumpmodule ${string_module}" > dump.out +cat dump.out +grep "Name: *${framework_dir}" dump.out +grep 'Attributes: *PEFile' dump.out +grep 'MetaData start address: *0' dump.out + + +# FIXME: dumpmt seems to work on 7.0.1 but not 7.0.0? +# heading "dumpmt" +# dump-analyze 'name2ee *!System.String' > dump.out +# cat dump.out +# grep 'MethodTable:' dump.out | awk '{print $2}' +# string_method_table=$(grep 'MethodTable:' dump.out | awk '{print $2}') +# dump-analyze "dumpmt ${string_method_table}" > dump.out +# cat dump.out +# grep -E '^Name:[ \n\t]+System.String' dump.out +# grep -E "^File:[ \n\t]+${framework_dir}" dump.out + + +heading "dumpobj" +dump-analyze 'dumpstackobjects' > dump.out +cat dump.out +mapfile -t object_ids < <(grep -F 'System.String[]' dump.out | awk '{ print $2 }') +id="${object_ids[0]}" +dump-analyze "dumpobj ${id}" > dump.out +cat dump.out +grep 'Array: Rank 1,' dump.out + + +heading "dumpruntimetypes" +# Disable exit on error for dumpruntimetypes. TODO Report this. +set +e +dump-analyze "dumpruntimetypes" > dump.out +set -e +cat dump.out +grep -E '^ *[0-9a-fA-F]+ +[0-9a-fA-F]+ +[0-9a-fA-F]+ +System\.String$' dump.out +grep -E '^ *[0-9a-fA-F]+ +[0-9a-fA-F]+ +[0-9a-fA-F]+ +System\.Byte$' dump.out +grep -E '^ *[0-9a-fA-F]+ +[0-9a-fA-F]+ +[0-9a-fA-F]+ +Microsoft\.Extensions\.Logging' dump.out + + +# TODO "dumpsig" + +# TODO "dumpsigelem" + + +heading "dumpstackobjects" +dump-analyze 'dumpstackobjects' > dump.out +cat dump.out +if grep '' dump.out; then + echo 'fail: found in dso output.' + exit 2 +fi +dump-analyze 'clrstack' > dump.out +cat dump.out +stack_pointer=$(grep 'OS Thread Id' dump.out -A3 | tail -1 | awk '{ print $1}') +# Disabled due to: https://github.com/dotnet/diagnostics/issues/4368 +# dump-analyze "dumpstackobjects ${stack_pointer}" +# cat dump.out + + +# TODO "dumpvc" + + +heading "eeheap" +dump-analyze 'eeheap' > dump.out +cat dump.out +if grep 'Error getting' dump.out; then + echo 'fail: Error getting some parts of eeheap' + exit 2 +fi +# FIXME: For some unknown reason, "No unique loader heaps found." is printed in +# some environments, even for same builds :/ +if ! grep 'No unique loader heaps found.' dump.out; then + grep 'Allocated Heap Size: Size: 0x' dump.out + grep 'Committed Heap Size: Size: 0x' dump.out +fi + +heading "eeversion" +dump-analyze 'eeversion' > dump.out +cat dump.out +grep -E '^[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+' dump.out +grep -E '^[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+ +@Commit: [0-9a-fA-F]+$' dump.out +grep -E '^(Workstation mode|Server mode with [[:digit:]]+ gc heaps)$' dump.out + + +heading "ehinfo" +dump-analyze 'name2ee *!System.String.ToString' > dump.out +cat dump.out +mapfile -t to_string_method_descriptors < <(grep 'MethodDesc:' dump.out | awk '{print $2}') +for desc in "${to_string_method_descriptors[@]}"; do + dump-analyze "ehinfo ${desc}" > dump.out + cat dump.out +done +# FIXME: why does ehinfo on a method with an actual try-catch show "No EH info available"? + + +# TODO: enummem + +# TODO: ext/sos + + +heading "finalizequeue" +dump-analyze 'finalizequeue' > dump.out +cat dump.out +grep -E 'generation [[:digit:]]+ has [[:digit:]] (finalizable )?objects' dump.out + + +heading "findappdomain" +dump-analyze 'dumpstackobjects' > dump.out +cat dump.out +mapfile -t object_ids < <(grep -F 'System.String[]' dump.out | awk '{ print $2 }') +id="${object_ids[0]}" +dump-analyze "findappdomain ${id}" > dump.out +cat dump.out + + +heading "gchandles" +dump-analyze 'gchandles' > dump.out +cat dump.out +for reference in Strong WeakShort WeakLong Dependent; do + if [[ $(cut -d' ' -f2 dump.out | grep -cF "$reference") -lt 2 ]]; then + echo "fail: too few references of type $reference" + exit 2 + fi +done + + +heading "gcheapstat" +dump-analyze 'gcheapstat' > dump.out +cat dump.out +grep -F 'Heap0' dump.out + + +heading "gcinfo" +dump-analyze 'name2ee *!System.String.ToString' > dump.out +cat dump.out +mapfile -t to_string_method_descriptors < <(grep 'MethodDesc:' dump.out | awk '{print $2}') +for desc in "${to_string_method_descriptors[@]}"; do + dump-analyze "gcinfo ${desc}" > dump.out + cat dump.out +done + + +heading "gcroot" +dump-analyze 'dso' > dump.out +cat dump.out +# Skipped on aarch64 due to https://github.com/dotnet/diagnostics/issues/4388 +if [[ "$(uname -m)" != "aarch64" ]]; then + mapfile -t object_ids < <(grep -F 'System.Threading.Tasks' dump.out | awk '{ print $2 }') + id="${object_ids[0]}" + dump-analyze "gcroot ${id}" > dump.out + cat dump.out + grep -E 'Found [[:digit:]]* (unique )?roots' dump.out + count=$(grep -E 'Found [[:digit:]]* (unique )?roots' dump.out | sed -E 's|Found ([[:digit:]]*) (unique )?roots.*|\1|') + if [[ $count -le 0 ]]; then + echo "fail: $count unique roots found" + exit 2 + fi +fi + + +heading "gcwhere" +dump-analyze 'dumpstackobjects' > dump.out +cat dump.out +mapfile -t object_ids < <(grep -F 'System.String[]' dump.out | awk '{ print $2 }') +id="${object_ids[-1]}" +dump-analyze "gcwhere ${id}" > dump.out +cat dump.out +# Output is in one of two formats: +# Address Gen Heap segment begin allocated size +# Address Heap Segment Generation Allocated Committed Reserved +grep -E '[0-9a-fA-F]+ +[0-9]+ +[0-9]+ +[0-9a-fA-F]+ +[0-9a-fA-F]+ +[0-9a-fA-F]+ +0x[0-9a-fA-F]+\([0-9]+\)' dump.out \ + || grep -E '[0-9a-fA-F]+ +[0-9]+ +[0-9a-fA-F]+ +[0-9]+ +[-0-9a-fA-F]+ +[-0-9a-fA-F]+ +[-0-9a-fA-F]+' dump.out \ + + +# TODO "histobj" + +# TODO "histobjfind" + +# TODO "histroot" + +# TODO "histstats" + + +heading "ip2md" +dump-analyze 'clrthreads' > dump.out +cat dump.out +i=0 +while true; do + i=$((i + 1)) + thread_id=$(grep -A999 'ID *OSID *ThreadOBJ' dump.out | tail -n +2 \ + | grep -vE 'Finalizer|Threadpool' \ + | { head -"$i"; cat > /dev/null; } | tail -1 \ + | awk '{print $1}') + dump-analyze "threads ${thread_id}" 'clrstack' > dump.out + cat dump.out + if ! grep DebuggerU2MCatchHandlerFrame dump.out ; then + break + fi +done +ip=$(grep 'OS Thread Id:' dump.out -A5 | tail -n3 | grep -v -F '[Prestub' | { head -1; cat > /dev/null; } | cut -d' ' -f2) +dump-analyze "ip2md ${ip}" > dump.out +cat dump.out +if ! grep 'IsJitted' dump.out ; then + echo 'IsJitted field not found in ip2md' + exit 2 +fi + + +heading "listnearobj" +dump-analyze 'eeheap' > dump.out +cat dump.out +# FIXME: For some unknown reason, "No unique loader heaps found." is printed in +# some environments, even for same builds :/ +if ! grep 'No unique loader heaps found.' dump.out; then +# Find a gen0 with a non-0 size, then grab the starting address from it + addr=$(grep -m 1 -E '^[0-9a-fA-F]+ +[0-9a-fA-F]+ +[0-9a-fA-F]+ +[0-9a-fA-F]+ +0x[1-9a-fA-F]' dump.out | awk ' { print $2 } ') + dump-analyze "listnearobj $addr" > dump.out + cat dump.out + grep -F 'Before: ' dump.out + grep -F 'Current: ' dump.out + grep -F 'After: ' dump.out +grep -F 'Heap local consistency confirmed.' dump.out +fi + + +heading "modules" +dump-analyze 'modules' > dump.out +cat dump.out +grep -E '/dotnet$' dump.out +grep -F '/libclrjit.so' dump.out +grep -F '/libcoreclr.so' dump.out +grep -F '/System.Private.CoreLib.dll' dump.out +grep -F '/System.Runtime.dll' dump.out + + +heading "name2ee" +dump-analyze 'name2ee *!System.String' > dump.out +cat dump.out +grep 'MethodTable: ' dump.out +grep 'EEClass: ' dump.out +grep 'Name: ' dump.out +dump-analyze 'name2ee *!System.String.ToString' > dump.out + + +heading "objsize" +dump-analyze 'dumpstackobjects' > dump.out +cat dump.out +mapfile -t object_ids < <(grep -F 'System.String[]' dump.out | awk '{ print $2 }') +id="${object_ids[-1]}" +dump-analyze "objsize ${id}" > dump.out +cat dump.out +if grep -F 'transitively keep alive' dump.out; then + # Updated output from objsize looks like this: + # + # Objects which 7f85ab80efd8(System.String[]) transitively keep alive: + # + # Address MT Size + # 7f85ab80efd8 7fc58eb2e0c0 24 + grep -E "${id:10} +[0-9a-fA-F]+ +[0-9]+" dump.out +else + grep -E '^sizeof\([0-9a-fA-F]+\) += +[0-9]+ \(0x[0-9a-fA-F]+\) bytes' dump.out +fi + + +heading "parallelstacks" +dump-analyze 'parallelstacks' > dump.out +cat dump.out +grep -E '==> [[:digit:]]+ threads with [[:digit:]]+ roots' dump.out + + +# TODO: printexception + + +heading "registers" +dump-analyze 'registers' > dump.out +cat dump.out +lines=$(wc -l dump.out | awk '{ print $1 }') +if [[ "$lines" -lt 20 ]]; then + echo "fail: too few registers" + exit 2 +fi + + +heading "readmemory" +# Disable exit on error for dumpruntimetypes. TODO Report this. +set +e +dump-analyze "dumpruntimetypes" > dump.out +set -e +cat dump.out +address=$(grep -F 'System.String' dump.out | { head -1; cat > /dev/null; } | cut -d' ' -f1) +dump-analyze "readmemory ${address} --length 100" > dump.out +cat dump.out + + +heading "runtimes" +dump-analyze 'runtimes' > dump.out +cat dump.out +grep -E '^#0 .NET Core runtime ([[:digit:]]+(\.[[:digit:]]+)* )?at [0-9a-fA-F]+ size [0-9a-fA-F]+ index [0-9a-fA-F]+$' dump.out +grep -E '^ Runtime module path: /.*/libcoreclr.so$' dump.out +grep -E '^ Dac .*/libmscordaccore.so LINUX [^ ]+ Coreclr [0-9a-fA-F]+$' dump.out +grep -E '^ Dbi libmscordbi.so LINUX [^ ]+ Coreclr [0-9a-fA-F]+$' dump.out + + +heading "sosstatus" +dump-analyze 'sosstatus' > dump.out +cat dump.out +grep -E 'Target OS: LINUX Architecture: (X64|Arm64) ProcessId: [[:digit:]]+' dump.out + + +heading "syncblk" +dump-analyze 'syncblk' > dump.out +cat dump.out +grep -E 'Total +[0-9]+$' dump.out +grep -E 'Free +[0-9]+$' dump.out + + +# TODO: "taskstate" + + +heading "threadpool" +dump-analyze 'threadpool' > dump.out +cat dump.out +if ! grep -E 'Worker Thread: Total: [0-9]+ Running: [0-9]+ Idle: [0-9]+ MaxLimit: [0-9]+ MinLimit: [0-9]+' dump.out; then + grep -E 'Workers Total: *[0-9]+' dump.out + grep -E 'Workers Running: *[0-9]+' dump.out + grep -E 'Workers Idle: *[0-9]+' dump.out + grep -E 'Worker Min Limit: *[0-9]+' dump.out + grep -E 'Worker Max Limit: *[0-9]+' dump.out +fi + + +# TODO: "threadpoolqueue" + + +heading "threads" +dump-analyze 'threads' > dump.out +cat dump.out +lines=$(wc -l dump.out | awk '{ print $1 }') +if [[ "$lines" -lt 9 ]]; then + echo 'fail: too few threads' + exit 2 +fi + + +heading "threadstate" +dump-analyze 'threads' > dump.out +cat dump.out +tail -n +2 dump.out | cut -b2- | xargs | cut -d' ' -f1 +mapfile -t thread_ids < <(grep -vE '^Loading core dump' dump.out | cut -b2- | cut -d' ' -f1) +echo "${thread_ids[@]}" +for id in "${thread_ids[@]}"; do + dump-analyze "threadstate ${id}" > dump.out + cat dump.out + if [[ $(grep -cvE '^Loading core dump' dump.out) -lt 1 ]]; then + echo 'fail: no output from thread state?' + exit 2 + fi +done + + +heading "timerinfo" +dump-analyze 'timerinfo' > dump.out +cat dump.out +grep -E '^ +[0-9]+ timers$' dump.out + + +heading "traverseheap" +if [[ "$(uname -m)" != "aarch64" ]]; then + dump-analyze 'help traverseheap' > dump.out + # Disable exit on error for traverseheap. Reported as https://github.com/dotnet/diagnostics/issues/3842 + if grep -F -- '-verify' dump.out; then + set +e + dump-analyze 'traverseheap -xml -verify full-heap' > dump.out + set -e + else + set +e + dump-analyze 'traverseheap -xml full-heap' > dump.out + set -e + fi + cat dump.out + head full-heap + tail full-heap + grep -E '' full-heap + grep -E ' dump.out +grep -F 'No heap corruption detected.' dump.out + + +heading "verifyobj" +dump-analyze 'dumpstackobjects' > dump.out +cat dump.out +mapfile -t object_ids < <(grep -F 'System.String[]' dump.out | awk '{ print $2 }') +for object in "${object_ids[@]}"; do + dump-analyze "verifyobj ${object}" > dump.out + cat dump.out + grep -E 'object 0[xX][0-9a-fA-F]+ is a valid object' dump.out +done + +echo "PASS" diff -Nru dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/distribution-packages/test-standard-packages dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/distribution-packages/test-standard-packages --- dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/distribution-packages/test-standard-packages 1970-01-01 00:00:00.000000000 +0000 +++ dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/distribution-packages/test-standard-packages 2024-03-18 12:48:03.000000000 +0000 @@ -0,0 +1,482 @@ +#!/usr/bin/python3 + +# This is an automated script to check package compliance against +# https://docs.microsoft.com/en-us/dotnet/core/build/distribution-packaging + +import argparse +from collections import namedtuple +from enum import Enum +import pathlib +import subprocess +import sys +from typing import Dict, List, Optional, Tuple + +description: str = ''' +Verify that .NET Core packages comply with the official packaging +suggestions by scanning the local packages, or, optionally, in the +local directory. +''' + +class SymbolsPresence(Enum): + NOT_ALLOWED = 1 + NOT_ALLOWED_EXCEPT_LEGACY = 2 + ONLY_SYMBOLS_ALLOWED = 3 + +class PackageRequirement: + + def __init__(self, name: str, version: str, + dependencies: List[str], + contains: List[str], + symbols: SymbolsPresence, + another_version: bool = False, + minimum_version_for_requirement: str = '1.0'): + self.name = name + self.version = version + self.dependencies = dependencies + self.contains = contains + self.symbols = symbols + self.another_version = another_version + self.minimum_version_for_requirement = minimum_version_for_requirement + + def applies_to_dotnet_major_minor(self, major_dot_minor: str) -> bool: + return float(self.minimum_version_for_requirement) <= float(major_dot_minor) + +# This is a machine-readable version of the guidelines at +# https://docs.microsoft.com/en-us/dotnet/core/build/distribution-packaging +# +# Values enclosed in paren {like_so} are replaced at runtime with the +# real values, based on user input. +# +# The following names are currently defined/replaced at runtime: +# +# rid: runtime id +# major: the major .NET Core version +# minor: the minor .NET Core version +# runtime_version: the full runtime version +# aspnetcore_runtime_version: the full ASP.NET Core version +# sdk_version: the full SDK version +# netstandard_version: the full .NET Standard version +# netstandard_major: the major .NET Standard version +# netstandard_minor: the minor .NET Standard version + +PACKAGE_REQUIREMENTS = [ + PackageRequirement( + name='dotnet-sdk-{major}.{minor}', + version='{sdk_version}', + dependencies=[ + 'dotnet-runtime-{major}.{minor}', + 'aspnetcore-runtime-{major}.{minor}', + 'aspnetcore-targeting-pack-{major}.{minor}', + 'dotnet-apphost-pack-{major}.{minor}', + 'dotnet-targeting-pack-{major}.{minor}', + 'dotnet-templates-{major}.{minor}', + 'netstandard-targeting-pack-{netstandard_major}.{netstandard_minor}', + ], + contains=['/sdk/', '/sdk/{major}.{minor}'], + symbols=SymbolsPresence.NOT_ALLOWED_EXCEPT_LEGACY, + ), + PackageRequirement( + name='dotnet-sdk-dbg-{major}.{minor}', + version='{sdk_version}', + dependencies=[ + 'dotnet-sdk-{major}.{minor}', + ], + contains=['/sdk/', '/sdk/{major}.{minor}'], + symbols=SymbolsPresence.ONLY_SYMBOLS_ALLOWED, + minimum_version_for_requirement='8.0', + ), + PackageRequirement( + name='aspnetcore-runtime-{major}.{minor}', + version='{aspnetcore_runtime_version}', + dependencies=[ + 'dotnet-runtime-{major}.{minor}', + ], + contains=['/shared/', '/shared/Microsoft.AspNetCore.App/{major}.{minor}'], + symbols=SymbolsPresence.NOT_ALLOWED, + ), + PackageRequirement( + name='aspnetcore-runtime-dbg-{major}.{minor}', + version='{aspnetcore_runtime_version}', + dependencies=[ + 'aspnetcore-runtime-{major}.{minor}', + ], + contains=['/shared/', '/shared/Microsoft.AspNetCore.App/{major}.{minor}'], + symbols=SymbolsPresence.ONLY_SYMBOLS_ALLOWED, + minimum_version_for_requirement='8.0', + ), + PackageRequirement( + name='dotnet-runtime-{major}.{minor}', + version='{runtime_version}', + dependencies=[ + 'dotnet-hostfxr-{major}.{minor}', + ], + contains=['/shared/', '/shared/Microsoft.NETCore.App/{major}.{minor}'], + symbols=SymbolsPresence.NOT_ALLOWED, + ), + PackageRequirement( + name='dotnet-runtime-dbg-{major}.{minor}', + version='{runtime_version}', + dependencies=[ + 'dotnet-runtime-{major}.{minor}', + ], + contains=['/shared/', '/shared/Microsoft.NETCore.App/{major}.{minor}'], + symbols=SymbolsPresence.ONLY_SYMBOLS_ALLOWED, + minimum_version_for_requirement='8.0', + ), + PackageRequirement( + name='dotnet-hostfxr-{major}.{minor}', + version='{runtime_version}', + dependencies=[ + 'dotnet-host', + ], + contains=['/host/fxr/{major}.{minor}'], + symbols=SymbolsPresence.NOT_ALLOWED, + ), + PackageRequirement( + name='dotnet-host', + version='{runtime_version}', + another_version=True, + dependencies=[], + contains=[ + '/usr/lib64/dotnet/dotnet', + '/dotnet/LICENSE.txt', + '/dotnet/ThirdPartyNotices.txt', + '/usr/bin/dotnet', + '/usr/share/man/man1/dotnet.1.gz', + '/etc/dotnet/install_location' + ], + symbols=SymbolsPresence.NOT_ALLOWED, + ), + PackageRequirement( + name='dotnet-apphost-pack-{major}.{minor}', + version='{runtime_version}', + dependencies=[], + contains=['/packs/Microsoft.NETCore.App.Host.{rid}/{major}.{minor}'], + symbols=SymbolsPresence.NOT_ALLOWED, + ), + PackageRequirement( + name='dotnet-targeting-pack-{major}.{minor}', + version='{runtime_version}', + dependencies=[], + contains=['/packs/Microsoft.NETCore.App.Ref/{major}.{minor}'], + symbols=SymbolsPresence.NOT_ALLOWED, + ), + PackageRequirement( + name='aspnetcore-targeting-pack-{major}.{minor}', + version='{aspnetcore_runtime_version}', + dependencies=[], + contains=['/packs/Microsoft.AspNetCore.App.Ref/{major}.{minor}'], + symbols=SymbolsPresence.NOT_ALLOWED, + ), + PackageRequirement( + name='netstandard-targeting-pack-{netstandard_major}.{netstandard_minor}', + version='{sdk_version}', + another_version=True, + dependencies=[], + contains=['/packs/NETStandard.Library.Ref/{netstandard_major}.{netstandard_minor}'], + symbols=SymbolsPresence.NOT_ALLOWED, + ), + PackageRequirement( + name='dotnet-templates-{major}.{minor}', + version='{sdk_version}', + dependencies=[], + contains=['/templates/{major}.{minor}'], + symbols=SymbolsPresence.NOT_ALLOWED, + ), +] + + +class PackageSource: + + def __init__(self): + raise NotImplementedError() + + def find_package(self, name: str): + raise NotImplementedError() + + def rpm_get_reqiures(self, package_name: str): + raise NotImplementedError() + + def rpm_query(self, package_name: str, query_args: List[str]) -> str: + raise NotImplementedError() + + def _rpm_requires_to_dependencies(self, output_lines: List[str]): + actual_dependencies: List[Tuple[str, Optional[str], Optional[str]]] = [] + for dep in output_lines: + dependency = dep.split(' ') + name = dependency[0] + if '(' in name: + name = name.split('(')[0] + try: + op: Optional[str] = dependency[1] + version: Optional[str] = dependency[2].split('-')[0] + except IndexError: + op = None + version = None + if name: + actual_dependencies.append((name, op, version)) + return actual_dependencies + + +class InstalledPackages(PackageSource): + + def __init__(self): + pass + + def find_package(self, name: str): + try: + return self._rpm_query(name, []) + except subprocess.CalledProcessError: + return None + + def rpm_get_reqiures(self, package_name: str): + package_requires = self._rpm_query(package_name, ['--requires']).split('\n') + return self._rpm_requires_to_dependencies(package_requires) + + def rpm_query(self, package_name: str, query_args: List[str]) -> str: + return self._rpm_query(package_name, query_args) + + def _rpm_query(self, package_name: str, query_args: List[str]) -> str: + # print(f'running rpm -qp {query_args} {str(f)}') + completed = subprocess.run(['rpm', '-q', *query_args, package_name], + check=True, universal_newlines=True, + stdout=subprocess.PIPE, stderr=subprocess.PIPE) + # print(completed.stdout) + return completed.stdout + + +class DirectoryOfPackages(PackageSource): + + def __init__(self, directory: str): + self.__package_cache: Dict[str, pathlib.Path] = self.__build_package_cache(directory) + + def __build_package_cache(self, directory: str): + cache: Dict[str, pathlib.Path] = {} + for f in pathlib.Path(directory).iterdir(): + # print(f) + if f.name.endswith('rpm'): + name = self._rpm_query_file(f, ['--queryformat', '%{name}']) + cache[name] = f + return cache + + def find_package(self, name: str) -> Optional[pathlib.Path]: + return self.__package_cache.get(name) + + def rpm_get_reqiures(self, package_name: str): + package_file = self.__package_cache.get(package_name) + if package_file is None: + raise AssertionError() + + package_requires = self._rpm_query_file(package_file, ['--requires']).split('\n') + return self._rpm_requires_to_dependencies(package_requires) + + def rpm_query(self, package_name, query_args: List[str]): + package_file = self.__package_cache.get(package_name) + if package_file is None: + raise AssertionError() + return self._rpm_query_file(package_file, query_args) + + def _rpm_query_file(self, package_path: pathlib.Path, query_args: List[str]) -> str: + # print(f'running rpm -qp {query_args} {str(f)}') + completed = subprocess.run(['rpm', '-qp', *query_args, str(package_path)], + check=True, universal_newlines=True, + stdout=subprocess.PIPE, stderr=subprocess.PIPE) + # print(completed.stdout) + return completed.stdout + + +def main() -> int: + parser = argparse.ArgumentParser(description=description) + parser.add_argument('runtime_id', help='Runtime Id') + parser.add_argument('runtime_version', help='Runtime version') + parser.add_argument('aspnetcore_runtime_version', help='ASP.NET Core Runtime version') + parser.add_argument('sdk_version', help='Sdk version') + parser.add_argument('netstandard_version', help='netstandard version') + parser.add_argument('--directory', default='', help='directory to search packages in') + parser.add_argument('--package-prefix', default='', help='prefix for packages') + + args = parser.parse_args() + + runtime_id = args.runtime_id + directory = args.directory + package_prefix = args.package_prefix + + runtime_version = to_package_version(args.runtime_version) + aspnetcore_runtime_version = to_package_version(args.aspnetcore_runtime_version) + sdk_version = to_package_version(args.sdk_version) + netstandard_version = to_package_version(args.netstandard_version) + + if package_prefix and not package_prefix.endswith('-'): + package_prefix = package_prefix + '-' + + package_source: PackageSource + if args.directory: + package_source = DirectoryOfPackages(args.directory) + else: + package_source = InstalledPackages() + + okay = check_packages(package_source, package_prefix, runtime_id, + runtime_version, aspnetcore_runtime_version, sdk_version, netstandard_version) + + if okay: + return 0 + else: + return 1 + +def to_package_version(version: str) -> str: + if '-preview.' or '-rc.' in version: + # Convert upstream version 11.2.3-preview.999.1234 to RPM-style 11.2.3~preview.999 + parts = version.split('-') + if len(parts) == 2: + release_prefix = '.'.join(parts[1].split('.')[0:2]) + return parts[0] + '~' + release_prefix + return version + + +def check_packages(package_source: PackageSource, package_prefix: str, runtime_id: str, + runtime_version: str, aspnetcore_runtime_version: str, + sdk_version: str, netstandard_version: str) -> bool: + okay = True + + major = runtime_version.split('.')[0] + minor = runtime_version.split('.')[1] + major_minor = f'{major}.{minor}' + + format_dict = { + 'rid': runtime_id, + 'major': major, + 'minor': minor, + 'runtime_version': runtime_version, + 'aspnetcore_runtime_version': aspnetcore_runtime_version, + 'sdk_version': sdk_version, + 'netstandard_version': netstandard_version, + 'netstandard_major': netstandard_version.split('.')[0], + 'netstandard_minor': netstandard_version.split('.')[1], + } + + known_packages: Dict[str, str] = {} + for requirement in PACKAGE_REQUIREMENTS: + package_name = package_prefix + requirement.name.format(**format_dict) + package_version = requirement.version.format(**format_dict) + known_packages[package_name] = package_version + + for requirement in PACKAGE_REQUIREMENTS: + + if not requirement.applies_to_dotnet_major_minor(major_minor): + continue + + package_name = package_prefix + requirement.name.format(**format_dict) + package = package_source.find_package(package_name) + + if package is None: + print(f'✗ {package_name}') + print(f' error: package {package_name} not found') + okay = False + continue + + verbose(f'Found {package_name} at {package}') + + issues: List[str] = [] + + expected_version = requirement.version.format(**format_dict) + another_version = requirement.another_version; + issues += check_package_version(package_source, package_name, expected_version, another_version) + + resolved_deps = [package_prefix + dep.format(**format_dict) for dep in requirement.dependencies] + issues += check_package_dependencies(package_source, package_name, runtime_id, known_packages, resolved_deps) + + contains = [path.format(**format_dict) for path in requirement.contains] + + symbols = requirement.symbols + + issues += check_package_contents(package_source, package_name, runtime_id, int(major), contains, symbols) + + if not issues: + print(f'✓ {package_name} ') + else: + print(f'✗ {package_name} FAIL') + for issue in issues: + print(f' error: {issue}') + + okay = okay and (len(issues) == 0) + + return okay + + +def check_package_version(package_source: PackageSource, package_name: str, expected_version: str, another_version: bool) -> List[str]: + package_version = package_source.rpm_query(package_name, ['--queryformat', '%{version}']) + if expected_version == package_version: + return [] + + if not another_version: + return [f'package {package_name} has incorrect version. Expected {expected_version}, got {package_version}'] + + package_version_major_minor = '.'.join(package_version.split('.')[:2]) + expected_version_major_minor = '.'.join(expected_version.split('.')[:2]) + + if expected_version_major_minor != package_version_major_minor: + return [] + + return [f'package {package_name} has incorrect version. Expected {expected_version} or a different major+minor version, got {package_version}'] + + +def check_package_dependencies(package_source: PackageSource, package_name: str, runtime_id: str, + known_packages: Dict[str, str], + expected_dependencies: List[str]) -> List[str]: + issues: List[str] = [] + + actual_dependencies = package_source.rpm_get_reqiures(package_name) + # print(str(actual_dependencies)) + + # print(f'Looking in {package_name}') + for dep in expected_dependencies: + if dep not in known_packages.keys(): + issues += [f'The dependency {dep} is unknown'] + continue + + expected_version = known_packages[dep] + # print(f'Expected version of {dep} is {expected_version}') + + if dep not in [name for name, _, _ in actual_dependencies]: + issues += [f'package {package_name} is missing the dependency {dep}'] + else: + actual_version = [version for name, _, version, in actual_dependencies if name == dep][0] + if actual_version != expected_version: + issues += [f'package {package_name} expected dependency of ({dep}, {expected_version})' + f' but has the actual dependency ({dep}, {actual_version})'] + + return issues + + +def check_package_contents(package_source: PackageSource, package_name: str, runtime_id: str, + major: int, + expected_contents: List[str], symbols: SymbolsPresence) -> List[str]: + package_files = package_source.rpm_query(package_name, ['-l']).strip().split('\n') + issues: List[str] = [] + for expected in expected_contents: + found = False + for actual in package_files: + if expected in actual: + found = True + break + if not found: + issues += [f'package {package_name} is missing the file {expected}'] + + for file in package_files: + if file.endswith('.pdb') and symbols == SymbolsPresence.NOT_ALLOWED_EXCEPT_LEGACY and major >= 8: + issues += [f'package {package_name} is includes a symbol file {file}.'] + if file.endswith('.pdb') and symbols == SymbolsPresence.NOT_ALLOWED: + issues += [f'package {package_name} is includes a symbol file {file}.'] + if symbols == SymbolsPresence.ONLY_SYMBOLS_ALLOWED and not file.endswith('.pdb'): + issues += [f'package {package_name} is includes non-symbol file {file}.'] + + return issues + + +def verbose(message: str) -> None: + # print(message) + pass + + +if __name__ == '__main__': + sys.exit(main()) diff -Nru dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/distribution-packages/test.json dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/distribution-packages/test.json --- dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/distribution-packages/test.json 1970-01-01 00:00:00.000000000 +0000 +++ dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/distribution-packages/test.json 2024-03-18 12:48:03.000000000 +0000 @@ -0,0 +1,16 @@ +{ + "name": "distribution-packages", + "enabled": true, + "version": "3.0", + "versionSpecific": false, + "type": "bash", + "cleanup": true, + "skipWhen": [ + "vmr-ci" // not packaged (tar.gz build) + ], + "ignoredRIDs":[ + "rhel7", + "linux-musl", + "ubuntu" // See: https://github.com/canonical/dotnet-regular-tests/issues/2 + ] +} diff -Nru dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/distribution-packages/test.sh dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/distribution-packages/test.sh --- dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/distribution-packages/test.sh 1970-01-01 00:00:00.000000000 +0000 +++ dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/distribution-packages/test.sh 2024-03-18 12:48:03.000000000 +0000 @@ -0,0 +1,17 @@ +#!/usr/bin/env bash + +set -euo pipefail +IFS=$'\n\t' +set -x + +sdk_version="$(dotnet --version)" +runtime_version="$(dotnet --list-runtimes | head -1 | awk '{ print $2 }')" +runtime_id=$(../runtime-id) +# This might be the final/only netstandard version from now on +netstandard_version=2.1 + +./test-standard-packages \ + "${runtime_id}" \ + "${runtime_version}" "${runtime_version}" \ + "${sdk_version}" \ + "${netstandard_version}" diff -Nru dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/dotnet-directory dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/dotnet-directory --- dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/dotnet-directory 1970-01-01 00:00:00.000000000 +0000 +++ dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/dotnet-directory 2024-03-18 12:48:03.000000000 +0000 @@ -0,0 +1,94 @@ +#!/bin/bash + +# This is a script called by multiple tests to find the runtime +# directory of the current platform. + +set -euo pipefail + +print_err() +{ + echo "err: $@" 1>&2; +} + +print_usage() { + echo "usage: $0 [--root (default) | --sdk | --framework | --help ]" 1>&2 + echo "" 1>&2 + echo "Shows a .NET directory." 1>&2 +} + +if [ "${1:-}" == "--help" ]; then + print_usage + exit 0 +fi + +dotnet_command_path=$(command -v dotnet || true) +if [ -z "$dotnet_command_path" ]; then + print_err "'dotnet' command not found." + exit 1 +fi +dotnet_dir=$(dirname "$(realpath "$dotnet_command_path")") + +print_root() { + if [ ! -d "$dotnet_dir" ]; then + print_err "dotnet root directory not found." + exit 1 + fi + echo "${dotnet_dir}" + exit 0 +} + +print_sdk() { + local sdk_version="$(dotnet --version)" + local sdk_dir="${dotnet_dir}/sdk/${sdk_version}" + if [ ! -d "$sdk_dir" ]; then + print_err "sdk directory for $sdk_version not found." + exit 1 + fi + echo "${sdk_dir}" + exit 0 +} + +print_framework() { + if [[ $# -lt 2 ]]; then + print_err "Missing argument." + exit 1 + fi + local dir_name="$1" + local version="$2" + declare -a versions + IFS='.-' read -ra versions <<< "${version}" + framework_dirs=( "${dotnet_dir}/shared/$dir_name/${versions[0]}.${versions[1]:-}"* ) + framework_dir="${framework_dirs[0]}" + if [ ! -d "$framework_dir" ]; then + print_err "framework directory for $version not found." + exit 1 + fi + echo "${framework_dir}" + exit 0 +} + +if [[ $# -eq 0 ]]; then + command="--root" +else + command="$1" + shift +fi +case "$command" in + --root) + print_root "$@" + ;; + --framework) + print_framework "Microsoft.NETCore.App" "$@" + ;; + --aspnet) + print_framework "Microsoft.AspNetCore.App" "$@" + ;; + --sdk) + print_sdk "$@" + ;; + *) + print_err "unknown argument: $1." + print_usage + exit 1 +esac + diff -Nru dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/dotnet-info-commit-ids/test.json dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/dotnet-info-commit-ids/test.json --- dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/dotnet-info-commit-ids/test.json 1970-01-01 00:00:00.000000000 +0000 +++ dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/dotnet-info-commit-ids/test.json 2024-03-18 12:48:03.000000000 +0000 @@ -0,0 +1,11 @@ +{ + "name": "dotnet-info-commit-ids", + "enabled": true, + "requiresSdk": true, + "version": "2.1", + "versionSpecific": false, + "type": "bash", + "cleanup": true, + "ignoredRIDs":[ + ] +} diff -Nru dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/dotnet-info-commit-ids/test.sh dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/dotnet-info-commit-ids/test.sh --- dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/dotnet-info-commit-ids/test.sh 1970-01-01 00:00:00.000000000 +0000 +++ dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/dotnet-info-commit-ids/test.sh 2024-03-18 12:48:03.000000000 +0000 @@ -0,0 +1,16 @@ +#!/usr/bin/env bash + +# unofficial bash strict mode +set -euo pipefail +IFS=$'\n\t' +set -x + +dotnet --info +commit_lines=($(dotnet --info | grep -i 'commit:' | sed 's/[cC]ommit://')) + +for line in "${commit_lines[@]}"; do + echo "$line" + if [[ $line == "N/A" ]] ; then + exit 1 + fi +done diff -Nru dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/dotnet-monitor-works/test.json dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/dotnet-monitor-works/test.json --- dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/dotnet-monitor-works/test.json 1970-01-01 00:00:00.000000000 +0000 +++ dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/dotnet-monitor-works/test.json 2024-03-18 12:48:03.000000000 +0000 @@ -0,0 +1,12 @@ +{ + "name": "dotnet-monitor-works", + "enabled": true, + "requireSdk": true, + "version": "6.0", + "versionSpecific": false, + "type": "bash", + "cleanup": false, + "skipWhen": [ + "version=6,arch=s390x", // https://github.com/redhat-developer/dotnet-regular-tests/issues/325 + ] +} diff -Nru dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/dotnet-monitor-works/test.sh dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/dotnet-monitor-works/test.sh --- dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/dotnet-monitor-works/test.sh 1970-01-01 00:00:00.000000000 +0000 +++ dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/dotnet-monitor-works/test.sh 2024-03-18 12:48:03.000000000 +0000 @@ -0,0 +1,45 @@ +#!/usr/bin/env bash + +set -euo pipefail +IFS=$'\n\t' +set -x + +IFS='.-' read -ra VERSION_SPLIT <<< "$1" +dotnet tool update -g dotnet-monitor --version "${VERSION_SPLIT[0]}.*-*" + +export PATH="$HOME/.dotnet/tools:$PATH" + +dotnet-monitor collect --no-auth & +../run-until-success-with-backoff wget --no-check-certificate -O https.html https://127.0.0.1:52323/info + +https=$(cat https.html) + +if [[ $https == *"version"* ]]; then + echo "collect - OK" +else + pkill dotnet-monitor + rm "https.html" + echo "collect - FAIL" + exit 1 +fi + +pkill dotnet-monitor +rm "https.html" + +config=$(dotnet-monitor config show) +if [[ $config == *"Metrics"* ]]; then + echo "config show - OK" +else + echo "config show - FAIL" + pkill dotnet-monitor + exit 1 +fi + +authkey=$(dotnet-monitor generatekey) +if [[ $authkey == *"Authorization: Bearer"* ]]; then + echo "generatekey - OK" +else + echo "generatekey - FAIL" + pkill dotnet-monitor + exit 1 +fi diff -Nru dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/dotnet-trace/test.json dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/dotnet-trace/test.json --- dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/dotnet-trace/test.json 1970-01-01 00:00:00.000000000 +0000 +++ dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/dotnet-trace/test.json 2024-03-18 12:48:03.000000000 +0000 @@ -0,0 +1,12 @@ +{ + "name": "dotnet-trace", + "enabled": true, + "requireSdk": true, + "version": "8.0", + "versionSpecific": false, + "type": "bash", + "cleanup": false, + "skipWhen": [ + "arch=s390x" // https://github.com/dotnet/runtime/issues/92891 + ] +} diff -Nru dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/dotnet-trace/test.sh dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/dotnet-trace/test.sh --- dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/dotnet-trace/test.sh 1970-01-01 00:00:00.000000000 +0000 +++ dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/dotnet-trace/test.sh 2024-03-18 12:48:03.000000000 +0000 @@ -0,0 +1,75 @@ +#!/usr/bin/env bash + +set -euo pipefail +IFS=$'\n\t' +set -x + +PROJNAME=dotnettrace +FILENAME=dotnettrace.nettrace +SPEEDSCOPENAME=dotnettrace.speedscope.json +REPORTNAME=dotnettrace.nettrace.etlx + +dotnet tool update -g dotnet-trace +export PATH="$HOME/.dotnet/tools:$PATH" + +dotnet-trace collect -o $FILENAME -- dotnet new console --output $PROJNAME +if [ -f $FILENAME ]; then + echo "collect - OK" +else + echo "collect - FAIL" + rm -r $PROJNAME + exit 1 +fi + +if dotnet-trace ps; then + echo "ps - OK" +else + echo "ps - FAIL" + rm -r $PROJNAME + rm $FILENAME + exit 1 +fi + +if dotnet-trace list-profiles; then + echo "list-profiles - OK" +else + echo "list-profiles - FAIL" + rm -r $PROJNAME + rm $FILENAME + exit 1 +fi + +dotnet-trace convert $FILENAME --format Speedscope +if [ -f $SPEEDSCOPENAME ]; then + echo "convert - OK" +else + echo "convert - FAIL" + rm -r $PROJNAME + rm $FILENAME + exit 1 +fi + +output=$(dotnet-trace report $FILENAME topN) +if [[ $output == *"Missing Symbol"* ]]; then + echo "report - FAIL" + rm -r $PROJNAME + rm $FILENAME + rm $SPEEDSCOPENAME + rm $REPORTNAME + exit 1 +elif [[ $output == *"Top 5 Functions (Exclusive)"* ]]; then + echo "report - OK" +else + echo "report - FAIL" + rm -r $PROJNAME + rm $FILENAME + rm $SPEEDSCOPENAME + rm $REPORTNAME + exit 1 +fi + + +rm -r $PROJNAME +rm $FILENAME +rm $SPEEDSCOPENAME +rm $REPORTNAME \ No newline at end of file diff -Nru dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/equality-and-sort/Part.cs dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/equality-and-sort/Part.cs --- dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/equality-and-sort/Part.cs 1970-01-01 00:00:00.000000000 +0000 +++ dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/equality-and-sort/Part.cs 2024-03-18 12:48:03.000000000 +0000 @@ -0,0 +1,50 @@ +using System.Collections.Generic; +using System; +namespace partTest +{ + public class Part : IEquatable , IComparable + { + public string PartName { get; set; } + + public int PartId { get; set; } + + public override string ToString() + { + return "ID: " + PartId + " Name: " + PartName; + } + public override bool Equals(object obj) + { + if (obj == null) return false; + Part objAsPart = obj as Part; + if (objAsPart == null) return false; + else return Equals(objAsPart); + } + public int SortByNameAscending(string name1, string name2) + { + + return name1.CompareTo(name2); + } + + // Default comparer for Part type. + public int CompareTo(Part comparePart) + { + // A null value means that this object is greater. + if (comparePart == null) + return 1; + + else + return this.PartId.CompareTo(comparePart.PartId); + } + public override int GetHashCode() + { + return PartId; + } + public bool Equals(Part other) + { + if (other == null) return false; + return (this.PartId.Equals(other.PartId)); + } + // Should also override == and != operators. + + } +} \ No newline at end of file diff -Nru dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/equality-and-sort/UnitTest1.cs dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/equality-and-sort/UnitTest1.cs --- dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/equality-and-sort/UnitTest1.cs 1970-01-01 00:00:00.000000000 +0000 +++ dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/equality-and-sort/UnitTest1.cs 2024-03-18 12:48:03.000000000 +0000 @@ -0,0 +1,40 @@ +using System; +using Xunit; +using System.Collections.Generic; + +namespace partTest +{ + public class UnitTest1 + { + [Fact] + public void Test1() + { + List parts = new List(); + + // Add parts to the list. + parts.Add(new Part() { PartName = "regular seat", PartId = 1434 }); + parts.Add(new Part() { PartName= "crank arm", PartId = 1234 }); + parts.Add(new Part() { PartName = "shift lever", PartId = 1634 }); ; + // Name intentionally left null. + parts.Add(new Part() { PartId = 1334 }); + parts.Add(new Part() { PartName = "banana seat", PartId = 1444 }); + parts.Add(new Part() { PartName = "cassette", PartId = 1534 }); + + parts.Sort(); + + for (int i = 0; i < parts.Count - 1; i++) + Assert.True(parts[i].CompareTo(parts[i + 1]) == -1, ""); + parts.Sort(delegate(Part x, Part y) + { + if (x.PartName == null && y.PartName == null) return 0; + else if (x.PartName == null) return -1; + else if (y.PartName == null) return 1; + else return x.PartName.CompareTo(y.PartName); + }); + for (int i = 0; i < parts.Count - 1; i++) + if (parts[i].PartName != null) + Assert.True(parts[i].PartName.CompareTo(parts[i + 1].PartName) == -1); + + } + } +} diff -Nru dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/equality-and-sort/equality-and-sort.csproj dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/equality-and-sort/equality-and-sort.csproj --- dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/equality-and-sort/equality-and-sort.csproj 1970-01-01 00:00:00.000000000 +0000 +++ dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/equality-and-sort/equality-and-sort.csproj 2024-03-18 12:48:03.000000000 +0000 @@ -0,0 +1,12 @@ + + + true + $(TestTargetFramework) + false + + + + + + + diff -Nru dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/equality-and-sort/test.json dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/equality-and-sort/test.json --- dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/equality-and-sort/test.json 1970-01-01 00:00:00.000000000 +0000 +++ dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/equality-and-sort/test.json 2024-03-18 12:48:03.000000000 +0000 @@ -0,0 +1,12 @@ +{ + "name": "equality-and-sort", + "enabled": true, + "requiresSdk": true, + "version": "1.0", + "versionSpecific": false, + "type": "xunit", + "cleanup": true, + "ignoredRIDs":[ + ] +} + diff -Nru dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/extract-bundle-dir/test.json dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/extract-bundle-dir/test.json --- dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/extract-bundle-dir/test.json 1970-01-01 00:00:00.000000000 +0000 +++ dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/extract-bundle-dir/test.json 2024-03-18 12:48:03.000000000 +0000 @@ -0,0 +1,11 @@ +{ + "name": "extract-bundle-dir", + "enabled": true, + "requiresSdk": true, + "version": "3.1", + "versionSpecific": true, + "type": "bash", + "cleanup": true, + "ignoredRIDs":[ + ] +} diff -Nru dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/extract-bundle-dir/test.sh dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/extract-bundle-dir/test.sh --- dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/extract-bundle-dir/test.sh 1970-01-01 00:00:00.000000000 +0000 +++ dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/extract-bundle-dir/test.sh 2024-03-18 12:48:03.000000000 +0000 @@ -0,0 +1,45 @@ +#!/usr/bin/env bash + +# The profile file sets DOTNET_BUNDLE_EXTRACT_BASE_DIR to avoid multi-user issues. +# see: https://bugzilla.redhat.com/show_bug.cgi?id=1752350. +if [ -f /etc/profile ]; then + source /etc/profile +fi + +set -euo pipefail +IFS=$'\n\t' + +# Verify DOTNET_BUNDLE_EXTRACT_BASE_DIR is set. +if [[ "${DOTNET_BUNDLE_EXTRACT_BASE_DIR:-}" != "$HOME/.cache/dotnet_bundle_extract" ]]; then + echo "error: DOTNET_BUNDLE_EXTRACT_BASE_DIR is '${DOTNET_BUNDLE_EXTRACT_BASE_DIR:-}', expected '${HOME:-}/.cache/dotnet_bundle_extract'" + echo "\$HOME: ${HOME:-}" + echo "\$PWD: ${PWD:-}" + echo "\$XDG_CACHE_HOME: ${XDG_CACHE_HOME:-}" + echo "\$DOTNET_BUNDLE_EXTRACT_BASE_DIR: ${DOTNET_BUNDLE_EXTRACT_BASE_DIR:-}" + exit 1 +else + echo "info: DOTNET_BUNDLE_EXTRACT_BASE_DIR is $DOTNET_BUNDLE_EXTRACT_BASE_DIR." +fi + +APP_NAME=extract-bundle-app +APP_EXTRACT_DIR=$DOTNET_BUNDLE_EXTRACT_BASE_DIR/$APP_NAME + +# Clean up the extract dir. +rm -rf $APP_EXTRACT_DIR + +# Create a single file executable. +dotnet new console -o $APP_NAME +sed -E -i '/Console.WriteLine/ a Console.WriteLine(AppContext.BaseDirectory);' $APP_NAME/Program.cs +dotnet publish -r $(../runtime-id --portable) /p:PublishSingleFile=true $APP_NAME -o published + +# Execute the single file, which will cause it to extract. +./published/$APP_NAME + +# Verify the single file exe was extracted. +if [ -d "$APP_EXTRACT_DIR" ]; then + echo "info: Application was extracted to expected location: $APP_EXTRACT_DIR" + rm -rf $APP_EXTRACT_DIR +else + echo "error: Application was not found at expected location: $APP_EXTRACT_DIR" + exit 1 +fi diff -Nru dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/fdd-no-nuget/Program.cs dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/fdd-no-nuget/Program.cs --- dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/fdd-no-nuget/Program.cs 1970-01-01 00:00:00.000000000 +0000 +++ dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/fdd-no-nuget/Program.cs 2024-03-18 12:48:03.000000000 +0000 @@ -0,0 +1,12 @@ +using System; + +namespace fdd_publish +{ + class Program + { + static void Main(string[] args) + { + Console.WriteLine("Hello World!"); + } + } +} diff -Nru dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/fdd-no-nuget/fdd-no-nuget.csproj dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/fdd-no-nuget/fdd-no-nuget.csproj --- dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/fdd-no-nuget/fdd-no-nuget.csproj 1970-01-01 00:00:00.000000000 +0000 +++ dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/fdd-no-nuget/fdd-no-nuget.csproj 2024-03-18 12:48:03.000000000 +0000 @@ -0,0 +1,6 @@ + + + Exe + $(TestTargetFramework) + + diff -Nru dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/fdd-no-nuget/test.json dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/fdd-no-nuget/test.json --- dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/fdd-no-nuget/test.json 1970-01-01 00:00:00.000000000 +0000 +++ dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/fdd-no-nuget/test.json 2024-03-18 12:48:03.000000000 +0000 @@ -0,0 +1,13 @@ +{ + "name": "fdd-no-nuget", + "enabled": true, + "requiresSdk": true, + "version": "3.1", + "versionSpecific": false, + "type": "bash", + "cleanup": true, + "ignoredRIDs":[ + + ] + } + \ No newline at end of file diff -Nru dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/fdd-no-nuget/test.sh dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/fdd-no-nuget/test.sh --- dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/fdd-no-nuget/test.sh 1970-01-01 00:00:00.000000000 +0000 +++ dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/fdd-no-nuget/test.sh 2024-03-18 12:48:03.000000000 +0000 @@ -0,0 +1,26 @@ +#!/usr/bin/env bash + +set -euo pipefail +IFS=$'\n\t' +set -x + +rm -rf ~/.nuget + + # Create the nuget.config with to block NuGet +cat <nuget.config + + + + + + +EOF + +dotnet publish + +if [ $? -eq 1 ]; then + echo "FAIL: unable to publish FFD without nuget.org access" + exit 1 +fi + +echo "PASS: successfully published FDD without nuget.org access" diff -Nru dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/file-permissions/test.json dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/file-permissions/test.json --- dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/file-permissions/test.json 1970-01-01 00:00:00.000000000 +0000 +++ dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/file-permissions/test.json 2024-03-18 12:48:03.000000000 +0000 @@ -0,0 +1,15 @@ +{ + "name": "file-permissions", + "enabled": true, + "requiresSdk": true, + "version": "3.0", + "versionSpecific": false, + "type": "bash", + "cleanup": true, + "skipWhen": [ + "vmr-ci" // not packaged (tar.gz build) + ], + "ignoredRIDs":[ + + ] +} diff -Nru dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/file-permissions/test.sh dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/file-permissions/test.sh --- dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/file-permissions/test.sh 1970-01-01 00:00:00.000000000 +0000 +++ dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/file-permissions/test.sh 2024-03-18 12:48:03.000000000 +0000 @@ -0,0 +1,36 @@ +#!/usr/bin/env bash + +set -euo pipefail +IFS=$'\n\t' + +errors=0 + +dotnet_home="$(dirname "$(readlink -f "$(command -v dotnet)")")" +test -d "${dotnet_home}" + +while IFS= read -r -d '' file; do + echo "$(stat -c "%A" "${file}") ${file}" + + # Everything should be readable by user, group, and other. There's no secret data in any of these files. + if [[ "$(stat -c "%A" "${file}" | tr -d -c 'r' | awk '{ print length; }')" -ne 3 ]]; then + echo "error: Missing read permissions on ${file}" + errors=1 + fi + + # If it's executable, it must be executable by all + if stat -c "%A" "${file}" | grep 'x' ; then + if [[ $(stat -c "%A" "${file}" | tr -d -c 'x' | awk '{print length; }') -ne 3 ]]; then + echo "error: Missing some execute permissions on ${file}" + errors=1 + fi + fi + +done < <(find "${dotnet_home}" -type f -print0) + +if [[ "$errors" == 1 ]]; then + echo "Errors detected" + exit 1 +else + echo "OK" + exit 0 +fi diff -Nru dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/hardened-binaries/test.json dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/hardened-binaries/test.json --- dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/hardened-binaries/test.json 1970-01-01 00:00:00.000000000 +0000 +++ dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/hardened-binaries/test.json 2024-03-18 12:48:03.000000000 +0000 @@ -0,0 +1,12 @@ +{ + "name": "hardened-binaries", + "enabled": true, + "requiresSdk": false, + "version": "3.0", + "versionSpecific": false, + "type": "bash", + "cleanup": true, + "ignoredRIDs":[ + "rhel7" + ] +} diff -Nru dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/hardened-binaries/test.sh dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/hardened-binaries/test.sh --- dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/hardened-binaries/test.sh 1970-01-01 00:00:00.000000000 +0000 +++ dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/hardened-binaries/test.sh 2024-03-18 12:48:03.000000000 +0000 @@ -0,0 +1,18 @@ +#!/usr/bin/env bash + +set -euo pipefail +IFS=$'\n\t' + +root=$(dirname "$(readlink -f "$(command -v dotnet)")") +echo ".NET Core base directory: $root" + +# TODO handle more architectures can just x86-64 + +file_list=$(find "$root/" -type f -exec file {} \; | grep -E 'ELF [[:digit:]][[:digit:]]-bit [LM]SB' | cut -d: -f 1 | sort -u) +mapfile -t binaries <<< "$file_list" +for binary in "${binaries[@]}"; do + echo "$binary" + # Check for full Relocation Read-Only (aka RELRO) + readelf -l "$binary" | grep GNU_RELRO + readelf -d "$binary" | grep BIND_NOW +done diff -Nru dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/helloworld/test.json dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/helloworld/test.json --- dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/helloworld/test.json 1970-01-01 00:00:00.000000000 +0000 +++ dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/helloworld/test.json 2024-03-18 12:48:03.000000000 +0000 @@ -0,0 +1,11 @@ +{ + "name": "helloworld", + "enabled": true, + "requiresSdk": true, + "version": "2.0", + "versionSpecific": false, + "type": "bash", + "cleanup": true, + "ignoredRIDs":[ + ] +} diff -Nru dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/helloworld/test.sh dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/helloworld/test.sh --- dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/helloworld/test.sh 1970-01-01 00:00:00.000000000 +0000 +++ dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/helloworld/test.sh 2024-03-18 12:48:03.000000000 +0000 @@ -0,0 +1,65 @@ +#!/usr/bin/env bash + +set -euo pipefail +IFS=$'\n\t' + +PROJNAME=helloworld + +# Test new C# project +dotnet new console --language C# --name $PROJNAME +pushd $PROJNAME +if dotnet run | grep 'Hello,\? World!'; then + true +else + echo "C# Hello World FAIL" + dotnet run + rm -rf $PROJNAME + exit 1 +fi +popd + +rm -rf $PROJNAME +echo -e "\n===================" +echo "C# Hello World PASS" +echo -e "===================\n" + +# Test new F# project + +dotnet new console --language F# --name $PROJNAME +pushd $PROJNAME +if dotnet run | grep -E 'Hello,? [Ww]orld!? from F#|Hello from F#'; then + true +else + echo "F# Hello World FAIL" + dotnet run + rm -rf $PROJNAME + exit 1 +fi +popd + +rm -rf $PROJNAME +echo -e "\n===================" +echo "F# Hello World PASS" +echo -e "===================\n" + +# Test new VB project + +dotnet new console --language VB --name $PROJNAME +pushd $PROJNAME +if dotnet run | grep 'Hello,\? World!'; then + true +else + echo "VB Hello World FAIL" + dotnet run + rm -rf $PROJNAME + exit 1 +fi +popd + +rm -rf $PROJNAME +echo -e "\n===================" +echo "VB Hello World PASS" +echo -e "===================\n" + +exit 0 + diff -Nru dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/host-probes-rid-assets/app/Program.cs dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/host-probes-rid-assets/app/Program.cs --- dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/host-probes-rid-assets/app/Program.cs 1970-01-01 00:00:00.000000000 +0000 +++ dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/host-probes-rid-assets/app/Program.cs 2024-03-18 12:48:03.000000000 +0000 @@ -0,0 +1,5 @@ +using System.Runtime.InteropServices; + +// Try load the native libraries packed under the rid folders. +NativeLibrary.Load("mylib-unix", typeof(Program).Assembly, DllImportSearchPath.ApplicationDirectory); +NativeLibrary.Load("mylib-sdkrid", typeof(Program).Assembly, DllImportSearchPath.ApplicationDirectory); diff -Nru dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/host-probes-rid-assets/app/host-probes-rid-assets.csproj dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/host-probes-rid-assets/app/host-probes-rid-assets.csproj --- dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/host-probes-rid-assets/app/host-probes-rid-assets.csproj 1970-01-01 00:00:00.000000000 +0000 +++ dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/host-probes-rid-assets/app/host-probes-rid-assets.csproj 2024-03-18 12:48:03.000000000 +0000 @@ -0,0 +1,14 @@ + + + + Exe + $(TestTargetFramework) + $(MSBuildThisFileDirectory)/../packages + + + + + + + + diff -Nru dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/host-probes-rid-assets/lib/lib.csproj dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/host-probes-rid-assets/lib/lib.csproj --- dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/host-probes-rid-assets/lib/lib.csproj 1970-01-01 00:00:00.000000000 +0000 +++ dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/host-probes-rid-assets/lib/lib.csproj 2024-03-18 12:48:03.000000000 +0000 @@ -0,0 +1,17 @@ + + + + netstandard2.1 + host-probes-rid-assets-$(LibName) + + $(NetCoreRoot)/shared/Microsoft.NETCore.App/$(BundledNETCoreAppPackageVersion)/libSystem.Native.so + + + + + + runtimes/$(Rid)/native/$(LibName).so + true + + + diff -Nru dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/host-probes-rid-assets/test.json dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/host-probes-rid-assets/test.json --- dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/host-probes-rid-assets/test.json 1970-01-01 00:00:00.000000000 +0000 +++ dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/host-probes-rid-assets/test.json 2024-03-18 12:48:03.000000000 +0000 @@ -0,0 +1,15 @@ +{ + "name": "host-probes-rid-assets", + "enabled": true, + "requiresSdk": true, + "version": "6.0", + "versionSpecific": false, + "type": "bash", + "cleanup": true, + "skipWhen": [ + "os=alpine,version=6", // see https://github.com/redhat-developer/dotnet-regular-tests/pull/303#issuecomment-1755727884 + "os=alpine,version=7", + ], + "ignoredRIDs":[ + ] +} diff -Nru dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/host-probes-rid-assets/test.sh dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/host-probes-rid-assets/test.sh --- dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/host-probes-rid-assets/test.sh 1970-01-01 00:00:00.000000000 +0000 +++ dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/host-probes-rid-assets/test.sh 2024-03-18 12:48:03.000000000 +0000 @@ -0,0 +1,16 @@ +#!/usr/bin/env bash + +set -euox pipefail +IFS=$'\n\t' + +# The lib project packages a native library in a rid-specific folder. +# Only one rid is considered per nuget package. +# We pack it once for the sdk rid, and once for a base rid ('unix'). +mkdir -p packages +dotnet pack lib -o packages /p:Rid=unix /p:LibName=mylib-unix +dotnet pack lib -o packages /p:Rid=$(../runtime-id --sdk) /p:LibName=mylib-sdkrid + +# This app reference the 'lib' NuGet packages, and loads the native libraries they contains. +dotnet run --project app + +echo "PASS" diff -Nru dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/host-probes-rid-assets-legacy/app/Program.cs dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/host-probes-rid-assets-legacy/app/Program.cs --- dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/host-probes-rid-assets-legacy/app/Program.cs 1970-01-01 00:00:00.000000000 +0000 +++ dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/host-probes-rid-assets-legacy/app/Program.cs 2024-03-18 12:48:03.000000000 +0000 @@ -0,0 +1,5 @@ +using System.Runtime.InteropServices; + +// Try load the native libraries packed under the rid folders. +NativeLibrary.Load("mylib-unix", typeof(Program).Assembly, DllImportSearchPath.ApplicationDirectory); +NativeLibrary.Load("mylib-sdkrid", typeof(Program).Assembly, DllImportSearchPath.ApplicationDirectory); diff -Nru dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/host-probes-rid-assets-legacy/app/host-probes-rid-assets.csproj dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/host-probes-rid-assets-legacy/app/host-probes-rid-assets.csproj --- dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/host-probes-rid-assets-legacy/app/host-probes-rid-assets.csproj 1970-01-01 00:00:00.000000000 +0000 +++ dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/host-probes-rid-assets-legacy/app/host-probes-rid-assets.csproj 2024-03-18 12:48:03.000000000 +0000 @@ -0,0 +1,18 @@ + + + + Exe + $(TestTargetFramework) + $(MSBuildThisFileDirectory)/../packages + + + + + + + + + + + + diff -Nru dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/host-probes-rid-assets-legacy/lib/lib.csproj dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/host-probes-rid-assets-legacy/lib/lib.csproj --- dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/host-probes-rid-assets-legacy/lib/lib.csproj 1970-01-01 00:00:00.000000000 +0000 +++ dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/host-probes-rid-assets-legacy/lib/lib.csproj 2024-03-18 12:48:03.000000000 +0000 @@ -0,0 +1,17 @@ + + + + netstandard2.1 + host-probes-rid-assets-$(LibName) + + $(NetCoreRoot)/shared/Microsoft.NETCore.App/$(BundledNETCoreAppPackageVersion)/libSystem.Native.so + + + + + + runtimes/$(Rid)/native/$(LibName).so + true + + + diff -Nru dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/host-probes-rid-assets-legacy/test.json dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/host-probes-rid-assets-legacy/test.json --- dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/host-probes-rid-assets-legacy/test.json 1970-01-01 00:00:00.000000000 +0000 +++ dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/host-probes-rid-assets-legacy/test.json 2024-03-18 12:48:03.000000000 +0000 @@ -0,0 +1,15 @@ +{ + "name": "host-probes-rid-assets-legacy", + "enabled": true, + "requiresSdk": true, + "version": "8.0", // test opts into using the legacy graph. + "versionSpecific": false, + "type": "bash", + "cleanup": true, + "skipWhen": [ + "os=alpine", // see https://github.com/redhat-developer/dotnet-regular-tests/issues/330#issuecomment-1911461723 + "vmr-ci" // test fails against stage 1 build (https://github.com/redhat-developer/dotnet-regular-tests/issues/289#issuecomment-1705268294) + ], + "ignoredRIDs":[ + ] +} diff -Nru dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/host-probes-rid-assets-legacy/test.sh dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/host-probes-rid-assets-legacy/test.sh --- dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/host-probes-rid-assets-legacy/test.sh 1970-01-01 00:00:00.000000000 +0000 +++ dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/host-probes-rid-assets-legacy/test.sh 2024-03-18 12:48:03.000000000 +0000 @@ -0,0 +1,19 @@ +#!/usr/bin/env bash + +set -euox pipefail +IFS=$'\n\t' + +# This test is testing the same functionality as host-probes-rid-assets +# but when opting in to use the legacy graph (by setting System.Runtime.Loader.UseRidGraph=true). + +# The lib project packages a native library in a rid-specific folder. +# Only one rid is considered per nuget package. +# We pack it once for the sdk rid, and once for a base rid ('unix'). +mkdir -p packages +dotnet pack lib -o packages /p:Rid=unix /p:LibName=mylib-unix +dotnet pack lib -o packages /p:Rid=$(../runtime-id --sdk) /p:LibName=mylib-sdkrid + +# This app reference the 'lib' NuGet packages, and loads the native libraries they contains. +dotnet run --project app + +echo "PASS" diff -Nru dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/install-location/test.json dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/install-location/test.json --- dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/install-location/test.json 1970-01-01 00:00:00.000000000 +0000 +++ dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/install-location/test.json 2024-03-18 12:48:03.000000000 +0000 @@ -0,0 +1,11 @@ +{ + "name": "install-location", + "enabled": true, + "requiresSdk": false, + "version": "3.0", + "versionSpecific": false, + "type": "bash", + "cleanup": true, + "ignoredRIDs":[ + ] +} diff -Nru dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/install-location/test.sh dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/install-location/test.sh --- dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/install-location/test.sh 1970-01-01 00:00:00.000000000 +0000 +++ dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/install-location/test.sh 2024-03-18 12:48:03.000000000 +0000 @@ -0,0 +1,22 @@ +#!/usr/bin/env bash + +set -euo pipefail +IFS=$'\n\t' + +if [[ ! -f /etc/dotnet/install_location ]]; then + echo "/etc/dotnet/install_location doesn't exist; nothing to test" + exit 0 +fi + +configured_install_location=$(cat /etc/dotnet/install_location) +echo "Install location in /etc/dotnet/install_location: ${configured_install_location}" + +actual_install_location=$(dirname "$(readlink -f "$(command -v dotnet)")") +echo "Actual install location: ${actual_install_location}" + +if [[ ${configured_install_location} == ${actual_install_location=} ]]; then + echo "OK" +else + echo "FAIL" + exit 1 +fi diff -Nru dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/japanese-eras/JapaneseEras.cs dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/japanese-eras/JapaneseEras.cs --- dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/japanese-eras/JapaneseEras.cs 1970-01-01 00:00:00.000000000 +0000 +++ dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/japanese-eras/JapaneseEras.cs 2024-03-18 12:48:03.000000000 +0000 @@ -0,0 +1,39 @@ +using System; +using System.Collections.Generic; +using System.Globalization; +using Xunit; + +namespace JapaneseEras +{ + public class JapaneseEras + { + [Theory] + [InlineData("2019-01-01", 4)] // Heisei + [InlineData("2019-04-30", 4)] // Heisei + [InlineData("2019-05-01", 5)] // Reiwa + [InlineData("2019-12-31", 5)] // Reiwa + public void VerifyEraIds(string date, int expectedEra) + { + var calendar = new JapaneseCalendar(); + var time = DateTime.Parse(date); + int era = calendar.GetEra(time); + Assert.Equal(expectedEra, era); + } + + [Theory] + [InlineData("2019-01-01", "平成")] // Heisei + [InlineData("2019-04-30", "平成")] // Heisei + [InlineData("2019-05-01", "令和")] // Reiwa + [InlineData("2019-12-31", "令和")] // Reiwa + public void VerifyEraNames(string date, string expectedEra) + { + CultureInfo japaneseCulture = new CultureInfo("ja-JP"); + var calendar = new JapaneseCalendar(); + japaneseCulture.DateTimeFormat.Calendar = calendar; + + var eraTime = DateTime.Parse(date); + + Assert.Equal(expectedEra, eraTime.ToString("gg", japaneseCulture)); + } + } +} diff -Nru dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/japanese-eras/japanese-eras.csproj dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/japanese-eras/japanese-eras.csproj --- dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/japanese-eras/japanese-eras.csproj 1970-01-01 00:00:00.000000000 +0000 +++ dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/japanese-eras/japanese-eras.csproj 2024-03-18 12:48:03.000000000 +0000 @@ -0,0 +1,11 @@ + + + true + $(TestTargetFramework) + + + + + + + diff -Nru dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/japanese-eras/test.json dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/japanese-eras/test.json --- dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/japanese-eras/test.json 1970-01-01 00:00:00.000000000 +0000 +++ dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/japanese-eras/test.json 2024-03-18 12:48:03.000000000 +0000 @@ -0,0 +1,12 @@ +{ + "name": "japanese-eras", + "enabled": false, + "requiresSdk": true, + "version": "2.1", + "versionSpecific": false, + "type": "xunit", + "cleanup": true, + "ignoredRIDs":[ + ] +} + diff -Nru dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/liblttng-ust_sys-sdt.h/test.json dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/liblttng-ust_sys-sdt.h/test.json --- dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/liblttng-ust_sys-sdt.h/test.json 1970-01-01 00:00:00.000000000 +0000 +++ dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/liblttng-ust_sys-sdt.h/test.json 2024-03-18 12:48:03.000000000 +0000 @@ -0,0 +1,16 @@ +{ + "name": "liblttng-ust_sys-sdt.h", + "enabled": true, + "requiresSdk": false, + "version": "2.1", + "versionSpecific": false, + "type": "bash", + "cleanup": true, + "skipWhen": [ + "runtime=mono", // mono does not use lttng + "os=ubuntu", // see https://github.com/canonical/dotnet-regular-tests/issues/3 + ], + "ignoredRIDs":[ + "alpine", // see https://github.com/redhat-developer/dotnet-regular-tests/pull/222 + ] +} diff -Nru dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/liblttng-ust_sys-sdt.h/test.sh dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/liblttng-ust_sys-sdt.h/test.sh --- dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/liblttng-ust_sys-sdt.h/test.sh 1970-01-01 00:00:00.000000000 +0000 +++ dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/liblttng-ust_sys-sdt.h/test.sh 2024-03-18 12:48:03.000000000 +0000 @@ -0,0 +1,45 @@ +#!/usr/bin/env bash + +set -euo pipefail +IFS=$'\n\t' +set -x + +RUNTIME_ID=$(../runtime-id) +packageNames=() +set +e # disable abort-on-error so we can have the pipeline below fail +case $RUNTIME_ID in + alpine*) ;; + *) mapfile -t packageNames < <(rpm -qa | grep 'dotnet.*lttng-ust') ;; +esac +set -e +# If a dotnet-specific lttng package doesn't exist, we must be using +# the normal system-wide lttng package. +if [[ "${#packageNames[@]}" == 0 ]]; then + case $RUNTIME_ID in + alpine*) + packageNames=("lttng-ust") + ;; + *) + mapfile -t packageNames < <(rpm -qa | grep 'lttng-ust') + ;; + esac +fi + +case $RUNTIME_ID in + alpine*) + filePath="/$(apk info -L "${packageNames[@]}" | grep -E 'liblttng-ust.so.[01]$')" + ;; + *) + filePath=$(rpm -ql "${packageNames[@]}" | grep -E 'liblttng-ust.so.[01]$') + ;; +esac + +readelf -n "$filePath" | grep -F 'NT_STAPSDT (SystemTap probe descriptors)' + +if [[ $? -eq 1 ]]; then + echo "NO NT_STAPSDT were found in lttng-ust: FAIL" + exit 1 +fi + +echo "Found NT_STAPSDT in lttng-ust: PASS" + diff -Nru dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/libuv-kestrel-sample-app-2x/Startup.cs dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/libuv-kestrel-sample-app-2x/Startup.cs --- dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/libuv-kestrel-sample-app-2x/Startup.cs 1970-01-01 00:00:00.000000000 +0000 +++ dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/libuv-kestrel-sample-app-2x/Startup.cs 2024-03-18 12:48:03.000000000 +0000 @@ -0,0 +1,66 @@ +// Copyright (c) .NET Foundation. All rights reserved. +// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. + +using System; +using System.IO; +using System.Net; +using Microsoft.AspNetCore.Builder; +using Microsoft.AspNetCore.Hosting; +using Microsoft.AspNetCore.Http; +using Microsoft.Extensions.Logging; + +namespace SampleApp +{ + public class Startup + { + public void Configure(IApplicationBuilder app, ILoggerFactory loggerFactory) + { + loggerFactory.AddConsole(LogLevel.Trace); + + app.Run(async context => + { + Console.WriteLine("{0} {1}{2}{3}", + context.Request.Method, + context.Request.PathBase, + context.Request.Path, + context.Request.QueryString); + Console.WriteLine($"Method: {context.Request.Method}"); + Console.WriteLine($"PathBase: {context.Request.PathBase}"); + Console.WriteLine($"Path: {context.Request.Path}"); + Console.WriteLine($"QueryString: {context.Request.QueryString}"); + + var connectionFeature = context.Connection; + Console.WriteLine($"Peer: {connectionFeature.RemoteIpAddress?.ToString()} {connectionFeature.RemotePort}"); + Console.WriteLine($"Sock: {connectionFeature.LocalIpAddress?.ToString()} {connectionFeature.LocalPort}"); + + context.Response.ContentLength = 11; + context.Response.ContentType = "text/plain"; + await context.Response.WriteAsync("Hello world"); + }); + } + + public static void Main(string[] args) + { + var host = new WebHostBuilder() + .UseKestrel(options => + { + options.Listen(IPAddress.Any, 5000, listenOptions => + { + listenOptions.NoDelay = true; + listenOptions.UseConnectionLogging(); + }); + options.Listen(IPAddress.Any, 5001, listenOptions => + { + listenOptions.NoDelay = true; + listenOptions.UseHttps("testCert.pfx", "testPassword"); + listenOptions.UseConnectionLogging(); + }); + }) + .UseContentRoot(Directory.GetCurrentDirectory()) + .UseStartup() + .Build(); + + host.Run(); + } + } +} diff -Nru dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/libuv-kestrel-sample-app-2x/libuv-kestrel-sample-app-2x.csproj dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/libuv-kestrel-sample-app-2x/libuv-kestrel-sample-app-2x.csproj --- dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/libuv-kestrel-sample-app-2x/libuv-kestrel-sample-app-2x.csproj 1970-01-01 00:00:00.000000000 +0000 +++ dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/libuv-kestrel-sample-app-2x/libuv-kestrel-sample-app-2x.csproj 2024-03-18 12:48:03.000000000 +0000 @@ -0,0 +1,15 @@ + + + + true + $(TestTargetFramework) + true + aspnet-hello_world-DE94012D-DD42-4C41-9932-5D416EA18C14 + + + + + + + + diff -Nru dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/libuv-kestrel-sample-app-2x/test.json dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/libuv-kestrel-sample-app-2x/test.json --- dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/libuv-kestrel-sample-app-2x/test.json 1970-01-01 00:00:00.000000000 +0000 +++ dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/libuv-kestrel-sample-app-2x/test.json 2024-03-18 12:48:03.000000000 +0000 @@ -0,0 +1,11 @@ +{ + "name": "libuv-kestrel-sample-app-2x", + "enabled": true, + "requiresSdk": true, + "version": "2.x", + "versionSpecific": true, + "type": "bash", + "cleanup": true, + "ignoredRIDs":[ + ] +} diff -Nru dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/libuv-kestrel-sample-app-2x/test.sh dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/libuv-kestrel-sample-app-2x/test.sh --- dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/libuv-kestrel-sample-app-2x/test.sh 1970-01-01 00:00:00.000000000 +0000 +++ dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/libuv-kestrel-sample-app-2x/test.sh 2024-03-18 12:48:03.000000000 +0000 @@ -0,0 +1,18 @@ +#!/usr/bin/env bash + +set -euo pipefail +IFS=$'\n\t' +set -x + +dotnet restore +dotnet build +dotnet bin/Debug/netcoreapp*/libuv-kestrel-sample-app-2x.dll & +root_pid=$! + +../run-until-success-with-backoff curl "http://localhost:5000" + +kill -s SIGTERM "${root_pid}" +sleep 1 +if ps -p "${root_pid}"; then + kill "${root_pid}" +fi Binary files /tmp/tmpa6h7_dnr/CPYwGZcj8b/dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/libuv-kestrel-sample-app-2x/testCert.pfx and /tmp/tmpa6h7_dnr/0Iwo6N2zXH/dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/libuv-kestrel-sample-app-2x/testCert.pfx differ diff -Nru dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/limits/LimitsTest.cs dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/limits/LimitsTest.cs --- dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/limits/LimitsTest.cs 1970-01-01 00:00:00.000000000 +0000 +++ dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/limits/LimitsTest.cs 2024-03-18 12:48:03.000000000 +0000 @@ -0,0 +1,41 @@ +using System.Diagnostics; +using System.Globalization; +using Xunit; + +namespace Limit; + +public class LimitsTest +{ + [Fact] + public void FileDescriptorLimitIsAtMax() + { + int softLimit = int.Parse(RunAndGetProcessOutput("../../../ulimit-wrapper.sh", new List { "-Sn" }), CultureInfo.InvariantCulture); + int hardLimit = int.Parse(RunAndGetProcessOutput("../../../ulimit-wrapper.sh", new List { "-Hn" }), CultureInfo.InvariantCulture); + + Assert.True(hardLimit == softLimit, $"File descriptor soft limit ({softLimit}) should be the same as the hard limit ({hardLimit})."); + } + + private static string RunAndGetProcessOutput(string name, List args) + { + ProcessStartInfo psi = new() + { + FileName = name, + RedirectStandardOutput = true, + }; + foreach (string arg in args) + { + psi.ArgumentList.Add(arg); + } + + Process? p = Process.Start(psi); + if (p is not null) + { + p.WaitForExit(); + return p.StandardOutput.ReadToEnd(); + } + else + { + throw new InvalidOperationException(); + } + } +} diff -Nru dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/limits/limits.csproj dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/limits/limits.csproj --- dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/limits/limits.csproj 1970-01-01 00:00:00.000000000 +0000 +++ dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/limits/limits.csproj 2024-03-18 12:48:03.000000000 +0000 @@ -0,0 +1,17 @@ + + + + $(TestTargetFramework) + enable + enable + false + true + + + + + + + + + diff -Nru dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/limits/test.json dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/limits/test.json --- dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/limits/test.json 1970-01-01 00:00:00.000000000 +0000 +++ dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/limits/test.json 2024-03-18 12:48:03.000000000 +0000 @@ -0,0 +1,10 @@ +{ + "name": "limits", + "enabled": true, + "requiresSdk": true, + "version": "8.0", + "versionSpecific": false, + "type": "xunit", + "cleanup": true, + "ignoredRIDs": [] +} diff -Nru dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/limits/ulimit-wrapper.sh dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/limits/ulimit-wrapper.sh --- dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/limits/ulimit-wrapper.sh 1970-01-01 00:00:00.000000000 +0000 +++ dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/limits/ulimit-wrapper.sh 2024-03-18 12:48:03.000000000 +0000 @@ -0,0 +1,2 @@ +#!/usr/bin/env bash +builtin ulimit "$@" diff -Nru dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/linq/UnitTest1.cs dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/linq/UnitTest1.cs --- dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/linq/UnitTest1.cs 1970-01-01 00:00:00.000000000 +0000 +++ dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/linq/UnitTest1.cs 2024-03-18 12:48:03.000000000 +0000 @@ -0,0 +1,149 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using Xunit; + +namespace linq +{ + public class UnitTest1 + { + public enum Suit + { + Clubs, + Diamonds, + Hearts, + Spades, + } + + public enum Rank + { + Two, + Three, + Four, + Five, + Six, + Seven, + Eight, + Nine, + Ten, + Jack, + Queen, + King, + Ace, + } + + public class PlayingCard + { + public Suit CardSuit { get; } + public Rank CardRank { get; } + + public PlayingCard(Suit s, Rank r) + { + CardSuit = s; + CardRank = r; + } + + public override string ToString() + { + return $"{CardRank} of {CardSuit}"; + } + } + + public class Program + { + [Fact] + public static void v() + { + var startingDeck = (from s in Suits() + from r in Ranks() + select new PlayingCard(s, r)) + .ToArray(); + // check length + Assert.Equal(52, startingDeck.Length); + // assert that all of kinds are different + for (int i = 0;i < startingDeck.Length;i++) + for (int j = i + 1;j < startingDeck.Length;j++) + Assert.NotEqual(startingDeck[i], startingDeck[j]); + + var top = startingDeck.Take(26); + var bottom = startingDeck.Skip(26); + + var shuffle2 = top.InterleaveSequenceWith(bottom); + + + var times = 0; + var shuffle = startingDeck; + do + { + var result = shuffle.Skip(26).InterleaveSequenceWith(shuffle.Take(26)).ToArray(); + // test if shuffled correctly + for (int i = 0; i < 0; i++) + { + if( i % 2 == 0 ) + Assert.Equal( shuffle[i/2 + result.Length/2], result[i] ); + else Assert.Equal( shuffle[i/2], result[i] ); + } + shuffle = result; + times++; + } while (!startingDeck.SequenceEquals(shuffle)); + + Assert.Equal(52, times); + } + + static IEnumerable Suits() + { + yield return Suit.Clubs; + yield return Suit.Diamonds; + yield return Suit.Hearts; + yield return Suit.Spades; + } + + static IEnumerable Ranks() + { + yield return Rank.Two; + yield return Rank.Three; + yield return Rank.Four; + yield return Rank.Five; + yield return Rank.Six; + yield return Rank.Seven; + yield return Rank.Eight; + yield return Rank.Nine; + yield return Rank.Ten; + yield return Rank.Jack; + yield return Rank.Queen; + yield return Rank.King; + yield return Rank.Ace; + } + } + } + + +} +public static class Extensions +{ + public static IEnumerable InterleaveSequenceWith (this IEnumerable first, IEnumerable second) + { + + var firstIter = first.GetEnumerator(); + var secondIter = second.GetEnumerator(); + while (firstIter.MoveNext() && secondIter.MoveNext()) + { + yield return firstIter.Current; + yield return secondIter.Current; + } + + } + + public static bool SequenceEquals(this IEnumerable first, IEnumerable second) + { + var firstIter = first.GetEnumerator(); + var secondIter = second.GetEnumerator(); + while (firstIter.MoveNext() && secondIter.MoveNext()) + { + if (!firstIter.Current.Equals(secondIter.Current)) + return false; + } + return true; + } + +} \ No newline at end of file diff -Nru dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/linq/linq.csproj dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/linq/linq.csproj --- dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/linq/linq.csproj 1970-01-01 00:00:00.000000000 +0000 +++ dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/linq/linq.csproj 2024-03-18 12:48:03.000000000 +0000 @@ -0,0 +1,16 @@ + + + + true + $(TestTargetFramework) + + false + + + + + + + + + diff -Nru dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/linq/test.json dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/linq/test.json --- dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/linq/test.json 1970-01-01 00:00:00.000000000 +0000 +++ dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/linq/test.json 2024-03-18 12:48:03.000000000 +0000 @@ -0,0 +1,12 @@ +{ + "name": "linq", + "enabled": true, + "requiresSdk": true, + "version": "1.0", + "versionSpecific": false, + "type": "xunit", + "cleanup": true, + "ignoredRIDs":[ + ] +} + diff -Nru dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/lttng/test.json dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/lttng/test.json --- dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/lttng/test.json 1970-01-01 00:00:00.000000000 +0000 +++ dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/lttng/test.json 2024-03-18 12:48:03.000000000 +0000 @@ -0,0 +1,18 @@ +{ + "name": "lttng", + "enabled": true, + "requiresSdk": true, + "version": "2.1", + "versionSpecific": false, + "type": "bash", + "cleanup": true, + "skipWhen": [ + "runtime=mono", // mono does not use lttng + "ubuntu-autopkgtest-cloud", // see https://github.com/canonical/dotnet-regular-tests/issues/8 + ], + "ignoredRIDs":[ + "centos", + "fedora", // see https://github.com/redhat-developer/dotnet-regular-tests/issues/202 + "rhel" + ] +} diff -Nru dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/lttng/test.sh dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/lttng/test.sh --- dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/lttng/test.sh 1970-01-01 00:00:00.000000000 +0000 +++ dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/lttng/test.sh 2024-03-18 12:48:03.000000000 +0000 @@ -0,0 +1,69 @@ +#!/usr/bin/env bash + +set -euo pipefail +IFS=$'\n\t' + +SESSION_NAME=my-session +TEST_FOLDER=/tmp/$SESSION_NAME + +TRACE_FOLDER=$TEST_FOLDER/trace +TRACE_EVENT=DotNETRuntime:RuntimeInformationStart + +function remove_test_folder { + rm -rf $TEST_FOLDER +} + +function end_session { + lttng stop $SESSION_NAME 2>/dev/null || true + lttng destroy $SESSION_NAME 2>/dev/null || true + killall lttng-sessiond 2>/dev/null || true +} + +function start_session { + # Start lttng user daemon + lttng-sessiond --daemonize + + # Create and start session + lttng create $SESSION_NAME --output $TRACE_FOLDER + lttng add-context --userspace --session=$SESSION_NAME --type=vpid + lttng enable-event -s $SESSION_NAME -u --tracepoint $TRACE_EVENT + lttng start $SESSION_NAME +} + +# Clean up from previous test run +end_session +remove_test_folder + +# Start lttng session +echo "== Starting lttng session" +start_session + +# Create new console application to generate an event +echo "== Creating new console application" +export COMPlus_PerfMapEnabled=1 +export COMPlus_EnableEventLog=1 +dotnet new console -o $TEST_FOLDER/console & +DOTNET_PID=$! +wait $DOTNET_PID + +# End lttng session +echo "== Ending lttng session" +end_session + +CMD="$(command -v babeltrace || true)" +[ -z "${CMD}" ] && CMD="$(command -v babeltrace2)" + +# Retrieve trace +LTTNG_TRACE=$($CMD "$TRACE_FOLDER/ust/uid/$(id -u)/64-bit" | grep "vpid = $DOTNET_PID") + +# Clean up +remove_test_folder + +echo "== Checking lttng trace" +if echo "$LTTNG_TRACE" | grep -q "$TRACE_EVENT"; then + echo "OK: Event $TRACE_EVENT found in lttng trace." + exit 0 +else + echo "FAIL: Event $TRACE_EVENT not found in lttng trace:"$'\n'"$LTTNG_TRACE" + exit 1 +fi diff -Nru dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/man-pages/test.json dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/man-pages/test.json --- dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/man-pages/test.json 1970-01-01 00:00:00.000000000 +0000 +++ dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/man-pages/test.json 2024-03-18 12:48:03.000000000 +0000 @@ -0,0 +1,14 @@ +{ + "name": "man-pages", + "enabled": true, + "requiresSdk": true, + "version": "2.1", + "versionSpecific": false, + "type": "bash", + "cleanup": true, + "skipWhen": [ + "vmr-ci" // man page not installed + ], + "ignoredRIDs":[ + ] +} diff -Nru dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/man-pages/test.sh dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/man-pages/test.sh --- dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/man-pages/test.sh 1970-01-01 00:00:00.000000000 +0000 +++ dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/man-pages/test.sh 2024-03-18 12:48:03.000000000 +0000 @@ -0,0 +1,31 @@ +#!/usr/bin/env bash + +set -euo pipefail +IFS=$'\n\t' + +helpPages=$(dotnet --help | grep -A 999 'SDK commands' | grep -E -B 999 'Common options|Additional commands' | awk 'NR>1 {print $1}' | head -n-2) + +RUNTIME_ID=$(../runtime-id) +case $RUNTIME_ID in + alpine*)manPages=$(apk info -L dotnet-doc);; + ubuntu*)manPages=$(dpkg-query --listfiles $(dpkg --list | grep --only-matching --max-count 1 --basic-regexp 'dotnet-host\(-\S\+\)\?') | grep 'man1/dotnet-');; + *)manPages=$(rpm -qd $(rpm -qa | grep 'dotnet') | grep 'man1/dotnet-');; +esac + +failed=0 +for page in $helpPages; do + if echo "$manPages" | grep "dotnet-$page"; then + true + else + echo "error: Man page for dotnet-$page not found: FAIL" + failed=1 + fi +done + +if [[ $failed == 0 ]]; then + echo "All the man pages were found: PASS" +else + echo "FAIL: some man pages are missing" +fi + +exit $failed diff -Nru dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/managed-symbols-available/test.json dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/managed-symbols-available/test.json --- dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/managed-symbols-available/test.json 1970-01-01 00:00:00.000000000 +0000 +++ dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/managed-symbols-available/test.json 2024-03-18 12:48:03.000000000 +0000 @@ -0,0 +1,17 @@ +{ + "name": "managed-symbols-available", + "enabled": true, + "requiresSdk": true, + "version": "3.0", + "versionSpecific": false, + "type": "bash", + "cleanup": true, + "skipWhen": [ + "vmr-ci,version=6", // unpacking symbols is a hassle + "vmr-ci,version=7", + "ubuntu-autopkgtest-cloud,version=8", // see https://github.com/canonical/dotnet-regular-tests/issues/11 + ], + "ignoredRIDs":[ + ] +} + diff -Nru dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/managed-symbols-available/test.sh dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/managed-symbols-available/test.sh --- dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/managed-symbols-available/test.sh 1970-01-01 00:00:00.000000000 +0000 +++ dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/managed-symbols-available/test.sh 2024-03-18 12:48:03.000000000 +0000 @@ -0,0 +1,70 @@ +#!/usr/bin/env bash + +# Check that managed symbol files are available + +set -euo pipefail +IFS=$'\n\t' + +framework_dir=$(../dotnet-directory --framework "$1") +aspnet_dir=$(../dotnet-directory --aspnet "$1") + +IFS='.-' read -ra VERSION <<< "$1" + +exit_code=0 + +if [[ ${VERSION[0]} == 6 ]] || [[ ${VERSION[0]} == 7 ]]; then + echo "We are not supposed to be shipping symbol files for .NET 6 and .NET 7" + + find "${framework_dir}" -name '*.pdb' || true + + if [[ "$(find "${framework_dir}" -name '*.pdb' -printf '.' | wc -c)" -gt 0 ]] ; then + echo "error: Found some pdb file." + exit 1 + fi + + find "${aspnet_dir}" -name '*.pdb' || true + + if [[ "$(find "${aspnet_dir}" -name '*.pdb' -printf '.' | wc -c)" -gt 0 ]] ; then + echo "error: Found some pdb file." + exit 1 + fi + +else + echo "Checking symbol files..." + + ignore_cases=( + System.Runtime.CompilerServices.Unsafe.dll + ) + framework_dlls=( $(find "${framework_dir}" -name '*.dll' -type f)) + framework_dlls+=( $(find "${aspnet_dir}" -name '*.dll' -type f)) + for dll_name in "${framework_dlls[@]}" + do + base_dll_name=$(basename "${dll_name}") + is_special=0 + for ignore_case in "${ignore_cases[@]}"; do + if [[ "${base_dll_name}" == "${ignore_case}" ]]; then + echo "IGNORE: ${dll_name} is special; ignoring" + is_special=1 + continue + fi + done + + if [[ ${is_special} == 0 ]]; then + pdb_name="${dll_name%%.dll}.pdb" + if [ -f "${pdb_name}" ]; then + echo "OK: ${base_dll_name} -> ${pdb_name}" + else + exit_code=1 + echo "error: missing ${pdb_name} (${base_dll_name})" + fi + fi + done +fi + +if [ $exit_code -eq 0 ]; then + echo "PASS: all pdbs found." +else + echo "FAIL: missing pdbs. See errors above." +fi + +exit $exit_code diff -Nru dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/nativeaot/Program.cs dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/nativeaot/Program.cs --- dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/nativeaot/Program.cs 1970-01-01 00:00:00.000000000 +0000 +++ dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/nativeaot/Program.cs 2024-03-18 12:48:03.000000000 +0000 @@ -0,0 +1,2 @@ +// See https://aka.ms/new-console-template for more information +Console.WriteLine("Hello, World!"); diff -Nru dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/nativeaot/console.csproj dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/nativeaot/console.csproj --- dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/nativeaot/console.csproj 1970-01-01 00:00:00.000000000 +0000 +++ dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/nativeaot/console.csproj 2024-03-18 12:48:03.000000000 +0000 @@ -0,0 +1,11 @@ + + + + Exe + $(TestTargetFramework) + enable + enable + console + + + diff -Nru dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/nativeaot/test.json dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/nativeaot/test.json --- dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/nativeaot/test.json 1970-01-01 00:00:00.000000000 +0000 +++ dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/nativeaot/test.json 2024-03-18 12:48:03.000000000 +0000 @@ -0,0 +1,16 @@ +{ + "name": "nativeaot", + "enabled": true, + "requiresSdk": true, + "version": "7.0", + "versionSpecific": false, + "type": "bash", + "cleanup": true, + "skipWhen": [ + "runtime=mono", // nativeaot is not available with mono + "vmr-ci" // nativeaot packages not published + ], + "ignoredRIDs": [ + "linux-arm" // nativeaot not supported on arm + ] +} diff -Nru dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/nativeaot/test.sh dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/nativeaot/test.sh --- dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/nativeaot/test.sh 1970-01-01 00:00:00.000000000 +0000 +++ dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/nativeaot/test.sh 2024-03-18 12:48:03.000000000 +0000 @@ -0,0 +1,29 @@ +#!/usr/bin/env bash + +set -euo pipefail +IFS=$'\n\t' +set -x + +rm -rf bin obj + +# Publish the app. +if ! dotnet publish --use-current-runtime /p:PublishAot=true; then + echo "FAIL: failed to publish application using NativeAot." + exit 1 +fi + +# Verify the published output contains a single file. +PUBLISHED_FILE_COUNT=$(ls ./bin/*/net*/*/publish | grep -v console.dbg | wc -l) +if [ "$PUBLISHED_FILE_COUNT" != "1" ]; then + echo "FAIL: published NativeAot app contains more than 1 file." + exit 1 +fi + +# Verify the application runs. +APP_OUTPUT="$(./bin/*/net*/*/publish/console 2>&1)" +if [ "$APP_OUTPUT" != "Hello, World!" ]; then + echo "FAIL: NativeAot console application did not have expected output." + exit 1 +fi + +echo "PASS: NativeAot app builds and runs." diff -Nru dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/no-source-files-in-nuget/test.json dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/no-source-files-in-nuget/test.json --- dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/no-source-files-in-nuget/test.json 1970-01-01 00:00:00.000000000 +0000 +++ dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/no-source-files-in-nuget/test.json 2024-03-18 12:48:03.000000000 +0000 @@ -0,0 +1,11 @@ +{ + "name": "no-source-files-in-nuget", + "enabled": true, + "requiresSdk": true, + "version": "1.0", + "versionSpecific": false, + "type": "bash", + "cleanup": true, + "ignoredRIDs":[ + ] +} diff -Nru dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/no-source-files-in-nuget/test.sh dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/no-source-files-in-nuget/test.sh --- dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/no-source-files-in-nuget/test.sh 1970-01-01 00:00:00.000000000 +0000 +++ dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/no-source-files-in-nuget/test.sh 2024-03-18 12:48:03.000000000 +0000 @@ -0,0 +1,27 @@ +#!/usr/bin/env bash + +set -euo pipefail +set -x + +rm -rf project.json + +IFS='.-' read -ra VERSION <<< "$1" +NEW_CMD="new console --force" +if [[ "${VERSION[0]}" = "1" ]]; then + NEW_CMD="new -t console" +fi + +rm -rf ~/.nuget + +dotnet $NEW_CMD +dotnet restore +dotnet build + +source_files=$(find ~/.nuget -iname '*.cs' | wc -l) +if [[ "$source_files" -ne 0 ]]; then + echo "Found source files in ~/.nuget - FAIL" + exit 1 +fi + +echo "No source files found in ~/.nuget - PASS" + diff -Nru dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/openssl-alpn/test.json dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/openssl-alpn/test.json --- dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/openssl-alpn/test.json 1970-01-01 00:00:00.000000000 +0000 +++ dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/openssl-alpn/test.json 2024-03-18 12:48:03.000000000 +0000 @@ -0,0 +1,11 @@ +{ + "name": "openssl-alpn", + "enabled": true, + "requiresSdk": false, + "version": "2.1", + "versionSpecific": false, + "type": "bash", + "cleanup": true, + "ignoredRIDs":[ + ] +} diff -Nru dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/openssl-alpn/test.sh dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/openssl-alpn/test.sh --- dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/openssl-alpn/test.sh 1970-01-01 00:00:00.000000000 +0000 +++ dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/openssl-alpn/test.sh 2024-03-18 12:48:03.000000000 +0000 @@ -0,0 +1,27 @@ +#!/usr/bin/env bash + +# Make sure .NET Core has linked to SSL_*_alpn_* functions from OpenSSL + +set -euo pipefail +IFS=$'\n\t' +set -x + +dotnet_dir="$(../dotnet-directory)" + +find_ssl_args=("-regex" '.*System\.Security\.Cryptography\.Native\.OpenSsl\.so$') + +# print for debugging +find "${dotnet_dir}" \ + "${find_ssl_args[@]}" + +find "${dotnet_dir}" \ + "${find_ssl_args[@]}" \ + -exec nm -D {} \; \ + | grep SSL + +# This is the real check. Make sure SSL_*_alpn_* are available as dynamic symbols +find "${dotnet_dir}" \ + "${find_ssl_args[@]}" \ + -exec nm -D {} \; \ + | grep SSL \ + | grep _alpn_ diff -Nru dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/pgo-dynamic/Program.cs dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/pgo-dynamic/Program.cs --- dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/pgo-dynamic/Program.cs 1970-01-01 00:00:00.000000000 +0000 +++ dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/pgo-dynamic/Program.cs 2024-03-18 12:48:03.000000000 +0000 @@ -0,0 +1,20 @@ + +// Run some loops to get the JIT compiler to optimize this code + +int iterations = (int.MaxValue / 100); +if (args.Length >= 1) +{ + iterations = int.Parse(args[0]); +} + +Console.WriteLine($"Running {iterations} iterations."); + +for (int i = 0; i < iterations; i++) +{ + if (i % 10000 == 0) + { + Console.Error.Write("."); + } +} + +Console.Error.WriteLine(); diff -Nru dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/pgo-dynamic/pgo-dynamic.csproj dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/pgo-dynamic/pgo-dynamic.csproj --- dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/pgo-dynamic/pgo-dynamic.csproj 1970-01-01 00:00:00.000000000 +0000 +++ dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/pgo-dynamic/pgo-dynamic.csproj 2024-03-18 12:48:03.000000000 +0000 @@ -0,0 +1,12 @@ + + + + Exe + $(TestTargetFramework) + enable + enable + + true + + + diff -Nru dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/pgo-dynamic/test.json dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/pgo-dynamic/test.json --- dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/pgo-dynamic/test.json 1970-01-01 00:00:00.000000000 +0000 +++ dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/pgo-dynamic/test.json 2024-03-18 12:48:03.000000000 +0000 @@ -0,0 +1,15 @@ +{ + "name": "pgo-dynamic", + "enabled": true, + "requiresSdk": true, + "version": "7.0", + "versionSpecific": false, + "type": "bash", + "cleanup": true, + "ignoredRIDs": [ + "linux-arm" // pgo optimization not supported on arm + ], + "skipWhen": [ + "runtime=mono" + ] +} diff -Nru dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/pgo-dynamic/test.sh dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/pgo-dynamic/test.sh --- dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/pgo-dynamic/test.sh 1970-01-01 00:00:00.000000000 +0000 +++ dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/pgo-dynamic/test.sh 2024-03-18 12:48:03.000000000 +0000 @@ -0,0 +1,28 @@ +#!/bin/bash + +# Check if the .NET Runtime can use dynamic PGO at runtime + +set -euo pipefail +IFS=$'\n\t' +set -x + +IFS='.-' read -ra VERSION <<< "$1" + +dotnet publish -c Release + +name=$(basename "$(pwd)") +frameworks=( ./bin/Release/* ) +executable="${frameworks[0]}/publish/$name" + +# Set env vars to print debugging information for the JIT +DOTNET_JitDisasmSummary=1 DOTNET_JitDisasm="
$" \ + "$executable" >stdout.log 2>stderr.log + +cat stderr.log +cat stdout.log + +# Check the debug info for JIT to make sure dyanmic PGO is enabled +grep -E 'Tier1-OSR @0x[a-zA-Z0-9]+ with Dynamic PGO' stdout.log +if [[ ${VERSION[0]} -ge 8 ]]; then + grep -E '^; optimized using Dynamic PGO' stdout.log +fi diff -Nru dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/publish-aspnet-selfcontained/test.json dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/publish-aspnet-selfcontained/test.json --- dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/publish-aspnet-selfcontained/test.json 1970-01-01 00:00:00.000000000 +0000 +++ dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/publish-aspnet-selfcontained/test.json 2024-03-18 12:48:03.000000000 +0000 @@ -0,0 +1,10 @@ +{ + "name": "publish-aspnet-selfcontained", + "enabled": true, + "requiresSdk": true, + "version": "8.0", + "versionSpecific": false, + "type": "bash", + "cleanup": true +} + diff -Nru dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/publish-aspnet-selfcontained/test.sh dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/publish-aspnet-selfcontained/test.sh --- dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/publish-aspnet-selfcontained/test.sh 1970-01-01 00:00:00.000000000 +0000 +++ dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/publish-aspnet-selfcontained/test.sh 2024-03-18 12:48:03.000000000 +0000 @@ -0,0 +1,37 @@ +#!/usr/bin/env bash + +set -euo pipefail +IFS=$'\n\t' +set -x + +# Clear nuget sources to use the bundled runtime. +cat > nuget.config < + + + + + +EOF + +runtime_id="$(../runtime-id)" + +url="http://localhost:5000" + +dir=web +output_dir=output +rm -rf "$dir" "$output_dir" +dotnet new web -o "$dir" +dotnet publish --sc -r "$runtime_id" -o "$output_dir" "$dir" + +ASPNETCORE_URLS="$url" "./$output_dir/web" & +run_pid=$! +trap "kill $run_pid && wait $run_pid" EXIT + + +if ! ../run-until-success-with-backoff curl "$url" ; then + echo 'FAIL: ASP.NET app failed to respond' + exit 2 +fi + +echo "PASS" diff -Nru dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/publish-dotnet-selfcontained/test.json dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/publish-dotnet-selfcontained/test.json --- dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/publish-dotnet-selfcontained/test.json 1970-01-01 00:00:00.000000000 +0000 +++ dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/publish-dotnet-selfcontained/test.json 2024-03-18 12:48:03.000000000 +0000 @@ -0,0 +1,10 @@ +{ + "name": "publish-dotnet-selfcontained", + "enabled": true, + "requiresSdk": true, + "version": "8.0", + "versionSpecific": false, + "type": "bash", + "cleanup": true +} + diff -Nru dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/publish-dotnet-selfcontained/test.sh dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/publish-dotnet-selfcontained/test.sh --- dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/publish-dotnet-selfcontained/test.sh 1970-01-01 00:00:00.000000000 +0000 +++ dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/publish-dotnet-selfcontained/test.sh 2024-03-18 12:48:03.000000000 +0000 @@ -0,0 +1,26 @@ +#!/usr/bin/env bash + +set -euo pipefail +IFS=$'\n\t' +set -x + +# Clear nuget sources to use the bundled runtime. +cat > nuget.config < + + + + + +EOF + +runtime_id="$(../runtime-id)" + +dir=console +output_dir=output +rm -rf "$dir" "$output_dir" +dotnet new console -o "$dir" +dotnet publish --sc -r "$runtime_id" -o "$output_dir" "$dir" +"./$output_dir/console" + +echo "PASS" \ No newline at end of file diff -Nru dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/publish-ready-to-run/test.json dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/publish-ready-to-run/test.json --- dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/publish-ready-to-run/test.json 1970-01-01 00:00:00.000000000 +0000 +++ dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/publish-ready-to-run/test.json 2024-03-18 12:48:03.000000000 +0000 @@ -0,0 +1,16 @@ +{ + "name": "publish-ready-to-run", + "enabled": true, + "requiresSdk": true, + "version": "3.0", + "versionSpecific": false, + "type": "bash", + "cleanup": true, + "skipWhen": [ + "vmr-ci" // portable runtime/crossgen packs not published + ], + "ignoredRIDs":[ + "linux-s390x", + "linux-ppc64le" + ] +} diff -Nru dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/publish-ready-to-run/test.sh dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/publish-ready-to-run/test.sh --- dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/publish-ready-to-run/test.sh 1970-01-01 00:00:00.000000000 +0000 +++ dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/publish-ready-to-run/test.sh 2024-03-18 12:48:03.000000000 +0000 @@ -0,0 +1,8 @@ +#!/usr/bin/env bash + +set -euo pipefail +IFS=$'\n\t' +set -x + +dotnet new console --no-restore +dotnet publish -r "$(../runtime-id)" /p:PublishReadyToRun=true diff -Nru dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/publish-ready-to-run-linux/test.json dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/publish-ready-to-run-linux/test.json --- dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/publish-ready-to-run-linux/test.json 1970-01-01 00:00:00.000000000 +0000 +++ dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/publish-ready-to-run-linux/test.json 2024-03-18 12:48:03.000000000 +0000 @@ -0,0 +1,16 @@ +{ + "name": "publish-ready-to-run-linux", + "enabled": true, + "requiresSdk": true, + "version": "3.0", + "versionSpecific": false, + "type": "bash", + "cleanup": true, + "skipWhen": [ + "vmr-ci" // portable runtime/crossgen packs not published + ], + "ignoredRIDs":[ + "linux-s390x", + "linux-ppc64le" + ] +} diff -Nru dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/publish-ready-to-run-linux/test.sh dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/publish-ready-to-run-linux/test.sh --- dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/publish-ready-to-run-linux/test.sh 1970-01-01 00:00:00.000000000 +0000 +++ dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/publish-ready-to-run-linux/test.sh 2024-03-18 12:48:03.000000000 +0000 @@ -0,0 +1,8 @@ +#!/usr/bin/env bash + +set -euo pipefail +IFS=$'\n\t' +set -x + +dotnet new console --no-restore +dotnet publish -r $(../runtime-id --portable) /p:PublishReadyToRun=true diff -Nru dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/release-version-sane/UpstreamRelease.cs dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/release-version-sane/UpstreamRelease.cs --- dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/release-version-sane/UpstreamRelease.cs 1970-01-01 00:00:00.000000000 +0000 +++ dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/release-version-sane/UpstreamRelease.cs 2024-03-18 12:48:03.000000000 +0000 @@ -0,0 +1,76 @@ +using System; +using System.Collections.Generic; +using System.Diagnostics; +using System.Linq; +using System.Net.Http; +using System.Threading.Tasks; +using Newtonsoft.Json; + +namespace ReleaseVersionSane +{ + public class UpstreamRelease + { + private readonly Uri RELEASE_INDEX = new Uri("https://raw.githubusercontent.com/dotnet/core/master/release-notes/releases-index.json"); + + public async Task<(List sdks, string runtime)> GetLatestRelease(HttpClient client, string majorMinor) + { + var releaseIndexRawJson = await client.GetStringAsync(RELEASE_INDEX); + var releaseInfoChannelJsonUrl = GetReleaseInfoChannelUrl(releaseIndexRawJson, majorMinor); + if (releaseInfoChannelJsonUrl == null) + { + return (null, null); + } + + var releaseInfoChannelRawJson = await client.GetStringAsync(releaseInfoChannelJsonUrl); + return GetLatestVersion(releaseInfoChannelRawJson); + } + + private (List sdks, string runtime) GetLatestVersion(string releaseRawJson) + { + dynamic releaseChannel = JsonConvert.DeserializeObject(releaseRawJson); + + string runtime = null; + var sdks = new List(); + var latestDate = new DateTime(2000, 1, 1); + + foreach (var release in releaseChannel["releases"]) + { + if (!DateTime.TryParse((string)release["release-date"], out DateTime releaseDate)) + { + continue; + } + + if (releaseDate > latestDate) + { + latestDate = releaseDate; + runtime = release["runtime"]["version"]; + sdks = new List(); + foreach (var sdk in release["sdks"]) + { + sdks.Add((string)sdk["version"]); + } + } + } + + return (sdks, runtime); + } + + private Uri GetReleaseInfoChannelUrl(string releaseIndexRawJson, string majorMinor) + { + dynamic releaseIndex = JsonConvert.DeserializeObject(releaseIndexRawJson); + + string releaseChannelJsonUrl = null; + foreach (var release in releaseIndex["releases-index"]) + { + if (release["channel-version"] == majorMinor) + { + releaseChannelJsonUrl = release["releases.json"]; + break; + } + } + + return new Uri(releaseChannelJsonUrl); + } + + } +} diff -Nru dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/release-version-sane/VersionTest.cs dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/release-version-sane/VersionTest.cs --- dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/release-version-sane/VersionTest.cs 1970-01-01 00:00:00.000000000 +0000 +++ dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/release-version-sane/VersionTest.cs 2024-03-18 12:48:03.000000000 +0000 @@ -0,0 +1,106 @@ +using System; +using System.Collections.Generic; +using System.IO; +using System.Net.Http; +using System.Linq; +using System.Threading.Tasks; +using System.Diagnostics; +using Xunit; + +namespace ReleaseVersionSane +{ + public class VersionTest + { + [Fact] + public async Task VersionIsSane() + { + // This test is meant for release pipelines and verifies the version being built + // either matches the upstream 'major.minor.patch' or 'major.minor.(patch + 1)'. + + string runtimeVersionRaw = GetRuntimeVersion(); + string sdkVersionRaw = GetSdkVersion(); + Version runtimeVersion = Normalize(runtimeVersionRaw); + Version sdkVersion = Normalize(sdkVersionRaw); + + string majorMinor = $"{runtimeVersion.Major}.{runtimeVersion.Minor}"; + var upstream = new UpstreamRelease(); + (List publicSdkVersionsRaw, string publicRuntimeVersionRaw) = await upstream.GetLatestRelease(new HttpClient(), majorMinor); + List publicSdkVersions = publicSdkVersionsRaw.Select(v => Normalize(v)).ToList(); + Version publicRuntimeVersion = Normalize(publicRuntimeVersionRaw); + + Version publicRuntimeVersionNextPatch = new Version(publicRuntimeVersion.Major, + publicRuntimeVersion.Minor, + publicRuntimeVersion.Build + 1); + bool matchesUpstream = runtimeVersion.Equals(publicRuntimeVersion); + bool matchesUpstreamNext = runtimeVersion.Equals(publicRuntimeVersionNextPatch); + Version expectedPublicSdkVersion = null; + if (matchesUpstream) + { + expectedPublicSdkVersion = sdkVersion; + } + else if (matchesUpstreamNext) + { + expectedPublicSdkVersion = new Version(sdkVersion.Major, + sdkVersion.Minor, + sdkVersion.Build - 1); + } + + Assert.True(matchesUpstream || matchesUpstreamNext, $"{runtimeVersionRaw} is not expected with public version {publicRuntimeVersionRaw}"); + Assert.NotNull(expectedPublicSdkVersion); + Assert.Contains(expectedPublicSdkVersion, publicSdkVersions); + } + + private string GetRuntimeVersion() + { + int exitCode = RunProcessAndGetOutput(new string[] { "dotnet" , "--list-runtimes" }, out string result); + if (exitCode != 0) + { + return null; + } + + return result.Split(Environment.NewLine) + .Where(line => line.StartsWith("Microsoft.NETCore.App ")) + .Select(line => line.Split(' ')[1]) + .First(); + } + + private string GetSdkVersion() + { + int exitCode = RunProcessAndGetOutput(new string[] { "dotnet" , "--list-sdks" }, out string result); + if (exitCode != 0) + { + return null; + } + + return result + .Split(Environment.NewLine) + .Select(line => line.Split(' ')[0]) + .First(); + } + + + private static int RunProcessAndGetOutput(string[] processAndArguments, out string standardOutput) + { + ProcessStartInfo startInfo = new ProcessStartInfo(); + startInfo.FileName = processAndArguments[0]; + startInfo.Arguments = string.Join(" ", processAndArguments.Skip(1)); + startInfo.RedirectStandardOutput = true; + + using (Process p = Process.Start(startInfo)) + { + p.WaitForExit(); + using (StreamReader r = p.StandardOutput) + { + standardOutput = r.ReadToEnd(); + } + return p.ExitCode; + } + } + + /// Normalize a version and remove parts that make it invalid. This includes 'preview' and 'rc' tags + public static Version Normalize(string version) + { + return new Version(version.Split('-')[0]); + } + } +} diff -Nru dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/release-version-sane/release-version-sane.csproj dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/release-version-sane/release-version-sane.csproj --- dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/release-version-sane/release-version-sane.csproj 1970-01-01 00:00:00.000000000 +0000 +++ dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/release-version-sane/release-version-sane.csproj 2024-03-18 12:48:03.000000000 +0000 @@ -0,0 +1,16 @@ + + + + true + $(TestTargetFramework) + + false + + + + + + + + + diff -Nru dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/release-version-sane/test.json dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/release-version-sane/test.json --- dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/release-version-sane/test.json 1970-01-01 00:00:00.000000000 +0000 +++ dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/release-version-sane/test.json 2024-03-18 12:48:03.000000000 +0000 @@ -0,0 +1,12 @@ +{ + "name": "release-version-sane", + "enabled": true, + "requiresSdk": true, + "version": "3.1", + "versionSpecific": false, + "type": "xunit", + "cleanup": true, + "skipWhen": [ + "vmr-ci" // see https://github.com/redhat-developer/dotnet-regular-tests/issues/282 + ] +} diff -Nru dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/rest-client/UnitTest1.cs dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/rest-client/UnitTest1.cs --- dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/rest-client/UnitTest1.cs 1970-01-01 00:00:00.000000000 +0000 +++ dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/rest-client/UnitTest1.cs 2024-03-18 12:48:03.000000000 +0000 @@ -0,0 +1,32 @@ +using System; +using System.Collections.Generic; +using System.Net; +using System.Net.Http; +using System.Net.Http.Headers; +using System.Threading.Tasks; +using Xunit; + +namespace rest_client +{ + public class UnitTest1 + { + [Fact] + public void Test1() + { + ProcessRepositories().Wait(); + } + + private static async Task ProcessRepositories() + { + var client = new HttpClient(); + client.DefaultRequestHeaders.Accept.Clear(); + client.DefaultRequestHeaders.Accept.Add( new MediaTypeWithQualityHeaderValue("application/vnd.github.v3+json")); + client.DefaultRequestHeaders.Add("User-Agent", ".NET Foundation Repository Reporter"); + + var stringTask = client.GetStringAsync("https://api.github.com/orgs/dotnet/repos"); + + var msg = await stringTask; + Assert.NotEmpty(msg); + } + } +} diff -Nru dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/rest-client/rest-client.csproj dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/rest-client/rest-client.csproj --- dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/rest-client/rest-client.csproj 1970-01-01 00:00:00.000000000 +0000 +++ dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/rest-client/rest-client.csproj 2024-03-18 12:48:03.000000000 +0000 @@ -0,0 +1,16 @@ + + + + true + $(TestTargetFramework) + + false + + + + + + + + + diff -Nru dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/rest-client/test.json dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/rest-client/test.json --- dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/rest-client/test.json 1970-01-01 00:00:00.000000000 +0000 +++ dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/rest-client/test.json 2024-03-18 12:48:03.000000000 +0000 @@ -0,0 +1,12 @@ +{ + "name": "rest-client", + "enabled": false, + "requiresSdk": true, + "version": "1.0", + "versionSpecific": false, + "type": "xunit", + "cleanup": true, + "ignoredRIDs":[ + ] +} + diff -Nru dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/restore-with-rid/test.json dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/restore-with-rid/test.json --- dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/restore-with-rid/test.json 1970-01-01 00:00:00.000000000 +0000 +++ dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/restore-with-rid/test.json 2024-03-18 12:48:03.000000000 +0000 @@ -0,0 +1,16 @@ +{ + "name": "restore-with-rid", + "enabled": true, + "requiresSdk": true, + "version": "2.1", + "versionSpecific": false, + "type": "bash", + "cleanup": true, + "skipWhen":[ + "version=6,arch=s390x", // no runtime pack available + "version=7,arch=s390x", + "version=7,arch=ppc64le" + ], + "ignoredRIDs":[ + ] +} diff -Nru dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/restore-with-rid/test.sh dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/restore-with-rid/test.sh --- dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/restore-with-rid/test.sh 1970-01-01 00:00:00.000000000 +0000 +++ dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/restore-with-rid/test.sh 2024-03-18 12:48:03.000000000 +0000 @@ -0,0 +1,8 @@ +#!/usr/bin/env bash + +set -euo pipefail +IFS=$'\n\t' +set -x + +dotnet new console --no-restore +dotnet restore -r "$(../runtime-id)" diff -Nru dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/rsa-pkcs-openssl/Program.cs dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/rsa-pkcs-openssl/Program.cs --- dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/rsa-pkcs-openssl/Program.cs 1970-01-01 00:00:00.000000000 +0000 +++ dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/rsa-pkcs-openssl/Program.cs 2024-03-18 12:48:03.000000000 +0000 @@ -0,0 +1,98 @@ +/* This test validates .NET preserves the OpenSSL 3.2 behavior introduced in + https://github.com/openssl/openssl/pull/13817. + This change is backported to earlier OpenSSL versions in the Red Hat/Fedora distributions. */ + +using System.Security.Cryptography; + +/* The data used in this test was generated using https://github.com/tomato42/marvin-toolkit/. + The data has PKCS padding errors. Instead of returning an error code for the padding errors, + OpenSSL returns success with data. */ + +string key = @" +-----BEGIN PRIVATE KEY----- +MIIEugIBADANBgkqhkiG9w0BAQEFAASCBKQwggSgAgEAAoIBAQCYLqFvySu5mYTS +j4yveQz0PAM4AQOdtCLriXUk6KVq0Q+sb0CxZ/L6S+KxNHIV46idUnNnihWRLdlU +MWG6Q0b7vKx58c8KGVZT51AUHaXyqbNFbh60ho8lPHIkrJxYw9Q22t2MIgb8pEgh +8yF6Z1aelSuZ8SC9rojhqUykaBG/oVwqaT6QG1lrS6gQx/glVbPv88ubUd6lSwMz +R2RwvhCTGMZFZDL3FP5ZmU2A6tQreLcC+3OloLoFDwzHkvrGBxhouEDuhmB91JHk +Erf+SUxY6gOV1hTuM6txnwZeOrJvGmrUaOsjT2cnvwDCun1KV+6tiQQlGmah7zMu +ST/km7RPAgMBAAECggEABs3sjVuz1xhS2yCGNe3vxj3Z5DFB0NVvy3ms1La+qrOC +HWYnp0CfTLfqGp1Ezc8myDEz4SwutOKVbJFjer+svVXDna8FRsDSRNPuly+qLo4n +t163BCbEelg+peTxfeCOE3PR/LfxLKIV0MeW6betvk9FXbYHDj273hP2GtKSZ8lR +qbP5UX+iRdPj2GThni4OWcN+lgszUyYb+yEAI8/JnNcISZjNFghjBuE8/Il3/Iww +Zuca5PWiDy5SBWeqYf+8Llz8wnJPT7IyBAMQfFRU77Eeqz3F/v9D5J+BGOjQDUDl +hWvgtc0sGI7n1tGRbGpZYTQo69mCHXkUVBTaL64yDQKBgQDKE9b4uRq8tB/2f+pW +AyS3x8UXewnPikWyMQqC7WZmPTvTKqePvF04XUznCQxujO6YRmSM2/avI63SNDKo +RhqPeW5wXg9jlqIFmYL1k0trjH0cbPuKBwxJtJT7TtFN5M9A+jNgPvt385sGXXyO +U1ebdaEcBD68TOlLoIE8orQNowKBgQDAymD7DzmF4dVUL1TQH/dC9EsnRqlHhTLo +m0X4Kkyy/Z0cbLOvNDG34Rr5IrGT4GnVx85nTUqxW7UUZ5CZpH4Z2kw5U8AJLVc2 +mJ9IuMLDNOOmeHs+YltLNWHQqmAcA6vwEaHjMQr8iFmDsXK27EIMedOcMQj+DcUt +VYnkRFORZQJ/E7vcQm3RLpxogqn7OGsWKtxXYvOhAaN/KuefHyoP1ewk63o+4sqC +T/7Mg8Nec21P348AQsE4VeImF2EBkW1HKruxDUgiOJd9Ow7CuzinJNmTXjNGXTRS +/t+jrOcFiZXOp4nHep6r8AraGMUIZN2+sG/MS/AeMEVSgxApjsJU0wKBgDTdifhu +NVTcF3ZtQDGOAmyOtqj/fF3LTalxIp+pYbzXRKTNvfv2MQf+JzpX5B/rsrnXf2be +T/QQdLgyqfknnRiTvsEdkRQzJa4n7c2wNF/4+c/lS85QhD48ViU1AwPLkfNTsnOt +OBkFfp5ZI167rGTlZzx2ScP4nLAQu64nek7tAoGACZ6TelILDOS9JKtUMymGK/mk +0rxTwxTNyaerAwRHIRFDtgoYpUlNyb0yHT3Gdd6iLYQv/PvKfJ8mM3oJp5we/WMy +FEPrfydLbz5+DhdgK235US5yIlegtvTFR9qLQFwEx7livneBjfa7OI2GmvS9pRPk +PsuFb/qC2D8QszN3eAI= +-----END PRIVATE KEY-----"; + +byte[] data = new[] +{ +0x70, 0x84, 0xab, 0x58, 0x44, 0x70, 0xf5, 0x55, 0x48, 0x3c, 0x06, 0xaa, 0x5f, 0x73, 0xda, 0x05, +0x81, 0xf7, 0x4f, 0x4c, 0x9f, 0xfa, 0xa2, 0xf9, 0x8a, 0xae, 0xd6, 0xf5, 0xbe, 0x17, 0x2e, 0x1c, +0x55, 0x6a, 0xd8, 0x73, 0x53, 0xdf, 0x5b, 0xa7, 0x5d, 0x09, 0xb8, 0x81, 0x3e, 0xf3, 0x16, 0x77, +0x23, 0xc1, 0x09, 0x16, 0xa5, 0x4d, 0x96, 0xff, 0xb4, 0xd5, 0xef, 0x7d, 0xc1, 0x5d, 0x8f, 0xc1, +0x75, 0x8b, 0x3c, 0xe0, 0xc8, 0xaf, 0xeb, 0xca, 0x0e, 0x46, 0x2b, 0x06, 0x8b, 0xf5, 0x3e, 0xb7, +0xa4, 0xf1, 0xec, 0xb4, 0x80, 0x2d, 0x6f, 0xd8, 0xa9, 0x63, 0xca, 0x3e, 0x60, 0x12, 0xae, 0x89, +0x59, 0x1e, 0xd3, 0x9e, 0x97, 0x78, 0x86, 0x2a, 0x49, 0xca, 0x55, 0x6d, 0xb8, 0xd5, 0x40, 0xbc, +0x31, 0x05, 0x2a, 0x2a, 0x7d, 0x77, 0x27, 0x53, 0xd8, 0xe8, 0xae, 0x89, 0xad, 0x80, 0x56, 0x08, +0x49, 0x5f, 0xf5, 0xa6, 0xe8, 0x58, 0x8f, 0x39, 0x58, 0xfe, 0xc2, 0x83, 0xb7, 0x88, 0x82, 0xb7, +0x90, 0x71, 0xe2, 0xd6, 0xbe, 0x2d, 0x93, 0x91, 0xb3, 0x2c, 0x9b, 0x27, 0xf5, 0x1d, 0xb8, 0xe5, +0x2d, 0x6a, 0xd9, 0x77, 0xbc, 0xc7, 0xb7, 0x09, 0xa6, 0x41, 0xc0, 0x57, 0xd1, 0xeb, 0x19, 0x7f, +0xe6, 0x61, 0x62, 0x54, 0xd9, 0x91, 0x6c, 0x3e, 0x76, 0x64, 0xb5, 0xa8, 0xcc, 0x8e, 0x0c, 0xdf, +0xbd, 0xec, 0x9b, 0xab, 0x55, 0xc6, 0x0b, 0x29, 0xa8, 0xc6, 0x72, 0xbf, 0xcb, 0x58, 0xda, 0x4d, +0x0e, 0x1a, 0x34, 0xd4, 0xc9, 0x93, 0x97, 0xce, 0xbc, 0x19, 0x50, 0xb3, 0x4b, 0xf2, 0xf9, 0x1f, +0x2e, 0x62, 0xbf, 0xf2, 0x5f, 0x50, 0xce, 0x89, 0x64, 0xd5, 0x54, 0xcc, 0xc4, 0x49, 0x57, 0xfa, +0x48, 0x7f, 0x19, 0x82, 0x17, 0x2b, 0xeb, 0x7e, 0x22, 0x6b, 0xd9, 0xf7, 0x77, 0x3e, 0xce, 0x72, +}.Select(i => (byte)i).ToArray(); + +byte[] expected = new[] +{ +0x38, 0xd2, 0x12, 0xd1, 0xef, 0xd2, 0x4d, 0x28, 0x99, 0x3e, 0x07, 0x0d, 0x7b, 0xb2, 0x8b, 0xe7, +0x4f, 0x8c, 0xbe, 0x68, 0x9e, 0x29, 0x01, 0x14, 0xd6, 0x08, 0x73, 0x67, 0x34, 0x3e, 0xed, 0x03, +0x6c, 0x08, 0x01, 0x75, 0x4e, 0xea, 0xcf, 0x1f, 0x98, 0xdd, 0x3b, 0x82, 0x78, 0x3c, 0xaf, 0x74, +0x56, 0xf2, 0xab, 0xd8, 0x2c, 0xe9, 0xe6, 0xcd, 0x1d, 0x61, 0xc9, 0x77, 0xfc, 0x71, 0x14, 0x9c, +0x9d, 0x53, 0xfc, 0xf4, 0xfc, 0x4a, 0x4d, 0xff, 0x93, 0x96, 0x08, 0xb8, 0x90, 0x83, 0xad, 0xfa, +0x73, 0x87, 0xeb, 0xbe, 0x28, 0x21, 0xae, 0x8d, 0xa8, 0xca, 0x79, 0xff, 0x38, 0xa2, 0x26, 0x67, +0xd4, 0x91, 0x05, 0x34, 0x1b, 0x02, 0xea, 0x11, 0x02, 0x60, 0xe9, 0x4d, 0x5c, 0xfd, 0x14, 0x7a, +0xbf, 0xfc, 0xff, 0xe9, 0x5b, 0x08, 0x6e, 0x10, 0x9a, 0x1d, 0xdf, +}.Select(i => (byte)i).ToArray(); + +using RSA rsa = RSA.Create(); +rsa.ImportFromPem(key); + +byte[] decrypted; +try +{ + decrypted = rsa.Decrypt(data, RSAEncryptionPadding.Pkcs1); +} +catch (Exception ex) +{ + Console.WriteLine("FAIL: RSA decryption threw an exception:"); + Console.WriteLine(ex); + return 1; +} + +if (!expected.AsSpan().SequenceEqual(decrypted)) +{ + Console.WriteLine("FAIL: decrypted data does not match the expected value from OpenSSL:"); + Console.WriteLine($"Actual: {string.Join("", decrypted.Select(b => b.ToString("x2")))}"); + Console.WriteLine($"Expected: {string.Join("", expected.Select(b => b.ToString("x2")))}"); + return 1; +} + + +Console.WriteLine("PASS: .NET RSA+PKCS API matches OpenSSL behavior."); +return 0; diff -Nru dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/rsa-pkcs-openssl/rsa-pkcs-openssl.csproj dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/rsa-pkcs-openssl/rsa-pkcs-openssl.csproj --- dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/rsa-pkcs-openssl/rsa-pkcs-openssl.csproj 1970-01-01 00:00:00.000000000 +0000 +++ dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/rsa-pkcs-openssl/rsa-pkcs-openssl.csproj 2024-03-18 12:48:03.000000000 +0000 @@ -0,0 +1,10 @@ + + + + Exe + $(TestTargetFramework) + enable + enable + + + diff -Nru dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/rsa-pkcs-openssl/test.json dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/rsa-pkcs-openssl/test.json --- dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/rsa-pkcs-openssl/test.json 1970-01-01 00:00:00.000000000 +0000 +++ dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/rsa-pkcs-openssl/test.json 2024-03-18 12:48:03.000000000 +0000 @@ -0,0 +1,17 @@ +{ + "name": "rsa-pkcs-openssl", + "enabled": true, + "requiresSdk": true, + "version": "6.0", + "versionSpecific": false, + "type": "bash", + "cleanup": true, + "skipWhen": [ + "vmr-ci", // upstream opts out of the OpenSSL change. + "os=rhel.7", // RHEL 7 is not getting OpenSSL changes. + "os=alpine", // test validates behavior for Fedora/RHEL. + "os=ubuntu" // Ubuntu follows upstream + ], + "ignoredRIDs":[ + ] +} diff -Nru dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/rsa-pkcs-openssl/test.sh dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/rsa-pkcs-openssl/test.sh --- dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/rsa-pkcs-openssl/test.sh 1970-01-01 00:00:00.000000000 +0000 +++ dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/rsa-pkcs-openssl/test.sh 2024-03-18 12:48:03.000000000 +0000 @@ -0,0 +1,6 @@ +#!/usr/bin/env bash + +set -euo pipefail +IFS=$'\n\t' + +dotnet run diff -Nru dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/run-until-success-with-backoff dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/run-until-success-with-backoff --- dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/run-until-success-with-backoff 1970-01-01 00:00:00.000000000 +0000 +++ dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/run-until-success-with-backoff 2024-03-18 12:48:03.000000000 +0000 @@ -0,0 +1,26 @@ +#!/bin/bash + +set -euo pipefail + +echo "Running with backoff:" "$@" + +max_retries=10 + +iterations=0 +total_slept=0 # seconds + +sleep $((iterations + 1)) +((total_slept += iterations + 1)) + +until "$@"; do + ((iterations += 1)) + if (( total_slept > 10 )); then + echo "$@" "still failing after more than ${total_slept} seconds" + fi + if (( iterations == max_retries )); then + echo "$@" "still failing after $max_retries retries" + exit 1 + fi + sleep $iterations + ((total_slept += iterations)) +done diff -Nru dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/runtime-id dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/runtime-id --- dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/runtime-id 1970-01-01 00:00:00.000000000 +0000 +++ dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/runtime-id 2024-03-18 12:48:03.000000000 +0000 @@ -0,0 +1,86 @@ +#!/usr/bin/env bash + +# This is a script called by multiple tests to find the runtime id of +# the current platform. + +set -euo pipefail + +SCRIPT_PATH=$(realpath $0) +SCRIPT_DIR=$(dirname "$SCRIPT_PATH") + +function usage() { + echo "usage: $0 [--portable] [--sdk]" + echo "" + echo "Prints a rid for the current environment" + echo "" + echo "$0 prints the non-portable rid for the OS" + echo "$0 --portable prints the portable rid for the OS" + echo "$0 --sdk prints the rid the SDK was built for" +} + +portable_rid=0 +sdk_rid=0 +while [[ $# -gt 0 ]]; do + arg=$1 + shift + case "$arg" in + --portable) portable_rid=1 ;; + --sdk) sdk_rid=1 ;; + *) usage; exit 1 ;; + esac +done + +if [[ ${sdk_rid} == 1 ]]; then + sdk_dir=$("$SCRIPT_DIR/dotnet-directory" --sdk) + rid_line=$(grep -m 1 "" "$sdk_dir/Microsoft.NETCoreSdk.BundledVersions.props") + rid_regex="(.*)" + if [[ "$rid_line" =~ $rid_regex ]]; then + sdk_rid="${BASH_REMATCH[1]}" + else + echo "failed to parse id from: '$rid_line'" + exit 1 + fi + echo $sdk_rid + exit 0 +fi + +source /etc/os-release + +declare -A archmap +archmap=( + ["aarch64"]="arm64" + ["amd64"]="x64" + ["armv8l"]="arm" + ["i686"]="x86" + ["i386"]="x86" + ["x86_64"]="x64" + ["s390x"]="s390x" + ["ppc64le"]="ppc64le" +) + +arch=${archmap["$(uname -m)"]} + +if [[ ${portable_rid} == 1 ]]; then + if (ldd --version 2>&1 || true) | grep -q musl ; then + echo "linux-musl-${arch}" + else + echo "linux-${arch}" + fi +else + case "${ID}" in + # Remove the minor version + alma|ol|rhel|rocky) + rid_version=${VERSION_ID%.*} + ;; + alpine) + # Remove _ and extra . to compute just the major.minor version + rid_version=$(echo "$VERSION_ID" | cut -d'_' -f1 | cut -d'.' -f1-2) + ;; + + *) + rid_version=${VERSION_ID} + ;; + esac + + echo "${ID}.${rid_version}-${arch}" +fi diff -Nru dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/sdks-are-available/test.json dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/sdks-are-available/test.json --- dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/sdks-are-available/test.json 1970-01-01 00:00:00.000000000 +0000 +++ dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/sdks-are-available/test.json 2024-03-18 12:48:03.000000000 +0000 @@ -0,0 +1,11 @@ +{ + "name": "sdks-are-available", + "enabled": true, + "requiresSdk": true, + "version": "6.0", + "versionSpecific": false, + "type": "bash", + "cleanup": true, + "ignoredRIDs":[ + ] +} diff -Nru dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/sdks-are-available/test.sh dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/sdks-are-available/test.sh --- dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/sdks-are-available/test.sh 1970-01-01 00:00:00.000000000 +0000 +++ dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/sdks-are-available/test.sh 2024-03-18 12:48:03.000000000 +0000 @@ -0,0 +1,46 @@ +#!/usr/bin/env bash + +set -euo pipefail +IFS=$'\n\t' + +# The publicly documented SDKs +# See https://docs.microsoft.com/en-us/dotnet/core/project-sdk/overview +expected_sdks=( + Microsoft.NET.Sdk + Microsoft.NET.Sdk.BlazorWebAssembly + Microsoft.NET.Sdk.Publish + Microsoft.NET.Sdk.Razor + Microsoft.NET.Sdk.Web + Microsoft.NET.Sdk.Worker +) + +sdk_dir=$(../dotnet-directory --sdk) + +echo "Looking for SDKs at" "${sdk_dir[@]}" + +sdks=( "${sdk_dir[0]}"/Sdks/* ) + +passed=true +for expected in "${expected_sdks[@]}"; do + found=false + + for sdk in "${sdks[@]}"; do + if [[ "$(basename "$sdk")" == "$expected" ]] && [[ -f "${sdk}/Sdk/Sdk.props" ]] ; then + found=true + fi + done + + if [[ $found == "false" ]]; then + echo "error: $expected not found" + passed=false + else + echo "found $expected" + fi +done + +if [[ $passed == "true" ]]; then + echo "found all expected sdks" +else + echo "error: some expected SDKs are missing" + exit 1 +fi diff -Nru dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/sha1-validation/Program.cs dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/sha1-validation/Program.cs --- dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/sha1-validation/Program.cs 1970-01-01 00:00:00.000000000 +0000 +++ dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/sha1-validation/Program.cs 2024-03-18 12:48:03.000000000 +0000 @@ -0,0 +1,51 @@ +using System.Net.Security; +using System.Security.Cryptography.X509Certificates; + +bool sha1RsaSignatureOnLastElementInChain = false; + +HttpClientHandler handler = new HttpClientHandler { + CheckCertificateRevocationList = true, + ServerCertificateCustomValidationCallback = ServerCertificateCustomValidation, +}; + +using HttpClient client = new HttpClient(handler); + +try +{ + HttpResponseMessage response = await client.GetAsync("https://redhat.com"); + + string responseBody = await response.Content.ReadAsStringAsync(); + if (!sha1RsaSignatureOnLastElementInChain) + { + Console.WriteLine("FAIL"); + Console.WriteLine("The certificate chain that is validated is no longer using an RSA1 signature."); + Console.WriteLine("The test must be updated to use a different host."); + return 1; + } + Console.WriteLine("PASS"); + return 0; +} +catch (Exception e) +{ + Console.WriteLine("\nException Caught!"); + Console.WriteLine(e); +} + +Console.WriteLine("FAIL"); +return 1; + +bool ServerCertificateCustomValidation(HttpRequestMessage requestMessage, X509Certificate2? certificate, X509Chain? chain, SslPolicyErrors sslErrors) +{ + foreach (var element in chain!.ChainElements) + { + var cert = element.Certificate; + Console.WriteLine($"{cert.SubjectName.Name} {cert.SignatureAlgorithm.FriendlyName}"); + } + if ( chain.ChainElements.Last().Certificate.SignatureAlgorithm.FriendlyName != "sha1RSA" ) + { + sha1RsaSignatureOnLastElementInChain = true; + } + + Console.WriteLine($"Errors: {sslErrors}"); + return sslErrors == SslPolicyErrors.None; +} \ No newline at end of file diff -Nru dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/sha1-validation/test.json dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/sha1-validation/test.json --- dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/sha1-validation/test.json 1970-01-01 00:00:00.000000000 +0000 +++ dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/sha1-validation/test.json 2024-03-18 12:48:03.000000000 +0000 @@ -0,0 +1,15 @@ +{ + "name": "sha1-validation", + "enabled": true, + "requiresSdk": true, + "version": "6.0", + "versionSpecific": false, + "type": "bash", + "cleanup": true, + "skipWhen": [ + "os=rhel.9,version=7", // Test fails on RHEL9 with .NET 7: https://issues.redhat.com/browse/RHEL-25254 + "os=centos.9,version=7", // Test fails on RHEL9 with .NET 7: https://issues.redhat.com/browse/RHEL-25254 + ], + "ignoredRIDs":[ + ] +} diff -Nru dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/sha1-validation/test.sh dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/sha1-validation/test.sh --- dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/sha1-validation/test.sh 1970-01-01 00:00:00.000000000 +0000 +++ dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/sha1-validation/test.sh 2024-03-18 12:48:03.000000000 +0000 @@ -0,0 +1,6 @@ +#!/usr/bin/env bash + +set -euo pipefail +IFS=$'\n\t' + +dotnet run \ No newline at end of file diff -Nru dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/sha1-validation/tests.csproj dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/sha1-validation/tests.csproj --- dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/sha1-validation/tests.csproj 1970-01-01 00:00:00.000000000 +0000 +++ dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/sha1-validation/tests.csproj 2024-03-18 12:48:03.000000000 +0000 @@ -0,0 +1,10 @@ + + + + Exe + $(TestTargetFramework) + enable + enable + + + diff -Nru dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/strerrorr-linkage/StrErrorLinkage.cs dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/strerrorr-linkage/StrErrorLinkage.cs --- dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/strerrorr-linkage/StrErrorLinkage.cs 1970-01-01 00:00:00.000000000 +0000 +++ dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/strerrorr-linkage/StrErrorLinkage.cs 2024-03-18 12:48:03.000000000 +0000 @@ -0,0 +1,60 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Net; +using System.Net.Sockets; +using System.Runtime.InteropServices; +using Xunit; + +namespace strerror +{ + // Make sure that strerror_r is usable on *nix + public class StrErrorLinkage + { + // The SocketException constructor does an strerror_r() to + // resolve the error code into a string message. Assert that + // it works. + [Fact] + public void SocketExceptionMessageIsParsedCorrectly() + { + var se = new SocketException((int)SocketError.InvalidArgument); + Assert.Equal(22, se.NativeErrorCode); + Assert.NotEmpty(se.Message); + Assert.Equal("Invalid argument", se.Message); + } + + // Manully duplicate the call that .NET Core internally does + // to strerror_r + [Fact] + public void ManuallyInvokingSystemNative_StrErrorRWorks() + { + var message = StrError(22); + Assert.NotEmpty(message); + Assert.Equal("Invalid argument", message); + } + + internal const string SystemNative = "System.Native"; + + static unsafe string StrError(int platformErrno) + { + int maxBufferLength = 1024; // should be long enough for most any UNIX error + byte* buffer = stackalloc byte[maxBufferLength]; + byte* message = StrErrorR(platformErrno, buffer, maxBufferLength); + + if (message == null) + { + // This means the buffer was not large enough, but still contains + // as much of the error message as possible and is guaranteed to + // be null-terminated. We're not currently resizing/retrying because + // maxBufferLength is large enough in practice, but we could do + // so here in the future if necessary. + message = buffer; + } + + return Marshal.PtrToStringAnsi((IntPtr)message); + } + + [DllImport(SystemNative, EntryPoint = "SystemNative_StrErrorR")] + private static extern unsafe byte* StrErrorR(int platformErrno, byte* buffer, int bufferSize); + } +} diff -Nru dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/strerrorr-linkage/strerrorr-linkage.csproj dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/strerrorr-linkage/strerrorr-linkage.csproj --- dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/strerrorr-linkage/strerrorr-linkage.csproj 1970-01-01 00:00:00.000000000 +0000 +++ dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/strerrorr-linkage/strerrorr-linkage.csproj 2024-03-18 12:48:03.000000000 +0000 @@ -0,0 +1,16 @@ + + + + true + $(TestTargetFramework) + true + latest + + + + + + + + + diff -Nru dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/strerrorr-linkage/test.json dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/strerrorr-linkage/test.json --- dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/strerrorr-linkage/test.json 1970-01-01 00:00:00.000000000 +0000 +++ dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/strerrorr-linkage/test.json 2024-03-18 12:48:03.000000000 +0000 @@ -0,0 +1,12 @@ +{ + "name": "strerrorr-linkage", + "enabled": true, + "requiresSdk": true, + "version": "1.0", + "versionSpecific": false, + "type": "xunit", + "cleanup": true, + "ignoredRIDs":[ + ] +} + diff -Nru dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/system-data-odbc/Program.cs dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/system-data-odbc/Program.cs --- dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/system-data-odbc/Program.cs 1970-01-01 00:00:00.000000000 +0000 +++ dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/system-data-odbc/Program.cs 2024-03-18 12:48:03.000000000 +0000 @@ -0,0 +1,40 @@ +using System.Globalization; +using System.Data.Odbc; + +string host = Environment.GetEnvironmentVariable("PGHOST")!; +string port = Environment.GetEnvironmentVariable("PGPORT")!; + +int expectedRows = int.Parse(Environment.GetEnvironmentVariable("EXPECTED_ROWS")!, CultureInfo.InvariantCulture); +int expectedColumns = int.Parse(Environment.GetEnvironmentVariable("EXPECTED_COLUMNS")!, CultureInfo.InvariantCulture); + +string connectionString = $"DRIVER={{PostgreSQL}};SERVER={host}; PORT={port};DATABASE=testdb;"; +Console.WriteLine(connectionString); + +OdbcConnection connection = new(connectionString); +connection.Open(); + +using (OdbcCommand dbCommand = connection.CreateCommand()) +{ + dbCommand.CommandText = "SELECT * FROM test"; + using (OdbcDataReader dbReader = dbCommand.ExecuteReader()) + { + int fieldCount = dbReader.FieldCount; + if (fieldCount != expectedColumns) + { + throw new InvalidOperationException($"Expected {expectedColumns} but got {fieldCount}"); + } + + int rows = 0; + while (dbReader.Read()) + { + rows++; + } + + if (rows != expectedRows) + { + throw new InvalidOperationException($"Expected {expectedRows} but got {rows}"); + } + Console.WriteLine($"Got {expectedRows} rows of output, with {expectedColumns} columns"); + } +} +connection.Close(); diff -Nru dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/system-data-odbc/system-data-odbc.csproj dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/system-data-odbc/system-data-odbc.csproj --- dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/system-data-odbc/system-data-odbc.csproj 1970-01-01 00:00:00.000000000 +0000 +++ dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/system-data-odbc/system-data-odbc.csproj 2024-03-18 12:48:03.000000000 +0000 @@ -0,0 +1,14 @@ + + + + Exe + $(TestTargetFramework) + enable + enable + + + + + + + diff -Nru dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/system-data-odbc/test.json dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/system-data-odbc/test.json --- dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/system-data-odbc/test.json 1970-01-01 00:00:00.000000000 +0000 +++ dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/system-data-odbc/test.json 2024-03-18 12:48:03.000000000 +0000 @@ -0,0 +1,13 @@ +{ + "name": "system-data-odbc", + "enabled": true, + "requiresSdk": false, + "version": "6.0", + "versionSpecific": false, + "type": "bash", + "cleanup": true, + "ignoredRIDs":[ + "rhel7", + "ubuntu" // See: https://github.com/canonical/dotnet-regular-tests/issues/4 + ] +} diff -Nru dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/system-data-odbc/test.sh dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/system-data-odbc/test.sh --- dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/system-data-odbc/test.sh 1970-01-01 00:00:00.000000000 +0000 +++ dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/system-data-odbc/test.sh 2024-03-18 12:48:03.000000000 +0000 @@ -0,0 +1,52 @@ +#!/bin/bash + +set -euo pipefail +IFS=$'\n\t' +set -x + +# This test *must* be run as non-root; postgresql will refuse to start as root. +if [[ $(id -u) == "0" ]]; then + id testrunner || useradd testrunner || adduser testrunner --disabled-password + chown -R testrunner:testrunner "$(pwd)" + su testrunner -c "$(readlink -f "$0")" "$@" + exit +fi + +function cleanup { + trap '' EXIT ERR # Remove the traps to prevent multiple invocations + pg_ctl stop -m fast + + while pg_ctl status; do + sleep 1 + done + + rm -rf "$PGDATA" "$PGSOCKET" +} + +# See https://www.postgresql.org/docs/current/libpq-envars.html for PGDATA, PGHOST and PGPORT +PGDATA="$(pwd)/data" +export PGDATA +export PGHOST=localhost +export PGPORT=$((1024 + $RANDOM )) + +PGSOCKET="$(mktemp -d)/socket" + +rm -rf "$PGDATA" "$PGSOCKET" +mkdir -p "$PGDATA" "$PGSOCKET" + +trap cleanup EXIT ERR + +pg_ctl initdb +pg_ctl start -o "-k $PGSOCKET" +until pg_ctl status; do + sleep 1 +done + +psql template1 -c "CREATE DATABASE testdb;" +psql testdb -c "CREATE TABLE test (ID INT PRIMARY KEY, NAME TEXT);" +psql testdb -c "INSERT INTO test VALUES (1, 'Test');" +psql testdb -c "SELECT * FROM test;" + +export EXPECTED_ROWS=1 +export EXPECTED_COLUMNS=2 +dotnet run diff -Nru dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/system-libunwind/test.json dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/system-libunwind/test.json --- dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/system-libunwind/test.json 1970-01-01 00:00:00.000000000 +0000 +++ dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/system-libunwind/test.json 2024-03-18 12:48:03.000000000 +0000 @@ -0,0 +1,24 @@ +{ + "name": "system-libunwind", + "enabled": true, + "requiresSdk": false, + "version": "2.0", + "versionSpecific": false, + "type": "bash", + "cleanup": true, + "skipWhen": [ + "os=fedora,version=8", // see https://github.com/redhat-developer/dotnet-regular-tests/issues/254 + "vmr-ci", // using system libunwind is configured in the rpm build + "runtime=mono", // mono does not use libunwind + "os=ubuntu,version=8", // see https://github.com/canonical/dotnet-regular-tests/issues/6 + "os=ubuntu,version=7", // see https://github.com/canonical/dotnet-regular-tests/issues/6 + ], + "ignoredRIDs":[ + "centos.8", + "centos.9", + "linux-arm", + "linux-arm64", + "rhel.8", + "rhel.9" + ] +} diff -Nru dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/system-libunwind/test.sh dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/system-libunwind/test.sh --- dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/system-libunwind/test.sh 1970-01-01 00:00:00.000000000 +0000 +++ dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/system-libunwind/test.sh 2024-03-18 12:48:03.000000000 +0000 @@ -0,0 +1,32 @@ +#!/usr/bin/env bash + +set -euo pipefail +IFS=$'\n\t' +set -x + +framework_dir=$(../dotnet-directory --framework "$1") + +libcoreclr=${framework_dir}/libcoreclr.so + +ldd "$libcoreclr" + +set +e +ldd "$libcoreclr" | grep -F "libunwind.so" +retval=$? +set -e +if [ $retval -eq 0 ]; then + echo "libunwind found" + exit 0 +fi + +set +e +ldd "$libcoreclr" | grep -F "libunwind-$(uname -m).so" +retval=$? +set -e +if [ $retval -eq 0 ]; then + echo "libunwind-$(uname -m).so found" + exit 0 +fi + +echo "fail: No linkage to libunwind found" +exit 1 diff -Nru dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/system-openssl/test.json dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/system-openssl/test.json --- dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/system-openssl/test.json 1970-01-01 00:00:00.000000000 +0000 +++ dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/system-openssl/test.json 2024-03-18 12:48:03.000000000 +0000 @@ -0,0 +1,11 @@ +{ + "name": "system-openssl", + "enabled": true, + "requiresSdk": false, + "version": "2.1", + "versionSpecific": false, + "type": "bash", + "cleanup": true, + "ignoredRIDs":[ + ] +} diff -Nru dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/system-openssl/test.sh dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/system-openssl/test.sh --- dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/system-openssl/test.sh 1970-01-01 00:00:00.000000000 +0000 +++ dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/system-openssl/test.sh 2024-03-18 12:48:03.000000000 +0000 @@ -0,0 +1,26 @@ +#!/usr/bin/env bash + +# Make sure .NET has ldd-visible links to OpenSSL. We prefer that over +# using OpenSSL via dlopen (which is more likely to fail at runtime). + +set -euo pipefail +IFS=$'\n\t' +set -x + +dotnet_dir="$(../dotnet-directory)" + +find_ssl_args=("-regex" '.*System\.Security\.Cryptography\.Native\.OpenSsl\.so$') + +# print for debugging +find "${dotnet_dir}" \ + "${find_ssl_args[@]}" + +find "${dotnet_dir}" \ + "${find_ssl_args[@]}" \ + -exec ldd {} \; \ + | grep -E '(libcrypto|libssl)' + +find "${dotnet_dir}" \ + "${find_ssl_args[@]}" \ + -exec nm -D {} \; \ + | grep SSL diff -Nru dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/targeting-packs-bad-files/test.json dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/targeting-packs-bad-files/test.json --- dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/targeting-packs-bad-files/test.json 1970-01-01 00:00:00.000000000 +0000 +++ dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/targeting-packs-bad-files/test.json 2024-03-18 12:48:03.000000000 +0000 @@ -0,0 +1,16 @@ +{ + "name": "targeting-packs-bad-files", + "enabled": true, + "requiresSdk": true, + "version": "3.1", + "versionSpecific": false, + "type": "bash", + "cleanup": true, + "skipWhen": [ + "version=8", // see https://github.com/redhat-developer/dotnet-regular-tests/issues/251 + "version=9" // see https://github.com/redhat-developer/dotnet-regular-tests/issues/251 + ], + "ignoredRIDs":[ + + ] +} diff -Nru dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/targeting-packs-bad-files/test.sh dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/targeting-packs-bad-files/test.sh --- dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/targeting-packs-bad-files/test.sh 1970-01-01 00:00:00.000000000 +0000 +++ dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/targeting-packs-bad-files/test.sh 2024-03-18 12:48:03.000000000 +0000 @@ -0,0 +1,28 @@ +#!/usr/bin/env bash + +set -euo pipefail +IFS=$'\n\t' +set -x + +dotnet_dir=$(dirname "$(readlink -f "$(command -v dotnet)")") +echo "Found .NET at $dotnet_dir" + +errors=0 + +json_lines=$(find "$dotnet_dir/packs" -iname '*.json' | wc -l) +if [[ $json_lines -gt 0 ]]; then + echo "error: found some json files in $dotnet_dir/packs" + find "$dotnet_dir/packs" -iname '*.json' + errors=1 +fi + +debug_lines=$(find "$dotnet_dir/packs" -iname 'Debug' | wc -l) +if [[ $debug_lines -gt 0 ]]; then + echo "error: found some Debug files in $dotnet_dir/packs" + find "$dotnet_dir/packs" -iname 'Debug' + errors=1 +fi + +if [[ $errors -gt 0 ]]; then + exit 1 +fi diff -Nru dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/telemetry-is-off-by-default/test-telemetry-tcpdump.sh dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/telemetry-is-off-by-default/test-telemetry-tcpdump.sh --- dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/telemetry-is-off-by-default/test-telemetry-tcpdump.sh 1970-01-01 00:00:00.000000000 +0000 +++ dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/telemetry-is-off-by-default/test-telemetry-tcpdump.sh 2024-03-18 12:48:03.000000000 +0000 @@ -0,0 +1,54 @@ +#!/usr/bin/env bash + +# This test is *NOT* executed by default. + +set -euo pipefail +set -x +IFS=$'\n\t' + +# found via experimentation +telemetry_host=dc.services.visualstudio.com + +echo "testing telemetry data" +host ${telemetry_host} +sudo --non-interactive tcpdump host "${telemetry_host}" -vv >tcp.out 2>tcp.err & +sleep 2 +rm -rf WebTest +mkdir -p WebTest +pushd WebTest +dotnet new web >/dev/null 2>&1 || true +dotnet publish +popd +sleep 2 +sudo --non-interactive pkill tcpdump +sleep 2 + +cat tcp.out +cat tcp.err + +# tcp dump writes out 1-byte files when no data is captured +if [[ $(wc -c tcp.out | awk '{print $1}') != 1 ]]; then + echo "error: expected no captured packets" + exit 3 +fi + +echo "testing telemetry data is still sent to the same host" +host ${telemetry_host} +sudo --non-interactive tcpdump host "${telemetry_host}" -vv >tcp.out 2>tcp.err & +sleep 2 +export DOTNET_CLI_TELEMETRY_OPTOUT=0 +dotnet new globaljson >/dev/null 2>&1 || true +sleep 2 +sudo --non-interactive pkill tcpdump +sleep 2 + +cat tcp.out +cat tcp.err + +# tcp dump writes out 1-byte files when no data is captured +if [[ $(wc -c tcp.out | awk '{print $1}') == 1 ]]; then + echo "error: expected captured telemetry packets. is the telemetry being sent to a new location?" + exit 4 +fi + +echo "OK" diff -Nru dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/telemetry-is-off-by-default/test.json dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/telemetry-is-off-by-default/test.json --- dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/telemetry-is-off-by-default/test.json 1970-01-01 00:00:00.000000000 +0000 +++ dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/telemetry-is-off-by-default/test.json 2024-03-18 12:48:03.000000000 +0000 @@ -0,0 +1,14 @@ +{ + "name": "telemetry-is-off-by-default", + "enabled": true, + "requiresSdk": true, + "version": "2.0", + "versionSpecific": false, + "type": "bash", + "cleanup": true, + "skipWhen": [ + "vmr-ci,version=6" // pre .NET 7, the telemetry opt-out is patched by the rpm build. + ], + "ignoredRIDs":[ + ] +} diff -Nru dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/telemetry-is-off-by-default/test.sh dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/telemetry-is-off-by-default/test.sh --- dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/telemetry-is-off-by-default/test.sh 1970-01-01 00:00:00.000000000 +0000 +++ dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/telemetry-is-off-by-default/test.sh 2024-03-18 12:48:03.000000000 +0000 @@ -0,0 +1,51 @@ +#!/usr/bin/env bash + +# This test ensures telemetry is not being sent for (some) commands by +# checking that no network connections are being made when not +# expected. Relies on strace and IF_NET to detect network connections. +# +# A more robust version would be to use tcpdump to check for network +# connections on each command, but this is harder to do without root +# access. + +set -euo pipefail +IFS=$'\n\t' +set -x + +no_server=("/nodeReuse:false" "/p:UseSharedCompilation=false" "/p:UseRazorBuildServer=false") + +IFS='.-' read -ra VERSION_SPLIT <<< "$1" +DOTNET_MAJOR="${VERSION_SPLIT[0]}" + +rm -rf HelloWeb + +mkdir HelloWeb +pushd HelloWeb +strace -s 512 -e network -fo ../new.log dotnet new web --no-restore +strace -s 512 -e network -fo ../restore.log dotnet restore "${no_server[@]}" +strace -s 512 -e network -fo ../build.log dotnet build -c Release "${no_server[@]}" +popd +rm -rf HelloWeb + +if [[ $DOTNET_MAJOR -ge 6 ]]; then + # Unfortunately, dotnet build for .NET 6 (and later?) connects to + # api.nuget.org. That *should* be safe (and not a telemetry + # endpoint). So we can't just fail on any network connection. + # Let's explicitly check for the (known) telemetry endpoints. + if ! grep AF_INET build.log ; then + echo "OK, no AF_INET found" + elif grep "services.visualstudio.com" build.log; then + echo "Found a data packet involving services.visualstudio.com" + exit 1 + elif grep "monitor.azure.com" build.log; then + echo "Found a data packet involving monitor.azure.com" + exit 1 + fi +elif grep AF_INET build.log ; then + echo "IF_INET not expected in build.log" + exit 1 +else + echo "OK" +fi + +rm new.log restore.log build.log diff -Nru dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/template-test/test.json dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/template-test/test.json --- dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/template-test/test.json 1970-01-01 00:00:00.000000000 +0000 +++ dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/template-test/test.json 2024-03-18 12:48:03.000000000 +0000 @@ -0,0 +1,15 @@ +{ + "name": "template-test", + "enabled": true, + "requiresSdk": true, + "version": "2.1", + "versionSpecific": false, + "type": "bash", + "cleanup": true, + "timeoutMultiplier": 2, + "skipWhen": [ + "vmr-ci" // template packages not published + ], + "ignoredRIDs":[ + ] +} diff -Nru dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/template-test/test.sh dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/template-test/test.sh --- dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/template-test/test.sh 1970-01-01 00:00:00.000000000 +0000 +++ dotnet8-8.0.103-8.0.3/debian/tests/regular-tests/template-test/test.sh 2024-03-18 12:48:03.000000000 +0000 @@ -0,0 +1,396 @@ +#!/usr/bin/env bash + +# this file tests templates created by +# dotnet new