Shutdown: help the style leak printer out a bit.
[gnumeric.git] / test / t8011-valgrind-xlsx.pl
blob6b7a3df0f92215e2646569f2d879e4702beb39ff
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 xlsx importer/exporter with valgrind.");
12 my $unzip = &GnumericTest::find_program ("unzip");
14 my $format = "Gnumeric_Excel:xlsx";
16 my @sources = &GnumericTest::corpus ();
17 my $nskipped = 0;
18 my $ngood = 0;
19 my $nbad = 0;
21 foreach my $src (@sources) {
22 if (!-r $src) {
23 $nskipped++;
24 next;
27 my $basename = &File::Basename::fileparse ($src);
28 my $basenoext = $basename;
29 $basenoext =~ s/\.[^.]+$//;
31 my $tmp1 = "$basenoext-tmp.xlsx";
32 print STDERR "$basename -> $tmp1\n";
33 &GnumericTest::junkfile ($tmp1);
34 my $cmd = &GnumericTest::quotearg ($ssconvert, "-T", $format, $src, $tmp1);
35 my $err = &test_valgrind ($cmd, 1, 1);
37 if (!$err && $basename !~ /\.xlsx$/) {
38 my $tmp2 = "$basenoext-tmp.gnumeric";
39 print STDERR "$tmp1 -> $tmp2\n";
40 &GnumericTest::junkfile ($tmp2);
42 my $cmd = &GnumericTest::quotearg ($ssconvert, $tmp1, $tmp2);
43 $err = &test_valgrind ($cmd, 1, 1);
44 &GnumericTest::removejunk ($tmp2);
47 $err ? $nbad++ : $ngood++;
48 &GnumericTest::removejunk ($tmp1);
51 &GnumericTest::report_skip ("No source files present") if $nbad + $ngood == 0;
53 if ($nskipped > 0) {
54 print STDERR "$nskipped files skipped.\n";
57 if ($nbad > 0) {
58 die "Fail\n";
59 } else {
60 print STDERR "Pass\n";
63 # -----------------------------------------------------------------------------