Skip to content

Commit d3f733a

Browse files
committed
Tests: reworked libgd version detection.
The "libgd-config" binary is deprecated in recent versions and may not exist or have unexpected output. More, it may not present within older versions, as well, if installed separately, which previously broke test assumptions. The fix is change the fallback to skip tests. In addition, recent Perl GD module (2.57) started to export libgd version, which is now also consulted.
1 parent 66d485c commit d3f733a

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

image_filter.t

+5-3
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,8 @@ is($im->interlaced, 0, 'gif interlaced off');
212212
is($im->transparent, 0, 'gif transparent white');
213213

214214
SKIP: {
215-
skip 'broken libgd', 1 unless has_gdversion('2.1.0') or $ENV{TEST_NGINX_UNSAFE};
215+
skip 'broken/unknown libgd', 1
216+
unless has_gdversion('2.1.0') or $ENV{TEST_NGINX_UNSAFE};
216217

217218
$im = GD::Image->newFromGifData(http_get_body('/interlaced/gif'));
218219
is($im->interlaced, 1, 'gif interlaced on');
@@ -279,8 +280,9 @@ sub http_get_body {
279280
sub has_gdversion {
280281
my ($need) = @_;
281282

282-
my $v_str = `gdlib-config --version 2>&1` or return 1;
283-
($v_str) = $v_str =~ m!^([0-9.]+)! or return 1;
283+
my $v_str = `gdlib-config --version 2>&1`
284+
|| eval { GD::VERSION_STRING() } or return 0;
285+
($v_str) = $v_str =~ m!^([0-9.]+)!m or return 0;
284286
my @v = split(/\./, $v_str);
285287
my ($n, $v);
286288

0 commit comments

Comments
 (0)