Compilation: kill warning.
[gnumeric.git] / test / t6162-gnumeric-deterministic.pl
blob2cf04775c9dfbd5e2423b8accdc9f1e17ba38421
1 #!/usr/bin/perl -w
2 # -----------------------------------------------------------------------------
4 use strict;
5 use lib ($0 =~ m|^(.*/)| ? $1 : ".");
6 use GnumericTest;
8 &message ("Check that the gnumeric exporter produces the same results every time.");
10 my $format = "Gnumeric_XmlIO:sax:0";
12 my @sources = &GnumericTest::corpus();
13 # datefuns and docs-samples use NOW()
14 @sources = grep { !m{(^|/)(datefuns\.xls|docs-samples\.gnumeric)$} } @sources;
16 my $nskipped = 0;
17 my $ngood = 0;
18 my $nbad = 0;
20 foreach my $src (@sources) {
21 if (!-r $src) {
22 $nskipped++;
23 next;
26 print STDERR "Checking $src\n";
28 my @data;
29 foreach my $i (1, 2) {
30 my $tmp = $src;
31 $tmp =~ s|^.*/||;
32 $tmp =~ s|\..*|-$i.gnumeric|;
33 &GnumericTest::junkfile ($tmp);
34 my $cmd = "$ssconvert -T $format $src $tmp";
35 print STDERR "# $cmd\n" if $GnumericTest::verbose;
36 system ($cmd);
37 if (!-r $tmp) {
38 print STDERR "ssconvert failed to produce $tmp\n";
39 die "Fail\n";
42 my $d = &GnumericTest::read_file ($tmp);
44 # Some formats (notably mps) set this to current time.
45 $d =~ s{<meta:creation-date>[0-9-:TZ]+</meta:creation-date>}{};
47 push @data, $d;
48 &GnumericTest::removejunk ($tmp);
51 if ($data[0] ne $data[1]) {
52 print STDERR "Generated output for $src is not deterministic.\n";
53 $nbad++;
54 } else {
55 $ngood++;
59 &GnumericTest::report_skip ("No source files present") if $nbad + $ngood == 0;
61 if ($nskipped > 0) {
62 print STDERR "$nskipped files skipped.\n";
65 if ($nbad > 0) {
66 die "Fail\n";
67 } else {
68 print STDERR "Pass\n";