[tests] Report an error when .apk tests crash #475
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
While reviewing PR 445 I noticed that it said that 41 tests had
been run, and 0 failed. Compare to e.g. PR 474, which has 164
passing tests.
Something isn't right here.
Further investigation showed that for PR 445, execution on the
emulator had crashed ("Segmentation fault"). The error was ignored.
Ignoring errors was in fact By Design™; see commit 6358a64.
So what we need is for the
RunUnitTestApkstarget to not reporterrors, while still reporting errors.
Solve this conundrum by updating the
<RunInstrumentationTests/>taskso that when the
nunit2-results-pathvalue can't be found, itreports a successful run, and sets the
RunInstrumentationTests.FailedToRunproperty to the name of thecomponent that failed. This allows the
ReleaseAndroidTargettargetto check for any failures, and report an
<Error/>after shuttingdown the emulator instance.
This should allow the build to "fail" when
nunit2-results-pathcan'tbe found -- a sign that the
.apkunit tests didn't finish executing-- while also allowing the emulator to be shut down.
Aside:
xbuilddoesn't supportContinueOnError="ErrorAndContinue",nor does it set
<Output/>properties whenever a task fails.Consequently, the
<RunInstrumentationTests/>task must return truewhen
nunit2-results-pathisn't found, because there's no other wayto convince
xbuildto collect the<Output/>values.