2 use File
::Temp qw
/ tempfile tempdir /;
7 my $binDir = dirname
($0);
8 my $timestampclean= "perl $binDir/timestampsClean.pl";
13 # 2 No Log to compare against
18 my $dirtocheck = shift;
19 my $filename = basename
($testfile);
20 $filename = "$logdir/$filename";
21 print "processing $testfile $filename\n";
24 $dir = tempdir
( CLEANUP
=> 1 );
25 ($fh, $tmpFile) = tempfile
( DIR
=> $dir );
28 my $status = system("diff -U 0 -p $testfile $filename | $timestampclean > $tmpFile");
29 my $info = stat($tmpFile) or die "no $tmpFile: $!";
30 if ( ($status >>=8) == 0 && ( $info->size == 0) ) {
31 #print "diff worked size is 0\n";
34 elsif ( ($status >>=8) == 0 && ( $info->size > 0) )
36 #print "diff worked size > 0\n";
41 #print "diff failed size > 0\n";
47 #print "not file > 0\n";
50 #print "diff result = $result\n";
54 if ( ! ( $logdir = shift @ARGV ) ) {
55 print STDERR
"No logdir specified!\n";
60 if ( ! ( $testlogdir = shift @ARGV ) ) {
61 print STDERR
"No testdocuments dir to compare against specified!\n";
66 if ( !(-d
$logdir ) ) {
67 print STDERR
"No output directory $logdir exists, please create it!!!!\n";
70 if ( !(-d
$testlogdir ) ) {
71 print STDERR
"the directory containing the logfiles to compare against \"$logdir\" does not exist\n";
75 print "logdir $logdir\n";
76 print "testlogdir $testlogdir\n";
82 $a =~ /\#$/ && return;
83 $a =~ /\.orig$/ && return;
84 $a =~ /unxlng.*\.pro$/ && return;
85 $a =~ /wntmsc.*\.pro$/ && return;
86 $a =~ /.swp$/ && return;
87 $a =~ /POSITION/ && return;
88 $a =~ /ReadMe/ && return;
89 $a =~ /.tmp$/ && return;
90 $a =~ /\.svn/ && return;
91 $a eq 'CVS' && return;
102 my ($dirhandle, $fname);
105 opendir ($dirhandle, $dir) || die "Can't open $dir";
106 while ($fname = readdir ($dirhandle)) {
107 $fname = filter_crud
($fname);
108 defined $fname || next;
109 # if (-d "$dir/$fname") {
110 # push @files, slurp_dir("$dir/$fname");
113 push @files, "$dir/$fname";
116 closedir ($dirhandle);
121 if (-d
$testlogdir) {
122 push @files, slurp_dir
($testlogdir);
132 my $testfile = shift @ARGV;
133 my $testfilepath = "$testlogdir/$testfile";
134 $testfilepath =~ s/\.xls/\.log/;
135 print "$testfilepath\n";
138 if ( "$testfilepath" eq "$filename" )
142 $testcase =~ s/\.log/\.xls/;
143 my $result = testLog
( $a, $logdir );
144 if ( $result == 0 ) {
145 push @failedTests, basename
($testcase);
146 if ( $failureCmd eq "" ) { $failureCmd = " diff -up $a $logdir "; }
148 elsif ( $result == 2 ) {
149 #print "skipped $a\n";
150 push @skippedTests, $testcase;
154 push @passedTests, $testcase;
155 #print "Test document for $a \t \t passed. \n";
159 my $compared=@passedTests+@failedTests;
160 my $skip = @skippedTests;
161 print "skipped $skip test-cases(s)\n";
162 print "compared $compared test-case documents\n";
163 print "\t \t $passed tests $@passedTests\n";
164 if ( @failedTests > 0 ) {
165 print "the following test-case documents failed, please examine the logs manually\n";
167 for $a (@failedTests) {
170 print "e.g. $failureCmd\n"