[gnumeric] t8010: new test for valgrinding ods import/export.



commit acf4c1d1f87852cd1c6cb2503a1e194723cd056c
Author: Morten Welinder <terra gnome org>
Date:   Fri Apr 10 22:12:21 2015 -0400

    t8010: new test for valgrinding ods import/export.
    
    This takes about half an hour -- that's too long.  We'll probably
    need to use a reduced corpus by default.

 test/GnumericTest.pm       |    9 ++--
 test/Makefile.am           |    1 +
 test/common.supp           |   44 ++++++++++++++++
 test/t8010-valgrind-ods.pl |  118 ++++++++++++++++++++++++++++++++++++++++++++
 4 files changed, 168 insertions(+), 4 deletions(-)
---
diff --git a/test/GnumericTest.pm b/test/GnumericTest.pm
index a0b916c..de872bd 100644
--- a/test/GnumericTest.pm
+++ b/test/GnumericTest.pm
@@ -538,7 +538,7 @@ sub test_roundtrip {
 # -----------------------------------------------------------------------------
 
 sub test_valgrind {
-    my ($cmd,$uselibtool) = @_;
+    my ($cmd,$uselibtool,$qreturn) = @_;
 
     local (%ENV) = %ENV;
     $ENV{'G_DEBUG'} .= ':gc-friendly:resident-modules';
@@ -597,12 +597,13 @@ sub test_valgrind {
        : -1;
     if ($errors == 0) {
        # &dump_indented ($txt);
-       print STDERR "Pass\n";
-       return;
+       print STDERR "Pass\n" unless $qreturn;
+       return 0;
     }
 
     &dump_indented ($txt);
-    die "Fail\n";
+    die "Fail\n" unless $qreturn;
+    return 1;
 }
 
 # -----------------------------------------------------------------------------
diff --git a/test/Makefile.am b/test/Makefile.am
index d1c0a94..7f9b07e 100644
--- a/test/Makefile.am
+++ b/test/Makefile.am
@@ -132,6 +132,7 @@ TESTS =     t1000-statfuns.pl                       \
        t8003-valgrind-pdf.pl                   \
        t8004-valgrind-xls-macro.pl             \
        t8005-valgrind-chart-fit.pl             \
+       t8010-valgrind-ods.pl                   \
        t8050-valgrind-sstest.pl                \
        t8100-null-false.pl                     \
        t8101-gfree.pl                          \
diff --git a/test/common.supp b/test/common.supp
index 2d7873c..d3b0c00 100644
--- a/test/common.supp
+++ b/test/common.supp
@@ -859,3 +859,47 @@
    fun:FcConfigEvaluate
    fun:FcConfigValues
 }
+
+# See https://bugs.freedesktop.org/show_bug.cgi?id=87898
+{
+   _CAIRO_RECORDING_SURFACE_SNAPSHOT_LEAK
+   Memcheck:Leak
+   fun:malloc
+   fun:_cairo_recording_surface_snapshot
+}
+
+{
+   CAIRO_REPLAY_UMR
+   Memcheck:Cond
+   fun:_cairo_recording_surface_merge_source_attributes.isra.8
+   fun:_cairo_recording_surface_replay_internal
+   fun:_cairo_recording_surface_replay_and_create_regions
+}
+
+{
+   PNG_UMR
+   Memcheck:Value8
+   fun:crc32
+   ...
+   fun:png_write_chunk
+}
+
+{
+   PNG_WRITE_ROW_UMR
+   Memcheck:Cond
+   fun:*
+   fun:png_write_row
+}
+
+{
+   PIXMAN_UMR
+   Memcheck:Cond
+   fun:sse2_combine_over_u
+}
+
+# Probably just valgrind getting confused
+{
+   PIXMAN_UMR2
+   Memcheck:Cond
+   fun:go_cairo_convert_data_to_pixbuf
+}
diff --git a/test/t8010-valgrind-ods.pl b/test/t8010-valgrind-ods.pl
new file mode 100755
index 0000000..b61f247
--- /dev/null
+++ b/test/t8010-valgrind-ods.pl
@@ -0,0 +1,118 @@
+#!/usr/bin/perl -w
+# -----------------------------------------------------------------------------
+
+use strict;
+use lib ($0 =~ m|^(.*/)| ? $1 : ".");
+use GnumericTest;
+
+&message ("Check the ods importer/exporter with valgrind.");
+
+my $xmllint = &GnumericTest::find_program ("xmllint");
+my $unzip = &GnumericTest::find_program ("unzip");
+
+my $format = "Gnumeric_OpenCalc:odf";
+
+my @sources =
+    ("$samples/graph-tests.gnumeric",
+     "$samples/excel/address.xls",
+     "$samples/excel/bitwise.xls",
+     "$samples/excel/chart-tests-excel.xls",
+     "$samples/excel/datefuns.xls",
+     "$samples/excel/dbfuns.xls",
+     "$samples/excel/engfuns.xls",
+     "$samples/excel/finfuns.xls",
+     "$samples/excel/functions.xls",
+     "$samples/excel/infofuns.xls",
+     "$samples/excel/logfuns.xls",
+     "$samples/excel/lookfuns2.xls",
+     "$samples/excel/lookfuns.xls",
+     "$samples/excel/mathfuns.xls",
+     "$samples/excel/objs.xls",
+     "$samples/excel/operator.xls",
+     "$samples/excel/sort.xls",
+     "$samples/excel/statfuns.xls",
+     "$samples/excel/textfuns.xls",
+     "$samples/excel/yalta2008.xls",
+     "$samples/excel12/cellstyle.xlsx",
+     "$samples/crlibm.gnumeric",
+     "$samples/amath.gnumeric",
+     "$samples/gamma.gnumeric",
+     "$samples/linest.xls",
+     "$samples/vba-725220.xls",
+     "$samples/sumif.xls",
+     "$samples/array-intersection.xls",
+     "$samples/arrays.xls",
+     "$samples/docs-samples.gnumeric",
+     "$samples/ftest.xls",
+     "$samples/ttest.xls",
+     "$samples/chitest.xls",
+     "$samples/numbermatch.gnumeric",
+     "$samples/solver/afiro.mps",
+     "$samples/solver/blend.mps",
+     "$samples/auto-filter-tests.gnumeric",
+     "$samples/cell-comment-tests.gnumeric",
+     "$samples/colrow-tests.gnumeric",
+     "$samples/cond-format-tests.gnumeric",
+     "$samples/formula-tests.gnumeric",
+     "$samples/graph-tests.gnumeric",
+     "$samples/merge-tests.gnumeric",
+     "$samples/names-tests.gnumeric",
+     "$samples/number-tests.gnumeric",
+     "$samples/object-tests.gnumeric",
+     "$samples/page-setup-tests.gnumeric",
+     "$samples/rich-text-tests.gnumeric",
+     "$samples/sheet-formatting-tests.gnumeric",
+     "$samples/solver-tests.gnumeric",
+     "$samples/split-panes-tests.gnumeric",
+     "$samples/string-tests.gnumeric",
+     "$samples/merge-tests.gnumeric",
+     "$samples/style-tests.gnumeric",
+     "$samples/validation-tests.gnumeric",
+    );
+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.ods";
+    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 !~ /\.ods$/) {
+       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]