Merge pull request #18716 from BruceForstall/RemoveTstJobsFromViews
[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     <XunitWrapperOutputIntermediatedDirBase>$(XunitTestBinBase)\Tests\</XunitWrapperOutputIntermediatedDirBase>
10     <MSBuildEnableAllPropertyFunctions>1</MSBuildEnableAllPropertyFunctions>
11   </PropertyGroup>
12
13   <!-- TestHost destinations -->
14   <PropertyGroup>
15     <NETCoreAppTestSharedFxVersion>9.9.9</NETCoreAppTestSharedFxVersion>
16     <TestHostRootPath>$(BinDir)testhost\</TestHostRootPath>
17     <NETCoreAppTestHostFxrPath>$(TestHostRootPath)host\fxr\$(NETCoreAppTestSharedFxVersion)\</NETCoreAppTestHostFxrPath>
18     <NETCoreAppTestSharedFrameworkPath>$(TestHostRootPath)shared\Microsoft.NETCore.App\$(NETCoreAppTestSharedFxVersion)\</NETCoreAppTestSharedFrameworkPath>
19   </PropertyGroup>
20
21   <ItemGroup>
22     <DisabledTestDir Include="Common" />
23     <_SkipTestDir Include="@(DisabledTestDir)" />
24   </ItemGroup>
25
26   <Target Name="Rebuild" />
27
28   <Target Name="FindCmdDirectories" DependsOnTargets="GetListOfTestCmds">
29
30     <Error Condition="!Exists('$(XunitTestBinBase)')"
31            Text="$(XunitTestBinBase) does not exist. Please run buildtest.cmd from the (repo root)\tests at least once to get the tests built." />
32
33     <ItemGroup>
34
35       <AllTestDirsNonCanonicalPaths Include="$([System.IO.Directory]::GetDirectories(`$(XunitTestBinBase)`))" />
36       <AllTestDirsPaths Include="@(AllTestDirsNonCanonicalPaths)" />
37       <AllTestDirsPaths Include="@(AllTestDirsNonCanonicalPaths)" >
38         <Path>$([System.IO.Path]::GetFullPath(%(Identity)))</Path>
39       </AllTestDirsPaths>
40       <NonExcludedTestDirectories Include="@(AllTestDirsPaths -> '%(Path)')" Exclude="@(_SkipTestDir -> '$(XunitTestBinBase)%(Identity)')" />
41       <TopLevelDirectories Include="@(NonExcludedTestDirectories)" />
42       <SecondLevel Include="$([System.IO.Directory]::GetDirectories(%(TopLevelDirectories.Identity)))" />
43       <SecondLevelDirectories Include="@(SecondLevel)">
44         <Path>$([System.IO.Path]::GetFullPath(%(AllRunnableTestPaths.Identity)))</Path>
45       </SecondLevelDirectories>
46       <TestDirectoriesWithDup Include="@(SecondLevelDirectories -> '%(Identity)')" Condition="$([System.String]::new('%(Path)').StartsWith('%(Identity)'))" />
47
48     </ItemGroup>
49
50     <RemoveDuplicates Inputs="@(TestDirectoriesWithDup)">
51       <Output
52           TaskParameter="Filtered"
53           ItemName="TestDirectories"/>
54     </RemoveDuplicates>
55
56   </Target>
57
58   <Import Project="$(__Exclude)" Condition="'$(__Exclude)' != '' AND '$(XunitTestBinBase)' != ''" />
59   <PropertyGroup>
60     <HaveExcludes>False</HaveExcludes>
61     <HaveExcludes Condition="'$(__Exclude)' != ''">True</HaveExcludes>
62   </PropertyGroup>
63
64   <Target Name="CreateXunitWrapper" DependsOnTargets="CreateXunitFacts">
65
66     <PropertyGroup>
67       <_XunitWrapperGen >
68         <![CDATA[
69
70 $(_XunitProlog)
71 @(AllXUnitFacts)
72 $(_XunitEpilog)
73
74 ]]>
75       </_XunitWrapperGen>
76       <XunitWrapperGenCsProj>
77         <![CDATA[
78 <?xml version="1.0" encoding="utf-8"?>
79 <Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
80
81   <Import Project="$(SourceDir)dir.props" />
82   <PropertyGroup>
83     <Configuration Condition=" '%24(Configuration)' == '' ">Debug</Configuration>
84     <Platform Condition=" '%24(Platform)' == '' ">AnyCPU</Platform>
85     <AssemblyName>$(XunitWrapper)</AssemblyName>
86     <SchemaVersion>2.0</SchemaVersion>
87     <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
88     <OutputType>Library</OutputType>
89     <TargetFrameworkIdentifier Condition ="('$(BuildTestsAgainstPackages)' != 'true') And ('$(BuildOS)' == 'Windows_NT')">.NETFramework</TargetFrameworkIdentifier>
90     <TargetFrameworkVersion Condition ="('$(BuildTestsAgainstPackages)' != 'true') And ('$(BuildOS)' == 'Windows_NT')">v4.5</TargetFrameworkVersion>
91     <NugetTargetMonikerShort Condition ="'$(BuildTestsAgainstPackages)' != 'true'">net45</NugetTargetMonikerShort>
92     <IsXunitWrapperProject>true</IsXunitWrapperProject>
93     <SkipSigning>true</SkipSigning>
94     <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB}%3B{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
95     <SolutionDir Condition="%24(SolutionDir) == '' Or %24(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
96     <CLRTestKind>BuildOnly</CLRTestKind>
97     <IsTestProject>true</IsTestProject>
98   </PropertyGroup>
99   <!-- Default configurations to help VS understand the configurations -->
100   <PropertyGroup Condition=" '%24(Configuration)|%24(Platform)' == 'Debug|AnyCPU' ">
101   </PropertyGroup>
102   <PropertyGroup Condition=" '%24(Configuration)|%24(Platform)' == 'Release|AnyCPU' ">
103   </PropertyGroup>
104   <ItemGroup>
105     <Compile Include="$(XunitWrapper).cs" />
106   </ItemGroup>
107   <ItemGroup>
108     <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
109   </ItemGroup>
110    <ItemGroup>
111     <ProjectReference Include="$(SourceDir)Common\Desktop.Coreclr.TestWrapper\Desktop.Coreclr.TestWrapper.csproj" Condition="('$(BuildTestsAgainstPackages)' != 'true') And ('$(BuildOS)' == 'Windows_NT')">
112       <Project>{8ffe99c0-22f8-4462-b839-970eac1b3472}</Project>
113       <Name>coreclr</Name>
114     </ProjectReference>
115     <ProjectReference Include="$(SourceDir)Common\Coreclr.TestWrapper\Coreclr.TestWrapper.csproj" Condition="('$(BuildTestsAgainstPackages)' == 'true') Or ('$(BuildOS)' != 'Windows_NT')">
116       <Project>{8ffe99c0-22f8-4462-b839-970eac1b3472}</Project>
117       <Name>coreclr</Name>
118     </ProjectReference>
119   </ItemGroup>
120
121   <ItemGroup>
122     <Reference Include="System" />
123     <Reference Include="System.Runtime" />
124     <Reference Include="mscorlib" />
125   </ItemGroup>
126   <Import Project="$(SourceDir)dir.targets" />
127   <PropertyGroup>
128     <OutDir>$(XunitTestBinBase)\$(CategoryWithSlash)\</OutDir>
129     <ProjectAssetsFile Condition="'$(BuildTestsAgainstPackages)' != 'true'">%24(TestWrappersPackagesConfigFileDirectory)obj/project.assets.json</ProjectAssetsFile>
130   </PropertyGroup>
131 </Project>
132         ]]>
133       </XunitWrapperGenCsProj>
134
135     </PropertyGroup>
136
137     <!-- <Exec Command="md" -->
138     <MakeDir  Directories="$(XunitWrapperGeneratedCSDirBase)$(Category)"/>
139
140     <!-- Write the file -->
141     <WriteLinesToFile
142       File="$(XunitWrapperSrcDir)\$(XunitWrapper).cs"
143       Lines="$(_XunitWrapperGen)"
144       Overwrite="true" />
145
146     <!-- Write the file -->
147     <WriteLinesToFile
148       File="$(XunitWrapperSrcDir)\$(XunitWrapper).csproj"
149       Lines="$(XunitWrapperGenCsProj)"
150       Overwrite="true" />
151   </Target>
152
153   <Target Name="BuildXunitWrapper">
154     <MSBuild Projects="$(XunitWrapperSrcDir)\$(XunitWrapper).csproj"/>
155   </Target>
156
157   <Target Name="CreateXunitFacts">
158     <!-- NOTE! semicolons must be escaped with %3B boooo -->
159
160     <PropertyGroup>
161       <_CMDDIR_Parent>$([System.IO.Path]::GetDirectoryName($(_CMDDIR)))</_CMDDIR_Parent>
162       <_CMDDIR_Grandparent>$([System.IO.Path]::GetDirectoryName($(_CMDDIR_Parent)))</_CMDDIR_Grandparent>
163       <CategoryWithSlash Condition="'$(RunningOnUnix)' != 'true'" >$([System.String]::Copy('$(_CMDDIR)').Replace("$(_CMDDIR_Grandparent)\",""))</CategoryWithSlash>
164       <CategoryWithSlash Condition="'$(RunningOnUnix)' == 'true'" >$([System.String]::Copy('$(_CMDDIR)').Replace("$(_CMDDIR_Grandparent)/",""))</CategoryWithSlash>
165       <Category Condition="'$(RunningOnUnix)' != 'true'" >$([System.String]::Copy('$(CategoryWithSlash)').Replace('\','.'))</Category>
166       <Category Condition="'$(RunningOnUnix)' == 'true'" >$([System.String]::Copy('$(CategoryWithSlash)').Replace('/','.'))</Category>
167       <XunitWrapper>$(Category).XUnitWrapper</XunitWrapper>
168       <XunitWrapperSrcDir>$(XunitWrapperGeneratedCSDirBase)$(Category)</XunitWrapperSrcDir>
169       <XunitWrapperOutputDir>$(XunitWrapperOutputIntermediatedDirBase)$(Category)</XunitWrapperOutputDir>
170     </PropertyGroup>
171     <PropertyGroup>
172       <_XunitProlog Condition=" '$(_XunitProlog)'=='' ">
173         <![CDATA[
174 using Xunit%3B
175 using System%3B
176 using System.Collections.Generic%3B
177 using System.Diagnostics%3B
178 using System.Reflection%3B
179 using CoreclrTestLib%3B
180
181 namespace $([System.String]::Copy($(Category)).Replace(".","_").Replace("\","").Replace("-","_"))
182 {
183         internal class _Global
184         {
185             internal static bool runningInWindows%3B
186             internal static string reportBase%3B
187             internal static string testBinaryBase%3B
188             internal static string coreRoot%3B
189
190             static _Global()
191             {
192                 reportBase = System.Environment.GetEnvironmentVariable(%22XunitTestReportDirBase%22)%3B
193                 testBinaryBase = System.IO.Path.GetDirectoryName(new Uri(Assembly.GetExecutingAssembly().CodeBase).LocalPath)%3B
194                 coreRoot = System.IO.Path.GetFullPath(System.Environment.GetEnvironmentVariable(%22CORE_ROOT%22))%3B
195
196                 if (String.IsNullOrEmpty(reportBase)) {
197                     reportBase = System.IO.Path.Combine(testBinaryBase, "Reports")%3B
198                 }
199                 else
200                 {
201                     reportBase = System.IO.Path.GetFullPath(reportBase)%3B
202                 }
203
204                 if (String.IsNullOrEmpty(coreRoot)) {
205                     throw new ArgumentException("Environment variable CORE_ROOT is not set")%3B
206                 }
207
208                 string operatingSystem = System.Environment.GetEnvironmentVariable("OS")%3B
209                 runningInWindows = (operatingSystem != null && operatingSystem.StartsWith("Windows"))%3B
210             }
211         }
212
213 ]]>
214       </_XunitProlog>
215
216       <_XunitEpilog Condition=" '$(_XunitEpilog)'=='' ">
217       <![CDATA[
218 }
219
220 ]]>
221       </_XunitEpilog>
222     </PropertyGroup>
223
224     <ItemGroup>
225       <CanonicalExcludeList Include="%(ExcludeList.FullPath)" Condition="$(HaveExcludes)"/>
226     </ItemGroup>
227
228     <PropertyGroup>
229       <TestExecutableReplacement Condition="'$(TargetsWindows)' != 'true' ">testExecutable = testExecutable.Replace("\\", "/")%3B</TestExecutableReplacement>
230     </PropertyGroup>
231
232     <ItemGroup>
233       <AllCMDsPresent Include="$(_CMDDIR)\**\*.cmd" Condition="'$(RunningOnUnix)' != 'true'" />
234       <AllCMDsPresent Include="$(_CMDDIR)\**\*.sh" Condition="'$(RunningOnUnix)' == 'true'" />
235       <AllCMDExcludeFilter Include="@(CanonicalExcludeList)" Condition="$(HaveExcludes)"/>
236       <AllCMDs Include="@(AllCMDsPresent)" Exclude="@(AllCMDExcludeFilter)"/>
237
238       <AllCommands Include="@(AllCMDs)" >
239         <_FactName Condition="'$(RunningOnUnix)' != 'true'" >$([System.String]::Copy('%(AllCMDs.FullPath)').Replace("$(_CMDDIR)",'').Replace(".","_").Replace("\","_").Replace("-","_"))</_FactName>
240         <_ClassName Condition="'$(RunningOnUnix)' != 'true'" >$([System.String]::Copy('%(AllCMDs.FullPath)').Replace("$(_CMDDIR)",'').Replace("cmd","").Replace(".","_").Replace("\","_").Replace("-","_"))</_ClassName>
241         <_FactName Condition="'$(RunningOnUnix)' == 'true'" >$([System.String]::Copy('%(AllCMDs.FullPath)').Replace("$(_CMDDIR)",'').Replace(".","_").Replace("/","_").Replace("-","_"))</_FactName>
242         <_ClassName Condition="'$(RunningOnUnix)' == 'true'" >$([System.String]::Copy('%(AllCMDs.FullPath)').Replace("$(_CMDDIR)",'').Replace("sh","").Replace(".","_").Replace("/","_").Replace("-","_"))</_ClassName>
243
244         <_XunitFact >
245           <![CDATA[
246
247         public class %(AllCommands._ClassName)
248         {
249             [Fact]
250             public void %(AllCommands._FactName)()
251             {
252                 int ret = -100%3B
253                 string outputFile = null%3B
254                 string errorFile = null%3B
255                 string testExecutable = null%3B
256                 Exception infraEx = null%3B
257
258                 try
259                 {
260                   CoreclrTestWrapperLib wrapper = new CoreclrTestWrapperLib()%3B
261                   string testSubfolder = @"\$(Category)\$([System.String]::Copy('%(AllCMDs.RelativeDir)').Replace("$(_CMDDIR)\",''))"%3B
262                   outputFile = System.IO.Path.GetFullPath(_Global.reportBase + testSubfolder + @"%(AllCMDs.FileName).output.txt")%3B
263                   errorFile = System.IO.Path.GetFullPath(_Global.reportBase + testSubfolder + @"%(AllCMDs.FileName).error.txt")%3B
264                   testExecutable = System.IO.Path.GetFullPath(_Global.testBinaryBase + @"$([System.String]::Copy('%(AllCMDs.FullPath)').Replace("$(_CMDDIR)",''))")%3B
265                   $(TestExecutableReplacement)
266
267                   if (!_Global.runningInWindows) {
268                       testExecutable = testExecutable.Replace(".cmd", ".sh")%3B
269                   }
270
271                   System.IO.Directory.CreateDirectory(_Global.reportBase + testSubfolder)%3B
272
273                   ret = wrapper.RunTest(testExecutable, outputFile, errorFile)%3B
274                 }
275                 catch (Exception ex)
276                 {
277                     infraEx = ex%3B
278                 }
279
280                 if (ret != CoreclrTestWrapperLib.EXIT_SUCCESS_CODE)
281                 {
282                     string sErrorText = null%3B
283                     try
284                     {
285                         sErrorText = System.IO.File.ReadAllText(errorFile)%3B
286                     }
287                     catch(Exception ex)
288                     {
289                       sErrorText = "Unable to read error file: " + errorFile%3B
290                     }
291
292                     string outputText = null%3B
293                     try
294                     {
295                         System.IO.StreamReader outputReader = new System.IO.StreamReader(outputFile)%3B
296                         outputText = outputReader.ReadToEnd()%3B
297                         outputReader.Close()%3B
298                     }
299                     catch(Exception ex)
300                     {
301                         outputText = "Unable to read output file: " + outputFile%3B
302                     }
303
304                     string msg = infraEx != null ? "Test Infrastructure Failure: " + infraEx.Message
305                                                  : sErrorText + "\n\n" +
306                                                    "Return code:      " + ret + "\n" +
307                                                    "Raw output file:      " + outputFile + "\n" +
308                                                    "Raw output:\n" + outputText + "\n" +
309                                                    "To run the test:\n" +
310                                                    "> set CORE_ROOT=" + _Global.coreRoot + "\n" +
311                                                    "> " + testExecutable + "\n"%3B
312
313                     Assert.True(ret == CoreclrTestWrapperLib.EXIT_SUCCESS_CODE, msg)%3B
314                 }
315             }
316        }
317
318         ]]>
319         </_XunitFact>
320       </AllCommands>
321       <AllXUnitFacts Include= "%(AllCommands._XunitFact)" />
322     </ItemGroup>
323
324   </Target>
325
326   <Target Name="CreateAllWrappers" DependsOnTargets="GetListOfTestCmds;FindCmdDirectories">
327     <MSBuild Projects="$(MSBuildProjectFile)" Targets="CreateXunitWrapper;BuildXunitWrapper" Properties="_CMDDIR=%(TestDirectories.Identity)" />
328   </Target>
329
330   <Target Name="GetListOfTestCmds">
331     <ItemGroup>
332       <AllRunnableTestPaths Include="$(XunitTestBinBase)\**\*.cmd" />
333     </ItemGroup>
334   </Target>
335
336   <!-- 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 -->
337   <Import Condition="'$(OverwriteCoreClrPackageVersion)' == 'true'" Project="$(BuildVersionFile)" />
338
339   <PropertyGroup Condition="'$(OverwriteCoreClrPackageVersion)' == 'true'">
340     <VersionToRestore Condition="'$(StableVersion)' != ''">$(StableVersion)</VersionToRestore>
341     <VersionToRestore Condition="'$(VersionToRestore)' == ''">$(PackageVersion)-$(PreReleaseLabel)-$(BuildNumberMajor)-$(BuildNumberMinor)</VersionToRestore>
342     <DesiredPackageVersionArg>$(VersionToRestore)</DesiredPackageVersionArg>
343   </PropertyGroup>
344
345   <Import Project="tests.targets" />
346   <Import Project="publishdependency.targets" />
347
348   <PropertyGroup>
349     <DesiredPackageVersionArg Condition="'$(DesiredPackageVersionArg)' == ''">$(MicrosoftNETCoreRuntimeCoreCLRPackageVersion)</DesiredPackageVersionArg>
350   </PropertyGroup>
351
352   <Target Name="CreateTestOverlay">
353     <MSBuild Projects="$(MSBuildProjectFile)"
354              Targets="CopyDependecyToCoreRoot"
355              Properties="Language=C#;TargetRid=$(TargetRid)" />
356   </Target>
357
358   <Target Name="BinPlaceRef">
359     <!-- Copy mscorlib.dll from TargetingPack to bin/Product/ref, if we're building against packages -->
360     <MSBuild Projects="$(MSBuildProjectFile)"
361              Targets="CopyDependencyToRef"
362              Properties="Language=C#;TargetRid=$(TargetRid)"
363              Condition=" '$(BuildTestsAgainstPackages)'=='true' " />
364   </Target>
365
366   <Target Name="BinPlaceProduct">
367     <!-- Copy test dependencies to bin/Product, if we're building against packages -->
368     <MSBuild Projects="$(MSBuildProjectFile)"
369              Targets="CopyDependencyToProduct"
370              Properties="Language=C#;TargetRid=$(TargetRid)"
371              Condition=" '$(BuildTestsAgainstPackages)'=='true' " />
372   </Target>
373
374   <Target Name="ResolveTestHostDependencies">
375     <MSBuild Projects="$(MSBuildThisFileDirectory)src\Common\CoreFX\CoreFX.depproj" 
376             Properties="OutputPath=$(NETCoreAppTestSharedFrameworkPath);" />
377   </Target>
378
379   <Target Name="CreateTestHost" DependsOnTargets="ResolveTestHostDependencies">
380     <MSBuild Projects="$(MSBuildProjectFile)"
381             Targets="SetupTestingHost"/>
382
383     <MSBuild Projects="$(MSBuildProjectFile)"
384             Targets="GenerateTestSharedFrameworkDepsFile"/>
385   </Target>
386
387   <UsingTask TaskName="GenerateDepsJson" AssemblyFile="$(BuildToolsTaskDir)Microsoft.DotNet.Build.Tasks.dll"/>
388   <!-- After we copied all the framework libraries we need to generate a deps.json file for the shared test framework -->
389   <Target Name="GenerateTestSharedFrameworkDepsFile" AfterTargets="SetupTestingHost">
390     <ItemGroup>
391       <!-- This is for HostPolicy, CoreCLR and Jit dependencies to continue to remain inside of the dep.json -->
392       <ExceptionForDepsJson Include="microsoft.netcore.app" />
393
394       <!-- TODO: We should see about generating this from scratch instead of relying on a previous deps file as a template -->
395       <_sharedFrameworkDepsJson Include="$(ToolsDir)dotnetcli\shared\Microsoft.NETCore.App\*\Microsoft.NETCore.App.deps.json" />
396     </ItemGroup>
397
398     <PropertyGroup>
399       <_OriginalDepsJsonPath>%(_sharedFrameworkDepsJson.FullPath)</_OriginalDepsJsonPath>
400       <_OutputTestSharedFrameworkDepsPath>$(NETCoreAppTestSharedFrameworkPath)\Microsoft.NETCore.App.deps.json</_OutputTestSharedFrameworkDepsPath>
401     </PropertyGroup>
402
403     <GenerateDepsJson DepsJsonPath="$(_OriginalDepsJsonPath)"
404                       GenerateNewDepsJson="true"
405                       RuntimeDirectory="$(NETCoreAppTestSharedFrameworkPath)"
406                       DepsExceptions="@(ExceptionForDepsJson)"
407                       OutputPath="$(_OutputTestSharedFrameworkDepsPath)"/>
408   </Target>
409
410   <Target Name="SetupTestingHost"  AfterTargets="CreateTestOverlay" Condition="'$(CreateTestHost)' != 'false'">
411
412     <PropertyGroup Condition="'$(OSGroup)'=='Windows_NT'">
413       <HostFxrFileName>hostfxr</HostFxrFileName>
414       <DotnetExecutableName>dotnet.exe</DotnetExecutableName>
415       <HostFxrFileExtension>dll</HostFxrFileExtension>
416     </PropertyGroup>
417     
418     <PropertyGroup Condition="'$(OSGroup)'!='Windows_NT'">
419       <HostFxrFileName>libhostfxr</HostFxrFileName>
420       <HostFxrFileExtension Condition="'$(OSGroup)' == 'Linux' Or '$(OSGroup)' == 'FreeBSD'">so</HostFxrFileExtension>
421       <HostFxrFileExtension Condition="$(OSGroup) =='OSX'">dylib</HostFxrFileExtension>
422       <DotnetExecutableName>dotnet</DotnetExecutableName>
423     </PropertyGroup>
424     
425     <ItemGroup>
426       <!-- Workaround for packages on which Microsoft.NetCoreApp expresses a dependency 
427       The <PackageToInclude> element doesn't allow a version to be specified and we end up with clashing assembly versions in Core_Root-->
428       <NetCoreAppPackagedAssemblies Include="System.Text.Encoding.CodePages.dll"/>
429     </ItemGroup>
430
431     <ItemGroup>
432       <CoreCLRBinaries Include="$(CORE_ROOT)\**\*.*" Exclude="$(CORE_ROOT)\**\@(NetCoreAppPackagedAssemblies -> '%(Identity)' )" />
433       <HostFxFile Include="$(ToolsDir)\dotnetcli\**\$(HostFxrFileName).$(HostFxrFileExtension)" />
434       <DotnetExe Include="$(ToolsDir)\dotnetcli\$(DotnetExecutableName)" />
435       <HostPolicyFile Include="$(ToolsDir)\dotnetcli\**\hostpolicy.dll" />
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);$(XunitWrapperOutputIntermediatedDirBase)" ContinueOnError="WarnAndContinue" />
502   </Target>
503 </Project>