• 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. GlusterFS – Real Time Data Replication Across Multiple RHEL/CentOS Nodes
  2. pulseaudio Command Examples in Linux
  3. st: command not found
  4. dconf Command Examples in Linux
  5. What is ioremap()
  6. lynis Command Examples in Linux
  7. swapon: command not found
  8. lxi Command Examples in Linux
  9. dvc config: Low level command to manage custom configuration options for dvc repositories
  10. doctl balance: Show the balance of a Digital Ocean account

You May Also Like

Primary Sidebar

Recent Posts

  • glab Command Examples
  • “glab repo” Command Examples
  • “glab release” Command Examples
  • “glab pipeline” Command Examples

© 2023 · The Geek Diary

  • Archives
  • Contact Us
  • Copyright