11#! /usr/bin/env bash
22
3- dotnet_runtime_version=" $2 "
3+ dotnet_sdk_version=" $2 "
4+ dotnet_runtime_version=" $3 "
45
56RESET=" \033[0m"
67RED=" \033[0;31m"
@@ -10,7 +11,7 @@ DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
1011
1112# Ensures every invocation of dotnet apps uses the same dotnet.exe
1213# Add $random to path to ensure tests don't expect dotnet to be in a particular path
13- export DOTNET_ROOT=" $HELIX_CORRELATION_PAYLOAD / dotnet"
14+ export DOTNET_ROOT=" $DIR /. dotnet$RANDOM "
1415
1516# Ensure dotnet comes first on PATH
1617export PATH=" $DOTNET_ROOT :$PATH :$DIR /node/bin"
4647# Call "sync" between "chmod" and execution to prevent "text file busy" error in Docker (aufs)
4748chmod +x " dotnet-install.sh" ; sync
4849
50+ ./dotnet-install.sh --version $dotnet_sdk_version --install-dir " $DOTNET_ROOT "
51+ if [ $? -ne 0 ]; then
52+ sdk_retries=3
53+ while [ $sdk_retries -gt 0 ]; do
54+ ./dotnet-install.sh --version $dotnet_sdk_version --install-dir " $DOTNET_ROOT "
55+ if [ $? -ne 0 ]; then
56+ let sdk_retries=sdk_retries-1
57+ echo -e " ${YELLOW} Failed to install .NET Core SDK $version . Retries left: $sdk_retries .${RESET} "
58+ else
59+ sdk_retries=0
60+ fi
61+ done
62+ fi
63+
4964./dotnet-install.sh --runtime dotnet --version $dotnet_runtime_version --install-dir " $DOTNET_ROOT "
5065if [ $? -ne 0 ]; then
5166 runtime_retries=3
7085# dontet-install.sh seems to affect the Linux filesystem and causes test flakiness unless we sync the filesystem before running tests
7186sync
7287
73- $DOTNET_ROOT /dotnet --list-sdks
74- $DOTNET_ROOT /dotnet --list-runtimes
75-
7688exit_code=0
7789echo " Restore: $DOTNET_ROOT /dotnet restore RunTests/RunTests.csproj --source https://api.nuget.org/v3/index.json --ignore-failed-sources..."
7890$DOTNET_ROOT /dotnet restore RunTests/RunTests.csproj --source https://api.nuget.org/v3/index.json --ignore-failed-sources
79- echo " Running tests: $DOTNET_ROOT /dotnet run --project RunTests/RunTests.csproj -- --target $1 --runtime $2 --queue $3 --arch $4 --quarantined $5 --ef $6 --aspnetruntime $7 --aspnetref $8 --helixTimeout $9 ..."
80- $DOTNET_ROOT /dotnet run --project RunTests/RunTests.csproj -- --target $1 --runtime $2 --queue $3 --arch $4 --quarantined $5 --ef $6 --aspnetruntime $7 --aspnetref $8 --helixTimeout $9
91+ echo " Running tests: $DOTNET_ROOT /dotnet run --project RunTests/RunTests.csproj -- --target $1 --sdk $2 --runtime $3 --queue $4 --arch $5 --quarantined $6 --ef $7 --aspnetruntime $8 --aspnetref $9 --helixTimeout ${10} ..."
92+ $DOTNET_ROOT /dotnet run --project RunTests/RunTests.csproj -- --target $1 --sdk $2 --runtime $3 --queue $4 --arch $5 --quarantined $6 --ef $7 --aspnetruntime $8 --aspnetref $9 --helixTimeout ${10}
8193exit_code=$?
8294echo " Finished tests...exit_code=$exit_code "
8395
0 commit comments