Skip to content

Instantly share code, notes, and snippets.

@mrash
Created August 7, 2014 03:46
Show Gist options
  • Save mrash/4e26359c399a98d8542a to your computer and use it in GitHub Desktop.
Save mrash/4e26359c399a98d8542a to your computer and use it in GitHub Desktop.
Generate lcov code coverage report for OpenSSH
#!/bin/sh
LCOV_DIR=lcov-results
LCOV_FILE=coverage.info
LCOV_FILTERED=coverage_final.info
PREFIX=~/install/openssh ### tmp path
mkdir $LCOV_DIR
make clean
./configure --with-cflags="-fprofile-arcs -ftest-coverage" --with-ldflags="-fprofile-arcs -lgcov" --prefix=$PREFIX
make
make tests
### build coverage info and filter /usr/include/ files
lcov --capture --directory . --output-file $LCOV_FILE
lcov -r $LCOV_FILE /usr/include/\* --output-file $LCOV_DIR/$LCOV_FILTERED
### create the HTML report
genhtml $LCOV_DIR/$LCOV_FILTERED --output-directory $LCOV_DIR
exit
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment