Quantcast
Channel: Planet PostgreSQL
Viewing all articles
Browse latest Browse all 9843

Beena Emerson: PostgreSQL : Test Coverage

$
0
0

Install lcov

Install Dependencies:
yum install perl-devel
yum install perl-Digest-MD5
yum install perl-GD

Download and install lcov
rpm -U lcov-1.13-1.el7.noarch.rpm

Run Test

Configure and make
Use the --enable-coverage configure flag
./configure --enable-coverage
make -j 4

Run make check
cd src/
make check -i

Check Coverage

HTML output

make coverage-html

A .gcov output file is created for each file in the test and a folder named 'coverage' with the index.html file to display the coverage information. The HTML page will show a summary of the coverage for each folder and recursively for each file and then for each line.

Text output

make coverage

A .gcov and .gcov.out file is created for each file in the test.

Reset

make coverage-clean

This resets the execution count.

Output files

<file>.gcov.out

This list out the details fo each function in the file. An example output for a function is shown below:

Function 'heap_sync' Lines executed:100.00% of 10 Branches executed:100.00% of 4 Taken at least once:75.00% of 4 Calls executed:100.00% of 6

<file>.gcov

This displays the original file entirely along with the original line number and the count of the number of times each line was executed Lines which were not executed are marked with hashes ‘######’ and '-' indicated that the line is not executable..

-: 9258: /* main heap */ 50: 9259: FlushRelationBuffers(rel); call 0 returned 100%

.
. <more code>
.

#####: 9283:    Page        page = (Page) pagedata;
        -: 9284:    OffsetNumber off;
        -: 9285:
    #####: 9286:    mask_page_lsn_and_checksum(page);
call    0 never executed

index.html

The home page:
This lists out all the sub directory along with their coverage data.


Per directory info:
On clicking a particular directory, we get the coverage info of each file in the selected directory.

Select a file:
This gives out the per line hit count of the selected file. The one highlighted in blue are hit and those in red are never executed during the test run.

Viewing all articles
Browse latest Browse all 9843

Latest Images

Trending Articles



Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>