Skip to content

Commit

Permalink
Remove TargetFramework reads in eng/testing (#35954)
Browse files Browse the repository at this point in the history
  • Loading branch information
ViktorHofer authored May 7, 2020
1 parent 5f2857a commit 9b5805f
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 25 deletions.
5 changes: 0 additions & 5 deletions eng/testing/tests.props
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,6 @@
<_withoutCategories Condition="!$(_withCategories.Contains('failing'))">$(_withoutCategories);failing</_withoutCategories>
</PropertyGroup>

<!-- Set env variable to use the local netfx assemblies instead of the ones in the GAC. -->
<ItemGroup Condition="$(TargetFramework.StartsWith('net4'))">
<RunScriptCommands Include="set DEVPATH=%RUNTIME_PATH%" />
</ItemGroup>

<!--
Unit/Functional/Integration test support.
Supported runners: xunit.
Expand Down
5 changes: 5 additions & 0 deletions eng/testing/tests.targets
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,11 @@
<RunScriptHost Condition="'$(TargetOS)' != 'Windows_NT'">$(RunScriptHostDir)dotnet</RunScriptHost>
</PropertyGroup>

<!-- Set env variable to use the local netfx assemblies instead of the ones in the GAC. -->
<ItemGroup Condition="'$(TargetFrameworkIdentifier)' == '.NETFramework'">
<RunScriptCommands Include="set DEVPATH=%RUNTIME_PATH%" />
</ItemGroup>

<!-- Archive test binaries. -->
<Target Name="ArchiveTests"
Condition="'$(ArchiveTests)' == 'true' and '$(IgnoreForCI)' != 'true'"
Expand Down
15 changes: 0 additions & 15 deletions eng/testing/xunit/xunit.console.props

This file was deleted.

20 changes: 17 additions & 3 deletions eng/testing/xunit/xunit.console.targets
Original file line number Diff line number Diff line change
@@ -1,8 +1,13 @@
<Project>
<PropertyGroup>
<CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies>
<TestResultsName>testResults.xml</TestResultsName>
</PropertyGroup>

<PropertyGroup>
<_depsFileArgument Condition="'$(GenerateDependencyFile)' == 'true'">--depsfile $(AssemblyName).deps.json</_depsFileArgument>
<RunScriptCommand Condition="'$(TargetFramework)' == '$(NetCoreAppCurrent)'">"$(RunScriptHost)" exec --runtimeconfig $(AssemblyName).runtimeconfig.json $(_depsFileArgument) xunit.console.dll</RunScriptCommand>
<RunScriptCommand Condition="'$(TargetFramework)' == '$(NetFrameworkCurrent)'">xunit.console.exe</RunScriptCommand>
<RunScriptCommand Condition="'$(TargetFrameworkIdentifier)' == '.NETCoreApp'">"$(RunScriptHost)" exec --runtimeconfig $(AssemblyName).runtimeconfig.json $(_depsFileArgument) xunit.console.dll</RunScriptCommand>
<RunScriptCommand Condition="'$(TargetFrameworkIdentifier)' == '.NETFramework'">xunit.console.exe</RunScriptCommand>

<RunScriptCommand>$(RunScriptCommand) $(TargetFileName)</RunScriptCommand>
<RunScriptCommand>$(RunScriptCommand) -xml $(TestResultsName)</RunScriptCommand>
Expand All @@ -14,7 +19,7 @@
<RunScriptCommand Condition="'$(XUnitMethodName)' != ''">$(RunScriptCommand) -method $(XUnitMethodName)</RunScriptCommand>
<RunScriptCommand Condition="'$(XUnitClassName)' != ''">$(RunScriptCommand) -class $(XUnitClassName)</RunScriptCommand>
<RunScriptCommand Condition="'$(XUnitShowProgress)' == 'true'">$(RunScriptCommand) -verbose</RunScriptCommand>
<RunScriptCommand Condition="'$(TargetFramework)' == '$(NetFrameworkCurrent)' and '$(TestDisableAppDomain)' == 'true'">$(RunScriptCommand) -noappdomain</RunScriptCommand>
<RunScriptCommand Condition="'$(TargetFrameworkIdentifier)' == '.NETFramework' and '$(TestDisableAppDomain)' == 'true'">$(RunScriptCommand) -noappdomain</RunScriptCommand>

<!-- Add to run argument string -->
<RunScriptCommand>$(RunScriptCommand)$(_withCategories.Replace(';', ' -trait category='))</RunScriptCommand>
Expand All @@ -24,6 +29,15 @@
<RunScriptCommand Condition="'$(XUnitOptions)' != ''">$(RunScriptCommand) $(XUnitOptions)</RunScriptCommand>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.DotNet.XUnitConsoleRunner"
Version="$(MicrosoftDotNetXUnitConsoleRunnerVersion)"
Condition="'$(TargetFrameworkIdentifier)' == '.NETCoreApp'" />
<PackageReference Include="xunit.runner.console"
Version="$(XUnitVersion)"
Condition="'$(TargetFrameworkIdentifier)' == '.NETFramework'" />
</ItemGroup>

<!-- Overwrite the runner config file with the app local one. -->
<Target Name="OverwriteDesktopTestRunnerConfigs"
Condition="'$(GenerateRuntimeConfigurationFiles)' == 'true' and '$(TargetFrameworkIdentifier)' == '.NETFramework'"
Expand Down
2 changes: 0 additions & 2 deletions eng/testing/xunit/xunit.props
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,4 @@
CopyToOutputDirectory="PreserveNewest"
Visible="false" />
</ItemGroup>

<Import Project="$(MSBuildThisFileDirectory)xunit.console.props" />
</Project>

0 comments on commit 9b5805f

Please sign in to comment.