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?