Skip to content

Instantly share code, notes, and snippets.

@mrash
Created August 7, 2014 03:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save mrash/8383288c66f973a2bbb2 to your computer and use it in GitHub Desktop.
Save mrash/8383288c66f973a2bbb2 to your computer and use it in GitHub Desktop.
OpenSSL: Generate lcov code coverage report
#!/bin/sh
#
# Basic script to compile OpenSSL with code coverage support via gcc
# gcov and build HTML reports with lcov.
#
LCOV_DIR=lcov-results
LCOV_FILE=coverage.info
LCOV_FILTERED=coverage_final.info
PREFIX=~/install/openssl
mkdir $LCOV_DIR
make clean
export CC="gcc -fprofile-arcs -ftest-coverage"; ./config
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