Re: Email to hackers for test coverage

From: Ahsan Hadi <ahsan(dot)hadi(at)gmail(dot)com>
To: "movead(dot)li(at)highgo(dot)ca" <movead(dot)li(at)highgo(dot)ca>
Cc: "pgsql-hackers(at)lists(dot)postgresql(dot)org" <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: Email to hackers for test coverage
Date: 2019-08-23 19:19:52
Message-ID: CA+9bhCLTNdgUPttWaY0kvXYwJgYc77vJ_da9FKi1T0y8ihC7OA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

The subject of the email may be bit misleading however this is really good
exercise to analyse the current code of Postgres regression suite using
GCOV and then adding test cases incrementally to increase the test
coverage.

On Thu, 22 Aug 2019 at 2:46 PM, movead(dot)li(at)highgo(dot)ca <movead(dot)li(at)highgo(dot)ca>
wrote:

> Hello hackers,
>
> One of the area that didn't get much attention in the community
> recently is analysing and increasing the code coverage of
> PostgreSQL regession test suite. I have started working on the
> code coverage by running the GCOV code coverage analysis tool in
> order to analyse the current code coverage and come up with test
> cases to increase the code coverage. This is going to be a long
> exercise so my plan is do it incrementaly. I will be analysing
> some area of untested code and then coming up with test cases to
> test those lines of code in regression and then moving on next
> area of untested code and so on.
>
> So far I have come up with 3 test cases to increase the code
> coverage of PostgreSQL regression test suite.
>
> I have performed the regression run for this exercise on this commit:
> (Commit version 75c1921cd6c868c5995b88113b4463a4830b9a27):
>
> The regression is executed with make check-world command and the
> results are gathered using 'make coverage-html' command.
>
> Below are the lines of untested code that i have analysed and the
> test cases added to regression to test these as part of regression.
>
> *1. src/include/utils/float.h:140*
>
> Analyze:
> This is an error report line when converting a big float8 value
> which a float4 can not storage to float4.
>
> Test case:
> Add a test case as below in file float4.sql:
> select float4(1234567890123456789012345678901234567890::float8);
>
> *2. src/include/utils/float.h:145*
>
> Analyze:
> This is an error report line when converting a small float8 value
> which a float4 can not storage to float4.
>
> Test case:
> Add a test case as below in file float4.sql:
> select float4(0.0000000000000000000000000000000000000000000001::float8);
>
> *3.src/include/utils/sortsupport.h:264*
>
> Analyze:
> It is reverse sorting for the data type that has abbreviated for
> sort, for example macaddr, uuid, numeric, network and I choose
> numeric to do it.
>
> Test cast:
> Add a test case as below in file numeric.sql:
> INSERT INTO num_input_test(n1) values('99999999999999999999999999.998');
> INSERT INTO num_input_test(n1) values('99999999999999999999999999.997');
> SELECT * FROM num_input_test ORDER BY n1 DESC;
>
> Result and patch
>
> By adding the test cases, the test coverage of float.h increased from
> 97.7% to 100% and sortsupport.h increased from 76.7% to 80.0%.
>
> The increase in code coverage can be seen in the before and after
> pictures of GCOV test coverage analysis summary.
>
> The attached patch contain the test cases added in regression for
> increasing the coverage.
>
>
> --
> Movead Li
>

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Stephen Frost 2019-08-23 19:42:54 Re: WIP/PoC for parallel backup
Previous Message Ahsan Hadi 2019-08-23 19:15:32 Re: WIP/PoC for parallel backup