Merge pull request #17161 from dotnetrt/testbuild
[platform/upstream/coreclr.git] / tests / helixprep.proj
index 0042b3a..2d08e91 100644 (file)
@@ -1,16 +1,14 @@
 <Project ToolsVersion="12.0" DefaultTargets="ArchiveAll" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
 
-  <UsingTask TaskName="ZipFileCreateFromDirectory" AssemblyFile="$(ToolsDir)\net45\Microsoft.DotNet.Build.Tasks.dll"/>
+  <UsingTask TaskName="ZipFileCreateFromDirectory" AssemblyFile="$(ToolsDir)\net46\Microsoft.DotNet.Build.Tasks.dll"/>
   
   <Import Project="dir.props" />
   <Import Project="..\dir.props" />
 
   <PropertyGroup>
     <DiscoveryDirectory>$(TestWorkingDir)</DiscoveryDirectory>
-    <CoreRootDir Condition="'$(RuntimeID)' == '' ">$(CORE_ROOT)</CoreRootDir>
-    <CoreRootDir Condition="'$(RuntimeID)' != '' ">$(CORE_OVERLAY)</CoreRootDir>
-    <CoreRootName Condition="'$(RuntimeID)' == '' ">Core_Root_Windows_NT-$(__BuildArch)</CoreRootName>
-    <CoreRootName Condition="'$(RuntimeID)' != '' ">Core_Root_$(RuntimeID)</CoreRootName>
+    <CoreRootDir>$(CORE_ROOT)</CoreRootDir>
+    <CoreRootName>Core_Root_$(RuntimeID)</CoreRootName>
   </PropertyGroup>
 
   <ItemGroup>
@@ -47,6 +45,7 @@
     <Delete Files="@(RequiresSigningFilesToDelete)" />
     <MSBuild Projects="helixprep.proj"
              Properties="BuildPath=%(XunitDlls.RootDir)%(XunitDlls.Directory);ProjectName=%(XunitDlls.Filename);BuildArchiveDir=$(TestWorkingDir)archive\tests\"
+             BuildInParallel="true"
              Targets="ArchiveBuild" />
   </Target>
 
 
   <!-- Generate wrapper .cmd file for an Xunit wrapper -->
   <Target Name="GenerateWrapperCmd"
-    Condition="'$(RuntimeID)' == '' ">
+    Condition="'$(TargetsWindows)' == 'true' ">
 
     <PropertyGroup>
+      <CmdCrossgenVar Condition="'$(Crossgen)' == 'true'">set RunCrossGen=true</CmdCrossgenVar>
       <WrapperCmdContents>
         <![CDATA[
 @ECHO OFF
@@ -82,6 +82,7 @@ setlocal ENABLEDELAYEDEXPANSION
 pushd %~dp0
 
 set CORE_ROOT=%HELIX_CORRELATION_PAYLOAD%
+$(CmdCrossgenVar)
 
 ECHO BEGIN EXECUTION
 ECHO %HELIX_CORRELATION_PAYLOAD%\CoreRun.exe %HELIX_WORKITEM_PAYLOAD%\xunit.console.netcore.exe %HELIX_WORKITEM_PAYLOAD%\$(ProjectName) -noshadow -xml testResults.xml -notrait category=outerloop -notrait category=failing
@@ -103,13 +104,13 @@ EXIT /B %ERRORLEVEL%
   </Target>
 
   <Target Name="GenerateWrapperSh"
-    Condition="'$(RuntimeID)' != '' ">
+    Condition="'$(TargetsWindows)' != 'true' ">
 
     <!-- Need to force in Unix line endings for Shell script -->
     <PropertyGroup>
       <WrapperShContents>#!/bin/sh%0a</WrapperShContents>
       <WrapperShContents>$(WrapperShContents)%0a</WrapperShContents> 
-      <WrapperShContents>$(WrapperShContents)export CORE_ROOT="$HELIX_CORRELATION_PAYLOAD"%0a</WrapperShContents>
+      <WrapperShContents>$(WrapperShContents)export CORE_ROOT="%24HELIX_CORRELATION_PAYLOAD"%0a</WrapperShContents>
       <WrapperShContents>$(WrapperShContents)%0a</WrapperShContents>
       <WrapperShContents>$(WrapperShContents)for scriptFilePath in %24(find . -type f -iname '%2A.sh' ! -iname "runtests.sh" | sort)%0a</WrapperShContents>
       <WrapperShContents>$(WrapperShContents)do%0a</WrapperShContents>
@@ -117,6 +118,36 @@ EXIT /B %ERRORLEVEL%
       <WrapperShContents>$(WrapperShContents) chmod +x "%24scriptFilePath"%0a</WrapperShContents>
       <WrapperShContents>$(WrapperShContents)done%0a</WrapperShContents>
       <WrapperShContents>$(WrapperShContents)%0a</WrapperShContents>
+
+      <!-- Crossgen FX assemblies, if running R2R tests. 
+      TODO - remove this when we build tests on Linux -->
+      <WrapperShContents Condition="'$(Crossgen)' == 'true'">$(WrapperShContents)export RunCrossGen=true%0a</WrapperShContents>
+      <WrapperShContents Condition="'$(Crossgen)' == 'true'">$(WrapperShContents)overlayDir=%24CORE_ROOT%0a</WrapperShContents>
+      <WrapperShContents Condition="'$(Crossgen)' == 'true'">$(WrapperShContents)if [ ! -f %24overlayDir/crossgenCompleted.mrk ]%3B then%0a</WrapperShContents>
+      <WrapperShContents Condition="'$(Crossgen)' == 'true'">$(WrapperShContents)  filesToPrecompile=%24(find -L %24overlayDir -iname \%2A.dll -not -iname \%2A.ni.dll -not -iname \%2A-ms-win-\%2A -type f )%0a</WrapperShContents>
+      <WrapperShContents Condition="'$(Crossgen)' == 'true'">$(WrapperShContents)  for fileToPrecompile in %24{filesToPrecompile}%0a</WrapperShContents>
+      <WrapperShContents Condition="'$(Crossgen)' == 'true'">$(WrapperShContents)  do%0a</WrapperShContents>
+      <WrapperShContents Condition="'$(Crossgen)' == 'true'">$(WrapperShContents)    filename=%24{fileToPrecompile}%0a</WrapperShContents>
+      <WrapperShContents Condition="'$(Crossgen)' == 'true'">$(WrapperShContents)    echo Precompiling %24filename%0a</WrapperShContents>
+      <WrapperShContents Condition="'$(Crossgen)' == 'true'">$(WrapperShContents)    %24overlayDir/crossgen /Platform_Assemblies_Paths %24overlayDir /in %24filename /out %24overlayDir/temp.ni.dll 1> %24filename.stdout 2>%24filename.stderr%0a</WrapperShContents>
+      <WrapperShContents Condition="'$(Crossgen)' == 'true'">$(WrapperShContents)    exitCode=%24%3F%0a</WrapperShContents>
+      <WrapperShContents Condition="'$(Crossgen)' == 'true'">$(WrapperShContents)    if [ %24exitCode != 0 ]%3B then%0a</WrapperShContents>
+      <WrapperShContents Condition="'$(Crossgen)' == 'true'">$(WrapperShContents)      if grep -q -e '(COR_E_ASSEMBLYEXPECTED)' %24filename.stderr%3B then%0a</WrapperShContents>
+      <WrapperShContents Condition="'$(Crossgen)' == 'true'">$(WrapperShContents)        printf "\n\t%24filename is not a managed assembly.\n\n"%0a</WrapperShContents>
+      <WrapperShContents Condition="'$(Crossgen)' == 'true'">$(WrapperShContents)      else%0a</WrapperShContents>
+      <WrapperShContents Condition="'$(Crossgen)' == 'true'">$(WrapperShContents)        echo Unable to precompile %24filename.%0a</WrapperShContents>
+      <WrapperShContents Condition="'$(Crossgen)' == 'true'">$(WrapperShContents)      fi%0a</WrapperShContents>
+      <WrapperShContents Condition="'$(Crossgen)' == 'true'">$(WrapperShContents)    else%0a</WrapperShContents>
+      <WrapperShContents Condition="'$(Crossgen)' == 'true'">$(WrapperShContents)      rm %24filename%0a</WrapperShContents>
+      <WrapperShContents Condition="'$(Crossgen)' == 'true'">$(WrapperShContents)      mv %24overlayDir/temp.ni.dll %24filename%0a</WrapperShContents>
+      <WrapperShContents Condition="'$(Crossgen)' == 'true'">$(WrapperShContents)    fi%0a</WrapperShContents> 
+      <WrapperShContents Condition="'$(Crossgen)' == 'true'">$(WrapperShContents)    rm %24filename.stdout%0a</WrapperShContents>
+      <WrapperShContents Condition="'$(Crossgen)' == 'true'">$(WrapperShContents)    rm %24filename.stderr%0a</WrapperShContents>
+      <WrapperShContents Condition="'$(Crossgen)' == 'true'">$(WrapperShContents)  done%0a</WrapperShContents>
+      <WrapperShContents Condition="'$(Crossgen)' == 'true'">$(WrapperShContents)  touch %24overlayDir/crossgenCompleted.mrk%0a</WrapperShContents>
+      <WrapperShContents Condition="'$(Crossgen)' == 'true'">$(WrapperShContents)fi%0a</WrapperShContents>
+      <WrapperShContents Condition="'$(Crossgen)' == 'true'">$(WrapperShContents)%0a</WrapperShContents>
+
       <WrapperShContents>$(WrapperShContents)echo BEGIN EXECUTION%0a</WrapperShContents>
       <WrapperShContents>$(WrapperShContents)echo "%24{HELIX_CORRELATION_PAYLOAD}/corerun" %24HELIX_WORKITEM_PAYLOAD/xunit.console.netcore.exe %24HELIX_WORKITEM_PAYLOAD/$(ProjectName) -noshadow -xml testResults.xml -notrait category=outerloop -notrait category=failing%0a</WrapperShContents>
       <WrapperShContents>$(WrapperShContents)"%24{HELIX_CORRELATION_PAYLOAD}/corerun" %24HELIX_WORKITEM_PAYLOAD/xunit.console.netcore.exe %24HELIX_WORKITEM_PAYLOAD/$(ProjectName) -noshadow -xml testResults.xml -notrait category=outerloop -notrait category=failing%0a</WrapperShContents>