Update of /cvsroot/popfile/engine
In directory sc8-pr-cvs1:/tmp/cvs-serv13729
Modified Files:
coverage.pl
Log Message:
update to handle forking tests
Index: coverage.pl
===================================================================
RCS file: /cvsroot/popfile/engine/coverage.pl,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** coverage.pl 13 Jul 2003 05:21:21 -0000 1.1
--- coverage.pl 15 Jul 2003 01:45:36 -0000 1.2
***************
*** 26,30 ****
# Each LNE has a file name of ModuleName.PID.lne and the ModuleName has had
! # / or :: converted to -
$file =~ /^(.+)\.pm\.(-?\d+)\.lne$/;
--- 26,30 ----
# Each LNE has a file name of ModuleName.PID.lne and the ModuleName has had
! # / or :: converted to #
$file =~ /^(.+)\.pm\.(-?\d+)\.lne$/;
***************
*** 37,42 ****
--- 37,48 ----
open SOURCE_FILE, "<../$module.pm";
open LINE_DATA, "<$file";
+ #$module = $file;
my $current_line = 0;
+ $count{$module}{executed} = [];
+
+
+ $count{$module}{total_executable_lines} = 0;
+ $count{$module}{total_lines} = 0;
while ( <SOURCE_FILE> ) {
***************
*** 50,59 ****
if ( $state =~ /1/ ) {
$count{$module}{total_executable_lines} += 1;
! $count{$module}{total_executed} += 1;
! } else {
! if ( $state =~ /0/ ) {
! $count{$module}{total_executable_lines} += 1;
! } else {
! }
}
}
--- 56,63 ----
if ( $state =~ /1/ ) {
$count{$module}{total_executable_lines} += 1;
! $count{$module}{executed}[$current_line] = 1;
! } elsif ( $state =~ /0/ ) {
! $count{$module}{total_executable_lines} += 1;
! } else {
}
}
***************
*** 62,74 ****
close SOURCE_FILE;
- $files{$module} = int(100 * $count{$module}{total_executed} / $count{$module}{total_executable_lines}) unless ( $count{$module}{total_executable_lines} == 0 );
-
unlink $file;
}
foreach my $file (sort {$files{$b} <=> $files{$a}} keys %files) {
my $clean = $file;
$clean =~ s/^\.\.\/\///;
!
print sprintf( "Coverage of %-32s %d%%\n", "$clean...", $files{$file});
}
--- 66,88 ----
close SOURCE_FILE;
unlink $file;
}
+ foreach my $module ( keys( %count ) )
+ {
+ my $total_executed = 0;
+ foreach my $line ( 0 .. $#{$count{$module}{executed}} ) {
+ $total_executed++ if ($count{$module}{executed}[$line]);
+ }
+
+ $files{$module} = int(100 * $total_executed / $count{$module}{total_executable_lines}) unless ( $count{$module}{total_executable_lines} == 0 );
+ }
+
+
foreach my $file (sort {$files{$b} <=> $files{$a}} keys %files) {
+
my $clean = $file;
$clean =~ s/^\.\.\/\///;
!
print sprintf( "Coverage of %-32s %d%%\n", "$clean...", $files{$file});
}
|