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

bash: Show uncovered files in report #224

Closed
oreganrob opened this issue Oct 24, 2017 · 10 comments
Closed

bash: Show uncovered files in report #224

oreganrob opened this issue Oct 24, 2017 · 10 comments

Comments

@oreganrob
Copy link

Hi,

I'm using kcov to report code coverage on a project that is mainly made up of bash scripts.
We are building out the unit test suite retrospectively.
Is it possible to include uncovered scripts in the html report?

Ideally I would like to be able to see what scripts have not yet been covered by tests and also identify any new scripts that may get added without an accompanying unit test.

@SimonKagstrom
Copy link
Owner

SimonKagstrom commented Oct 25, 2017 via email

@oreganrob
Copy link
Author

Hi Simon,

Thanks for the feedback. Something like your suggestion would be ideal if it were possible.
The issue I have right now is the covered % to me doesn't tell the whole story.
It could say 90% but my tests actually only cover 10% of the codebase.

I previously looked at another option for bash coverage...

https://github.com/infertux/bashcov

This does actually instrument all of the bash scripts in the project folder.
However it doesn't provide as many configuration options as kcov and introduces a dependency on Ruby. Also, in my specific test scenario it tends to overwrite data as it progresses making it inaccurate.

Hence I started using kcov which works very well but it would be handy if it were able to show gaps in my test suite.

Thanks

@SimonKagstrom
Copy link
Owner

I'll take a look to see how this could be implemented, hopefully during the next few days.

@SimonKagstrom SimonKagstrom changed the title Show uncovered files in report bash: Show uncovered files in report Nov 3, 2017
SimonKagstrom added a commit that referenced this issue Nov 3, 2017
By default kcov scans the binary directory for bash scripts.
@SimonKagstrom
Copy link
Owner

Fixed with 0dd22bd . Kcov now by default parses the directory of the script to find other scripts. This behavior can be turned off via an option, and another option allows passing directories manually as we discussed above.

So I think your test case should work by default now.

@oreganrob
Copy link
Author

Great. Thanks!

@tooptoop4
Copy link

@SimonKagstrom has this option been removed?

@SimonKagstrom
Copy link
Owner

SimonKagstrom commented Sep 29, 2023 via email

@tooptoop4
Copy link

unfortunately

@SimonKagstrom
Copy link
Owner

I just tested it here, and it works for me. I.e., with a

/tmp/kalle/shell-main
/tmp/kalle/manne/short-test.sh

where shell-main does not invoke short-test.sh, I see both in the report (with short-test.sh uncovered) when running

kcov /tmp/kcov /tmp/kalle/shell-main

what are the circumstances when it doesn't work?

@tooptoop4
Copy link

adding --bash-parse-files-in-dir=/myshfolder solved this

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

No branches or pull requests

3 participants