Update CoreClr, CoreFx, CoreSetup to preview-27213-02, preview.18613.4, preview-27213...
[platform/upstream/coreclr.git] / tests / runtest.proj
1 <?xml version="1.0" encoding="utf-8"?>
2 <Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3   <Import Project="src\dir.props" />
4   <Import Project="$(ToolsDir)Build.Post.targets" Condition="Exists('$(ToolsDir)Build.Post.targets') AND '$(BuildWrappers)' == 'true'" />
5   <Import Project="helixperftasks.targets" Condition="'$(Performance)'=='true'"/>
6   <PropertyGroup>
7     <XunitTestBinBase Condition="'$(XunitTestBinBase)'==''" >$(BaseOutputPathWithConfig)</XunitTestBinBase>
8     <XunitWrapperGeneratedCSDirBase>$(XunitTestBinBase)\TestWrappers\</XunitWrapperGeneratedCSDirBase>
9     <MSBuildEnableAllPropertyFunctions>1</MSBuildEnableAllPropertyFunctions>
10   </PropertyGroup>
11
12   <!-- TestHost destinations -->
13   <PropertyGroup>
14     <NETCoreAppTestSharedFxVersion>9.9.9</NETCoreAppTestSharedFxVersion>
15     <TestHostRootPath>$(BinDir)testhost\</TestHostRootPath>
16     <NETCoreAppTestHostFxrPath>$(TestHostRootPath)host\fxr\$(NETCoreAppTestSharedFxVersion)\</NETCoreAppTestHostFxrPath>
17     <NETCoreAppTestSharedFrameworkPath>$(TestHostRootPath)shared\Microsoft.NETCore.App\$(NETCoreAppTestSharedFxVersion)\</NETCoreAppTestSharedFrameworkPath>
18   </PropertyGroup>
19
20   <ItemGroup>
21     <DisabledTestDir Include="Common" />
22     <_SkipTestDir Include="@(DisabledTestDir)" />
23   </ItemGroup>
24
25   <Target Name="Rebuild" />
26
27   <Target Name="FindCmdDirectories" DependsOnTargets="GetListOfTestCmds">
28
29     <Error Condition="!Exists('$(XunitTestBinBase)')"
30            Text="$(XunitTestBinBase) does not exist. Please run build-test.cmd from the repo root at least once to get the tests built." />
31
32     <ItemGroup>
33
34       <AllTestDirsNonCanonicalPaths Include="$([System.IO.Directory]::GetDirectories(`$(XunitTestBinBase)`))" />
35       <AllTestDirsPaths Include="@(AllTestDirsNonCanonicalPaths)" />
36       <AllTestDirsPaths Include="@(AllTestDirsNonCanonicalPaths)" >
37         <Path>$([System.IO.Path]::GetFullPath(%(Identity)))</Path>
38       </AllTestDirsPaths>
39       <NonExcludedTestDirectories Include="@(AllTestDirsPaths -> '%(Path)')" Exclude="@(_SkipTestDir -> '$(XunitTestBinBase)%(Identity)')" />
40       <TopLevelDirectories Include="@(NonExcludedTestDirectories)" />
41       <SecondLevel Include="$([System.IO.Directory]::GetDirectories(%(TopLevelDirectories.Identity)))" />
42       <SecondLevelDirectories Include="@(SecondLevel)">
43         <Path>$([System.IO.Path]::GetFullPath(%(AllRunnableTestPaths.Identity)))</Path>
44       </SecondLevelDirectories>
45       <TestDirectoriesWithDup Include="@(SecondLevelDirectories -> '%(Identity)')" Condition="$([System.String]::new('%(Path)').StartsWith('%(Identity)'))" />
46
47     </ItemGroup>
48
49     <RemoveDuplicates Inputs="@(TestDirectoriesWithDup)">
50       <Output
51           TaskParameter="Filtered"
52           ItemName="TestDirectories"/>
53     </RemoveDuplicates>
54
55   </Target>
56
57   <!-- Target to check the test build, to see if it looks ok. We've had several cases where a change inadvertently and drastically changes
58        the set of tests that are built, and that change is unnoticed. The most common case is for a build of the Priority 1 tests
59        to only build the Priority 0 tests. This target is run after a test build to verify that the basic number of tests that were
60        built is basically what was expected. When this was written, there were about 2500 Priority 0 tests and about 10268 Priority 1
61        tests on Windows, 9976 on Ubuntu (it differs slightly based on platform). We currently check that the number of Priority 0 tests
62        is greater than 2000 and less than 3000, and the number of Priority 1 tests is greater than 9000.
63   -->
64   <Target Name="CheckTestBuild" DependsOnTargets="GetListOfTestCmds">
65     <Error Condition="!Exists('$(XunitTestBinBase)')"
66         Text="$(XunitTestBinBase) does not exist. Please run build-test.cmd from the repo root at least once to get the tests built." />
67
68     <PropertyGroup>
69         <TestCount>@(AllRunnableTestPaths->Count())</TestCount>
70     </PropertyGroup>
71
72     <Message Text="Found $(TestCount) built tests"/>
73
74     <Error Condition="'$(CLRTestPriorityToBuild)' == '0' and '$(TestCount)' &lt;= 2000" Text="Unexpected test count. Expected &gt; 2000, found $(TestCount).'" />
75     <Error Condition="'$(CLRTestPriorityToBuild)' == '0' and '$(TestCount)' &gt;= 3000" Text="Unexpected test count. Expected &lt; 3000, found $(TestCount).'" />
76     <Error Condition="'$(CLRTestPriorityToBuild)' == '1' and '$(TestCount)' &lt;= 9000" Text="Unexpected test count. Expected &gt; 9000, found $(TestCount).'" />
77     <Error Condition="'$(CLRTestPriorityToBuild)' != '0' and '$(CLRTestPriorityToBuild)' != '1'" Text="Unknown priority $(CLRTestPriorityToBuild)" />
78   </Target>
79
80   <Import Project="$(__Exclude)" Condition="'$(__Exclude)' != '' AND '$(XunitTestBinBase)' != ''" />
81   <PropertyGroup>
82     <HaveExcludes>False</HaveExcludes>
83     <HaveExcludes Condition="'$(__Exclude)' != ''">True</HaveExcludes>
84   </PropertyGroup>
85
86   <Target Name="CreateXunitWrapper" DependsOnTargets="CreateXunitFacts">
87
88     <PropertyGroup>
89       <_XunitWrapperGen >
90         <![CDATA[
91
92 $(_XunitProlog)
93 @(AllXUnitFacts)
94 $(_XunitEpilog)
95
96 ]]>
97       </_XunitWrapperGen>
98       <XunitWrapperGenCsProj>
99         <![CDATA[
100 <Project>
101
102   <Import Project="$(ProjectDir)dir.sdkbuild.props" />
103
104   <PropertyGroup>
105     <OutputPath>$(XUnitTestBinBase)\$(CategoryWithSlash)</OutputPath>
106     <RuntimeFrameworkVersion>$(MicrosoftNETCoreAppPackageVersion)</RuntimeFrameworkVersion>
107  </PropertyGroup>
108
109   <Import Sdk="Microsoft.NET.Sdk" Project="Sdk.props" />
110
111   <ItemGroup>
112     <Compile Include="$(XunitWrapper).cs" />
113   </ItemGroup>
114
115   <ItemGroup>
116     <ProjectReference Include="$(SourceDir)Common\Coreclr.TestWrapper\Coreclr.TestWrapper.csproj" />
117   </ItemGroup>
118
119   <ItemGroup>
120     <PackageReference Include="xunit" Version="$(XunitPackageVersion)" />
121     <PackageReference Include="xunit.runner.console" Version="$(XunitPackageVersion)" />
122   </ItemGroup>
123
124   <Import Sdk="Microsoft.NET.Sdk" Project="Sdk.targets" />
125
126 </Project>
127 ]]>
128       </XunitWrapperGenCsProj>
129     </PropertyGroup>
130
131     <!-- <Exec Command="md" -->
132     <MakeDir  Directories="$(XunitWrapperGeneratedCSDirBase)$(Category)"/>
133
134     <!-- Write the file -->
135     <WriteLinesToFile
136       File="$(XunitWrapperSrcDir)\$(XunitWrapper).cs"
137       Lines="$(_XunitWrapperGen)"
138       Overwrite="true" />
139
140     <!-- Write the file -->
141     <WriteLinesToFile
142       File="$(XunitWrapperSrcDir)\$(XunitWrapper).csproj"
143       Lines="$(XunitWrapperGenCsProj)"
144       Overwrite="true" />
145   </Target>
146
147   <Target Name="BuildXunitWrapper">
148     <MSBuild Projects="$(XunitWrapperSrcDir)\$(XunitWrapper).csproj" Targets="Restore;Build" />
149   </Target>
150
151   <Target Name="CreateXunitFacts">
152     <!-- NOTE! semicolons must be escaped with %3B boooo -->
153
154     <PropertyGroup>
155       <_CMDDIR_Parent>$([System.IO.Path]::GetDirectoryName($(_CMDDIR)))</_CMDDIR_Parent>
156       <_CMDDIR_Grandparent>$([System.IO.Path]::GetDirectoryName($(_CMDDIR_Parent)))</_CMDDIR_Grandparent>
157       <CategoryWithSlash Condition="'$(RunningOnUnix)' != 'true'" >$([System.String]::Copy('$(_CMDDIR)').Replace("$(_CMDDIR_Grandparent)\",""))</CategoryWithSlash>
158       <CategoryWithSlash Condition="'$(RunningOnUnix)' == 'true'" >$([System.String]::Copy('$(_CMDDIR)').Replace("$(_CMDDIR_Grandparent)/",""))</CategoryWithSlash>
159       <Category Condition="'$(RunningOnUnix)' != 'true'" >$([System.String]::Copy('$(CategoryWithSlash)').Replace('\','.'))</Category>
160       <Category Condition="'$(RunningOnUnix)' == 'true'" >$([System.String]::Copy('$(CategoryWithSlash)').Replace('/','.'))</Category>
161       <XunitWrapper>$(Category).XUnitWrapper</XunitWrapper>
162       <XunitWrapperSrcDir>$(XunitWrapperGeneratedCSDirBase)$(Category)</XunitWrapperSrcDir>
163     </PropertyGroup>
164     <PropertyGroup>
165       <_XunitProlog Condition=" '$(_XunitProlog)'=='' ">
166         <![CDATA[
167 using Xunit%3B
168 using System%3B
169 using System.Collections.Generic%3B
170 using System.Diagnostics%3B
171 using System.Reflection%3B
172 using CoreclrTestLib%3B
173
174 namespace $([System.String]::Copy($(Category)).Replace(".","_").Replace("\","").Replace("-","_"))
175 {
176         internal class _Global
177         {
178             internal static bool runningInWindows%3B
179             internal static string reportBase%3B
180             internal static string testBinaryBase%3B
181             internal static string coreRoot%3B
182
183             static _Global()
184             {
185                 reportBase = System.Environment.GetEnvironmentVariable(%22XunitTestReportDirBase%22)%3B
186                 testBinaryBase = System.IO.Path.GetDirectoryName(new Uri(Assembly.GetExecutingAssembly().CodeBase).LocalPath)%3B
187                 coreRoot = System.Environment.GetEnvironmentVariable(%22CORE_ROOT%22)%3B
188
189                 if (String.IsNullOrEmpty(reportBase)) {
190                     reportBase = System.IO.Path.Combine(testBinaryBase, "Reports")%3B
191                 }
192                 else
193                 {
194                     reportBase = System.IO.Path.GetFullPath(reportBase)%3B
195                 }
196
197                 if (String.IsNullOrEmpty(coreRoot)) {
198                     throw new ArgumentException("Environment variable CORE_ROOT is not set")%3B
199                 }
200
201                 coreRoot = System.IO.Path.GetFullPath(coreRoot)%3B
202
203                 string operatingSystem = System.Environment.GetEnvironmentVariable("OS")%3B
204                 runningInWindows = (operatingSystem != null && operatingSystem.StartsWith("Windows"))%3B
205             }
206         }
207
208 ]]>
209       </_XunitProlog>
210
211       <_XunitEpilog Condition=" '$(_XunitEpilog)'=='' ">
212       <![CDATA[
213 }
214
215 ]]>
216       </_XunitEpilog>
217     </PropertyGroup>
218
219     <ItemGroup>
220       <CanonicalExcludeList Include="%(ExcludeList.FullPath)" Condition="$(HaveExcludes)"/>
221     </ItemGroup>
222
223     <PropertyGroup>
224       <TestExecutableReplacement Condition="'$(TargetsWindows)' != 'true' ">testExecutable = testExecutable.Replace("\\", "/")%3B</TestExecutableReplacement>
225     </PropertyGroup>
226
227     <ItemGroup>
228       <AllCMDsPresent Include="$(_CMDDIR)\**\*.cmd" Condition="'$(RunningOnUnix)' != 'true'" />
229       <AllCMDsPresent Include="$(_CMDDIR)\**\*.sh" Condition="'$(RunningOnUnix)' == 'true'" />
230       <AllCMDExcludeFilter Include="@(CanonicalExcludeList)" Condition="$(HaveExcludes)"/>
231       <AllCMDs Include="@(AllCMDsPresent)" Exclude="@(AllCMDExcludeFilter)"/>
232
233       <AllCommands Include="@(AllCMDs)" >
234         <_FactName Condition="'$(RunningOnUnix)' != 'true'" >$([System.String]::Copy('%(AllCMDs.FullPath)').Replace("$(_CMDDIR)",'').Replace(".","_").Replace("\","_").Replace("-","_"))</_FactName>
235         <_ClassName Condition="'$(RunningOnUnix)' != 'true'" >$([System.String]::Copy('%(AllCMDs.FullPath)').Replace("$(_CMDDIR)",'').Replace("cmd","").Replace(".","_").Replace("\","_").Replace("-","_"))</_ClassName>
236         <_FactName Condition="'$(RunningOnUnix)' == 'true'" >$([System.String]::Copy('%(AllCMDs.FullPath)').Replace("$(_CMDDIR)",'').Replace(".","_").Replace("/","_").Replace("-","_"))</_FactName>
237         <_ClassName Condition="'$(RunningOnUnix)' == 'true'" >$([System.String]::Copy('%(AllCMDs.FullPath)').Replace("$(_CMDDIR)",'').Replace("sh","").Replace(".","_").Replace("/","_").Replace("-","_"))</_ClassName>
238
239         <_XunitFact >
240           <![CDATA[
241
242         public class %(AllCommands._ClassName)
243         {
244             [Fact]
245             public void %(AllCommands._FactName)()
246             {
247                 int ret = -100%3B
248                 string outputFile = null%3B
249                 string errorFile = null%3B
250                 string testExecutable = null%3B
251                 Exception infraEx = null%3B
252
253                 try
254                 {
255                   CoreclrTestWrapperLib wrapper = new CoreclrTestWrapperLib()%3B
256                   string testSubfolder = @"\$(Category)\$([System.String]::Copy('%(AllCMDs.RelativeDir)').Replace("$(_CMDDIR)$([System.IO.Path]::DirectorySeparatorChar)",''))"%3B
257                   outputFile = System.IO.Path.GetFullPath(_Global.reportBase + testSubfolder + @"%(AllCMDs.FileName).output.txt")%3B
258                   errorFile = System.IO.Path.GetFullPath(_Global.reportBase + testSubfolder + @"%(AllCMDs.FileName).error.txt")%3B
259                   testExecutable = System.IO.Path.GetFullPath(_Global.testBinaryBase + @"$([System.String]::Copy('%(AllCMDs.FullPath)').Replace("$(_CMDDIR)",''))")%3B
260                   $(TestExecutableReplacement)
261
262                   if (!_Global.runningInWindows) {
263                       testExecutable = testExecutable.Replace(".cmd", ".sh")%3B
264                   }
265
266                   System.IO.Directory.CreateDirectory(_Global.reportBase + testSubfolder)%3B
267
268                   ret = wrapper.RunTest(testExecutable, outputFile, errorFile)%3B
269                 }
270                 catch (Exception ex)
271                 {
272                     infraEx = ex%3B
273                 }
274
275                 if (ret != CoreclrTestWrapperLib.EXIT_SUCCESS_CODE)
276                 {
277                     string sErrorText = null%3B
278                     try
279                     {
280                         sErrorText = System.IO.File.ReadAllText(errorFile)%3B
281                     }
282                     catch(Exception ex)
283                     {
284                       sErrorText = $"Unable to read error file: {errorFile}\n{ex}"%3B
285                     }
286
287                     string outputText = null%3B
288                     try
289                     {
290                         System.IO.StreamReader outputReader = new System.IO.StreamReader(outputFile)%3B
291                         outputText = outputReader.ReadToEnd()%3B
292                         outputReader.Close()%3B
293                     }
294                     catch(Exception ex)
295                     {
296                         outputText = $"Unable to read error file: {outputFile}\n{ex}"%3B
297                     }
298
299                     string msg = infraEx != null ? "Test Infrastructure Failure: " + infraEx.ToString()
300                                                  : sErrorText + "\n\n" +
301                                                    "Return code:      " + ret + "\n" +
302                                                    "Raw output file:      " + outputFile + "\n" +
303                                                    "Raw output:\n" + outputText + "\n" +
304                                                    "To run the test:\n" +
305                                                    "> set CORE_ROOT=" + _Global.coreRoot + "\n" +
306                                                    "> " + testExecutable + "\n"%3B
307
308                     Assert.True(ret == CoreclrTestWrapperLib.EXIT_SUCCESS_CODE, msg)%3B
309                 }
310             }
311        }
312
313         ]]>
314         </_XunitFact>
315       </AllCommands>
316       <AllXUnitFacts Include= "%(AllCommands._XunitFact)" />
317     </ItemGroup>
318   </Target>
319
320   <Target Name="CreateAllWrappers" DependsOnTargets="GetListOfTestCmds;FindCmdDirectories">
321     <MSBuild Projects="$(MSBuildProjectFile)" Targets="CreateXunitWrapper;BuildXunitWrapper" Properties="_CMDDIR=%(TestDirectories.Identity)" />
322   </Target>
323
324   <Target Name="GetListOfTestCmds">
325     <ItemGroup>
326       <AllRunnableTestPaths Include="$(XunitTestBinBase)\**\*.cmd" Condition="'$(BuildOS)' == 'Windows_NT'" />
327       <AllRunnableTestPaths Include="$(XunitTestBinBase)\**\*.sh" Condition="'$(BuildOS)' != 'Windows_NT'" />
328     </ItemGroup>
329   </Target>
330
331   <!-- If we want to overwrite the desired CoreCLR package version, we need to get the new version from the generated props file in bin/obj -->
332   <Import Condition="'$(OverwriteCoreClrPackageVersion)' == 'true'" Project="$(BuildVersionFile)" />
333
334   <PropertyGroup Condition="'$(OverwriteCoreClrPackageVersion)' == 'true'">
335     <VersionToRestore Condition="'$(StableVersion)' != ''">$(StableVersion)</VersionToRestore>
336     <VersionToRestore Condition="'$(VersionToRestore)' == ''">$(PackageVersion)-$(PreReleaseLabel)-$(BuildNumberMajor)-$(BuildNumberMinor)</VersionToRestore>
337     <DesiredPackageVersionArg>$(VersionToRestore)</DesiredPackageVersionArg>
338   </PropertyGroup>
339
340   <Import Project="tests.targets" />
341   <Import Project="publishdependency.targets" />
342
343   <PropertyGroup>
344     <DesiredPackageVersionArg Condition="'$(DesiredPackageVersionArg)' == ''">$(MicrosoftNETCoreRuntimeCoreCLRPackageVersion)</DesiredPackageVersionArg>
345   </PropertyGroup>
346
347   <Target Name="CreateTestOverlay">
348     <MSBuild Projects="$(MSBuildProjectFile)"
349              Targets="CopyDependecyToCoreRoot"
350              Properties="Language=C#;TargetRid=$(TargetRid)" />
351   </Target>
352
353   <Target Name="BinPlaceRef">
354     <!-- Copy mscorlib.dll from TargetingPack to bin/Product/ref, if we're building against packages -->
355     <MSBuild Projects="$(MSBuildProjectFile)"
356              Targets="CopyDependencyToRef"
357              Properties="Language=C#;TargetRid=$(TargetRid)"
358              Condition=" '$(BuildTestsAgainstPackages)'=='true' " />
359   </Target>
360
361   <Target Name="BinPlaceProduct">
362     <!-- Copy test dependencies to bin/Product, if we're building against packages -->
363     <MSBuild Projects="$(MSBuildProjectFile)"
364              Targets="CopyDependencyToProduct"
365              Properties="Language=C#;TargetRid=$(TargetRid)"
366              Condition=" '$(BuildTestsAgainstPackages)'=='true' " />
367   </Target>
368
369   <Target Name="ResolveTestHostDependencies">
370     <MSBuild Projects="$(MSBuildThisFileDirectory)src\Common\CoreFX\CoreFX.depproj" 
371             Properties="OutputPath=$(NETCoreAppTestSharedFrameworkPath);" />
372   </Target>
373
374   <Target Name="CreateTestHost" DependsOnTargets="ResolveTestHostDependencies">
375     <MSBuild Projects="$(MSBuildProjectFile)"
376             Targets="SetupTestingHost"/>
377
378     <MSBuild Projects="$(MSBuildProjectFile)"
379             Targets="GenerateTestSharedFrameworkDepsFile"/>
380   </Target>
381
382   <UsingTask TaskName="GenerateDepsJson" AssemblyFile="$(BuildToolsTaskDir)Microsoft.DotNet.Build.Tasks.dll"/>
383   <!-- After we copied all the framework libraries we need to generate a deps.json file for the shared test framework -->
384   <Target Name="GenerateTestSharedFrameworkDepsFile" AfterTargets="SetupTestingHost">
385     <ItemGroup>
386       <!-- This is for HostPolicy, CoreCLR and Jit dependencies to continue to remain inside of the dep.json -->
387       <ExceptionForDepsJson Include="microsoft.netcore.app" />
388
389       <!-- TODO: We should see about generating this from scratch instead of relying on a previous deps file as a template -->
390       <_sharedFrameworkDepsJson Include="$(ToolsDir)dotnetcli\shared\Microsoft.NETCore.App\*\Microsoft.NETCore.App.deps.json" />
391     </ItemGroup>
392
393     <PropertyGroup>
394       <_OriginalDepsJsonPath>%(_sharedFrameworkDepsJson.FullPath)</_OriginalDepsJsonPath>
395       <_OutputTestSharedFrameworkDepsPath>$(NETCoreAppTestSharedFrameworkPath)\Microsoft.NETCore.App.deps.json</_OutputTestSharedFrameworkDepsPath>
396     </PropertyGroup>
397
398     <GenerateDepsJson DepsJsonPath="$(_OriginalDepsJsonPath)"
399                       GenerateNewDepsJson="true"
400                       RuntimeDirectory="$(NETCoreAppTestSharedFrameworkPath)"
401                       DepsExceptions="@(ExceptionForDepsJson)"
402                       OutputPath="$(_OutputTestSharedFrameworkDepsPath)"/>
403   </Target>
404
405   <Target Name="SetupTestingHost"  AfterTargets="CreateTestOverlay" Condition="'$(CreateTestHost)' != 'false'">
406
407     <PropertyGroup Condition="'$(OSGroup)'=='Windows_NT'">
408       <HostFxrFileName>hostfxr</HostFxrFileName>
409       <HostFxrFileExtension>dll</HostFxrFileExtension>
410       <DotnetExecutableName>dotnet.exe</DotnetExecutableName>
411       <HostPolicyFileName>hostpolicy</HostPolicyFileName>
412       <HostPolicyExtension>dll</HostPolicyExtension>
413     </PropertyGroup>
414     
415     <PropertyGroup Condition="'$(OSGroup)'!='Windows_NT'">
416       <HostFxrFileName>libhostfxr</HostFxrFileName>
417       <HostFxrFileExtension Condition="'$(OSGroup)' == 'Linux' Or '$(OSGroup)' == 'FreeBSD'">so</HostFxrFileExtension>
418       <HostFxrFileExtension Condition="$(OSGroup) =='OSX'">dylib</HostFxrFileExtension>
419       <HostPolicyFileName>libhostpolicy</HostPolicyFileName>
420       <HostPolicyExtension>$(HostFxrFileExtension)</HostPolicyExtension>
421       <DotnetExecutableName>dotnet</DotnetExecutableName>
422     </PropertyGroup>
423     
424     <ItemGroup>
425       <!-- Workaround for packages on which Microsoft.NetCoreApp expresses a dependency 
426       The <PackageToInclude> element doesn't allow a version to be specified and we end up with clashing assembly versions in Core_Root-->
427       <NetCoreAppPackagedAssemblies Include="System.Text.Encoding.CodePages.dll"/>
428       <!-- Use xunit dependencies defined in CoreFX.depproj instead of conflicting versions from test dependencies. -->
429       <TestDependenciesToExclude Include="$(CORE_ROOT)\**\xunit*"/>
430       <CoreCLRBinariesToExclude Include="@(NetCoreAppPackagedAssemblies);@(TestDependenciesToExclude -> '%(Identity)')" />
431     </ItemGroup>
432
433     <ItemGroup>
434       <CoreCLRBinaries Include="$(CORE_ROOT)\**\*.*" Exclude="$(CORE_ROOT)\**\@(CoreCLRBinariesToExclude -> '%(Identity)' )" />
435       <HostFxFile Include="$(ToolsDir)\dotnetcli\**\$(HostFxrFileName).$(HostFxrFileExtension)" />
436       <DotnetExe Include="$(ToolsDir)\dotnetcli\$(DotnetExecutableName)" />
437       <HostPolicyFile Include="$(ToolsDir)\dotnetcli\**\$(HostPolicyFileName).$(HostPolicyExtension)" />
438     </ItemGroup>
439
440     <Copy SourceFiles="@(HostFxFile)"
441           DestinationFolder="$(NETCoreAppTestHostFxrPath)"
442           SkipUnchangedFiles="true"
443           UseHardlinksIfPossible="true" />
444
445     <!-- Should this be referenced from a NuGet package? -->
446     <Copy SourceFiles="@(HostPolicyFile)"
447           DestinationFolder="$(NETCoreAppTestSharedFrameworkPath)" 
448           SkipUnchangedFiles="true"
449           UseHardlinksIfPossible="true" />
450
451     <Copy SourceFiles="@(DotnetExe)"
452           DestinationFolder="$(TestHostRootPath)" 
453           SkipUnchangedFiles="true"
454           UseHardlinksIfPossible="true"  />
455
456     <Copy SourceFiles="@(CoreCLRBinaries)" 
457           DestinationFolder="$(NETCoreAppTestSharedFrameworkPath)" 
458           SkipUnchangedFiles="true" />
459   </Target>
460
461   <Target Name="RunPerfTests" Condition="'$(Performance)'=='true'">
462     <Message Text="Executing steps for perf tests" Importance="High"/>
463
464     <!-- generate project.json for runtime dependency -->
465     <MSBuild Projects="$(MSBuildProjectFile)"
466              Targets="CreateTestRuntimeJsonFile"/>
467
468     <!-- generate project.lock.json file corresponding to above json file -->
469     <MSBuild Projects="src\Common\test_dependencies\test_dependencies.csproj"/>
470
471     <!-- Package each perf test, upload it and trigger event to execute the tests -->
472     <MSBuild Projects="$(MSBuildProjectFile)" Targets="UploadPerfAssemblies" />
473   </Target>
474
475
476   <Target Name="Build">
477
478     <!-- generate project.lock.json file corresponding to above json file -->
479     <MSBuild Projects="src\Common\test_dependencies\test_dependencies.csproj"
480              Condition=" '$(BuildWrappers)'=='true' " />
481
482     <!-- Default for building -->
483     <MSBuild Projects="$(MSBuildProjectFile)"
484              Targets="CreateAllWrappers"
485              Properties="_CMDDIR=%(TestDirectories.Identity)"
486              Condition=" '$(BuildWrappers)'=='true' " />
487
488     <!-- Execution -->
489
490     <MSBuild Projects="$(MSBuildProjectFile)"
491              Targets="CreateTestOverlay"
492              Condition=" '$(GenerateRuntimeLayout)'=='true' "/>
493
494     <MSBuild Projects="$(MSBuildProjectFile)"
495              Targets="CreateTestHost"
496              Condition=" '$(GenerateTestHost)'=='true' "/>    
497
498     <MSBuild Projects="$(MSBuildProjectFile)" Targets="RunTests"
499              Condition=" '$(RunTests)'=='true' "/>
500   </Target>
501
502   <Target Name="Clean">
503     <RemoveDir Condition=" '$(BuildWrappers)'=='true'" Directories="$(XunitWrapperGeneratedCSDirBase);" ContinueOnError="WarnAndContinue" />
504   </Target>
505 </Project>