Skip to content

feat: add gcov executable#794

Merged
drazisil-codecov merged 8 commits intomainfrom
gcov-executable
Jul 26, 2022
Merged

feat: add gcov executable#794
drazisil-codecov merged 8 commits intomainfrom
gcov-executable

Conversation

@thomasrockhu-codecov
Copy link
Copy Markdown
Contributor

fixes #786

@thomasrockhu-codecov thomasrockhu-codecov marked this pull request as ready for review June 4, 2022 22:27
@thomasrockhu-codecov thomasrockhu-codecov requested a review from a team as a code owner June 4, 2022 22:27
@codecov
Copy link
Copy Markdown

codecov bot commented Jun 4, 2022

Codecov Report

Merging #794 (9eb6b35) into main (f7ca6a7) will decrease coverage by 0.06%.
The diff coverage is 66.66%.

@@            Coverage Diff             @@
##             main     #794      +/-   ##
==========================================
- Coverage   92.13%   92.07%   -0.07%     
==========================================
  Files          34       34              
  Lines        1170     1173       +3     
  Branches      238      240       +2     
==========================================
+ Hits         1078     1080       +2     
- Misses         62       63       +1     
  Partials       30       30              
Flag Coverage Δ
alpine 92.07% <66.66%> (-0.07%) ⬇️
alpine-proxy 92.07% <66.66%> (-0.07%) ⬇️
alpine-without-git 92.07% <66.66%> (-0.07%) ⬇️
linux 92.07% <66.66%> (-0.07%) ⬇️
linux-without-git 92.07% <66.66%> (-0.07%) ⬇️
macos 92.07% <66.66%> (-0.07%) ⬇️
macos-without-git 92.07% <66.66%> (-0.07%) ⬇️
windows 92.07% <66.66%> (-0.07%) ⬇️
windows-without-git 92.07% <66.66%> (-0.07%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
src/helpers/cli.ts 100.00% <ø> (ø)
src/index.ts 75.16% <0.00%> (-0.51%) ⬇️
src/helpers/gcov.ts 100.00% <100.00%> (ø)

}
return runExternalProgram('gcov', ['-pb', ...gcovArgs, ...files]);
if (gcovExecutable == 'gcov') {
gcovArgs.unshift('-pb')
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Where does -pb come from?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tl;dr preserve full paths and collect branch coverage

-p: Preserve complete path information in the names of generated .gcov files. Without this option, just the filename component is used. With this option, all directories are used, with ‘/’ characters translated to ‘#’ characters, . directory components removed and unremoveable .. components renamed to ‘^’. This is useful if sourcefiles are in several different directories.

-b: Write branch frequencies to the output file, and write branch summary info to the standard output. This option allows you to see how often each branch in your program was taken. Unconditional branches will not be shown, unless the -u option is given.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, Tom. I thought -pb was being removed from the array rather than added to it.

I clearly need to brush up on my JavaScript!

Co-authored-by: Mitchell Borrego <[email protected]>
@lukaszstolarczuk
Copy link
Copy Markdown

Hi, is there a chance this PR will be merged? :-)

@drazisil-codecov
Copy link
Copy Markdown
Contributor

From https://en.wikipedia.org/wiki/Gcov#Coverage_summaries

Lcov is a graphical front-end for gcov. It collects gcov data for multiple source files and creates HTML pages containing the source code annotated with coverage information.

Why would a customer use lcov? In addition to creating HTML files, which Codecov does not support, is it able to be executed without gcov being present? What situations would this be the case?

@lukaszstolarczuk
Copy link
Copy Markdown

From https://en.wikipedia.org/wiki/Gcov#Coverage_summaries

Lcov is a graphical front-end for gcov. It collects gcov data for multiple source files and creates HTML pages containing the source code annotated with coverage information.

Why would a customer use lcov? In addition to creating HTML files, which Codecov does not support, is it able to be executed without gcov being present? What situations would this be the case?

In our case it wasn't lcov, it was -x "llvm-cov gcov" with clang compilation. As far as I understand, they might produce different coverage reports from gcov + gcc.

@drazisil-codecov
Copy link
Copy Markdown
Contributor

In our case it wasn't lcov, it was -x "llvm-cov gcov" with clang compilation. As far as I understand, they might produce different coverage reports from gcov + gcc.

@lukaszstolarczuk ,

In that case, since you are calling gcov manually, wouldn't it work for you to not call the Codecov gcov and run the uploader normally? It should pick up your generated reports. Apologies if I do not quite understand your use case.

@lukaszstolarczuk
Copy link
Copy Markdown

In our case it wasn't lcov, it was -x "llvm-cov gcov" with clang compilation. As far as I understand, they might produce different coverage reports from gcov + gcc.

@lukaszstolarczuk ,

In that case, since you are calling gcov manually, wouldn't it work for you to not call the Codecov gcov and run the uploader normally? It should pick up your generated reports. Apologies if I do not quite understand your use case.

Oh no, we never call gcov manually. With bash uploader we used to call you script like this:

if [[ ${clang_used} -gt 0 ]]; then
	gcovexe="llvm-cov gcov"
else
	gcovexe="gcov"
fi
/opt/scripts/codecov -c -F ${1} -Z -x "${gcovexe}" "gcovout"

right now, with the new uploader, we just ignore that parameter, because it's missing 😉

/opt/scripts/codecov --flags ${1} --nonZero --gcov --rootDir . --clean

We never confirmed what the reason was, but since the day we started using the new uploader, our coverage dropped by ~6% (the only difference we noticed for sure, was missing clang builds coverage reports).

@drazisil-codecov
Copy link
Copy Markdown
Contributor

right now, with the new uploader, we just ignore that parameter, because it's missing 😉

Ah, makes sens now. Thanks, @lukaszstolarczuk , sorry for the confusion.

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

Successfully merging this pull request may close these issues.

Specify which gcov executable to run

5 participants