wolfSSL / wolfssl

The wolfSSL library is a small, fast, portable implementation of TLS/SSL for embedded devices to the cloud. wolfSSL supports up to TLS 1.3 and DTLS 1.3!
https://www.wolfssl.com
GNU General Public License v2.0
2.31k stars 823 forks source link

Can not Collect Coverage Properly #7674

Closed songshangru closed 3 months ago

songshangru commented 3 months ago

Version

wolfssl-5.7.0-stable

Description

I compile wolfssl in ubuntu 20 , cmd as follow:

autoreconf --install CFLAGS="-g -O0 -ftest-coverage" LDFLAGS="-fprofile-arcs -ftest-coverage" ./configure "--enable-tls13" "--enable-session-ticket" "--enable-debug" "--disable-shared" CFLAGS="-g -O0 -ftest-coverage" LDFLAGS="-fprofile-arcs -ftest-coverage" make

But the compiled program ./examples/server/server fails to correctly collect coverage, with all coverage metrics showing 0. Additionally, I couldn't find the corresponding .gcno files, only server-server.gcno. What could be the problem?

embhorn commented 3 months ago

Hi @songshangru

Thanks for contacting wolfSSL Support. It looks like you missed running the tests with make check. Here is how we generate a code coverage report:

./autogen.sh
./configure LDFLAGS=-lgcov CFLAGS="-O0 -fprofile-arcs -ftest-coverage" CXXFLAGS="-O0 -fprofile-arcs -ftest-coverage" --enable-all 
make check
lcov -t 'wolfssl' -o coverage.info -c -d .
mkdir wolfSSL-Code-Coverage-Report
cd wolfSSL-Code-Coverage-Report
genhtml ../coverage.info
cd ..
zip -r wolfSSL-Code-Coverage-Report.zip wolfSSL-Code-Coverage-Report

Here is an example: wolfSSL-Code-Coverage-Report.zip

songshangru commented 3 months ago

Sorry, I would not want to run 'make check', because I only want to collect the coverage when run './example/server/server' with arguements. But all coverage metrics showing 0 when I run this cmd.