Re: Email to hackers for test coverage
От | Ahsan Hadi |
---|---|
Тема | Re: Email to hackers for test coverage |
Дата | |
Msg-id | CA+9bhCLTNdgUPttWaY0kvXYwJgYc77vJ_da9FKi1T0y8ihC7OA@mail.gmail.com обсуждение исходный текст |
Ответ на | Email to hackers for test coverage ("movead.li@highgo.ca" <movead.li@highgo.ca>) |
Список | 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.
Hello hackers,One of the area that didn't get much attention in the communityrecently is analysing and increasing the code coverage ofPostgreSQL regession test suite. I have started working on thecode coverage by running the GCOV code coverage analysis tool inorder to analyse the current code coverage and come up with testcases to increase the code coverage. This is going to be a longexercise so my plan is do it incrementaly. I will be analysingsome area of untested code and then coming up with test cases totest those lines of code in regression and then moving on nextarea of untested code and so on.So far I have come up with 3 test cases to increase the codecoverage 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 theresults are gathered using 'make coverage-html' command.Below are the lines of untested code that i have analysed and thetest cases added to regression to test these as part of regression.1. src/include/utils/float.h:140Analyze:This is an error report line when converting a big float8 valuewhich 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:145Analyze:This is an error report line when converting a small float8 valuewhich 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:264Analyze:It is reverse sorting for the data type that has abbreviated forsort, for example macaddr, uuid, numeric, network and I choosenumeric 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 patchBy adding the test cases, the test coverage of float.h increased from97.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 afterpictures of GCOV test coverage analysis summary.The attached patch contain the test cases added in regression forincreasing the coverage.--Movead Li
В списке pgsql-hackers по дате отправления: