[gnumeric] Tests: add full valgrind test for xlsx too



commit 58230c1173a7c197e5e4acb7f459c078f0e4a82c
Author: Morten Welinder <terra gnome org>
Date:   Sat Apr 11 10:06:51 2015 -0400

    Tests: add full valgrind test for xlsx too

 test/Makefile.am            |    1 +
 test/t8011-valgrind-xlsx.pl |   64 +++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 65 insertions(+), 0 deletions(-)
---
diff --git a/test/Makefile.am b/test/Makefile.am
index 7f9b07e..0795124 100644
--- a/test/Makefile.am
+++ b/test/Makefile.am
@@ -133,6 +133,7 @@ TESTS =     t1000-statfuns.pl                       \
        t8004-valgrind-xls-macro.pl             \
        t8005-valgrind-chart-fit.pl             \
        t8010-valgrind-ods.pl                   \
+       t8011-valgrind-xlsx.pl                  \
        t8050-valgrind-sstest.pl                \
        t8100-null-false.pl                     \
        t8101-gfree.pl                          \
diff --git a/test/t8011-valgrind-xlsx.pl b/test/t8011-valgrind-xlsx.pl
new file mode 100755
index 0000000..0f9d77a
--- /dev/null
+++ b/test/t8011-valgrind-xlsx.pl
@@ -0,0 +1,64 @@
+#!/usr/bin/perl -w
+# -----------------------------------------------------------------------------
+
+use strict;
+use lib ($0 =~ m|^(.*/)| ? $1 : ".");
+use GnumericTest;
+
+$GnumericTest::default_corpus = 'random:5';
+
+&message ("Check the xlsx importer/exporter with valgrind.");
+
+my $xmllint = &GnumericTest::find_program ("xmllint");
+my $unzip = &GnumericTest::find_program ("unzip");
+
+my $format = "Gnumeric_Excel:xlsx";
+
+my @sources = &GnumericTest::corpus ();
+my $nskipped = 0;
+my $ngood = 0;
+my $nbad = 0;
+
+foreach my $src (@sources) {
+    if (!-r $src) {
+       $nskipped++;
+       next;
+    }
+
+    my $basename = &File::Basename::fileparse ($src);
+    my $basenoext = $basename;
+    $basenoext =~ s/\.[^.]+$//;
+
+    my $tmp1 = "$basenoext-tmp.xlsx";
+    print STDERR "$basename -> $tmp1\n";
+    &GnumericTest::junkfile ($tmp1);
+    my $cmd = &GnumericTest::quotearg ($ssconvert, "-T", $format, $src, $tmp1);
+    my $err = &test_valgrind ($cmd, 1, 1);
+
+    if (!$err && $basename !~ /\.xlsx$/) {
+       my $tmp2 = "$basenoext-tmp.gnumeric";
+       print STDERR "$tmp1 -> $tmp2\n";
+       &GnumericTest::junkfile ($tmp2);
+
+       my $cmd = &GnumericTest::quotearg ($ssconvert, $tmp1, $tmp2);
+       $err = &test_valgrind ($cmd, 1, 1);
+       &GnumericTest::removejunk ($tmp2);
+    }
+
+    $err ? $nbad++ : $ngood++;
+    &GnumericTest::removejunk ($tmp1);
+}
+
+&GnumericTest::report_skip ("No source files present") if $nbad + $ngood == 0;
+
+if ($nskipped > 0) {
+    print STDERR "$nskipped files skipped.\n";
+}
+
+if ($nbad > 0) {
+    die "Fail\n";
+} else {
+    print STDERR "Pass\n";
+}
+
+# -----------------------------------------------------------------------------


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