• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar
  • Skip to footer navigation

The Geek Diary

  • OS
    • Linux
    • CentOS/RHEL
    • VCS
  • Interview Questions
  • Database
    • MariaDB
  • DevOps
    • Docker
    • Shell Scripting
  • Big Data
    • Hadoop
    • Cloudera
    • Hortonworks HDP

lcov: command not found

by admin

The traditional Linux and Unix way for finding code coverage is to use gcov to generate the coverage map and lcov to make the output pretty. Code coverage measures if, and if so, how many times, a line of code is executed. This is useful for measuring the efficacy of your test code. In theory, the more lines that are “covered”, the more complete your tests are. However, the link between code coverage and test completeness can be tenuous.

Code Coverage Data

Code coverage data typically comes in two pieces, line coverage and function coverage, both of which are most easily expressed as percentages. These numbers are easily understood for individual unit tests. When testing either an individual function or a method within an object, the total number of functions and lines in the file loaded serves as the denominator for the percentage calculation. So, if you spread your testing across multiple files for a single module, unit test coverage will be low for each individual test. Aggregation of all the coverage numbers from each individual test will give the complete coverage picture for that file.

If you encounter and error as shown below:

lcov: command not found

you may try installing below package as per your choice of distribution.

Distribution Command
OS X brew install lcov
Debian apt-get install lcov
Ubuntu apt-get install lcov
Kali Linux apt-get install lcov
Fedora dnf install lcov
Raspbian apt-get install lcov

Final Thoughts

Generating and viewing code coverage information is crucial for unit testing and important for aggregated integration testing. While code coverage numbers do not tell the whole tale, code coverage information does provide a nice single number to use to track the progress of your tests.

Filed Under: Linux

Some more articles you might also be interested in …

  1. How to uninstall aria2 from Ubuntu
  2. CentOS / RHEL : How To Check FC Brocade HBA Firmware
  3. chkconfig: command not found
  4. Red Hat / CentOS : How to create interface / NIC bonding
  5. pkgfile Command Examples in Linux:
  6. pw-loopback Command Examples in Linux
  7. phar Command Examples in Linux
  8. “aws s3 rm” Command Examples
  9. mountpoint Command Examples in Linux
  10. sed: command not found

You May Also Like

Primary Sidebar

Recent Posts

  • Vanilla OS 2 Released: A New Era for Linux Enthusiasts
  • mk Command Examples
  • mixxx Command Examples
  • mix Command Examples

© 2025 · The Geek Diary

  • Archives
  • Contact Us
  • Copyright