Welcome! Log In Create A New Profile

Advanced

Re: Code coverage on nginx using lcov (gcov)

Valentin V. Bartenev
June 07, 2012 05:02PM
On Thursday 07 June 2012 21:57:05 parttis wrote:
> Hi
>
> I am trying to measure code coverage on nginx with lcov (gcov) tool. So
> far I am able to get code coverage results, but they are always the
> same. Here is a short recap on what I've done.
>
> Downloaded source code.
>
> $ cd /opt
> $ wget http://nginx.org/download/nginx-1.2.1.tar.gz
> $ tar xzvf nginx-1.2.1.tar.gz
> $ cd nginx-1.2.1
> $ chmod -R 777 .
>
> Compiled source code with following compiler and linker flags.
>
> $ ./configure --with-cc-opt=--coverage --with-ld-opt=-lgcov
> $ make
> $ make install
>
> I have done code coverage measurements in following order.
>
> $ lcov --directory /opt/nginx-1.2.1 --zerocounters
> $ /usr/local/nginx/sbin/nginx
>
> Made an HTTP request to nginx server.
> $ lynx http://localhost:80
>
> $ /usr/local/nginx/sbin/nginx/nginx -s quit
> $ lcov --directory /opt/nginx-1.2.1 --capture --output-file app.info
> --base-directory /opt/nginx-1.2.1
> $ genhtml -o /opt/report1 app.info
>
> Here are the code coverage results.
> lines......: 15.1% (4159 of 27467 lines)
> functions..: 22.6% (262 of 1158 functions)
> branches...: 11.7% (2231 of 19121 branches)
>
> My problem is that I get exactly the same code coverage result when I
> don't even make the HTTP request. I think the code coverage in this case
> should be smaller than when an HTTP request has been made.
>
> And I get exactly the same code coverage result even if I use several
> different request methods (GET, HEAD, PUT, DELETE, POST and TRACE). I
> think the code coverage in this case should be bigger than when only one
> HTTP request has been made.
>
> Could someone please give an advice on this?
>

Looks like it measures only the master process, which does not
process requests. I don't know much about gcov, probably it can
measure multi-process applications, but also you can set the
"master_process" directive to "off".

http://nginx.org/r/master_process

wbr, Valentin V. Bartenev

_______________________________________________
nginx mailing list
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx
Subject Author Posted

Code coverage on nginx using lcov (gcov)

parttis June 07, 2012 01:57PM

Re: Code coverage on nginx using lcov (gcov)

Valentin V. Bartenev June 07, 2012 05:02PM

Re: Code coverage on nginx using lcov (gcov)

parttis June 13, 2012 02:29PM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 279
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready