Re: com php-src: Make tests a little more resilient:ext/gd/tests/bug22544.phpt ext/gd/tests/bug43828.phptext/gd/tests/bug72604.phpt
ext/gd/tests/imagearc_basic.phptext/gd/tests/imagearc_error1.phpt ext/gd/tests/imagearc_variation1.phptext/gd

From: Date: Sat, 03 Sep 2016 10:42:46 +0000
Subject: Re: com php-src: Make tests a little more resilient:ext/gd/tests/bug22544.phpt ext/gd/tests/bug43828.phptext/gd/tests/bug72604.phpt
ext/gd/tests/imagearc_basic.phptext/gd/tests/imagearc_error1.phpt ext/gd/tests/imagearc_variation1.phptext/gd
References: 1 2 3 4  Groups: php.cvs 
Request: Send a blank email to php-cvs+get-94272@lists.php.net to get a copy of this message
On 02.09.2016 at 01:00, Anatol Belski wrote: >> -----Original Message----- >> From: Christoph M. Becker [mailto:cmbecker69@gmx.de] >> Sent: Wednesday, August 31, 2016 12:44 AM >> To: Anatol Belski <anatol.php@belski.net>; php-cvs@lists.php.net >> Cc: Pierre Joye <pierre.php@gmail.com> >> Subject: Re: [PHP-CVS] com php-src: Make tests a little more >> resilient:ext/gd/tests/bug22544.phpt >> ext/gd/tests/bug43828.phptext/gd/tests/bug72604.phpt >> ext/gd/tests/imagearc_basic.phptext/gd/tests/imagearc_error1.phpt >> ext/gd/tests/imagearc_variation1.phptext/gd >> >> On 30.08.2016 at 19:20, Christoph M. Becker wrote: >>> >>> On 30.08.2016 at 18:33, Anatol Belski wrote: >>>> >>>>> -----Original Message----- >>>>> From: Christoph Michael Becker [mailto:cmb@php.net] >>>>> Sent: Wednesday, August 17, 2016 6:00 PM >>>>> To: php-cvs@lists.php.net >>>>> Subject: [PHP-CVS] com php-src: Make tests a little more resilient: >>>>> ext/gd/tests/bug22544.phpt ext/gd/tests/bug43828.phpt >>>>> ext/gd/tests/bug72604.phpt ext/gd/tests/imagearc_basic.phpt >>>>> ext/gd/tests/imagearc_error1.phpt >>>>> ext/gd/tests/imagearc_variation1.phpt >>>>> ext/gd/tes >>>>> >>>>> Commit: a3159d29bb24d5c946c14b7aa33e96bebcd56e59 >>>>> Author: Christoph M. Becker <cmbecker69@gmx.de> Wed, 17 Aug >> 2016 >>>>> 17:59:33 +0200 >>>>> Parents: 48198e4c257825ab89ee027bff5a93fc2cd59601 >>>>> Branches: PHP-5.6 PHP-7.0 PHP-7.1 master >>>>> >>>>> Link: http://git.php.net/?p=php- >>>>> src.git;a=commitdiff;h=a3159d29bb24d5c946c14b7aa33e96bebcd56e59 >>>>> >>>>> Log: >>>>> Make tests a little more resilient >>>>> >>>>> PNG allows identical images to be stored differently what makes >>>>> nearly all tests checking the MD5 hash of the PNG representation >>>>> fail with external libgd. For now, we use the GD format instead, which >> doesn't allow for such differences. >>>>> >>>>> Of course, this md5() checking should be replaced by a image diffing >>>>> feature in the long run. >>>> >>>> I've got these fails at least in 7.0 x64 >>>> >>>> TEST 1/3 >>>> [C:\php-sdk\php70\vc14\x64\php-src\ext\gd\tests\imagecolorallocatealp >>>> ha_basic.phpt] >>>> ========DIFF======== >>>> 001+ string(32) "d776984f1a2ce89be189bd16db303427" >>>> 001- string(32) "0981ef94ee2209a8dccb59aa8ad07e18" >>>> ========DONE======== >>>> FAIL Testing imagecolorallocatealpha() >>>> [C:\php-sdk\php70\vc14\x64\php-src\ext\gd\tests\imagecolorallocatealp >>>> ha_basic.phpt] TEST 2/3 >>>> [C:\php-sdk\php70\vc14\x64\php-src\ext\gd\tests\imageconvolution_basi >>>> c.phpt] >>>> ========DIFF======== >>>> 001+ 0b35b0ded5e20eff78f4cd7850579dab >>>> 001- 20979b45f8772cdbd78262af4e332638 ========DONE======== FAIL >>>> Testing imageconvolution() of GD library >>>> [C:\php-sdk\php70\vc14\x64\php-src\ext\gd\tests\imageconvolution_basi >>>> c.phpt] TEST 3/3 >>>> [C:\php-sdk\php70\vc14\x64\php-src\ext\gd\tests\libgd00100.phpt] >>>> ========DIFF======== >>>> 001+ 155d2437ff8000e68ae703ff198ad926 >>>> 001- df7253c765280396f303166f10ba9283 ========DONE======== >>>> >>>> Seems to be related to the test changes in this or the decsendant commits. >> Could you please check? >>> >>> Indeed, on Windows the tests are failing. A quick check indicates >>> that >>> imagegd() doesn't behave identical. I'll investigate right away. >> >> Well, imagegd() behaves rather unexpected for truecolor images. Even though >> the GD image format is able to store truecolor images[1], the PHP binding >> converts these to palette images using dithering[2], which is system >> dependent[3]. The few failing tests on Windows already hint at this problem, >> but on other systems more/other tests might fail. >> >> The cleanest solution would be to change the PHP binding to not convert to >> palette, but that obviously would break BC, and there still might be a problem >> when saving truecolor images in GD format[4]. >> >> Reverting back the commit (i.e. comparing the PNG hashes instead of the GD >> hashes) would solve the test failures for the bundled libgd, but would leave >> several failures with external libgd. >> >> Switching to output in GD2 image format might also exhibit system dependent >> behavior (I'm not sure, but GD2 allows for zlib compression…) >> >> Perhaps PR #1949[5] should be considered to be merged into PHP-5.6+? >> >> Thoughts? >> > Thanks for figuring this out. > > IMO overwhelming the platform dependency were worth it pursuing. If #1949 fixes the test issue > and doesn't break, probably were fine. Otherwise, If there's no fix without breakage is > possible, for stable branches it'd be fine to fork the failing tests preserving the old > behavior. I just run the GD test suite on Windows x64 with PR #1949, and no test is failing (namely, those which did fail with the GD format ouput succeeded). That is not surprising, because much of the platform dependend behavior of the tests is due to writing the images as PNG or GD (what is not actually subject of these tests), potentially resulting in subtle differences wrt. the string representation of PNGs, respectively the dithering applied by imagegd() for truecolor images. test_image_equals_file() will not solve all issues, namely those that are caused by different external libgd versions, where bugs may or may not have been fixed (e.g. the whiskers produced by older versions of gdImageRectangle()[1]), and those that are caused by rounding issues (e.g. <https://github.com/libgd/libgd/issues/242>). Anyhow, the only disadvantages of PR #1949 are that the tests are supposedly slower (every single pixel of both images will be compared with PHP code), and that the size of the source distribution will increase (as we have to include the expected images), what currently amounts to roughly 15KB. So I would suggest to introduce PR #1949 into PHP-5.6+. If there are no objections, I'll merge it in a week. [1] <https://github.com/libgd/libgd/issues/172#issuecomment-224653396> -- Christoph M. Becker

« previous php.cvs (#94272) next »