React to deprecation of Fedora.28.Amd64.Open (#10409)

This commit is contained in:
Nate McMaster 2019-05-22 10:59:04 -07:00 committed by GitHub
parent 72e2d13217
commit 52133ac431
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 57 additions and 29 deletions

View File

@ -1,9 +1,46 @@
#!/usr/bin/env bash #!/usr/bin/env bash
test_binary_path="$1"
dotnet_sdk_version="$2"
dotnet_runtime_version="$3"
helix_queue_name="$4"
RESET="\033[0m"
RED="\033[0;31m"
YELLOW="\033[0;33m"
MAGENTA="\033[0;95m"
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
# Ensures every invocation of dotnet apps uses the same dotnet.exe
# Add $random to path to ensure tests don't expect dotnet to be in a particular path
export DOTNET_ROOT="$DIR/.dotnet$RANDOM"
# Ensure dotnet comes first on PATH
export PATH="$DOTNET_ROOT:$PATH"
# Prevent fallback to global .NET locations. This ensures our tests use the shared frameworks we specify and don't rollforward to something else that might be installed on the machine
export DOTNET_MULTILEVEL_LOOKUP=0
# Avoid contaminating userprofiles
# Add $random to path to ensure tests don't expect home to be in a particular path
export DOTNET_CLI_HOME="$DIR/.home$RANDOM"
export DOTNET_SKIP_FIRST_TIME_EXPERIENCE=1
# Used by SkipOnHelix attribute
export helix="$helix_queue_name"
RESET="\033[0m"
RED="\033[0;31m"
YELLOW="\033[0;33m"
MAGENTA="\033[0;95m"
curl -o dotnet-install.sh -sSL https://dot.net/v1/dotnet-install.sh curl -o dotnet-install.sh -sSL https://dot.net/v1/dotnet-install.sh
if [ $? -ne 0 ]; then if [ $? -ne 0 ]; then
download_retries=3 download_retries=3
while [ $download_retries -gt 0 ]; do while [ $download_retries -gt 0 ]; do
curl -sSL https://dot.net/v1/dotnet-install.sh curl -o dotnet-install.sh -sSL https://dot.net/v1/dotnet-install.sh
if [ $? -ne 0 ]; then if [ $? -ne 0 ]; then
let download_retries=download_retries-1 let download_retries=download_retries-1
echo -e "${YELLOW}Failed to download dotnet-install.sh. Retries left: $download_retries.${RESET}" echo -e "${YELLOW}Failed to download dotnet-install.sh. Retries left: $download_retries.${RESET}"
@ -16,11 +53,11 @@ fi
# Call "sync" between "chmod" and execution to prevent "text file busy" error in Docker (aufs) # Call "sync" between "chmod" and execution to prevent "text file busy" error in Docker (aufs)
chmod +x "dotnet-install.sh"; sync chmod +x "dotnet-install.sh"; sync
./dotnet-install.sh --version $2 --install-dir $HELIX_CORRELATION_PAYLOAD/sdk ./dotnet-install.sh --version $dotnet_sdk_version --install-dir "$DOTNET_ROOT"
if [ $? -ne 0 ]; then if [ $? -ne 0 ]; then
sdk_retries=3 sdk_retries=3
while [ $sdk_retries -gt 0 ]; do while [ $sdk_retries -gt 0 ]; do
./dotnet-install.sh --version $2 --install-dir $HELIX_CORRELATION_PAYLOAD/sdk ./dotnet-install.sh --version $dotnet_sdk_version --install-dir "$DOTNET_ROOT"
if [ $? -ne 0 ]; then if [ $? -ne 0 ]; then
let sdk_retries=sdk_retries-1 let sdk_retries=sdk_retries-1
echo -e "${YELLOW}Failed to install .NET Core SDK $version. Retries left: $sdk_retries.${RESET}" echo -e "${YELLOW}Failed to install .NET Core SDK $version. Retries left: $sdk_retries.${RESET}"
@ -30,11 +67,11 @@ if [ $? -ne 0 ]; then
done done
fi fi
./dotnet-install.sh --runtime dotnet --version $3 --install-dir $HELIX_CORRELATION_PAYLOAD/sdk ./dotnet-install.sh --runtime dotnet --version $dotnet_runtime_version --install-dir "$DOTNET_ROOT"
if [ $? -ne 0 ]; then if [ $? -ne 0 ]; then
runtime_retries=3 runtime_retries=3
while [ $runtime_retries -gt 0 ]; do while [ $runtime_retries -gt 0 ]; do
./dotnet-install.sh --runtime dotnet --version $3 --install-dir $HELIX_CORRELATION_PAYLOAD/sdk ./dotnet-install.sh --runtime dotnet --version $dotnet_runtime_version --install-dir "$DOTNET_ROOT"
if [ $? -ne 0 ]; then if [ $? -ne 0 ]; then
let runtime_retries=runtime_retries-1 let runtime_retries=runtime_retries-1
echo -e "${YELLOW}Failed to install .NET Core runtime $version. Retries left: $runtime_retries.${RESET}" echo -e "${YELLOW}Failed to install .NET Core runtime $version. Retries left: $runtime_retries.${RESET}"
@ -44,23 +81,7 @@ if [ $? -ne 0 ]; then
done done
fi fi
export DOTNET_SKIP_FIRST_TIME_EXPERIENCE=1 $DOTNET_ROOT/dotnet vstest $test_binary_path -lt >discovered.txt
# Ensures every invocation of dotnet apps uses the same dotnet.exe
export DOTNET_ROOT="$HELIX_CORRELATION_PAYLOAD/sdk"
# Ensure dotnet comes first on PATH
export PATH="$DOTNET_ROOT:$PATH"
# Prevent fallback to global .NET locations. This ensures our tests use the shared frameworks we specify and don't rollforward to something else that might be installed on the machine
export DOTNET_MULTILEVEL_LOOKUP=0
# Avoid contaminating userprofiles
export DOTNET_CLI_HOME="$HELIX_CORRELATION_PAYLOAD/home"
export helix="$4"
$DOTNET_ROOT/dotnet vstest $1 -lt >discovered.txt
if grep -q "Exception thrown" discovered.txt; then if grep -q "Exception thrown" discovered.txt; then
echo -e "${RED}Exception thrown during test discovery${RESET}". echo -e "${RED}Exception thrown during test discovery${RESET}".
cat discovered.txt cat discovered.txt
@ -71,17 +92,18 @@ fi
# We need to specify all possible Flaky filters that apply to this environment, because the flaky attribute # We need to specify all possible Flaky filters that apply to this environment, because the flaky attribute
# only puts the explicit filter traits the user provided in the flaky attribute # only puts the explicit filter traits the user provided in the flaky attribute
# Filter syntax: https://github.com/Microsoft/vstest-docs/blob/master/docs/filter.md # Filter syntax: https://github.com/Microsoft/vstest-docs/blob/master/docs/filter.md
NONFLAKY_FILTER="Flaky:All!=true&Flaky:Helix:All!=true&Flaky:Helix:Queue:All!=true&Flaky:Helix:Queue:$HELIX!=true" NONFLAKY_FILTER="Flaky:All!=true&Flaky:Helix:All!=true&Flaky:Helix:Queue:All!=true&Flaky:Helix:Queue:$helix_queue_name!=true"
echo "Running non-flaky tests." echo "Running non-flaky tests."
$DOTNET_ROOT/dotnet vstest $1 --logger:trx --TestCaseFilter:"$NONFLAKY_FILTER" $DOTNET_ROOT/dotnet vstest $test_binary_path --logger:trx --TestCaseFilter:"$NONFLAKY_FILTER"
nonflaky_exitcode=$? nonflaky_exitcode=$?
if [ $nonflaky_exitcode != 0 ]; then if [ $nonflaky_exitcode != 0 ]; then
echo "Non-flaky tests failed!" 1>&2 echo "Non-flaky tests failed!" 1>&2
# DO NOT EXIT # DO NOT EXIT
fi fi
FLAKY_FILTER="Flaky:All=true|Flaky:Helix:All=true|Flaky:Helix:Queue:All=true|Flaky:Helix:Queue:$HELIX=true"
FLAKY_FILTER="Flaky:All=true|Flaky:Helix:All=true|Flaky:Helix:Queue:All=true|Flaky:Helix:Queue:$helix_queue_name=true"
echo "Running known-flaky tests." echo "Running known-flaky tests."
$DOTNET_ROOT/dotnet vstest $1 --TestCaseFilter:"$FLAKY_FILTER" $DOTNET_ROOT/dotnet vstest $test_binary_path --TestCaseFilter:"$FLAKY_FILTER"
if [ $? != 0 ]; then if [ $? != 0 ]; then
echo "Flaky tests failed!" 1>&2 echo "Flaky tests failed!" 1>&2
# DO NOT EXIT # DO NOT EXIT

View File

@ -23,7 +23,7 @@
<HelixAvailableTargetQueue Include="Debian.8.Amd64.Open" Platform="Linux" /> <HelixAvailableTargetQueue Include="Debian.8.Amd64.Open" Platform="Linux" />
<HelixAvailableTargetQueue Include="Debian.9.Amd64.Open" Platform="Linux" /> <HelixAvailableTargetQueue Include="Debian.9.Amd64.Open" Platform="Linux" />
<HelixAvailableTargetQueue Include="Redhat.7.Amd64.Open" Platform="Linux" /> <HelixAvailableTargetQueue Include="Redhat.7.Amd64.Open" Platform="Linux" />
<HelixAvailableTargetQueue Include="Fedora.28.Amd64.Open" Platform="Linux" /> <HelixAvailableTargetQueue Include="(Fedora.28.Amd64.Open)Ubuntu.1604.Amd64.Open@mcr.microsoft.com/dotnet-buildtools/prereqs:fedora-28-helix-09ca40b-20190508143249" Platform="Linux" />
<!-- TODO: re-enable Debian.9.Arm64.Open and Ubuntu.1804.Arm64.Open --> <!-- TODO: re-enable Debian.9.Arm64.Open and Ubuntu.1804.Arm64.Open -->
</ItemGroup> </ItemGroup>

View File

@ -60,6 +60,12 @@ Usage: dotnet build /t:Helix src/MyTestProject.csproj
<Target Name="_CreateHelixWorkItem" Condition="$(BuildHelixPayload)"> <Target Name="_CreateHelixWorkItem" Condition="$(BuildHelixPayload)">
<PropertyGroup>
<!-- Extract the effective queue name from this format "(name)host@dockerimage". This is sometimes used in test code to skip tests. -->
<_HelixFriendlyNameTargetQueue>$(HelixTargetQueue)</_HelixFriendlyNameTargetQueue>
<_HelixFriendlyNameTargetQueue Condition="$(HelixTargetQueue.Contains('@'))">$(HelixTargetQueue.Substring(1, $([MSBuild]::Subtract($(HelixTargetQueue.LastIndexOf(')')), 1))))</_HelixFriendlyNameTargetQueue>
</PropertyGroup>
<MSBuild Projects="$(MSBuildProjectFullPath)" Targets="_PublishHelixArchive" RemoveProperties="HelixTargetQueue;TestRunId" /> <MSBuild Projects="$(MSBuildProjectFullPath)" Targets="_PublishHelixArchive" RemoveProperties="HelixTargetQueue;TestRunId" />
<ConvertToAbsolutePath Paths="$(PublishDir)"> <ConvertToAbsolutePath Paths="$(PublishDir)">
@ -72,8 +78,8 @@ Usage: dotnet build /t:Helix src/MyTestProject.csproj
<TestAssembly>$(TargetFileName)</TestAssembly> <TestAssembly>$(TargetFileName)</TestAssembly>
<PreCommands>@(HelixPreCommand)</PreCommands> <PreCommands>@(HelixPreCommand)</PreCommands>
<PostCommands>@(HelixPostCommand)</PostCommands> <PostCommands>@(HelixPostCommand)</PostCommands>
<Command Condition="$(IsWindowsHelixQueue)">call runtests.cmd $(TargetFileName) $(TargetFrameworkIdentifier) $(NETCoreSdkVersion) $(MicrosoftNETCoreAppPackageVersion) $(HelixTargetQueue)</Command> <Command Condition="$(IsWindowsHelixQueue)">call runtests.cmd $(TargetFileName) $(TargetFrameworkIdentifier) $(NETCoreSdkVersion) $(MicrosoftNETCoreAppPackageVersion) $(_HelixFriendlyNameTargetQueue)</Command>
<Command Condition="!$(IsWindowsHelixQueue)">./runtests.sh $(TargetFileName) $(NETCoreSdkVersion) $(MicrosoftNETCoreAppPackageVersion) $(HelixTargetQueue)</Command> <Command Condition="!$(IsWindowsHelixQueue)">./runtests.sh $(TargetFileName) $(NETCoreSdkVersion) $(MicrosoftNETCoreAppPackageVersion) $(_HelixFriendlyNameTargetQueue)</Command>
<Timeout>$(HelixTimeout)</Timeout> <Timeout>$(HelixTimeout)</Timeout>
</HelixWorkItem> </HelixWorkItem>
</ItemGroup> </ItemGroup>