[libgsf] Tests: test non-seekable sink for zip creation.



commit 0837e6edbd716a06fb06c9dc34905b66b58ce7c6
Author: Morten Welinder <terra gnome org>
Date:   Tue Dec 2 20:39:20 2014 -0500

    Tests: test non-seekable sink for zip creation.

 tests/LibGsfTest.pm            |   10 ++++++++--
 tests/Makefile.am              |    1 +
 tests/t1005-zip-nonseekable.pl |   20 ++++++++++++++++++++
 3 files changed, 29 insertions(+), 2 deletions(-)
---
diff --git a/tests/LibGsfTest.pm b/tests/LibGsfTest.pm
index aca28e5..59b9e28 100644
--- a/tests/LibGsfTest.pm
+++ b/tests/LibGsfTest.pm
@@ -344,9 +344,15 @@ sub test_archive {
     {
        my $gsfcmd = $pargs->{'create-arg'};
        my $gsfopts = $pargs->{'create-options'} || [];
-       my $cmd = &quotearg ($gsf, $gsfcmd, @$gsfopts, $archive, @$pfiles);
+       my $stdio = $pargs->{'stdio'};
+       my $cmd = &quotearg ($gsf, $gsfcmd, @$gsfopts,
+                            ($stdio ? "-" : $archive),
+                            @$pfiles);
        print STDERR "# $cmd\n";
-       my $code = system ("$cmd 2>&1 | sed -e 's/^/| /'");
+       my $code =
+           $stdio
+           ? system ("($cmd | cat >$archive) 2>&1 | sed -e 's/^/| /'")
+           : system ("$cmd 2>&1 | sed -e 's/^/| /'");
        &system_failure ($gsf, $code) if $code;
        die "$gsf failed to create the archive $archive\n" unless -e $archive;
     }
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 43affe6..bc945ae 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -17,6 +17,7 @@ TESTS =       t1000-zip-single.pl                             \
        t1002-zip-aaaa.pl                               \
        t1003-zip-noise.pl                              \
        t1004-zip-zip64.pl                              \
+       t1005-zip-nonseekable.pl                        \
        t8000-valgrind-zip.pl                           \
        t8020-valgrind-ole.pl                           \
        t9999-epilogue.pl
diff --git a/tests/t1005-zip-nonseekable.pl b/tests/t1005-zip-nonseekable.pl
new file mode 100755
index 0000000..6c0a9d5
--- /dev/null
+++ b/tests/t1005-zip-nonseekable.pl
@@ -0,0 +1,20 @@
+#!/usr/bin/perl -w
+# -----------------------------------------------------------------------------
+
+use strict;
+use lib ($0 =~ m|^(.*/)| ? $1 : ".");
+use LibGsfTest;
+
+&test_zip ('files' => ['Makefile.am', 'common.supp'],
+          'stdio' => 1,
+          'zip-member-tests' => ['zip64']);
+
+&test_zip ('files' => ['Makefile.am', 'common.supp'],
+          'create-options' => ["--zip64=0"],
+          'stdio' => 1,
+          'zip-member-tests' => ['!zip64']);
+
+&test_zip ('files' => ['Makefile.am', 'common.supp'],
+          'create-options' => ["--zip64=1"],
+          'stdio' => 1,
+          'zip-member-tests' => ['zip64']);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]