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