Skip to content

Conversation

cmb69
Copy link
Member

@cmb69 cmb69 commented Jun 19, 2016

The bundled GD test suites makes heavy use of md5() to verify the result
of drawing operations. This leads to fragile tests (even a slight change
in a PNG header would cause failure, and of course there is the
possibility of collisions), and even worse, eventual test failures are
rather unrevealing.

Therefore we replace all md5() verification with a simplistic
test_image_equals_file(), which is basically a simplified port of libgd's
gdTestImageCompareToFile(), adapted to the needs of PHPTs.

In the long run better tests helpers should be introduced (see also
http://news.php.net/php.internals/94081), but for now this solution
is preferable over the former.

The bundled GD test suites makes heavy use of md5() to verify the result
of drawing operations. This leads to fragile tests (even a slight change
in a PNG header would cause failure, and of course there is the
possibility of collisions), and even worse, eventual test failures are
rather unrevealing.

Therefore we replace all md5() verification with a simplistic
test_image_equals_file(), which is basically a simplified port of libgd's
gdTestImageCompareToFile(), adapted to the needs of PHPTs.

In the long run better tests helpers should be introduced (see also
<http://news.php.net/php.internals/94081>), but for now this solution
is preferable over the former.
@cmb69
Copy link
Member Author

cmb69 commented Jun 19, 2016

Note that something like this seems to be a prerequisite for several improvements and fixes to GD. For instance, I wanted to fix https://bugs.php.net/64641, but the fix caused several tests to fail. As it turned out, the failure was due to minimal differences introduced by fixing the bug. However, inspecting the failures caused by the md5() verification is cumbersome; test_image_equals_file() is supposed to considerably alleviate this problem.

@php-pulls
Copy link

Comment on behalf of cmb at php.net:

Cherry-picked into PHP-5.6+ with commit dc09f30.

@php-pulls php-pulls closed this Sep 11, 2016
@cmb69 cmb69 deleted the gd-test-suite branch August 16, 2017 15:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants