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" />
6 <XunitTestBinBase Condition="'$(XunitTestBinBase)'==''" >$(BaseOutputPathWithConfig)</XunitTestBinBase>
7 <XunitWrapperGeneratedCSDirBase>$(SourceDir)\TestWrappers_$(Platform)_$(Configuration)\</XunitWrapperGeneratedCSDirBase>
8 <XunitWrapperOutputIntermediatedDirBase>$(XunitTestBinBase)\Tests\</XunitWrapperOutputIntermediatedDirBase>
9 <MSBuildEnableAllPropertyFunctions>1</MSBuildEnableAllPropertyFunctions>
13 <DisabledTestDir Include="Common" />
14 <_SkipTestDir Include="@(DisabledTestDir)" />
18 <Target Name="FindCmdDirectories"
19 DependsOnTargets="GetListOfTestCmds"
22 <Error Condition="!Exists('$(XunitTestBinBase)')"
23 Text="$(XunitTestBinBase) does not exists. Please run buildtest.cmd from the (repo root)\tests at least once to get the tests built." />
26 <AllTestDirsNonCanonicalPaths Include="$([System.IO.Directory]::GetDirectories(`$(XunitTestBinBase)`))" />
28 <AllTestDirsPaths Include="@(AllTestDirsNonCanonicalPaths)" />
29 <AllTestDirsPaths Include="@(AllTestDirsNonCanonicalPaths)" >
30 <Path>$([System.IO.Path]::GetFullPath(%(Identity)))</Path>
33 <NonExcludedTestDirectories Include="@(AllTestDirsPaths -> '%(Path)')" Exclude="@(_SkipTestDir -> '$(XunitTestBinBase)%(Identity)')">
34 <Path>$([System.IO.Path]::GetFullPath(%(AllRunnableTestPaths.Identity)))</Path>
35 </NonExcludedTestDirectories>
37 <TestDirectoriesWithDup Include="@(NonExcludedTestDirectories -> '%(Identity)')" Condition="$([System.String]::new('%(Path)').StartsWith('%(Identity)'))" />
42 Inputs="@(TestDirectoriesWithDup)">
44 TaskParameter="Filtered"
45 ItemName="TestDirectories"/>
51 <Import Project="$(__Exclude)" Condition="'$(__Exclude)' != '' AND '$(XunitTestBinBase)' != ''" />
53 <Target Name="CreateXunitWrapper"
54 DependsOnTargets="CreateXunitFacts">
66 <XunitVersionCompiled>2.0.0-beta5-build2785</XunitVersionCompiled>
67 <XunitWrapperGenCsProj>
69 <?xml version="1.0" encoding="utf-8"?>
70 <Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
72 <Import Project="%24([MSBuild]::GetDirectoryNameOfFileAbove(%24(MSBuildThisFileDirectory), dir.props))\dir.props" />
74 <Configuration Condition=" '%24(Configuration)' == '' ">Debug</Configuration>
75 <Platform Condition=" '%24(Platform)' == '' ">AnyCPU</Platform>
76 <AssemblyName>$(XunitWrapper)</AssemblyName>
77 <SchemaVersion>2.0</SchemaVersion>
78 <ProjectGuid>{95DFC527-4DC1-495E-97D7-E94EE1F7140D}</ProjectGuid>
79 <OutputType>Library</OutputType>
80 <TargetFrameworkIdentifier>.NETFramework</TargetFrameworkIdentifier>
81 <TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
82 <IsXunitWrapperProject>true</IsXunitWrapperProject>
83 <SkipSigning>true</SkipSigning>
84 <AppDesignerFolder>Properties</AppDesignerFolder>
85 <FileAlignment>512</FileAlignment>
86 <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
87 <SolutionDir Condition="%24(SolutionDir) == '' Or %24(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
88 <RestorePackages>true</RestorePackages>
89 <NuGetPackageImportStamp>7a9bfb7d</NuGetPackageImportStamp>
90 <GenerateRunScript>false</GenerateRunScript>
92 <!-- Default configurations to help VS understand the configurations -->
93 <PropertyGroup Condition=" '%24(Configuration)|%24(Platform)' == 'Debug|AnyCPU' ">
95 <PropertyGroup Condition=" '%24(Configuration)|%24(Platform)' == 'Release|AnyCPU' ">
98 <Compile Include="$(XunitWrapper).cs" />
103 <Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
106 <ProjectReference Include="$(SourceDir)Common\Desktop.Coreclr.TestWrapper\Desktop.Coreclr.TestWrapper.csproj">
107 <Project>{8ffe99c0-22f8-4462-b839-970eac1b3472}</Project>
113 <Reference Include="System" />
114 <Reference Include="System.Runtime" />
115 <Reference Include="mscorlib" />
117 <Import Project="%24([MSBuild]::GetDirectoryNameOfFileAbove(%24(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
119 <OutDir>$(XunitWrapperOutputIntermediatedDirBase)\XunitRunner\</OutDir>
123 </XunitWrapperGenCsProj>
124 <XunitWrapperGenPackConfig>
128 "xunit" : "2.0.0-beta5-build2785",
129 "xunit.abstractions" : "2.0.0-beta5-build2785",
130 "xunit.assert" : "2.0.0-beta5-build2785",
131 "xunit.core" : "2.0.0-beta5-build2785",
132 "xunit.execution" : "2.0.0-beta5-build2785",
133 "xunit.runners" : "2.0.0-beta5-build2785"
140 </XunitWrapperGenPackConfig>
144 <!-- <Exec Command="md" -->
145 <MakeDir Directories="$(XunitWrapperGeneratedCSDirBase)$(Category)"/>
146 <!-- Write the file -->
148 File="$(XunitWrapperSrcDir)\$(XunitWrapper).cs"
149 Lines="$(_XunitWrapperGen)"
151 <!-- Write the file -->
153 File="$(XunitWrapperSrcDir)\$(XunitWrapper).csproj"
154 Lines="$(XunitWrapperGenCsProj)"
157 <!-- Write the file -->
159 File="$(XunitWrapperSrcDir)\project.json"
160 Lines="$(XunitWrapperGenPackConfig)"
163 <MSBuild Projects="$(XunitWrapperSrcDir)\$(XunitWrapper).csproj" />
165 <Target Name="CreateXunitFacts">
166 <!-- NOTE! semicolons must be escaped with %3B boooo -->
169 <_CMDDIR_Parent>$([System.IO.Path]::GetDirectoryName($(_CMDDIR)))</_CMDDIR_Parent>
170 <Category>$([System.String]::Copy('$(_CMDDIR)').Replace($(_CMDDIR_Parent)\,''))</Category>
171 <XunitWrapper>$(Category).XUnitWrapper</XunitWrapper>
172 <XunitWrapperSrcDir>$(XunitWrapperGeneratedCSDirBase)$(Category)</XunitWrapperSrcDir>
173 <XunitWrapperOutputDir>$(XunitWrapperOutputIntermediatedDirBase)$(Category)</XunitWrapperOutputDir>
176 <_XunitProlog Condition=" '$(_XunitProlog)'=='' ">
180 using System.Collections.Generic%3B
181 using System.Diagnostics%3B
182 using CoreclrTestLib%3B
184 namespace $([System.String]::Copy($(Category)).Replace(".","_").Replace("\","").Replace("-","_"))
189 <_XunitEpilog Condition=" '$(_XunitEpilog)'=='' ">
198 <CanonicalExcludeList Include="%(ExcludeList.FullPath)" Condition="'$(__Exclude)' != ''"/>
202 <AllCMDsPresent Include="$(_CMDDIR)\**\*.cmd" />
203 <AllCMDExcludeFilter Include="@(CanonicalExcludeList)" Condition="'$(__Exclude)' != ''"/>
204 <AllCMDs Include="@(AllCMDsPresent)" Exclude="@(AllCMDExcludeFilter)"/>
206 <AllCommamds Include="@(AllCMDs)" >
208 <_FactName>$([System.String]::Copy('%(AllCMDs.FullPath)').Replace("$(_CMDDIR)",'').Replace(".","_"))</_FactName>
212 public class $([System.String]::Copy('%(AllCMDs.FullPath)').Replace("$(_CMDDIR)",'').Replace("cmd","").Replace(".","_").Replace("\","_").Replace("-","_"))
214 static bool category_initlialized = false%3B
215 static bool runningInWindows = false%3B
216 static string reportbase%3B
217 static string TestBinaryBase%3B
218 static string core_root%3B
221 if (!category_initlialized)
223 reportbase = System.IO.Path.GetFullPath(System.Environment.GetEnvironmentVariable(%22XunitTestReportDirBase%22))%3B
224 TestBinaryBase = System.IO.Path.GetFullPath(System.Environment.GetEnvironmentVariable(%22XunitTestBinBase%22))%3B
225 core_root = System.IO.Path.GetFullPath(System.Environment.GetEnvironmentVariable(%22CORE_ROOT%22))%3B
226 if (String.IsNullOrEmpty(reportbase)){
228 throw new ArgumentException("Env variables XunitTestReportDirBase is not set") %3B
231 if (String.IsNullOrEmpty(TestBinaryBase)){
233 throw new ArgumentException("Env variables XunitTestBinBase is not set")%3B
236 if (String.IsNullOrEmpty(core_root)){
238 throw new ArgumentException("Env variables CORE_ROOT is not set")%3B
240 runningInWindows = System.Environment.GetEnvironmentVariable("OS").StartsWith("Windows")%3B
243 category_initlialized = true%3B
248 public void $([System.String]::Copy('%(AllCMDs.FullPath)').Replace("$(_CMDDIR)",'').Replace(".","_").Replace("\","_").Replace("-","_"))()
251 string msg ="Test Infrastructure Failure :\n"%3B
255 CoreclrTestWrapperLib wrapper = new CoreclrTestWrapperLib()%3B
256 string testsubfolder = @"\$(Category)\$([System.String]::Copy('%(AllCMDs.RelativeDir)').Replace("$(_CMDDIR)\",''))"%3B
257 string outputfile = System.IO.Path.GetFullPath(reportbase + testsubfolder + @"%(AllCMDs.FileName).output.txt")%3B
258 string errorfile = System.IO.Path.GetFullPath(reportbase + testsubfolder + @"%(AllCMDs.FileName).error.txt")%3B
259 string test_cmd = System.IO.Path.GetFullPath(TestBinaryBase + @"\$(Category)\$([System.String]::Copy('%(AllCMDs.FullPath)').Replace("$(_CMDDIR)",''))")%3B
262 if (!runningInWindows){
264 test_cmd = test_cmd.Replace(".cmd", ".sh")%3B
267 System.IO.Directory.CreateDirectory(reportbase + testsubfolder)%3B
269 ret = wrapper.RunTest(test_cmd, outputfile, errorfile)%3B
271 string err_text = System.IO.File.ReadAllText(errorfile)%3B
273 @"Raw Output :"+ outputfile + "\n" +
274 @"To Run the test :Step 1. set Core_Root="+ core_root + "\n" +
275 " Step 2. "+test_cmd + "\n"%3B
281 msg = msg + Ex.Message%3B
284 Assert.True(ret == CoreclrTestWrapperLib.EXIT_SUCCESS_CODE, msg)%3B
293 <AllXUnitFacts Include= "%(AllCommamds._XunitFact)" />
298 <Target Name="CreateAllWrappers"
299 DependsOnTargets="GetListOfTestCmds;FindCmdDirectories">
301 <MSBuild Projects="$(MSBuildProjectFile)" Targets="CreateXunitWrapper" Properties="_CMDDIR=%(TestDirectories.Identity)" />
304 <Target Name="GetListOfTestCmds">
306 <AllRunnableTestPaths Include="$(XunitTestBinBase)\**\*.cmd" />
310 <Import Project="tests.targets" />
311 <Import Project="publishdependency.targets" />
313 <Target Name="Build">
314 <!-- Default for building -->
315 <MSBuild Projects="$(MSBuildProjectFile)"
316 Targets="CreateAllWrappers"
317 Properties="_CMDDIR=%(TestDirectories.Identity)"
318 Condition=" '$(NoBuild)'!='true' " />
322 <MSBuild Projects="$(MSBuildProjectFile)" Targets="CopyDependecyToCoreRoot"
323 Condition=" '$(NoRun)'!='true' "/>
325 <MSBuild Projects="$(MSBuildProjectFile)" Targets="RunTests"
326 Condition=" '$(NoRun)'!='true' "/>
329 <Target Name="Clean">
330 <RemoveDir Condition=" '$(NoBuild)'!='true'" Directories="$(XunitWrapperGeneratedCSDirBase);$(XunitWrapperOutputIntermediatedDirBase)" ContinueOnError="WarnAndContinue" />