This is an automated email from the git hooks/post-receive script.

guillem pushed a commit to branch master
in repository dpkg.

View the commit online:
https://git.dpkg.org/cgit/dpkg/dpkg.git/commit/?id=3844c38302396772f78a670bb8b4f678437600d5

commit 3844c38302396772f78a670bb8b4f678437600d5
Author: Guillem Jover <guil...@debian.org>
AuthorDate: Sat Jan 16 13:37:28 2021 +0100

    test: Use gunzip instead of zcat and assume it might not be present
    
    On Solaris CPAN testing systems, zcat(1) is an alias for the traditional
    uncompress(1), so it does not work as gunzip(1). Use the latter
    explicitly to avoid portability issues, and do not assume it will always
    be present, when we will skip the unit test.
---
 scripts/t/Dpkg_Compression.t | 13 ++++++++++---
 1 file changed, 10 insertions(+), 3 deletions(-)

diff --git a/scripts/t/Dpkg_Compression.t b/scripts/t/Dpkg_Compression.t
index 3babe5fca..c0db331a7 100644
--- a/scripts/t/Dpkg_Compression.t
+++ b/scripts/t/Dpkg_Compression.t
@@ -19,12 +19,15 @@ use warnings;
 use Test::More tests => 13;
 use Test::Dpkg qw(:paths);
 
+use IPC::Cmd qw(can_run);
+
 use_ok('Dpkg::Compression');
 use_ok('Dpkg::Compression::FileHandle');
 
 my $tmpdir = test_get_temp_path();
 my @lines = ("One\n", "Two\n", "Three\n");
 my $fh;
+my $have_gunzip = can_run('gunzip');
 
 sub test_write {
     my ($filename, $check_result) = @_;
@@ -60,7 +63,7 @@ sub check_uncompressed {
 
 sub check_compressed {
     my ($filename, $method) = @_;
-    open my $read_fh, '-|', 'zcat', "$tmpdir/myfile.gz"
+    open my $read_fh, '-|', 'gunzip', '-c', "$tmpdir/myfile.gz"
         or die 'cannot fork zcat';
     my @read = <$read_fh>;
     close $read_fh or die 'cannot close';
@@ -98,8 +101,12 @@ is(compression_get_default_level(), $old_level, 'reset 
default compression level
 # Test write on uncompressed file
 test_write("$tmpdir/myfile", \&check_uncompressed);
 
-# Test write on compressed file
-test_write("$tmpdir/myfile.gz", \&check_compressed);
+SKIP: {
+    skip 'gunzip not available', 1 if not $have_gunzip;
+
+    # Test write on compressed file
+    test_write("$tmpdir/myfile.gz", \&check_compressed);
+}
 
 # Test read on uncompressed file
 test_read("$tmpdir/myfile");

-- 
Dpkg.Org's dpkg

Reply via email to