Is it possible to measure the code coverage of an executed shell script instead of a sourced one?
I have a shell script with a couple of switches, options. I have added a few tests and I want to measure the test suite's coverage.
Sources:
The script.
And its tests.
As you can see the tests.sh
executes the shell script instead of calling its functions in the same shell. This way I couldn't get kcov
to measure the coverage on the script. I was only able to measure the coverage on the file tests.sh
.
Is it possible somehow to force kcov
to measure the main script's coverage?
This command was the best I could achieve:
/usr/local/bin/kcov --debug=31 coverage/ test/tests.sh
And in the result I see only coverage report about shunit2
and tests.sh
, but in the debug output I see references to misspell_fixer.sh
as well. So I'm suspicious that it could work.
Please submit a bug report to the kcov issue tracker,
https://github.com/SimonKagstrom/kcov
it should support this as far as I can tell. (I'm the author of Kcov).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With