From 0c36f110aeadec9adcc639596c68cf5bb94809cd Mon Sep 17 00:00:00 2001 From: Driele Neves Ribeiro <35274978+drneve@users.noreply.github.com> Date: Wed, 24 Oct 2018 10:43:22 -0700 Subject: [PATCH] Verification test for .NET Runtime and SDK Linux packages (dotnet/core-setup#4087) Commit migrated from https://github.com/dotnet/core-setup/commit/164b133c29ca8fde84fd9b07a3219cea7acebc0a --- src/installer/test/scripts/linux-test/README.md | 49 +++ .../test/scripts/linux-test/RuntimeInstallation.sh | 244 +++++++++++++ .../test/scripts/linux-test/SdkInstallation.sh | 406 +++++++++++++++++++++ .../scripts/linux-test/VerificationTestOnDocker.sh | 30 ++ src/installer/test/scripts/linux-test/images.txt | 11 + 5 files changed, 740 insertions(+) create mode 100644 src/installer/test/scripts/linux-test/README.md create mode 100644 src/installer/test/scripts/linux-test/RuntimeInstallation.sh create mode 100644 src/installer/test/scripts/linux-test/SdkInstallation.sh create mode 100644 src/installer/test/scripts/linux-test/VerificationTestOnDocker.sh create mode 100644 src/installer/test/scripts/linux-test/images.txt diff --git a/src/installer/test/scripts/linux-test/README.md b/src/installer/test/scripts/linux-test/README.md new file mode 100644 index 0000000..8daff5c --- /dev/null +++ b/src/installer/test/scripts/linux-test/README.md @@ -0,0 +1,49 @@ +This project has the purpose to automate verification test for .NET Core Runtime and SDK linux packages. + +To have this test running in your local machine do the following steps: +1. Download VerificationTestOnDocker.sh, RuntimeInstallation.sh, SdkInstallation.sh, images.txt in the same folder +2. Update images.txt with images name you want to run the installation test +3. Run $ ./VerificationTestOnDocker.sh \ \ \ + +The options are: + +* \ + * runtime - verification test for .NET Core Runtime Linux packages + * sdk - verification test for .NET Core SDK Linux packages +* \ + * latest - install the latest available .NET Core package from our master repository + * \ - install the package corresponding to this version number +* \ + * install - verification test for install + * install uninstall - verification test for install and uninstall + + +The script VerificationTestOnDocker.sh is responsible for read a file (images.txt) containing docker images and run a docker container for each image specified in that file. Inside each container it will be executed the script to install .NET Runtime (RuntimeInstallation.sh) or .NET SDK (SdkInstallation.sh). + +Both scripts RuntimeInstallation.sh and SdkInstallation.sh automatically identify what distro and version is running in the current machine and can install and uninstall the latest version of .NET Core Runtime/Sdk packages corresponding to that distro & version. The installation's stdout for all containers is redirected to a single file (logfile.txt). In the end of this file (logfile.txt) it's also displayed the results of the test, printing for each distro and version the result 'failed' or 'passed'. + +.NET Core packages are downloaded from the blob https://dotnetcli.blob.core.windows.net/dotnet + +This project takes in account: + -> dotnet-sdk depends on dotnet-runtime and aspnet-runtime + -> aspnet-runtime depends on dotnet-runtime (can be different to what dotnet-sdk depends on) + -> dotnet-runtime-deps depends on system packages + -> .NET Core runtime carries: dotnet-runtime-deps, dotnet-host, dotnet-hostfxr and dotnet-runtime. + +Changes on how dotnet runtime packages are structured or modification on the packages dependencies may affect the verification test result. + +This verification test depends on docker images and the test result can be a false negative if the image doesn't carry some system packages required to have a proper runtime package installation. + + +The scrip allows automated test only for the following distro & version: + +| Distro | Version | +|--------|---------| +| Ubuntu | 14.04, 16.04, 17.10, 18.04 | +| Debian | 8, 9 | +| Centos | 7 | +| Fedora | 26, 27 | +| OpenSUSE | 42 | +| Oracle Linux | 7 | +| RHEL | 7 | +| SLES | 12 | diff --git a/src/installer/test/scripts/linux-test/RuntimeInstallation.sh b/src/installer/test/scripts/linux-test/RuntimeInstallation.sh new file mode 100644 index 0000000..c4ec682 --- /dev/null +++ b/src/installer/test/scripts/linux-test/RuntimeInstallation.sh @@ -0,0 +1,244 @@ +#!/bin/bash + +current_user=$(whoami) +if [ $current_user != "root" ]; then + echo "script requires superuser privileges to run" + exit 1 +fi + +source /etc/os-release +distro="$ID" +version="$VERSION_ID" +arch="x64" +result_file="/docker/result.txt" +log_file="/docker/logfile.txt" + +exec &>> $log_file + +if [ $ID == "ol" ] ; then + distro="oraclelinux" +fi +if [ "$distro" == "oraclelinux" ] || [ "$distro" == "rhel" ] || [ "$distro" == "opensuse" ] ; then + version=$(echo $version | cut -d . -f 1) +fi + +echo $distro:$version + +runtime_version=$1 +if [ "$runtime_version" == "latest" ] ; +then + BLOB_RUNTIME_DIR="https://dotnetcli.blob.core.windows.net/dotnet/Runtime/master" +else + BLOB_RUNTIME_DIR="https://dotnetcli.blob.core.windows.net/dotnet/Runtime/$runtime_version" +fi + +install_curl(){ + apt-get -y install curl + if [ $? -ne 0 ] ; then + apt-get update + apt-get -y install curl + fi +} +download_from_blob_deb(){ + BLOB_PATH=$1 + if curl --output /dev/null --head --fail $BLOB_PATH; then + curl -O -s $BLOB_PATH + else + echo "Could not extract file from blob" + exit 1 + fi +} +download_runtime_packages_deb(){ + download_from_blob_deb "$BLOB_RUNTIME_DIR/dotnet-runtime-deps-$runtime_version-$distro.$version-$arch.deb" + download_from_blob_deb "$BLOB_RUNTIME_DIR/dotnet-host-$runtime_version-$arch.deb" + download_from_blob_deb "$BLOB_RUNTIME_DIR/dotnet-hostfxr-$runtime_version-$arch.deb" + download_from_blob_deb "$BLOB_RUNTIME_DIR/dotnet-runtime-$runtime_version-$arch.deb" +} +install_runtime_packages_deb(){ + dpkg -i dotnet-runtime-deps-$runtime_version-$distro.$version-$arch.deb + apt-get install -f -y + dpkg -i *.deb +} +determine_runtime_version_deb(){ + if [ "$runtime_version" == "latest" ] ; then + runtime_version=$(dpkg-deb -f dotnet-runtime-latest-$arch.deb Package) + runtime_version=${runtime_version#dotnet-runtime-} + fi +} +check_if_runtime_is_installed_deb(){ + find_runtime=$(apt list --installed | grep dotnet-runtime-$runtime_version) + if [ "$find_runtime" == "" ] ; then + echo "Not able to remove runtime $runtime_version because it is not installed" + exit 1 + fi +} +uninstall_runtime_deb(){ + apt-get remove -y $(apt list --installed | grep -e dotnet | cut -d "/" -f 1) + runtime_installed_packages=$(apt list --installed | grep -e dotnet) +} +install_wget_yum(){ + yum install -y wget +} +install_wget_zypper(){ + zypper --non-interactive install wget +} +download_from_blob_rpm(){ + BLOB_PATH=$1 + if wget --spider $BLOB_PATH; then + wget -nv $BLOB_PATH + else + echo "Could not extract file from blob" + exit 1 + fi +} +download_runtime_packages_rpm(){ + download_from_blob_rpm "$BLOB_RUNTIME_DIR/dotnet-runtime-deps-$runtime_version-$distro.$version-$arch.rpm" + download_from_blob_rpm "$BLOB_RUNTIME_DIR/dotnet-host-$runtime_version-$arch.rpm" + download_from_blob_rpm "$BLOB_RUNTIME_DIR/dotnet-hostfxr-$runtime_version-$arch.rpm" + download_from_blob_rpm "$BLOB_RUNTIME_DIR/dotnet-runtime-$runtime_version-$arch.rpm" +} +install_runtime_packages_yum(){ + yum localinstall -y dotnet-runtime-deps-$runtime_version-$distro.$version-$arch.rpm + rm dotnet-runtime-deps-$runtime_version-$distro.$version-$arch.rpm + rpm -Uvh *.rpm +} +install_runtime_packages_zypper(){ + zypper --no-gpg-checks --non-interactive in ./dotnet-runtime-deps-$runtime_version-$distro.$version-$arch.rpm + rm dotnet-runtime-deps-$runtime_version-$distro.$version-$arch.rpm + rpm -Uvh *.rpm +} +determine_runtime_version_rpm(){ + if [ "$runtime_version" == "latest" ] ; then + runtime_version=$(rpm -qip dotnet-runtime-latest-$arch.rpm | grep Version) + runtime_version=$(echo $runtime_version | cut -d ":" -f 2) + runtime_version=$(echo $runtime_version | tr _ -) + fi +} +check_if_runtime_is_installed_rpm(){ + find_runtime=$(rpm -qa | grep dotnet-runtime-$runtime_version) + if [ "$find_runtime" == "" ] ; then + echo "Not able to remove runtime $runtime_version because it is not installed" + exit 1 + fi +} +uninstall_runtime_yum(){ + yum remove -y $(rpm -qa | grep -e dotnet) + runtime_installed_packages=$(rpm -qa | grep -e dotnet) +} +uninstall_runtime_zypper(){ + zypper -n rm $(rpm -qa | grep -e dotnet) + runtime_installed_packages=$(rpm -qa | grep -e dotnet) +} +determine_success_install(){ + if [ -e $result_file ] ; then + installed_runtime=$(dotnet --list-runtimes | grep $runtime_version) + if [ "$installed_runtime" != "" ] ; then + success_install=1 + else + success_install=0 + fi + fi +} +test_result_install(){ + if [ -e $result_file ] ; then + if [ $success_install -eq 1 ] ; then + echo "$distro:$version install -> passed" >> $result_file + else + echo "$distro:$version install -> failed" >> $result_file + fi + fi +} +uninstall_latest_runtime_warning(){ + if [ "$runtime_version" == "latest" ] ; then + echo "Specify runtime version to unistall. Type dotnet --list-runtimes to see runtimes versions installed" + exit 1 + fi +} +test_result_uninstall(){ + if [ "$runtime_installed_packages" == "" ] ; then + success_uninstall=1 + else + success_uninstall=0 + fi + if [ -e $result_file ] ; then + if [ $success_uninstall -eq 1 ] ; then + echo "$distro:$version uninstall -> passed" >> $result_file + else + echo "$distro:$version uninstall -> failed" >> $result_file + fi + fi +} + +if [ "$distro" == "ubuntu" ] || [ "$distro" == "debian" ] ; then + if [ "$2" == "install" ] ; then + install_curl + + download_runtime_packages_deb + install_runtime_packages_deb + dotnet --list-runtimes + + determine_runtime_version_deb + determine_success_install + test_result_install + + elif [ "$2" == "uninstall" ] ; then + uninstall_latest_runtime_warning + fi + + if [ "$3" == "uninstall" ] || [ "$2" == "uninstall" ] ; then + check_if_runtime_is_installed_deb + uninstall_runtime_deb + test_result_uninstall + fi + +elif [ "$distro" == "fedora" ] || [ "$distro" == "centos" ] || [ "$distro" == "oraclelinux" ] || [ "$distro" == "rhel" ] ; then + if [ "$2" == "install" ] ; then + install_wget_yum + + download_runtime_packages_rpm + install_runtime_packages_yum + + dotnet --list-runtimes + + determine_runtime_version_rpm + determine_success_install + test_result_install + + elif [ "$2" == "uninstall" ] ; then + uninstall_latest_runtime_warning + fi + if [ "$3" == "uninstall" ] || [ "$2" == "uninstall" ] ; then + check_if_runtime_is_installed_rpm + uninstall_runtime_yum + test_result_uninstall + fi + +elif [ "$distro" == "opensuse" ] || [ "$distro" == "sles" ] ; then + if [ "$2" == "install" ] ; then + install_wget_zypper + + download_runtime_packages_rpm + install_runtime_packages_zypper + dotnet --list-runtimes + + determine_runtime_version_rpm + determine_success_install + test_result_install + + elif [ "$2" == "uninstall" ] ; then + uninstall_latest_runtime_warning + fi + + if [ "$3" == "uninstall" ] || [ "$2" == "uninstall" ] ; then + check_if_runtime_is_installed_rpm + uninstall_runtime_zypper + test_result_uninstall + fi +fi + +if [ -e $log_file ] ; then + ch=$(printf "%-160s" "-") + echo "${ch// /-} " +fi + + diff --git a/src/installer/test/scripts/linux-test/SdkInstallation.sh b/src/installer/test/scripts/linux-test/SdkInstallation.sh new file mode 100644 index 0000000..b2e068d --- /dev/null +++ b/src/installer/test/scripts/linux-test/SdkInstallation.sh @@ -0,0 +1,406 @@ +#!/bin/bash + +current_user=$(whoami) +if [ $current_user != "root" ]; then + echo "script requires superuser privileges to run" + exit 1 +fi + +source /etc/os-release +distro="$ID" +version="$VERSION_ID" +arch="x64" +result_file="/docker/result.txt" +log_file="/docker/logfile.txt" + +exec &>> $log_file + +if [ $ID == "ol" ] ; then + distro="oraclelinux" +fi +if [ "$distro" == "oraclelinux" ] || [ "$distro" == "rhel" ] || [ "$distro" == "opensuse" ] ; then + version=$(echo $version | cut -d . -f 1) +fi + +echo $distro:$version + +sdk_version=$1 + +BLOB_RUNTIME_DIR="https://dotnetcli.blob.core.windows.net/dotnet/Runtime" +BLOB_SDK_DIR="https://dotnetcli.blob.core.windows.net/dotnet/Sdk" +BLOB_ASPNET_DIR="https://dotnetcli.blob.core.windows.net/dotnet/aspnetcore/Runtime" + +install_curl(){ + apt-get -y install curl + if [ $? -ne 0 ] ; then + apt-get update + apt-get -y install curl + fi +} +download_from_blob_deb(){ + BLOB_PATH=$1 + if curl --output /dev/null --head --fail $BLOB_PATH; then + curl -O -s $BLOB_PATH + else + echo "Could not extract file from blob" + exit 1 + fi +} +download_sdk_package_deb(){ + if [ "$sdk_version" == "latest" ] ; then + download_from_blob_deb "$BLOB_SDK_DIR/master/dotnet-sdk-latest-$arch.deb" + else + download_from_blob_deb "$BLOB_SDK_DIR/$sdk_version/dotnet-sdk-$sdk_version-$arch.deb" + fi +} +download_aspnet_package_deb(){ + download_from_blob_deb "$BLOB_ASPNET_DIR/$aspnet_version/aspnetcore-runtime-$aspnet_version-$arch.deb" +} +determine_aspnet_version_install_deb(){ + aspnet_version=$(dpkg -I dotnet-sdk-$sdk_version-$arch.deb | grep -o 'aspnetcore-runtime-[^ ]*') + aspnet_version=${aspnet_version#aspnetcore-runtime-} + [ "${aspnet_version: -1}" == "," ] && aspnet_version=${aspnet_version%,} +} +determine_runtime_sdk_install_deb(){ + runtime_sdk=$(dpkg -I dotnet-sdk-$sdk_version-$arch.deb | grep -o 'dotnet-runtime-[^ ]*') + runtime_sdk=${runtime_sdk#dotnet-runtime-} + [ "${runtime_sdk: -1}" == "," ] && runtime_sdk=${runtime_sdk%,} +} +determine_runtime_aspnet_install_deb(){ + runtime_aspnet=$(dpkg -I aspnetcore-runtime-$aspnet_version-$arch.deb | grep -o 'dotnet-runtime[^ ]*') + runtime_aspnet=${runtime_aspnet#dotnet-runtime-} + [ "${runtime_aspnet: -1}" == "," ] && runtime_sdk=${runtime_aspnet%,} +} +download_runtime_packages_deb(){ + download_from_blob_deb "$BLOB_RUNTIME_DIR/$runtime_version/dotnet-runtime-deps-$runtime_version-$distro.$version-$arch.deb" + download_from_blob_deb "$BLOB_RUNTIME_DIR/$runtime_version/dotnet-host-$runtime_version-$arch.deb" + download_from_blob_deb "$BLOB_RUNTIME_DIR/$runtime_version/dotnet-hostfxr-$runtime_version-$arch.deb" + download_from_blob_deb "$BLOB_RUNTIME_DIR/$runtime_version/dotnet-runtime-$runtime_version-$arch.deb" +} +install_runtime_packages_deb(){ + dpkg -i dotnet-runtime-deps-$runtime_version-$distro.$version-$arch.deb + apt-get install -f -y + dpkg -i *.deb +} +install_aspnet_and_sdk_deb(){ + dpkg -i aspnetcore-runtime-$aspnet_version-$arch.deb + dpkg -i dotnet-sdk-$sdk_version-$arch.deb +} +check_if_sdk_is_installed_deb(){ + find_sdk=$(apt list --installed | grep dotnet-sdk-$sdk_version) + if [ "$find_sdk" == "" ] ; then + echo "Not able to remove sdk $sdk_version because it is not installed" + exit 1 + fi +} +determine_runtime_sdk_uninstall_deb(){ + runtime_sdk=$(apt-cache depends dotnet-sdk-$sdk_version | grep -o 'dotnet-runtime-[^ ]*') + runtime_sdk=${runtime_sdk#dotnet-runtime-} +} +determine_aspnet_package_name_uninstall_deb(){ + aspnet_package_name=$(apt-cache depends dotnet-sdk-$sdk_version | grep -o 'aspnetcore-runtime-[^ ]*') +} +determine_runtime_aspnet_uninstall_deb(){ + runtime_aspnet=$(apt-cache depends $aspnet_package_name | grep -o 'dotnet-runtime-[^ ]*') + runtime_aspnet=${runtime_aspnet#dotnet-runtime-} +} +uninstall_dotnet_deb(){ + apt-get remove -y $(apt list --installed | grep -e dotnet -e aspnet | cut -d "/" -f 1) + dotnet_installed_packages=$(apt list --installed | grep -e dotnet -e aspnet) +} + +install_wget_yum(){ + yum install -y wget +} +install_wget_zypper(){ + zypper --non-interactive install wget +} +download_from_blob_rpm(){ + BLOB_PATH=$1 + if wget --spider $BLOB_PATH; then + wget -nv $BLOB_PATH + else + echo "Could not extract file from blob" + exit 1 + fi +} +download_sdk_package_rpm(){ + if [ "$sdk_version" == "latest" ] ; then + download_from_blob_rpm "$BLOB_SDK_DIR/master/dotnet-sdk-latest-$arch.rpm" + else + download_from_blob_rpm "$BLOB_SDK_DIR/$sdk_version/dotnet-sdk-$sdk_version-$arch.rpm" + fi +} +download_aspnet_package_rpm(){ + download_from_blob_rpm "$BLOB_ASPNET_DIR/$aspnet_version/aspnetcore-runtime-$aspnet_version-$arch.rpm" +} +determine_aspnet_version_install_rpm(){ + aspnet_version=$(rpm -qpR dotnet-sdk-$sdk_version-$arch.rpm | grep -o 'aspnetcore-runtime-[^ ]*') + aspnet_version=${aspnet_version#aspnetcore-runtime-} +} +determine_runtime_aspnet_install_rpm(){ + runtime_aspnet=$(rpm -qpR aspnetcore-runtime-$aspnet_version-$arch.rpm | grep -o 'dotnet-runtime[^ ]*') + runtime_aspnet=${runtime_aspnet#dotnet-runtime-} +} +determine_runtime_sdk_install_rpm(){ + runtime_sdk=$(rpm -qpR dotnet-sdk-$sdk_version-$arch.rpm | grep -o 'dotnet-runtime-[^ ]*') + runtime_sdk=${runtime_sdk#dotnet-runtime-} + +} +download_runtime_packages_rpm(){ + download_from_blob_rpm "$BLOB_RUNTIME_DIR/$runtime_version/dotnet-runtime-deps-$runtime_version-$distro.$version-$arch.rpm" + download_from_blob_rpm "$BLOB_RUNTIME_DIR/$runtime_version/dotnet-host-$runtime_version-$arch.rpm" + download_from_blob_rpm "$BLOB_RUNTIME_DIR/$runtime_version/dotnet-hostfxr-$runtime_version-$arch.rpm" + download_from_blob_rpm "$BLOB_RUNTIME_DIR/$runtime_version/dotnet-runtime-$runtime_version-$arch.rpm" +} +install_runtime_deps_package_yum(){ + yum localinstall -y dotnet-runtime-deps-$runtime_version-$distro.$version-$arch.rpm + rm dotnet-runtime-deps-$runtime_version-$distro.$version-$arch.rpm +} +install_rpm_from_folder(){ + rpm -Uvh *.rpm +} +install_runtime_deps_package_zypper(){ + zypper --no-gpg-checks --non-interactive in ./dotnet-runtime-deps-$runtime_version-$distro.$version-$arch.rpm + rm dotnet-runtime-deps-$runtime_version-$distro.$version-$arch.rpm +} +install_aspnet_and_sdk_rpm(){ + rpm -i aspnetcore-runtime-$aspnet_version-$arch.rpm + rpm -i dotnet-sdk-$sdk_version-$arch.rpm +} +check_if_sdk_is_installed_rpm(){ + find_sdk=$(rpm -qa | grep dotnet-sdk-$sdk_version) + if [ "$find_sdk" == "" ] ; + then + echo "Not able to remove sdk $sdk_version because it is not installed" + exit 1 + fi +} +determine_runtime_sdk_uninstall_rpm(){ + runtime_sdk=$(rpm -q --requires dotnet-sdk-$sdk_version | grep -o 'dotnet-runtime-[^ ]*') + runtime_sdk=${runtime_sdk#dotnet-runtime-} +} +determine_aspnet_package_name_uninstall_rpm(){ + aspnet_package_name=$(rpm -q --requires dotnet-sdk-$sdk_version | grep -o 'aspnetcore-runtime-[^ ]*') +} +determine_runtime_aspnet_uninstall_rpm(){ + runtime_aspnet=$(rpm -q --requires $aspnet_package_name | grep -o 'dotnet-runtime-[^ ]*') + runtime_aspnet=${runtime_aspnet#dotnet-runtime-} +} +uninstall_dotnet_yum(){ + yum remove -y $(rpm -qa | grep -e dotnet -e aspnet) + dotnet_installed_packages=$(rpm -qa | grep -e dotnet -e aspnet) +} +uninstall_dotnet_zypper(){ + zypper -n rm $(rpm -qa | grep -e dotnet -e aspnet) + dotnet_installed_packages=$(rpm -qa | grep -e dotnet -e aspnet) +} +checkout_new_folder(){ + mkdir temp_folder + cd temp_folder +} +checkout_previous_folder(){ + cd .. +} +run_app(){ + if [ -e $result_file ] ; then + dotnet new console -o dockerApp + cd dockerApp + dotnet restore -s https://dotnet.myget.org/F/dotnet-core/api/v3/index.json + project_output=$(dotnet run) + if [ "$project_output" == 'Hello World!' ] ; + then + sucess_install=1; + else + sucess_install=0; + fi + fi +} +test_result_install(){ + if [ -e $result_file ] ; then + if [ $sucess_install -eq 1 ] ; then + echo "$distro:$version install -> passed" >> $result_file + else + echo "$distro:$version install -> failed" >> $result_file + fi + fi +} +test_result_uninstall(){ + + if [ "$dotnet_installed_packages" == "" ] ; then + sucess_uninstall=1; + else + sucess_uninstall=0; + fi + + if [ -e $result_file ] ; then + if [ $sucess_uninstall -eq 1 ] ; then + echo "$distro:$version uninstall -> passed" >> $result_file + else + echo "$distro:$version uninstall -> failed" >> $result_file + fi + fi +} +uninstall_latest_sdk_warning(){ + if [ "$sdk_version" == "latest" ] ; then + echo "Specify sdk version to unistall. Type dotnet --list-sdks to see sdks versions installed" + exit 1 + fi +} + +if [ "$distro" == "ubuntu" ] || [ "$distro" == "debian" ] ; then + if [ "$2" == "install" ] ; then + install_curl + + download_sdk_package_deb + + determine_aspnet_version_install_deb + download_aspnet_package_deb + + determine_runtime_aspnet_install_deb + determine_runtime_sdk_install_deb + + runtime_version="$runtime_aspnet" + download_runtime_packages_deb + install_runtime_packages_deb + + if [ "$runtime_aspnet" != "$runtime_sdk" ] ; then + runtime_version="$runtime_sdk" + checkout_new_folder + download_runtime_packages_deb + install_runtime_packages_deb + checkout_previous_folder + fi + + install_aspnet_and_sdk_deb + + dotnet --list-runtimes + dotnet --list-sdks + + run_app + test_result_install + + elif [ "$2" == "uninstall" ] ; then + uninstall_latest_sdk_warning + check_if_sdk_is_installed_deb + + determine_runtime_sdk_uninstall_deb + determine_aspnet_package_name_uninstall_deb + determine_runtime_aspnet_uninstall_deb + + fi + + if [ "$3" == "uninstall" ] && [ $sucess_install -eq 1 ] || [ "$2" == "uninstall" ] ; then + uninstall_dotnet_deb + test_result_uninstall + fi + +elif [ "$distro" == "fedora" ] || [ "$distro" == "centos" ] || [ "$distro" == "oraclelinux" ] || [ "$distro" == "rhel" ] ; then + if [ "$2" == "install" ] ; then + install_wget_yum + + download_sdk_package_rpm + + determine_aspnet_version_install_rpm + download_aspnet_package_rpm + + determine_runtime_aspnet_install_rpm + determine_runtime_sdk_install_rpm + + checkout_new_folder + runtime_version="$runtime_aspnet" + download_runtime_packages_rpm + install_runtime_deps_package_yum + + if [ "$runtime_aspnet" != "$runtime_sdk" ] ; then + runtime_version="$runtime_sdk" + download_runtime_packages_rpm + install_runtime_deps_package_yum + fi + install_rpm_from_folder + checkout_previous_folder + + install_aspnet_and_sdk_rpm + + dotnet --list-runtimes + dotnet --list-sdks + + run_app + test_result_install + + elif [ "$2" == "uninstall" ] ; then + uninstall_latest_sdk_warning + check_if_sdk_is_installed_rpm + + determine_runtime_sdk_uninstall_rpm + determine_aspnet_package_name_uninstall_rpm + determine_runtime_aspnet_uninstall_rpm + + echo $runtime_sdk + echo $runtime_aspnet + + fi + if [ "$3" == "uninstall" ] && [ $sucess_install -eq 1 ]|| [ "$2" == "uninstall" ] ; then + uninstall_dotnet_yum + test_result_uninstall + fi + + +elif [ "$distro" == "opensuse" ] || [ "$distro" == "sles" ] ; then + if [ "$2" == "install" ] ; then + install_wget_zypper + + download_sdk_package_rpm + + determine_aspnet_version_install_rpm + download_aspnet_package_rpm + + determine_runtime_aspnet_install_rpm + determine_runtime_sdk_install_rpm + + checkout_new_folder + runtime_version="$runtime_aspnet" + download_runtime_packages_rpm + install_runtime_deps_package_zypper + + if [ "$runtime_aspnet" != "$runtime_sdk" ] ; then + runtime_version="$runtime_sdk" + download_runtime_packages_rpm + install_runtime_deps_package_zypper + fi + + install_rpm_from_folder + checkout_previous_folder + + install_aspnet_and_sdk_rpm + + dotnet --list-runtimes + dotnet --list-sdks + + run_app + test_result_install + + elif [ "$2" == "uninstall" ] ; then + uninstall_latest_sdk_warning + check_if_sdk_is_installed_rpm + + determine_runtime_sdk_uninstall_rpm + determine_aspnet_package_name_uninstall_rpm + determine_runtime_aspnet_uninstall_rpm + + echo $runtime_sdk + echo $runtime_aspnet + + fi + + if [ "$3" == "uninstall" ] && [ $sucess_install -eq 1 ] || [ "$2" == "uninstall" ] ; then + uninstall_dotnet_zypper + test_result_uninstall + fi +fi + +if [ -e $log_file ] ; then + ch=$(printf "%-160s" "-") + echo "${ch// /-} " +fi + diff --git a/src/installer/test/scripts/linux-test/VerificationTestOnDocker.sh b/src/installer/test/scripts/linux-test/VerificationTestOnDocker.sh new file mode 100644 index 0000000..16fce03 --- /dev/null +++ b/src/installer/test/scripts/linux-test/VerificationTestOnDocker.sh @@ -0,0 +1,30 @@ +#!/bin/bash + +InstallationTestResult="result.txt" +InstallationTestLogFile="logfile.txt" +ImagesFile="images.txt" + +current_user=$(whoami) +if [ $current_user != "root" ]; then + echo "test.sh requires superuser privileges to run" + exit 1 +fi + +if [ -e $InstallationTestLogFile ] ; then + rm $InstallationTestLogFile -f +fi + +if [ "$1" == "sdk" ] ; then + InstallationScript="SdkInstallation.sh" + echo -e ".NET Core SDK varification test result\n" > $InstallationTestResult +elif [ "$1" == "runtime" ] ; then + InstallationScript="RuntimeInstallation.sh" + echo -e ".NET Core Runtime varification test result\n" > $InstallationTestResult +fi + +while IFS='' read -r image || [[ -n "$image" ]]; do + echo $image + docker run --rm -v $(pwd):/docker -t $image /bin/bash /docker/$InstallationScript $2 $3 $4 +done <$ImagesFile + +cat $InstallationTestResult >> $InstallationTestLogFile diff --git a/src/installer/test/scripts/linux-test/images.txt b/src/installer/test/scripts/linux-test/images.txt new file mode 100644 index 0000000..d4464f1 --- /dev/null +++ b/src/installer/test/scripts/linux-test/images.txt @@ -0,0 +1,11 @@ +ubuntu:14.04 +ubuntu:16.04 +ubuntu:17.10 +ubuntu:18.04 +debian:8 +debian:9 +centos:7 +fedora:26 +fedora:27 +opensuse:42.2 +oraclelinux:7 -- 2.7.4