Tests: add tests for ssgrep
[gnumeric.git] / test / t8010-valgrind-ods.pl
bloba1b80895f368613316525c432f5b9e6a7e8de32b
1 #!/usr/bin/perl -w
2 # -----------------------------------------------------------------------------
4 use strict;
5 use lib ($0 =~ m|^(.*/)| ? $1 : ".");
6 use GnumericTest;
8 $GnumericTest::default_corpus = 'random:5';
10 &message ("Check the ods importer/exporter with valgrind.");
12 my $xmllint = &GnumericTest::find_program ("xmllint");
13 my $unzip = &GnumericTest::find_program ("unzip");
15 my $format = "Gnumeric_OpenCalc:odf";
17 my @sources = &GnumericTest::corpus ();
18 my $nskipped = 0;
19 my $ngood = 0;
20 my $nbad = 0;
22 foreach my $src (@sources) {
23 if (!-r $src) {
24 $nskipped++;
25 next;
28 my $basename = &File::Basename::fileparse ($src);
29 my $basenoext = $basename;
30 $basenoext =~ s/\.[^.]+$//;
32 my $tmp1 = "$basenoext-tmp.ods";
33 print STDERR "$basename -> $tmp1\n";
34 &GnumericTest::junkfile ($tmp1);
35 my $cmd = &GnumericTest::quotearg ($ssconvert, "-T", $format, $src, $tmp1);
36 my $err = &test_valgrind ($cmd, 1, 1);
38 if (!$err && $basename !~ /\.ods$/) {
39 my $tmp2 = "$basenoext-tmp.gnumeric";
40 print STDERR "$tmp1 -> $tmp2\n";
41 &GnumericTest::junkfile ($tmp2);
43 my $cmd = &GnumericTest::quotearg ($ssconvert, $tmp1, $tmp2);
44 $err = &test_valgrind ($cmd, 1, 1);
45 &GnumericTest::removejunk ($tmp2);
48 $err ? $nbad++ : $ngood++;
49 &GnumericTest::removejunk ($tmp1);
52 &GnumericTest::report_skip ("No source files present") if $nbad + $ngood == 0;
54 if ($nskipped > 0) {
55 print STDERR "$nskipped files skipped.\n";
58 if ($nbad > 0) {
59 die "Fail\n";
60 } else {
61 print STDERR "Pass\n";
64 # -----------------------------------------------------------------------------