kcov icon indicating copy to clipboard operation
kcov copied to clipboard

kcov seems to loosing trace when functions called xargs bash -c function

Open vlajos opened this issue 6 years ago • 5 comments

In my script I try to parallelize mass processing of files with this xargs bash -c bashfunction solution. For example: https://coveralls.io/builds/15790039/source?filename=misspell_fixer.sh

The 2 functions whose name starts with loop_ are not covered in the report.

Is there an easy way to get coverage report about these functions as well?

vlajos avatar Mar 06 '18 23:03 vlajos

Hmm... I'm not sure. So this starts a new bash shell to execute the function in?

The two options (which I don't think will affect this) kcov has are --bash-handle-sh-invocation and --bash-method=DEBUG.

SimonKagstrom avatar Mar 07 '18 11:03 SimonKagstrom

Thank you for the answer.

Hmm... I'm not sure. So this starts a new bash shell to execute the function in?

Yes. I did not find a better way to parallelize the execution

I tried the suggested 2 options, but you were right. They did not make any difference.

vlajos avatar Mar 07 '18 18:03 vlajos

@SimonKagstrom I was wondering maybe to generate individual data for all the xargs-forked instances and merge them somehow. Would this be possible? What do you think?

vlajos avatar Mar 25 '18 00:03 vlajos

Yes! That should be possible. kcov has a --merge option, where you can produce a merged output from multiple separate runs.

Also, if you run with the same output directory, merging is done automatically and placed under the [merged] link in the html output.

SimonKagstrom avatar Mar 25 '18 12:03 SimonKagstrom

Thanks. I think I managed to implement it... I had to create a wrapper script, kcov did not like bash as an argument, but it seems to be working now: https://github.com/vlajos/misspell-fixer/commit/efe0ea657d57826a72813afac5f585bd390ce372

vlajos avatar Mar 28 '18 23:03 vlajos