Просмотр исходного кода

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

Nate McMaster 6 лет назад
Родитель
Сommit
52133ac431
3 измененных файлов с 57 добавлено и 29 удалено
  1. 48 26
      eng/helix/content/runtests.sh
  2. 1 1
      eng/targets/Helix.Common.props
  3. 8 2
      eng/targets/Helix.targets

+ 48 - 26
eng/helix/content/runtests.sh

@@ -1,9 +1,46 @@
 #!/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
 if [ $? -ne 0 ]; then
     download_retries=3
     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
             let download_retries=download_retries-1
             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)
 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
     sdk_retries=3
     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
             let sdk_retries=sdk_retries-1
             echo -e "${YELLOW}Failed to install .NET Core SDK $version. Retries left: $sdk_retries.${RESET}"
@@ -30,11 +67,11 @@ if [ $? -ne 0 ]; then
     done
 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
     runtime_retries=3
     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
             let runtime_retries=runtime_retries-1
             echo -e "${YELLOW}Failed to install .NET Core runtime $version. Retries left: $runtime_retries.${RESET}"
@@ -44,23 +81,7 @@ if [ $? -ne 0 ]; then
     done
 fi
 
-export DOTNET_SKIP_FIRST_TIME_EXPERIENCE=1
-
-# 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
+$DOTNET_ROOT/dotnet vstest $test_binary_path -lt >discovered.txt
 if grep -q "Exception thrown" discovered.txt; then
     echo -e "${RED}Exception thrown during test discovery${RESET}".
     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
 # 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
-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."
-$DOTNET_ROOT/dotnet vstest $1 --logger:trx --TestCaseFilter:"$NONFLAKY_FILTER"
+$DOTNET_ROOT/dotnet vstest $test_binary_path --logger:trx --TestCaseFilter:"$NONFLAKY_FILTER"
 nonflaky_exitcode=$?
 if [ $nonflaky_exitcode != 0 ]; then
     echo "Non-flaky tests failed!" 1>&2
     # DO NOT EXIT
 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."
-$DOTNET_ROOT/dotnet vstest $1 --TestCaseFilter:"$FLAKY_FILTER"
+$DOTNET_ROOT/dotnet vstest $test_binary_path --TestCaseFilter:"$FLAKY_FILTER"
 if [ $? != 0 ]; then
     echo "Flaky tests failed!" 1>&2
     # DO NOT EXIT

+ 1 - 1
eng/targets/Helix.Common.props

@@ -23,7 +23,7 @@
     <HelixAvailableTargetQueue Include="Debian.8.Amd64.Open" Platform="Linux" />
     <HelixAvailableTargetQueue Include="Debian.9.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)[email protected]/dotnet-buildtools/prereqs:fedora-28-helix-09ca40b-20190508143249" Platform="Linux" />
 
     <!--  TODO: re-enable Debian.9.Arm64.Open and Ubuntu.1804.Arm64.Open    -->
   </ItemGroup>

+ 8 - 2
eng/targets/Helix.targets

@@ -60,6 +60,12 @@ Usage: dotnet build /t:Helix src/MyTestProject.csproj
 
   <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" />
 
     <ConvertToAbsolutePath Paths="$(PublishDir)">
@@ -72,8 +78,8 @@ Usage: dotnet build /t:Helix src/MyTestProject.csproj
         <TestAssembly>$(TargetFileName)</TestAssembly>
         <PreCommands>@(HelixPreCommand)</PreCommands>
         <PostCommands>@(HelixPostCommand)</PostCommands>
-        <Command Condition="$(IsWindowsHelixQueue)">call runtests.cmd $(TargetFileName) $(TargetFrameworkIdentifier) $(NETCoreSdkVersion) $(MicrosoftNETCoreAppPackageVersion) $(HelixTargetQueue)</Command>
-        <Command Condition="!$(IsWindowsHelixQueue)">./runtests.sh $(TargetFileName) $(NETCoreSdkVersion) $(MicrosoftNETCoreAppPackageVersion) $(HelixTargetQueue)</Command>
+        <Command Condition="$(IsWindowsHelixQueue)">call runtests.cmd $(TargetFileName) $(TargetFrameworkIdentifier) $(NETCoreSdkVersion) $(MicrosoftNETCoreAppPackageVersion) $(_HelixFriendlyNameTargetQueue)</Command>
+        <Command Condition="!$(IsWindowsHelixQueue)">./runtests.sh $(TargetFileName) $(NETCoreSdkVersion) $(MicrosoftNETCoreAppPackageVersion) $(_HelixFriendlyNameTargetQueue)</Command>
         <Timeout>$(HelixTimeout)</Timeout>
       </HelixWorkItem>
     </ItemGroup>