diff options
author | Fridrich Štrba <fridrich.strba@bluewin.ch> | 2013-12-03 10:45:28 +0100 |
---|---|---|
committer | Fridrich Štrba <fridrich.strba@bluewin.ch> | 2013-12-03 10:45:28 +0100 |
commit | fc64b00ab93a49c1bb348e5f344d75061565f582 (patch) | |
tree | 8137aa16237bbf4386477d0216dd08bab51717ae /regression.pl | |
parent | 12b8bc2f98df61dad161bf4264bc9c50148b8281 (diff) |
ODG regression test + ODG document reference
Diffstat (limited to 'regression.pl')
-rwxr-xr-x | regression.pl | 106 |
1 files changed, 101 insertions, 5 deletions
diff --git a/regression.pl b/regression.pl index 03af99a..0fa9e85 100755 --- a/regression.pl +++ b/regression.pl @@ -2,7 +2,8 @@ my $html = 0; # set to 1 to output a nicely formatted HTML page -my $do_vg = 0; # execute the valgrind test (takes a while) +my $do_odg = 0; # execute the cdr2odg diff test +my $do_vg = 0; # execute the valgrind test (takes a while) my $pass_colour = "11dd11"; my $fail_colour = "dd1111"; @@ -47,7 +48,6 @@ sub DiffTest { # diff the stored raw data with the newly generated raw data `diff -u --minimal -d $rawPath $newRawPath 1>$diffPath 2>$diffPath`; -# print "DEBUG: $extension fp:$file ep:$errPath rp:$rawPath nrp:$newRawPath dp:$diffPath\n"; $diff = `cat $diffPath | grep -v "No differences encountered"`; if ( $diff ne "" ) { @@ -106,6 +106,7 @@ sub CgTest { sub RegTest { my $rawDiffFailures = 0; my $xhtmlDiffFailures = 0; + my $odgDiffFailures = 0; my $vgFailures = 0; my $callGraphFailures = 0; my $vgCommand = "valgrind --tool=memcheck -v --track-origins=yes"; @@ -133,7 +134,9 @@ sub RegTest { print "<td style='background-color: rgb(204, 204, 255);'><b>Raw Diff Test<br/>(cdr2raw)</b></td>\n"; print "<td style='background-color: rgb(204, 204, 255);'><b>XHTML Diff Test<br/>(cdr2xhtml)</b></td>\n"; print "<td style='background-color: rgb(204, 204, 255);'><b>Call Graph Test<br/>(cdr2raw)</b></td>\n"; + print "<td style='background-color: rgb(204, 204, 255);'><b>ODG Test<br/>(cdr2odg)</b></td>\n"; print "<td style='background-color: rgb(204, 204, 255);'><b>Valgrind Test<br/>(cdr2raw)</b></td>\n"; + print "<td style='background-color: rgb(204, 204, 255);'><b>ODG Valgrind Test<br/>(cdr2odg)</b></td>\n"; print "</tr>\n"; } else { @@ -174,6 +177,29 @@ sub RegTest { $xhtmlDiffFailures++; } + if ($do_odg) { + if ( + DiffTest( + "cdr2odg --stdout", + "xmllint --c14n", + "xmllint --format", + $filePath, + "odg" + ) eq "fail" + ) + { + $odgDiffFailures++; + } + } + else { + if ($html) { + DisplayCell( $skip_colour, "skipped" ); + } + else { + print "! $file ODG: skipped\n"; + } + } + # ////////////////////////// # CALL GRAPH REGRESSION TEST # ////////////////////////// @@ -249,6 +275,57 @@ sub RegTest { } } + if ( $do_vg && $do_odg ) { + $vgPath = 'testset/' . $cdrVersion . '/' . $file . '.odgvg'; + $odgvalgrind = 0; + `$vgCommand --leak-check=yes cdr2odg --stdout $filePath 1> $vgPath 2> $vgPath`; + open VG, "$vgPath"; + my $vgOutput; + while (<VG>) { + if (/^\=\=/) { + $vgOutput .= $_; + if ( /definitely lost: [1-9]/ + || /ERROR SUMMARY: [1-9]/ + || /Invalid read of/ ) + { + $odgvalgrind = 1; + } + } + } + close VG; + + `rm -f $vgPath`; + if ($odgvalgrind) { + open VG, ">$vgPath"; + print VG $vgOutput; + close VG; + $odgvgFailures++; + } + $vgOutput = ""; + + if ($html) { + ( + $odgvalgrind eq 0 + ? DisplayCell( $pass_colour, "passed" ) + : DisplayCell( + $fail_colour, "failed <a href='$vgPath'>log<a>" + ) + ); + print "</tr>\n"; + } + else { + print "! $file odg valgrind: " + . ( $odgvalgrind eq "0" ? "passed" : "failed" ) . "\n"; + } + } + else { + if ($html) { + DisplayCell( $skip_colour, "skipped" ); + } + else { + print "! $file odg valgrind: skipped\n"; + } + } } if ($html) { @@ -266,13 +343,21 @@ sub RegTest { print "Regression test found " . $callGraphFailures . " call graph failure(s)<br>\n"; + if ($do_odg) { + print "Regression test found " + . $odgDiffFailures + . " odg diff failure(s)<br>\n"; + } + else { + print "ODG diff test skipped<br>\n"; + } if ($do_vg) { print "Regression test found " . $vgFailures - . " valgrind failure(s)<br><br>\n"; + . " valgrind failure(s)<br>\n"; } else { - print "Valgrind test skipped<br><br>\n"; + print "Valgrind test skipped<br>\n"; } } else { @@ -294,6 +379,14 @@ sub RegTest { else { print "Valgrind test skipped\n"; } + if ($do_vg && $do_odg) { + print "Regression test found " + . $odgvgFailures + . "ODG valgrind failure(s)<br><br>\n"; + } + else { + print "ODG valgrind test skipped<br><br>\n"; + } } } } @@ -316,12 +409,15 @@ while ( scalar(@ARGV) > 0 ) { elsif ( $argument =~ /--vg/ ) { $do_vg = 1; } + elsif ( $argument =~ /--odg/ ) { + $do_odg = 1; + } else { $confused = 1; } } if ($confused) { - print "Usage: regression.pl [ --output-html ] [ --vg ]\n"; + print "Usage: regression.pl [ --output-html ] [ --vg ] [ --odg ]\n"; exit; } |