Merge pull request #8827 from hseok-oh/nuget_armel
[platform/upstream/coreclr.git] / tests / runtest.proj
index b6e714e..45f2bb7 100644 (file)
 
   </Target>
 
-
-  <Import Project="$(__Exclude0)" Condition="'$(__Exclude0)' != '' AND '$(XunitTestBinBase)' != ''" /> 
   <Import Project="$(__Exclude)" Condition="'$(__Exclude)' != '' AND '$(XunitTestBinBase)' != ''" /> 
   <PropertyGroup>
     <HaveExcludes>False</HaveExcludes>
-    <HaveExcludes Condition="('$(__Exclude0)' != '') Or ('$(__Exclude)' != '')">True</HaveExcludes>
+    <HaveExcludes Condition="'$(__Exclude)' != ''">True</HaveExcludes>
   </PropertyGroup>
 
   <Target Name="CreateXunitWrapper" DependsOnTargets="CreateXunitFacts">
@@ -64,7 +62,6 @@ $(_XunitEpilog)
 
 ]]>
       </_XunitWrapperGen>
-      <XunitVersionCompiled>2.1.0</XunitVersionCompiled>
       <XunitWrapperGenCsProj>
         <![CDATA[
 <?xml version="1.0" encoding="utf-8"?>
@@ -78,8 +75,8 @@ $(_XunitEpilog)
     <SchemaVersion>2.0</SchemaVersion>
     <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
     <OutputType>Library</OutputType>
-    <TargetFrameworkIdentifier>.NETFramework</TargetFrameworkIdentifier>
-    <TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
+    <TargetFrameworkIdentifier Condition ="'$(BuildTestsAgainstPackages)' != 'true'">.NETFramework</TargetFrameworkIdentifier>
+    <TargetFrameworkVersion Condition ="'$(BuildTestsAgainstPackages)' != 'true'">v4.5</TargetFrameworkVersion>
     <IsXunitWrapperProject>true</IsXunitWrapperProject>
     <SkipSigning>true</SkipSigning>
     <AppDesignerFolder>Properties</AppDesignerFolder>
@@ -89,6 +86,8 @@ $(_XunitEpilog)
     <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
     <CLRTestKind>BuildOnly</CLRTestKind>
     <IsTestProject>true</IsTestProject>
+    <ProjectJson Condition="'$(BuildTestsAgainstPackages)' != 'true'">%24(TestWrappersPackagesConfigFileDirectory)project.json</ProjectJson>
+    <ProjectLockJson Condition="'$(BuildTestsAgainstPackages)' != 'true'">%24(TestWrappersPackagesConfigFileDirectory)project.lock.json</ProjectLockJson>
   </PropertyGroup>
   <!-- Default configurations to help VS understand the configurations -->
   <PropertyGroup Condition=" '%24(Configuration)|%24(Platform)' == 'Debug|AnyCPU' ">
@@ -99,13 +98,14 @@ $(_XunitEpilog)
     <Compile Include="$(XunitWrapper).cs" />
   </ItemGroup>
   <ItemGroup>
-    <None Include="%24(TestWrappersPackagesConfigFileDirectory)project.json" />
-  </ItemGroup>
-  <ItemGroup>
     <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
   </ItemGroup>
    <ItemGroup>
-    <ProjectReference Include="$(SourceDir)Common\Desktop.Coreclr.TestWrapper\Desktop.Coreclr.TestWrapper.csproj">
+    <ProjectReference Include="$(SourceDir)Common\Desktop.Coreclr.TestWrapper\Desktop.Coreclr.TestWrapper.csproj" Condition="'$(BuildTestsAgainstPackages)' != 'true'">
+      <Project>{8ffe99c0-22f8-4462-b839-970eac1b3472}</Project>
+      <Name>coreclr</Name>
+    </ProjectReference>
+    <ProjectReference Include="$(SourceDir)Common\Coreclr.TestWrapper\Coreclr.TestWrapper.csproj" Condition="'$(BuildTestsAgainstPackages)' == 'true'">
       <Project>{8ffe99c0-22f8-4462-b839-970eac1b3472}</Project>
       <Name>coreclr</Name>
     </ProjectReference>
@@ -116,12 +116,7 @@ $(_XunitEpilog)
     <Reference Include="System.Runtime" />
     <Reference Include="mscorlib" />
   </ItemGroup>
-  <PropertyGroup>
-    <ProjectJson>%24(TestWrappersPackagesConfigFileDirectory)project.json</ProjectJson>
-    <ProjectLockJson>%24(TestWrappersPackagesConfigFileDirectory)project.lock.json</ProjectLockJson>
-  </PropertyGroup>
   <Import Project="$(SourceDir)dir.targets" />
-  <Import Project="$(ProjectDir)helix.targets" />
   <PropertyGroup>
      <OutDir>$(XunitTestBinBase)\$(Category)\</OutDir>
   </PropertyGroup>
@@ -148,8 +143,7 @@ $(_XunitEpilog)
   </Target>
   
   <Target Name="BuildXunitWrapper">
-    <MSBuild Projects="$(XunitWrapperSrcDir)\$(XunitWrapper).csproj"
-             Properties="RestorePackages=false"/>
+    <MSBuild Projects="$(XunitWrapperSrcDir)\$(XunitWrapper).csproj"/>
   </Target>
 
   <Target Name="CreateXunitFacts">
@@ -199,7 +193,8 @@ namespace $([System.String]::Copy($(Category)).Replace(".","_").Replace("\","").
                     throw new ArgumentException("Environment variable CORE_ROOT is not set")%3B
                 }
 
-                runningInWindows = System.Environment.GetEnvironmentVariable("OS").StartsWith("Windows")%3B
+                string operatingSystem = System.Environment.GetEnvironmentVariable("OS")%3B
+                runningInWindows = (operatingSystem != null && operatingSystem.StartsWith("Windows"))%3B
             }
         }
 
@@ -218,6 +213,10 @@ namespace $([System.String]::Copy($(Category)).Replace(".","_").Replace("\","").
       <CanonicalExcludeList Include="%(ExcludeList.FullPath)" Condition="$(HaveExcludes)"/>
     </ItemGroup>
 
+    <PropertyGroup>
+      <TestExecutableReplacement Condition="'$(RuntimeID)' != '' ">testExecutable = testExecutable.Replace("\\", "/")%3B</TestExecutableReplacement>
+    </PropertyGroup>
+
     <ItemGroup>
       <AllCMDsPresent Include="$(_CMDDIR)\**\*.cmd" />
       <AllCMDExcludeFilter Include="@(CanonicalExcludeList)" Condition="$(HaveExcludes)"/>
@@ -248,6 +247,7 @@ namespace $([System.String]::Copy($(Category)).Replace(".","_").Replace("\","").
                   outputFile = System.IO.Path.GetFullPath(_Global.reportBase + testSubfolder + @"%(AllCMDs.FileName).output.txt")%3B
                   errorFile = System.IO.Path.GetFullPath(_Global.reportBase + testSubfolder + @"%(AllCMDs.FileName).error.txt")%3B
                   testExecutable = System.IO.Path.GetFullPath(_Global.testBinaryBase + @"$([System.String]::Copy('%(AllCMDs.FullPath)').Replace("$(_CMDDIR)",''))")%3B
+                  $(TestExecutableReplacement)
 
                   if (!_Global.runningInWindows) {
                       testExecutable = testExecutable.Replace(".cmd", ".sh")%3B
@@ -309,31 +309,7 @@ namespace $([System.String]::Copy($(Category)).Replace(".","_").Replace("\","").
   </Target>
 
   <Target Name="CreateAllWrappers" DependsOnTargets="GetListOfTestCmds;FindCmdDirectories">
-    <MSBuild Projects="$(MSBuildProjectFile)" Targets="CreateXunitWrapper" Properties="_CMDDIR=%(TestDirectories.Identity)" />
-
-    <!--
-      Contents of a project.json that will be restored once with errors turned off. This works
-      around the package being incompatible with dotnet restore. Only the package contents are
-      required so the compatibility errors can be ignored.
-    -->
-    <PropertyGroup>
-      <XunitRunnerRestoreGenConfig>{ "dependencies": { "xunit.runner.msbuild": "$(XunitPackageVersion)" }, "frameworks": { "net45": {} } }</XunitRunnerRestoreGenConfig>
-      <XunitRunnerRestoreProjectDir>$(BaseOutputPath)\tempRestoreProject</XunitRunnerRestoreProjectDir>
-      <XunitRunnerRestoreProjectJsonPath>$(XunitRunnerRestoreProjectDir)\project.json</XunitRunnerRestoreProjectJsonPath>
-    </PropertyGroup>
-    
-    <MakeDir Directories="$(XunitRunnerRestoreProjectDir)" />
-    <WriteLinesToFile File="$(XunitRunnerRestoreProjectJsonPath)"
-                      Lines="$(XunitRunnerRestoreGenConfig)"
-                      Overwrite="true" />
-    
-    <Exec Command="$(DnuRestoreCommand) &quot;$(XunitRunnerRestoreProjectJsonPath)&quot;"
-          StandardOutputImportance="Low"
-          CustomErrorRegularExpression="^Unable to resolve .*"
-          IgnoreExitCode="true" 
-          IgnoreStandardErrorWarningFormat="true" />
-
-    <MSBuild Projects="$(MSBuildProjectFile)" Targets="BuildXunitWrapper" Properties="_CMDDIR=%(TestDirectories.Identity)" />
+    <MSBuild Projects="$(MSBuildProjectFile)" Targets="CreateXunitWrapper;BuildXunitWrapper" Properties="_CMDDIR=%(TestDirectories.Identity)" />
   </Target>
 
   <Target Name="GetListOfTestCmds">
@@ -351,12 +327,32 @@ namespace $([System.String]::Copy($(Category)).Replace(".","_").Replace("\","").
              Properties="Language=C#" />
   </Target>
 
+  <Target Name="CreateNonWindowsTestOverlay">
+    <MSBuild Projects="$(MSBuildProjectFile)"
+             Targets="CopyNonWindowsDependecyToCoreRoot"
+             Properties="Language=C#;NonWindowsRuntimeId=$(NonWindowsRuntimeId)" />
+  </Target>
+
+  <Target Name="BinPlaceRef">
+    <!-- Copy mscorlib.dll from TargetingPack to bin/Product/ref, if we're building against packages -->
+    <MSBuild Projects="$(MSBuildProjectFile)"
+             Targets="CopyDependencyToRef"
+             Properties="Language=C#"
+             Condition=" '$(BuildTestsAgainstPackages)'=='true' " />
+  </Target>
+
+  <Target Name="BinPlaceProduct">
+    <!-- Copy test dependencies to bin/Product, if we're building against packages -->
+    <MSBuild Projects="$(MSBuildProjectFile)"
+             Targets="CopyDependencyToProduct"
+             Properties="Language=C#"
+             Condition=" '$(BuildTestsAgainstPackages)'=='true' " />
+  </Target>
+
   <!-- All the test projects need to add dependency to currently built runtime as they require that to run. 
-       In addition the version number of built runtime can change so all project.json needs to be dynamically generated. 
-       In order to avoid regenerating project.json for all the tests projects...I added a common project for all the tests.
-       This project is at tests\src\common\test_runtime\test_runtime.csproj. This project is adding common dependencies to
-       all the tests like dependency on Microsoft.netcore.runtime.coreclr ..etc. Project.json for this project is dynamically 
-       generated via task CreateTestRuntimeJsonFile. -->
+       In addition the version number of built runtime can change so all project.json needs to be dynamically generated.
+       Instead the following task creates a project.json with dependencies like  Microsoft.netcore.runtime.coreclr ..etc.
+        -->
   <Target Name="CreateTestRuntimeJsonFile">
     <ItemGroup>
       <CoreclrPackage Include="$(CORE_ROOT)\.nuget\**\Microsoft.NETCore.Runtime.CoreCLR.*.nupkg"/>
@@ -402,7 +398,7 @@ namespace $([System.String]::Copy($(Category)).Replace(".","_").Replace("\","").
              Targets="CreateTestRuntimeJsonFile"/>  
      
     <!-- generate project.lock.json file corresponding to above json file -->
-    <MSBuild Projects="src\Common\test_runtime\test_runtime.csproj"/>
+    <MSBuild Projects="src\Common\test_dependencies\test_dependencies.csproj"/>
     
     <!-- Package each perf test, upload it and trigger event to execute the tests -->  
     <MSBuild Projects="$(MSBuildProjectFile)" Targets="UploadPerfAssemblies" />  
@@ -417,7 +413,7 @@ namespace $([System.String]::Copy($(Category)).Replace(".","_").Replace("\","").
              Condition=" '$(BuildWrappers)'=='true' " />
 
     <!-- generate project.lock.json file corresponding to above json file -->
-    <MSBuild Projects="src\Common\test_runtime\test_runtime.csproj"
+    <MSBuild Projects="src\Common\test_dependencies\test_dependencies.csproj"
              Condition=" '$(BuildWrappers)'=='true' " />
 
     <!-- Default for building -->