2009-01-21 11:00:00 +0100 npower r266639 : replace ScAddress::CONV_XL_R1C1 with formula::FormulaGrammar::CONV_XL_R1C1 2009-01-21 10:58:33 +0100 npower r266638 : fixup access for changes to compiler.[ch]xx 2009-01-21 10:57:46 +0100 npower r266637 : replace the static with non-static member ( to align with the latest m39 ) changes 2009-01-20 11:53:52 +0100 npower r266562 : CWS-TOOLING: rebase CWS npower11 to trunk@266428 (milestone: DEV300:m39) 2009-01-09 23:31:00 +0100 cloph r266122 : fix typo (missing "="), initialize variables to avoid WaE breakage 2009-01-09 11:57:20 +0100 npower r266071 : wae Mac OSX gcc-4.0.1 (PPC) 2009-01-08 11:09:49 +0100 npower r265986 : wae - Mac OSX gcc-4.0.1 (PPC) 2009-01-07 10:33:20 +0100 npower r265952 : wae Mac OSX gcc-4.0.1 2008-12-18 19:14:10 +0100 npower r265712 : wae for wntmsci12 target 2008-12-17 16:14:54 +0100 npower r265640 : add Outline property for Font, also remove growing list of friend classes for ScCellRangeObj and replace by a single class. 2008-12-17 16:11:02 +0100 npower r265639 : fix path variable for 3.1, also tweak the unix logs 2008-12-11 02:39:58 +0100 hanbo r265233 : fix the vba/vba namespace of constants 2008-11-25 17:05:39 +0100 npower r264317 : namespace changes 2008-11-25 14:12:37 +0100 npower r264308 : revert changes made by mistake when migrating cws 2008-11-25 13:30:59 +0100 npower r264296 : i#93944# namespace changes 2008-11-25 13:29:25 +0100 npower r264293 : i#93944# namespace changes 2008-11-25 13:27:08 +0100 npower r264289 : i#93944# namespace changes 2008-11-24 18:24:17 +0100 npower r264263 : svn migration 2008-11-24 18:22:47 +0100 npower r264262 : not needed anymore 2008-11-24 18:21:23 +0100 npower r264261 : svn migration 2008-11-24 18:18:31 +0100 npower r264260 : svn migration
172 lines
4.0 KiB
Perl
172 lines
4.0 KiB
Perl
#!/usr/bin/perl -w
|
|
use File::Temp qw/ tempfile tempdir /;
|
|
use File::Basename;
|
|
use File::stat;
|
|
use File::Copy;
|
|
|
|
my $binDir = dirname($0);
|
|
my $timestampclean= "perl $binDir/timestampsClean.pl";
|
|
#sub gen_diff($)
|
|
|
|
sub testLog
|
|
{
|
|
# 2 No Log to compare against
|
|
# 1 Log passed
|
|
# 0 Log failed
|
|
my $result = 0;
|
|
my $testfile = shift;
|
|
my $dirtocheck = shift;
|
|
my $filename = basename($testfile);
|
|
$filename = "$logdir/$filename";
|
|
print "processing $testfile $filename\n";
|
|
if ( -f $filename ) {
|
|
my $tmpFile;
|
|
$dir = tempdir( CLEANUP => 1 );
|
|
($fh, $tmpFile) = tempfile( DIR => $dir );
|
|
close($fh);
|
|
#
|
|
my $status = system("diff -U 0 -p $testfile $filename | $timestampclean > $tmpFile");
|
|
my $info = stat($tmpFile) or die "no $tmpFile: $!";
|
|
if ( ($status >>=8) == 0 && ( $info->size == 0) ) {
|
|
#print "diff worked size is 0\n";
|
|
$result = 1;
|
|
}
|
|
elsif ( ($status >>=8) == 0 && ( $info->size > 0) )
|
|
{
|
|
#print "diff worked size > 0\n";
|
|
$result = 0;
|
|
}
|
|
else
|
|
{
|
|
#print "diff failed size > 0\n";
|
|
$result = 0;
|
|
}
|
|
}
|
|
else
|
|
{
|
|
#print "not file > 0\n";
|
|
$result = 2;
|
|
}
|
|
#print "diff result = $result\n";
|
|
return $result;
|
|
}
|
|
|
|
if ( ! ( $logdir = shift @ARGV ) ) {
|
|
print STDERR "No logdir specified!\n";
|
|
usage();
|
|
exit 1;
|
|
}
|
|
|
|
if ( ! ( $testlogdir = shift @ARGV ) ) {
|
|
print STDERR "No testdocuments dir to compare against specified!\n";
|
|
usage();
|
|
exit 1;
|
|
}
|
|
|
|
if ( !(-d $logdir ) ) {
|
|
print STDERR "No output directory $logdir exists, please create it!!!!\n";
|
|
exit 1;
|
|
}
|
|
if ( !(-d $testlogdir ) ) {
|
|
print STDERR "the directory containing the logfiles to compare against \"$logdir\" does not exist\n";
|
|
usage();
|
|
exit 1;
|
|
}
|
|
print "logdir $logdir\n";
|
|
print "testlogdir $testlogdir\n";
|
|
sub filter_crud($)
|
|
{
|
|
my $a = shift;
|
|
|
|
$a =~ /~$/ && return;
|
|
$a =~ /\#$/ && return;
|
|
$a =~ /\.orig$/ && return;
|
|
$a =~ /unxlng.*\.pro$/ && return;
|
|
$a =~ /wntmsc.*\.pro$/ && return;
|
|
$a =~ /.swp$/ && return;
|
|
$a =~ /POSITION/ && return;
|
|
$a =~ /ReadMe/ && return;
|
|
$a =~ /.tmp$/ && return;
|
|
$a =~ /\.svn/ && return;
|
|
$a eq 'CVS' && return;
|
|
$a eq '.' && return;
|
|
$a eq '..' && return;
|
|
|
|
return $a;
|
|
}
|
|
sub slurp_dir($);
|
|
|
|
sub slurp_dir($)
|
|
{
|
|
my $dir = shift;
|
|
my ($dirhandle, $fname);
|
|
my @files = ();
|
|
|
|
opendir ($dirhandle, $dir) || die "Can't open $dir";
|
|
while ($fname = readdir ($dirhandle)) {
|
|
$fname = filter_crud($fname);
|
|
defined $fname || next;
|
|
# if (-d "$dir/$fname") {
|
|
# push @files, slurp_dir("$dir/$fname");
|
|
# } else
|
|
{
|
|
push @files, "$dir/$fname";
|
|
}
|
|
}
|
|
closedir ($dirhandle);
|
|
|
|
return @files;
|
|
}
|
|
|
|
if (-d $testlogdir) {
|
|
push @files, slurp_dir($testlogdir);
|
|
}
|
|
|
|
my $processed = 0;
|
|
my $passed = 0;
|
|
my @passedTests=();
|
|
my @skippedTests=();
|
|
my @failedTests=();
|
|
|
|
my $failureCmd="";
|
|
my $testfile = shift @ARGV;
|
|
my $testfilepath = "$testlogdir/$testfile";
|
|
$testfilepath =~ s/\.xls/\.log/;
|
|
print "$testfilepath\n";
|
|
for $a (@files) {
|
|
$filename = $a;
|
|
if ( "$testfilepath" eq "$filename" )
|
|
{
|
|
$processed++;
|
|
my $testcase = $a;
|
|
$testcase =~ s/\.log/\.xls/;
|
|
my $result = testLog( $a, $logdir );
|
|
if ( $result == 0 ) {
|
|
push @failedTests, basename($testcase);
|
|
if ( $failureCmd eq "" ) { $failureCmd = " diff -up $a $logdir "; }
|
|
}
|
|
elsif ( $result == 2 ) {
|
|
#print "skipped $a\n";
|
|
push @skippedTests, $testcase;
|
|
}
|
|
else {
|
|
$passed++;
|
|
push @passedTests, $testcase;
|
|
#print "Test document for $a \t \t passed. \n";
|
|
}
|
|
}
|
|
}
|
|
my $compared=@passedTests+@failedTests;
|
|
my $skip = @skippedTests;
|
|
print "skipped $skip test-cases(s)\n";
|
|
print "compared $compared test-case documents\n";
|
|
print "\t \t $passed tests $@passedTests\n";
|
|
if ( @failedTests > 0 ) {
|
|
print "the following test-case documents failed, please examine the logs manually\n";
|
|
|
|
for $a (@failedTests) {
|
|
print "\t$a\n";
|
|
}
|
|
print "e.g. $failureCmd\n"
|
|
}
|