diff options
author | allen <allen@17b73243-c579-4c4c-a9d2-2d5706c11dac> | 2002-04-30 17:48:25 +0000 |
---|---|---|
committer | allen <allen@17b73243-c579-4c4c-a9d2-2d5706c11dac> | 2002-04-30 17:48:25 +0000 |
commit | 576a8c2da33c9c37de9175a2061dfe7ca96e3612 (patch) | |
tree | 7217d17aaa7f4d04664de9ffeb17a13c62364797 /lib/sbin/RunTestUtils.pl | |
parent | 6991944323391c5389f3ba63863f575f6bda8c67 (diff) |
Check for empty files in both test and archive and do the appropriate
thing
Check for divide by zeros even in the cases where you think they could
never ever happen and ask how you could ever get this.
git-svn-id: http://svn.cactuscode.org/flesh/trunk@2776 17b73243-c579-4c4c-a9d2-2d5706c11dac
Diffstat (limited to 'lib/sbin/RunTestUtils.pl')
-rw-r--r-- | lib/sbin/RunTestUtils.pl | 39 |
1 files changed, 33 insertions, 6 deletions
diff --git a/lib/sbin/RunTestUtils.pl b/lib/sbin/RunTestUtils.pl index 6f4d9823..7eec7e0c 100644 --- a/lib/sbin/RunTestUtils.pl +++ b/lib/sbin/RunTestUtils.pl @@ -389,11 +389,11 @@ sub RunCactus $retcode = $1 + 0; } } - print STDOUT "\n\n" if ($output =~ /stdout/); - close LOG; close CMD; $retcode = $? >> 8 if($retcode==0); + + print STDOUT "\n\n" if ($output =~ /stdout/); return $retcode; } @@ -810,7 +810,7 @@ sub CompareTestFiles $newfile = "$test_dir$sep$file"; $oldfile = "$testdata->{\"$inthorn TESTSDIR\"}${sep}${test}${sep}$file"; - if ( -e $newfile) + if ( -e $newfile && -s $newfile && -s $oldfile) { open (INORIG, "<$oldfile") || print "Warning: Archive file $oldfile not found"; open (INNEW, "<$newfile") || print "Warning: Test file $newfile not found"; @@ -930,19 +930,46 @@ sub CompareTestFiles } #while } - else + elsif (-e $newfile && -z $oldfile && -s $newfile) + { + print " $file in archive but not in test\n"; + $rundata->{"$inthorn $test NFAILWEAK"}++; + $rundata->{"$inthorn $test NFAILSTRONG"}++; + } + elsif (-e $newfile && -s $oldfile && -z $newfile) + { + print " $file is empty\n"; + $rundata->{"$inthorn $test NFAILWEAK"}++; + $rundata->{"$inthorn $test NFAILSTRONG"}++; + } + elsif (-e $newfile && -z $oldfile && -z $newfile) + { + print " $file empty in both test and archive\n"; + } + elsif (-e $newfile && -s $oldfile && -s $newfile) { - print " $newfile not there for comparison\n"; + print " $file not created for comparison\n"; $rundata->{"$inthorn $test NFAILWEAK"}++; $rundata->{"$inthorn $test NFAILSTRONG"}++; } + else + { + print " TESTSUITE ERROR: $newfile not compared\n"; + } for ($count = 0; $count < $nold; $count++) { if ($maxdiff[$count]) { $rundata->{"$inthorn $test $file MAXABSDIFF $count"} = $maxdiff[$count]; - $rundata->{"$inthorn $test $file MAXRELDIFF $count"} = $maxdiff[$count]/$valmax[$count]; + if ($valmax[$count] > 0) + { + $rundata->{"$inthorn $test $file MAXRELDIFF $count"} = $maxdiff[$count]/$valmax[$count]; + } + else + { + print "ERROR: How did I get here, maximum difference is $maxdiff[$count] and maximum value if $valmax[$count]\n"; + } } else { |