bitrise-steplib / steps-virtual-device-testing-for-android

MIT License
22 stars 23 forks source link

Export coverage file #36

Closed dloic closed 5 years ago

dloic commented 5 years ago

Hi!

We're trying to configure the Instrumentation to get back coverage report. We've configured the following items in the Debug section:

Directories to pull: /sdcard/coverage.ec

Env vars: coverage=true coverageFile=/sdcard/coverage.ec

Download files: True

Unfortunately, we always get a permission denied error when it's time to write the coverage report. Here an example of output we get in bugreport.txt:

TestRunner: run finished: 8 tests, 6 failed, 0 ignored : Failed to generate emma coverage. : java.lang.reflect.InvocationTargetException : at java.lang.reflect.Method.invoke(Native Method) : at java.lang.reflect.Method.invoke(Method.java:372) : at android.support.test.internal.runner.listener.CoverageListener.generateCoverageReport(CoverageListener.java:80) : at android.support.test.internal.runner.listener.CoverageListener.instrumentationRunFinished(CoverageListener.java:68) : at android.support.test.internal.runner.TestExecutor.reportRunEnded(TestExecutor.java:94) : at android.support.test.internal.runner.TestExecutor.execute(TestExecutor.java:69) : at android.support.test.runner.AndroidJUnitRunner.onStart(AndroidJUnitRunner.java:262) : at android.app.Instrumentation$InstrumentationThread.run(Instrumentation.java:1853) : Caused by: java.io.FileNotFoundException: /sdcard/coverage.ec: open failed: EACCES (Permission denied) : at libcore.io.IoBridge.open(IoBridge.java:456) : at java.io.FileOutputStream.<init>(FileOutputStream.java:87) : at com.vladium.emma.rt.RT.dumpCoverageData(RT.java:50) : ... 8 more : Caused by: android.system.ErrnoException: open failed: EACCES (Permission denied) : at libcore.io.Posix.open(Native Method) : at libcore.io.BlockGuardOs.open(BlockGuardOs.java:186) : at libcore.io.IoBridge.open(IoBridge.java:442) : ... 10 more

We've tried with different version of the emulator (22 & 24). We would like to get back the coverage.ec file to forward it in another step to send information to another tool (sonarqube in this case).

Do you have an idea of what we're doing wrong here? Thanks for your feedback.

fehersanyi-bitrise commented 5 years ago

Hello @dloic!

Could you please send me the url to this build, so I can check the logs for more details?

dloic commented 5 years ago

Hi @fehersanyi-bitrise!

Sure:

Let me know if you need more details.

fehersanyi-bitrise commented 5 years ago

Hello @dloic !

sorry for the late response! I did not find any permission denied error in the logs, but I assume it can happenbecause the ssh key has only read capability. on the testing, could you try assembleDebug assembleDebugAndroidTest?

dloic commented 5 years ago

Hi @fehersanyi-bitrise,

Did you check the right log file? The error is in the bugreport.txt file, inside the test section. You can search for "Caused by: java.io.FileNotFoundException: /sdcard/coverage.ec (Permission denied)".

For testing, everything is working fine locally. As for targets, we have custom ones composed with Android flavor, I don't think this is related to the error we have.

fehersanyi-bitrise commented 5 years ago

Hello @dloic! there is no such txt file uploaded as artifact here đŸ¤”

dloic commented 5 years ago

Hi @fehersanyi-bitrise ,

Didi you check on the right section of the build? it's in the test section.

capture d ecran le 2019-01-10 a 11 52 22

then

capture d ecran le 2019-01-10 a 11 52 53

fehersanyi-bitrise commented 5 years ago

@dloic oh I can not reach that page, with the url I get some basic info on the build machine setup and the build log :) if you could enable support user on the app's settings tab, I could check it out and maybe run a few test runs to check if I can make it work.

dloic commented 5 years ago

Hi @fehersanyi-bitrise.

Thanks for your help. Unfortunately we did remove the problematic part of the workflow as of now, so we can focus on building apps. I will re-open the issue when we have time to get back on this.

Best regards.