-
-
Notifications
You must be signed in to change notification settings - Fork 114
[Help] Unable to get coverage for bash script #213
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
Comments
Do you have a |
I haven't set
|
Yes, that looks like it. You could try to use the |
The |
Hmm, I modified the tests so that
This still reports 0.0% |
I made the error even more trivial. # trivial.sh
#!/bin/bash
echo "foo"
someFoo() {
if [ "$1" = "hello" ]; then
echo "Greetings"
elif [ "$1" = "bye" ]; then
echo "See you"
else
echo "Untested"
fi
}
someFoo "hello"
someFoo "bye"
|
Then there is something in the docker environment I would guess - your trivial.sh example works fine when running from the command line here. Could you try it on your host system? |
I might be onto something. Here is the compilation of kcov
|
No, dyninst is only important for compiled code, and optional there as well.
Are you able to try it locally, and does it behave the same way then?
|
I got it to work locally, It sucks because I added every package i manually installed to the Dockerfile but it still gives me the 0.0% error. I'm currently diffing the installed packages between the container and my machine but it feels like finding a needle in a haystack. |
You could try running a printenv before the script to compare the
environments. Maybe the docker environment has something which causes this?
|
|
Well, it has I'm not really sure how to tackle this. Perhaps you could try to manually run the script (without kcov) with |
Closing, i'll run this on ubuntu 12 for now. Even if it's end of life'd. These packages compile RUN apt-get install -y pkg-config
RUN apt-get install -y binutils-dev libcurl4-openssl-dev zlib1g-dev libdw-dev libiberty-dev cmake git python
RUN apt-get install -y curl |
Well Ubuntu 16.04 isn't the problem as such: I run it here without problems on the trivial.sh script, so there has to be something with the docker setup I think. Anyway, if you're OK with Ubuntu 12, I guess that qualifies as a valid workaround! |
Is there any update on this problem other than the downgrade workround? I'm having the same problem with bash. Outside the Docker container, everything works fine with the default PS4 method, on Linux and MacOS. Inside the container however, the coverage is always zero, and the output begins with the I'm running kcov on GitLab runner, by the way. |
@congma: I think this might be related to Issue #234. Bash upstream (or perhaps Ubuntu) has fixed a security issue which disallows setting PS4 when running as root. See the diff in the Ubuntu package: https://launchpad.net/ubuntu/+source/bash/4.3-7ubuntu1.7 And I guess in the docker container, you will run as root and then you probably get this behavior. A possible workaround is to use |
AFAIK, that upstream (CVE-2016-7543) bug is only triggered when Bash runs a setuid-root executable. However, I observe the strange behaviour reported by the OP when running |
Well, the bug might be for that, but I believe the Ubuntu fix just checks for the root user:
|
Much like #45, i'm using
shunit2
to test my main file calledtimelog
. My unittests reside intest/unittest.sh
, the unittests looks for atimelog
command.I'm getting output(short excerpt)
But the index.html does not report anything.

I'm using kcov with docker. The
Dockerfile
And finally, to run it.
Which results in the screenshot taken above.
The text was updated successfully, but these errors were encountered: