[gnumeric] fuzz: minor improvements.



commit 7ec0bb35818332a619c7a840311385024e85a060
Author: Morten Welinder <terra gnome org>
Date:   Fri Aug 6 15:31:34 2010 -0400

    fuzz: minor improvements.

 test/ChangeLog |    5 ++++-
 test/fuzzxml   |   25 +++++++++++++++++--------
 test/zzufit    |    1 +
 3 files changed, 22 insertions(+), 9 deletions(-)
---
diff --git a/test/ChangeLog b/test/ChangeLog
index fa5d078..5311b9e 100644
--- a/test/ChangeLog
+++ b/test/ChangeLog
@@ -1,6 +1,9 @@
 2010-08-06  Morten Welinder  <terra gnome org>
 
-	* fuzzxml: Write empty tags in the short form.
+	* zzufit: Log the name of the corrupted file.
+
+	* fuzzxml: Write empty tags in the short form.  Carry over xml
+	declaration, at least as far as encoding goes.
 
 2010-07-30  Morten Welinder <terra gnome org>
 
diff --git a/test/fuzzxml b/test/fuzzxml
index 4588144..151cf85 100755
--- a/test/fuzzxml
+++ b/test/fuzzxml
@@ -30,9 +30,14 @@ my %attr_range;
 # -----------------------------------------------------------------------------
 
 my $tree;
+my $encoding;
 {
     my $parser = new XML::Parser ('Style' => 'Tree');
-    $parser->setHandlers('Start' => \&MyStart);
+    $parser->setHandlers('Start' => \&MyStart,
+			 'XMLDecl' => sub {
+			     my ($expat,$ver,$enc,$standalone) = @_;
+			     $encoding = $enc;
+			 });
     $tree = $parser->parsefile ($infile);
 }
 
@@ -45,7 +50,11 @@ foreach my $key (sort keys %attr_range) {
 
 {
     my $f = new IO::File ($outfile, "w");
-    my $writer = new XML::Writer(OUTPUT => $f);
+    my $writer = new XML::Writer(OUTPUT => $f,
+				 ENCODING => $encoding);
+    if (defined $encoding) {
+	$writer->xmlDecl();
+    }
     &write_xml ($writer, $tree);
 }
 
@@ -184,10 +193,10 @@ sub looks_like_int {
 # Just like XML::Parse::Style::Tree::start, except attrs as list.
 
 sub MyStart {
-  my $expat = shift;
-  my $tag = shift;
-  my $newlist = [ [ @_ ] ];
-  push @{ $expat->{Lists} }, $expat->{Curlist};
-  push @{ $expat->{Curlist} }, $tag => $newlist;
-  $expat->{Curlist} = $newlist;
+    my $expat = shift;
+    my $tag = shift;
+    my $newlist = [ [ @_ ] ];
+    push @{ $expat->{Lists} }, $expat->{Curlist};
+    push @{ $expat->{Curlist} }, $tag => $newlist;
+    $expat->{Curlist} = $newlist;
 }
diff --git a/test/zzufit b/test/zzufit
index 93ab58a..8f88ab8 100755
--- a/test/zzufit
+++ b/test/zzufit
@@ -39,6 +39,7 @@ while (1) {
     } else {
 	system ("zzuf -s$n -r$rate <'$file' >'$zzuffile'");
     }
+    &append_log ("Corrupted file is $zzuffile\n");
 
     my $outfile = "$DIR/${filebase}-${n}.gnumeric";
     system ("../src/ssconvert '$zzuffile' '$outfile' >>'$LOG' 2>&1");



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]