Skip to content
This repository was archived by the owner on Dec 7, 2019. It is now read-only.

Handle app process crash.#95

Merged
yunikkk merged 1 commit intomasterfrom
dn/handle-app-process-crash
Aug 9, 2017
Merged

Handle app process crash.#95
yunikkk merged 1 commit intomasterfrom
dn/handle-app-process-crash

Conversation

@dmitry-novikov
Copy link
Copy Markdown
Contributor

Fixes issue when Composer fails to recognize that app process under the test is crashed that leads to successful completion.

.filterNotNull()
.map { (first, second) ->
InstrumentationTest(
index = first.current,
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Printing test index and total test count sharded to particular device really helps.

Copy link
Copy Markdown
Collaborator

@artem-zinnatullin artem-zinnatullin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great!

Exception("Instrumentation was unable to run tests using runner $runner.\n" +
private fun String.throwIfError(output: File) = when {
contains("INSTRUMENTATION_RESULT: shortMsg=Process crashed") -> {
throw Exception("Application process crashed. Check Logcat output for more details.")
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice

.takeWhile { !it.startsWith("INSTRUMENTATION_CODE") }
.map { it.throwIfError(output) }
.takeWhile {
// `INSTRUMENTATION_CODE: <code>` is the last line printed by instrumentation, even if 0 tests were run.
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thx for fix

)
}
adbDevice.log(
"Test ${test.index}/${test.total} $status in " +
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Super nice, I actually wanted this in #82

@yunikkk yunikkk merged commit beae497 into master Aug 9, 2017
@artem-zinnatullin artem-zinnatullin deleted the dn/handle-app-process-crash branch August 10, 2017 01:16
@artem-zinnatullin
Copy link
Copy Markdown
Collaborator

@yunikkk can you ship a release with this please?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants