{"id":3626,"date":"2011-11-20T22:54:01","date_gmt":"2011-11-21T06:54:01","guid":{"rendered":"http:\/\/multimedia.cx\/eggs\/?p=3626"},"modified":"2011-12-12T11:33:51","modified_gmt":"2011-12-12T19:33:51","slug":"using-lcov-with-ffmpeg","status":"publish","type":"post","link":"https:\/\/multimedia.cx\/eggs\/using-lcov-with-ffmpeg\/","title":{"rendered":"Using lcov With FFmpeg\/Libav"},"content":{"rendered":"<p>Last year, I delved into code coverage tools and their usage with <a href=\"http:\/\/ffmpeg.org\/\">FFmpeg<\/a>. I learned about using <a href=\"http:\/\/multimedia.cx\/eggs\/ffmpeg-and-code-coverage-tools\/\">GNU gcov<\/a>, which is powerful but pretty raw about the details it provides to you. I wrote a script to help interpret its output and later found <a href=\"http:\/\/multimedia.cx\/eggs\/using-gcovr-with-ffmpeg\/\">another script called gcovr<\/a> to do the same, only much better. <\/p>\n<p>I later found another tool called <a href=\"http:\/\/ltp.sourceforge.net\/coverage\/lcov.php\">lcov<\/a> which is absolutely amazing for understanding code coverage of your software. I&#8217;ve been meaning to use it to further FATE test coverage for the multimedia projects.<\/p>\n<p><center><br \/>\n<a href=\"http:\/\/multimedia.cx\/eggs\/wp-content\/uploads\/2011\/11\/lcov-code-coverage-report.png\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/multimedia.cx\/eggs\/wp-content\/uploads\/2011\/11\/lcov-code-coverage-report-s.png\" alt=\"\" title=\"lcov code coverage of Libav project\" width=\"400\" height=\"253\" class=\"aligncenter size-full wp-image-3630\" srcset=\"https:\/\/multimedia.cx\/eggs\/wp-content\/uploads\/2011\/11\/lcov-code-coverage-report-s.png 400w, https:\/\/multimedia.cx\/eggs\/wp-content\/uploads\/2011\/11\/lcov-code-coverage-report-s-300x189.png 300w\" sizes=\"auto, (max-width: 400px) 100vw, 400px\" \/><br \/>\n<em>Click for larger image<\/em><\/a><br \/>\n<\/center><\/p>\n<p><strong>Basic Instructions<\/strong><br \/>\nInstall the lcov tool, of course. In Ubuntu, <code>'apt-get install lcov'<\/code> will do the trick.<\/p>\n<p>Build the project with code coverage support, i.e., <\/p>\n<pre>\r\n.\/configure --enable-gpl --samples=\/path\/to\/fate\/samples \\\r\n --extra-cflags=\"-fprofile-arcs -ftest-coverage\" \\\r\n --extra-ldflags=\"-fprofile-arcs -ftest-coverage\"\r\nmake\r\n<\/pre>\n<p>Clear the coverage data:<\/p>\n<pre>\r\nlcov --directory . --zerocounters\r\n<\/pre>\n<p>Run the software (in this case, the FATE test suite):<\/p>\n<pre>\r\nmake fate\r\n<\/pre>\n<p>Let lcov work its magic:<\/p>\n<pre>\r\nlcov --directory . --capture --output-file coverage.info\r\nmkdir html-output\r\ngenhtml -o html-output coverage.info\r\n<\/pre>\n<p>At this point, you can aim your web browser at html-output\/index.html to learn everything you could possibly want to know about code coverage of the test suite. You can sort various columns in order to see which modules have the least code coverage. You can drill into individual source files and see highlighted markup demonstrating which lines have been executed.<\/p>\n<p>As you can see from the screenshot above, FFmpeg \/ Libav are not anywhere close to full coverage. But lcov provides an exquisite roadmap.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Basic instructions for using lcov to measure code coverage of the multimedia projects<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[28],"tags":[228,68,229,227],"class_list":["post-3626","post","type-post","status-publish","format-standard","hentry","category-programming","tag-code-coverage","tag-ffmpeg","tag-lcov","tag-libav"],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/multimedia.cx\/eggs\/wp-json\/wp\/v2\/posts\/3626","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/multimedia.cx\/eggs\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/multimedia.cx\/eggs\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/multimedia.cx\/eggs\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/multimedia.cx\/eggs\/wp-json\/wp\/v2\/comments?post=3626"}],"version-history":[{"count":7,"href":"https:\/\/multimedia.cx\/eggs\/wp-json\/wp\/v2\/posts\/3626\/revisions"}],"predecessor-version":[{"id":3647,"href":"https:\/\/multimedia.cx\/eggs\/wp-json\/wp\/v2\/posts\/3626\/revisions\/3647"}],"wp:attachment":[{"href":"https:\/\/multimedia.cx\/eggs\/wp-json\/wp\/v2\/media?parent=3626"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/multimedia.cx\/eggs\/wp-json\/wp\/v2\/categories?post=3626"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/multimedia.cx\/eggs\/wp-json\/wp\/v2\/tags?post=3626"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}