[libgsf] Tests: add test for zip64 forced on or forced off.



commit af96c7a26f93dc6d1493cfb3c4ac00e54fda75c5
Author: Morten Welinder <terra gnome org>
Date:   Tue Dec 2 18:03:34 2014 -0500

    Tests: add test for zip64 forced on or forced off.

 tests/LibGsfTest.pm      |    7 ++++---
 tests/Makefile.am        |    1 +
 tests/t1004-zip-zip64.pl |   14 ++++++++++++++
 tools/gsf.c              |   18 +++++++++++++++---
 4 files changed, 34 insertions(+), 6 deletions(-)
---
diff --git a/tests/LibGsfTest.pm b/tests/LibGsfTest.pm
index 5ca3b96..aca28e5 100644
--- a/tests/LibGsfTest.pm
+++ b/tests/LibGsfTest.pm
@@ -293,7 +293,7 @@ sub zipinfo_callback {
 sub test_zip {
     my (%args) = @_;
 
-    $args{'createarg'} = 'createzip';
+    $args{'create-arg'} = 'createzip';
     $args{'ext'} = 'zip';
     $args{'archive-tester'} = [$unzip, '-q', '-t'];
     $args{'independent-cat'} = [$unzip, '-p'];
@@ -342,8 +342,9 @@ sub test_archive {
     &junkfile ($archive);
 
     {
-       my $gsfcmd = $pargs->{'createarg'};
-       my $cmd = &quotearg ($gsf, $gsfcmd, $archive, @$pfiles);
+       my $gsfcmd = $pargs->{'create-arg'};
+       my $gsfopts = $pargs->{'create-options'} || [];
+       my $cmd = &quotearg ($gsf, $gsfcmd, @$gsfopts, $archive, @$pfiles);
        print STDERR "# $cmd\n";
        my $code = system ("$cmd 2>&1 | sed -e 's/^/| /'");
        &system_failure ($gsf, $code) if $code;
diff --git a/tests/Makefile.am b/tests/Makefile.am
index e26aca5..43affe6 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -16,6 +16,7 @@ TESTS =       t1000-zip-single.pl                             \
        t1001-zip-multiple.pl                           \
        t1002-zip-aaaa.pl                               \
        t1003-zip-noise.pl                              \
+       t1004-zip-zip64.pl                              \
        t8000-valgrind-zip.pl                           \
        t8020-valgrind-ole.pl                           \
        t9999-epilogue.pl
diff --git a/tests/t1004-zip-zip64.pl b/tests/t1004-zip-zip64.pl
new file mode 100755
index 0000000..24223ed
--- /dev/null
+++ b/tests/t1004-zip-zip64.pl
@@ -0,0 +1,14 @@
+#!/usr/bin/perl -w
+# -----------------------------------------------------------------------------
+
+use strict;
+use lib ($0 =~ m|^(.*/)| ? $1 : ".");
+use LibGsfTest;
+
+&test_zip ('files' => ['Makefile.am', 'common.supp'],
+          'create-options' => ["--zip64=1"],
+          'zip-member-tests' => ['zip64']);
+
+&test_zip ('files' => ['Makefile.am', 'common.supp'],
+          'create-options' => ["--zip64=0"],
+          'zip-member-tests' => ['!zip64']);
diff --git a/tools/gsf.c b/tools/gsf.c
index e8c1393..5e4cc13 100644
--- a/tools/gsf.c
+++ b/tools/gsf.c
@@ -10,6 +10,7 @@
 #include <errno.h>
 
 static gboolean show_version;
+static int opt_zip64 = -1;
 
 static GOptionEntry const gsf_options [] = {
        {
@@ -19,6 +20,14 @@ static GOptionEntry const gsf_options [] = {
                NULL
        },
 
+       /* All options below are for gsf testing only.  */
+       {
+               "zip64", 0,
+               G_OPTION_FLAG_HIDDEN, G_OPTION_ARG_INT, &opt_zip64,
+               "",
+               NULL
+       },
+
        /* ---------------------------------------- */
 
        { NULL, 0, 0, 0, NULL, NULL, NULL}
@@ -467,9 +476,12 @@ gsf_create (int argc, char **argv, GType type)
 
        if (type == GSF_OUTFILE_MSOLE_TYPE)
                outfile = gsf_outfile_msole_new (dest);
-       else if (type == GSF_OUTFILE_ZIP_TYPE)
-               outfile = gsf_outfile_zip_new (dest, &error);
-       else
+       else if (type == GSF_OUTFILE_ZIP_TYPE) {
+               outfile = g_object_new (GSF_OUTFILE_ZIP_TYPE,
+                                       "sink", dest,
+                                       "zip64", opt_zip64,
+                                       NULL);
+       } else
                g_assert_not_reached ();
 
        if (error) {


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