GNOME Bugzilla – Bug 752027
dashdemux: tests: improve unit test code coverage
Last modified: 2015-08-16 13:37:42 UTC
Improve the code coverage of dashdemux unit tests: achieve 100% function coverage.
Created attachment 306935 [details] [review] patch 1/5
Created attachment 306936 [details] [review] patch 2/5
Created attachment 306937 [details] [review] patch 3/5
Created attachment 306938 [details] [review] patch 4/5
Created attachment 306939 [details] [review] patch 5/5 tested all functions. Code coverage is: lines......: 83.8% (1941 of 2316 lines) functions..: 100.0% (141 of 141 functions)
Comment on attachment 306939 [details] [review] patch 5/5 98%: Checks: 85, Failures: 1, Errors: 0 elements/dash_mpd.c:3118:F:complexMPD:dash_mpdparser_segments:0: 'flow' (-3) is not equal to 'GST_FLOW_OK' (0) Makefile:3867: recipe for target 'elements/dash_mpd.check' failed
Created attachment 307019 [details] [review] replaced patch 5/5 The problem is caused by the changes introduced in bug https://bugzilla.gnome.org/show_bug.cgi?id=751850. I've raised bug https://bugzilla.gnome.org/show_bug.cgi?id=752085 to explain why. Please resolve bug 752085 and then these tests will not have any problem. I've updated patch 5/5 a little bit: I've updated some comments to better explain the test scenario. See the new patch attached.
Comment on attachment 307019 [details] [review] replaced patch 5/5 Looks good, will merge in a bit with other changes.
Comment on attachment 307019 [details] [review] replaced patch 5/5 This fails now with latest GIT: 98%: Checks: 85, Failures: 1, Errors: 0 elements/dash_mpd.c:3119:F:complexMPD:dash_mpdparser_segments:0: 'hasNextSegment' (0) is not equal to '1' (1) Makefile:3867: recipe for target 'elements/dash_mpd.check' failed The test in question checks if with segment_index=0 and segments_count=1, there has_next_segment() returns TRUE. It assumes it should, but it doesn't. Which is AFAIU correct: if you have segment_index=0 and segments_count=1, then there is no next segment. Segment indices start at 0 and go up to segment_count-1. Without the change that broke your test, we won't be able to detect if we expect a next segment or not.
Created attachment 307102 [details] [review] replaced patch 5/5 corrected the offending test. It now works correctly with the latest master.
commit cd4755635111775ed2df1616e0410664b4869f81 Author: Sebastian Dröge <sebastian@centricular.com> Date: Wed Jul 8 23:14:13 2015 +0300 mpdparser: Fix some memory leaks in the MPD parser and unit test commit d525d9c39145fed21a4a7c5dd6aae3a58f14372a Author: Florin Apostol <florin.apostol@oregan.net> Date: Tue Jul 7 16:59:52 2015 +0100 dashdemux: tests: added unit tests to test all functions Added unit tests for all functions. Code coverage: Overall coverage rate: lines......: 83.8% (1941 of 2316 lines) functions..: 100.0% (141 of 141 functions)
what tools/tests did you run to spot the memory leaks? I'm using "make elements/dash_mpd.lcov" to build and run the unit tests and get the code coverage.
make elements/dash_mpd.valgrind