Introspection update
[gnumeric.git] / test / t6151-gnumeric-syntax.pl
blob3bd2390293125fe74ad36226dbcb54d080888a98
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 valid files.");
10 my $schema = "$topsrc/gnumeric.xsd";
11 &GnumericTest::report_skip ("Cannot find schema") unless -r $schema;
13 my $xmllint = &GnumericTest::find_program ("xmllint");
15 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 print STDERR "Checking $src\n";
29 my $tmp = $src;
30 $tmp =~ s|^.*/||;
31 $tmp =~ s|\..*|.xml|;
32 &GnumericTest::junkfile ($tmp);
33 system ("$ssconvert $src $tmp");
34 if (!-r $tmp) {
35 print STDERR "ssconvert failed to produce $tmp\n";
36 die "Fail\n";
39 my $out = `$xmllint --noout --schema $schema $tmp 2>&1`;
40 if ($out !~ /validates$/) {
41 print STDERR "While checking $tmp:\n";
42 &GnumericTest::dump_indented ($out);
43 $nbad++;
44 } else {
45 $ngood++;
48 &GnumericTest::removejunk ($tmp);
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";