Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions build-tools/scripts/UnitTestApks.targets
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,10 @@
ToolExe="$(AdbToolExe)"
ToolPath="$(AdbToolPath)"
/>
<Error
Condition="'@(_FailedComponent)' != ''"
Text="Execution of the following components did not complete successfully: @(_FailedComponent->'%(Identity)', ', ')"
/>
</Target>

<!--
Expand Down Expand Up @@ -96,15 +100,14 @@
<Target Name="RunUnitTestApks"
Condition=" '@(UnitTestApk)' != '' ">
<RunInstrumentationTests
ContinueOnError="True"
AdbTarget="$(_AdbTarget)"
AdbOptions="$(AdbOptions)"
Component="%(UnitTestApk.Package)/%(UnitTestApk.InstrumentationType)"
NUnit2TestResultsFile="%(UnitTestApk.ResultsPath)"
TestFixture="$(TestFixture)"
ToolExe="$(AdbToolExe)"
ToolPath="$(AdbToolPath)">
<Output TaskParameter="NUnit2TestResultsFile" PropertyName="_ResultsFile "/>
<Output TaskParameter="FailedToRun" ItemName="_FailedComponent"/>
</RunInstrumentationTests>
</Target>
</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,11 @@ public class RunInstrumentationTests : Adb

public string[] InstrumentationArguments { get; set; }

[Output]
public string NUnit2TestResultsFile { get; set; }

[Output]
public string FailedToRun { get; set; }

protected override bool LogTaskMessages {
get { return false; }
}
Expand Down Expand Up @@ -63,15 +65,19 @@ public override bool Execute ()
base.Execute ();

if (string.IsNullOrEmpty (targetTestResultsPath)) {
Log.LogError ("No `nunit2-results-path` bundle value found in command output! Cannot find NUnit2 XML output!");
return false;
FailedToRun = Component;
Log.LogError (
"Could not find NUnit2 results file after running component `{0}`: " +
"no `nunit2-results-path` bundle value found in command output!",
Component);
// Can return false once we use MSBuild and not xbuild
// return false;
return true;
}

executionState = ExecuteState.PullFiles;
base.Execute ();

Log.LogMessage (MessageImportance.Low, $" [Output] {nameof (NUnit2TestResultsFile)}: {NUnit2TestResultsFile}");

return !Log.HasLoggedErrors;
}

Expand Down