changeset 1542:451e787aad76

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.
author Sergey Kandaurov <pluknet@nginx.com>
date Mon, 13 Jan 2020 18:15:35 +0300
parents b9de5364dfc9
children 0b97d431571f
files image_filter.t
diffstat 1 files changed, 5 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- 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);