Android Ui Tests With Espresso + Mockk Crash With Sigsegv On Emulators, Fine On Physical Devices
Solution 1:
This was in my stacktrace:
W Unexpected CPU variant for X86 using defaults: x86
ActivityThread W Package uses different ABI(s) than its instrumentation:
Switching to a 64 bit emulator fixed the problem.
Solution 2:
I too have been running into this issue with my instrumentation test suite and also suspect MockK to be (at least partially) at fault.
This is far from a true solution, but I've noticed that running MY tests with Android Test Orchestrator greatly reduces the chance of random failure due to test process crash (caused by the above segfault). (If you are running tests with Firebase Test Lab emulators, this could be particularly helpful.) Another bonus of using Orchestrator, it does a really good job of digging through the logs (in Firebase Test Lab) to find the root error if your test does fail in an Orchestrator process.
I'm not certain this will work well for everyone, but if it does, it likely indicates that MockK (if it truly is the source of this issue) isn't cleaning up fully and is leaking into other tests.
Solution 3:
I had exactly the same case where my tests were crashing randomly on the Emulator with Process crashed
error saying check the Logcat. There was SIGSEGV
error on the Logcat but not always.
In my case it was com.linkedin.dexmaker:dexmaker-mockito-inline
causing the random crashes. I had to add it to mock a Kotlin data class in Instrumentation tests which I didn't need after all. So removing this dependency solved my issue.
I recommend to investigate after which point your tests started crashing, then it will be easier to get to bottom of it.
Post a Comment for "Android Ui Tests With Espresso + Mockk Crash With Sigsegv On Emulators, Fine On Physical Devices"