Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Covering code run by a docker container from tests run on the host #315

Open
jclaveau opened this issue Jan 6, 2020 · 2 comments
Open

Comments

@jclaveau
Copy link

jclaveau commented Jan 6, 2020

I currently use kcov for my tests of a script located on my host. This script run some commands in a docker container, including shared code between the host and the container: https://github.com/jclaveau/docker-php-multiversion

The code executed on the host is well covered but the part which is run via docker exec my_container ... is not as you can see here: https://codecov.io/gh/jclaveau/docker-php-multiversion

This seems logical but produces a kind of false negative and I would like to know if there is a way to merge the covered part of the host with the one of the container or maybe a way to let docker exec provide feedback to kcov.

Thanks in advance and for your work!

@SimonKagstrom
Copy link
Owner

Well, if you can access the output directories of both the docker run and the host run, then you can do a merge step afterwards:

kcov --merge /tmp/host-output /tmp/docker-output /tmp/merged-output

which should give you the union of both runs in /tmp/merged-output. I'm assuming the host run is placed in /tmp/host-output and that you're able to run kcov in docker as well, and that the host can access it afterwards.

@jclaveau
Copy link
Author

jclaveau commented Jan 6, 2020

Thanks a lot, I'll let you know when it will work!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants