Ensure trx logging is reported correctly when building in TeamCity
This commit is contained in:
parent
7b00c77391
commit
62ea0264e4
|
|
@ -530,9 +530,17 @@
|
||||||
|
|
||||||
<Target Name="BuildSharedFx" DependsOnTargets="GeneratePropsFiles;ResolveSharedFxFiles;CrossGenAssemblies;CrossGenSymbols;PackSharedFx;TestSharedFx"/>
|
<Target Name="BuildSharedFx" DependsOnTargets="GeneratePropsFiles;ResolveSharedFxFiles;CrossGenAssemblies;CrossGenSymbols;PackSharedFx;TestSharedFx"/>
|
||||||
|
|
||||||
|
|
||||||
<Target Name="TestSharedFx" DependsOnTargets="GeneratePropsFiles;DefineSharedFxPrerequisites;ResolveCommitHash;InstallDotNet">
|
<Target Name="TestSharedFx" DependsOnTargets="GeneratePropsFiles;DefineSharedFxPrerequisites;ResolveCommitHash;InstallDotNet">
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<UnitTestFxProject>$(RepositoryRoot)\test\SharedFx.UnitTests\SharedFx.UnitTests.csproj</UnitTestFxProject>
|
<UnitTestFxProject>$(RepositoryRoot)\test\SharedFx.UnitTests\SharedFx.UnitTests.csproj</UnitTestFxProject>
|
||||||
|
|
||||||
|
<!-- The file path to the log file, from within the container -->
|
||||||
|
<UnitTestFxTrxLogFile>$(LogOutputDir)SharedFx-UnitTests-$(Version).trx</UnitTestFxTrxLogFile>
|
||||||
|
<!-- The trx file path from the perspective of the TeamCity agent -->
|
||||||
|
<UnitTestFxTrxPhysicalFilePath>$(UnitTestFxTrxLogFile)</UnitTestFxTrxPhysicalFilePath>
|
||||||
|
<UnitTestFxTrxPhysicalFilePath Condition="'$(HostMachineRepositoryRoot)' != ''">$(HostMachineRepositoryRoot)/artifacts/logs/SharedFx-UnitTests.trx</UnitTestFxTrxPhysicalFilePath>
|
||||||
|
|
||||||
<UnitTestFxTestProps>
|
<UnitTestFxTestProps>
|
||||||
DotNetRestoreSourcePropsPath=$(GeneratedRestoreSourcesPropsPath);
|
DotNetRestoreSourcePropsPath=$(GeneratedRestoreSourcesPropsPath);
|
||||||
DotNetPackageVersionPropsPath=$(GeneratedPackageVersionPropsPath);
|
DotNetPackageVersionPropsPath=$(GeneratedPackageVersionPropsPath);
|
||||||
|
|
@ -540,7 +548,6 @@
|
||||||
RepositoryCommit=$(RepositoryCommit);
|
RepositoryCommit=$(RepositoryCommit);
|
||||||
SharedFxRuntimeIdentifier=$(SharedFXRid)
|
SharedFxRuntimeIdentifier=$(SharedFXRid)
|
||||||
</UnitTestFxTestProps>
|
</UnitTestFxTestProps>
|
||||||
<TrxFile>$(LogOutputDir)SharedFx.UnitTests-$(BuildNumber).trx</TrxFile>
|
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<MSBuild Projects="$(UnitTestFxProject)" Targets="Restore" Properties="_Dummy=restore;$(UnitTestFxTestProps)" />
|
<MSBuild Projects="$(UnitTestFxProject)" Targets="Restore" Properties="_Dummy=restore;$(UnitTestFxTestProps)" />
|
||||||
<MSBuild Projects="$(UnitTestFxProject)" Targets="Build" Properties="$(UnitTestFxTestProps)">
|
<MSBuild Projects="$(UnitTestFxProject)" Targets="Build" Properties="$(UnitTestFxTestProps)">
|
||||||
|
|
@ -548,15 +555,15 @@
|
||||||
</MSBuild>
|
</MSBuild>
|
||||||
<RunDotNet Arguments="vstest;
|
<RunDotNet Arguments="vstest;
|
||||||
--Framework:%(TargetFrameworkIdentifier),Version=v%(TargetFrameworkVersion);
|
--Framework:%(TargetFrameworkIdentifier),Version=v%(TargetFrameworkVersion);
|
||||||
--Logger:$([MSBuild]::Escape('trx;LogFileName=$(TrxFile)'));
|
--Logger:$([MSBuild]::Escape('trx;LogFileName=$(UnitTestFxTrxLogFile)'));
|
||||||
%(SharedFxTestAssembly.Identity);
|
%(SharedFxTestAssembly.Identity);
|
||||||
--;RunConfiguration.NoAutoReporters=true" IgnoreExitCode="true">
|
--;RunConfiguration.NoAutoReporters=true" IgnoreExitCode="true">
|
||||||
<Output TaskParameter="ExitCode" PropertyName="VsTestExitCode" />
|
<Output TaskParameter="ExitCode" PropertyName="VsTestExitCode" />
|
||||||
</RunDotNet>
|
</RunDotNet>
|
||||||
|
|
||||||
<Message Text="##teamcity[importData type='vstest' path='$(TrxFile)']"
|
<Message Text="##teamcity[importData type='vstest' path='$(UnitTestFxTrxPhysicalFilePath)']"
|
||||||
Importance="High"
|
Importance="High"
|
||||||
Condition="'$(TEAMCITY_VERSION)' != '' AND Exists($(TrxFile))" />
|
Condition="'$(TEAMCITY_VERSION)' != '' AND Exists('$(UnitTestFxTrxLogFile)')" />
|
||||||
<Error Text="SharedFx.UnitTests failed with exit code '$(VsTestExitCode)'." Condition=" $(VsTestExitCode) != 0 " />
|
<Error Text="SharedFx.UnitTests failed with exit code '$(VsTestExitCode)'." Condition=" $(VsTestExitCode) != 0 " />
|
||||||
</Target>
|
</Target>
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -108,4 +108,5 @@ docker run \
|
||||||
${docker_args[@]+"${docker_args[@]}"} \
|
${docker_args[@]+"${docker_args[@]}"} \
|
||||||
$tagname \
|
$tagname \
|
||||||
./build.sh \
|
./build.sh \
|
||||||
${build_args[@]+"${build_args[@]}"}
|
${build_args[@]+"${build_args[@]}"} \
|
||||||
|
"-p:HostMachineRepositoryRoot=$DIR"
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue