# HG changeset patch # User Sergey Kandaurov # Date 1578928535 -10800 # Node ID 451e787aad7661c6fc5236cf750a5bf059e69034 # Parent b9de5364dfc9867b763391fbf262689e3cea4c48 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. diff --git a/image_filter.t b/image_filter.t --- a/image_filter.t +++ b/image_filter.t @@ -212,7 +212,8 @@ is($im->interlaced, 0, 'gif interlaced o is($im->transparent, 0, 'gif transparent white'); SKIP: { -skip 'broken libgd', 1 unless has_gdversion('2.1.0') or $ENV{TEST_NGINX_UNSAFE}; +skip 'broken/unknown libgd', 1 + unless has_gdversion('2.1.0') or $ENV{TEST_NGINX_UNSAFE}; $im = GD::Image->newFromGifData(http_get_body('/interlaced/gif')); is($im->interlaced, 1, 'gif interlaced on'); @@ -279,8 +280,9 @@ sub http_get_body { sub has_gdversion { my ($need) = @_; - my $v_str = `gdlib-config --version 2>&1` or return 1; - ($v_str) = $v_str =~ m!^([0-9.]+)! or return 1; + my $v_str = `gdlib-config --version 2>&1` + || eval { GD::VERSION_STRING() } or return 0; + ($v_str) = $v_str =~ m!^([0-9.]+)!m or return 0; my @v = split(/\./, $v_str); my ($n, $v);