On Thu, Aug 22, 2019 at 2:46 PM movead...@highgo.ca <movead...@highgo.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 > Hi Movead, Please add that to commitfest. -- Ibrar Ahmed