Update of /cvsroot/popfile/engine
In directory sc8-pr-cvs1:/tmp/cvs-serv22820
Modified Files:
coverage.pl
Log Message:
Simplify coverage calculator and make it work correctly when fork occurs
Index: coverage.pl
===================================================================
RCS file: /cvsroot/popfile/engine/coverage.pl,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** coverage.pl 21 Jul 2003 19:03:51 -0000 1.3
--- coverage.pl 21 Jul 2003 19:53:36 -0000 1.4
***************
*** 23,27 ****
my @line_files = glob '*.lne';
! foreach my $file (@line_files) {
# Each LNE has a file name of ModuleName.PID.lne and the ModuleName has had
--- 23,27 ----
my @line_files = glob '*.lne';
! foreach my $file (sort @line_files) {
# Each LNE has a file name of ModuleName.PID.lne and the ModuleName has had
***************
*** 39,62 ****
my $current_line = 0;
- $count{$module}{executed} = [];
-
-
- $count{$module}{total_executable_lines} = 0;
- $count{$module}{total_lines} = 0;
while ( <SOURCE_FILE> ) {
! # Keep count of the total number of lines in this file
!
! $current_line += 1;
! $count{$module}{total_lines} += 1;
my $state = <LINE_DATA>;
if ( $state =~ /1/ ) {
! $count{$module}{total_executable_lines} += 1;
! $count{$module}{executed}[$current_line] = 1;
} elsif ( $state =~ /0/ ) {
! $count{$module}{total_executable_lines} += 1;
! # print "$module.pm:$current_line $_";
}
}
--- 39,54 ----
my $current_line = 0;
while ( <SOURCE_FILE> ) {
! $current_line += 1;
my $state = <LINE_DATA>;
if ( $state =~ /1/ ) {
! $count{$module}{executed}{$current_line} = 1;
} elsif ( $state =~ /0/ ) {
! if ( $count{$module}{executed}{$current_line} != 1 ) {
! $count{$module}{executed}{$current_line} = 0;
! }
}
}
***************
*** 70,81 ****
foreach my $module ( keys( %count ) )
{
! my $total_executed = 0;
! foreach my $line ( 0 .. $#{$count{$module}{executed}} ) {
! if ($count{$module}{executed}[$line]) {
$total_executed += 1;
! }
}
! $files{$module} = int(100 * $total_executed / $count{$module}{total_executable_lines}) unless ( $count{$module}{total_executable_lines} == 0 );
}
--- 62,77 ----
foreach my $module ( keys( %count ) )
{
! my $total_executed = 0;
! my $total_not_executed = 0;
!
! foreach my $line ( keys %{$count{$module}{executed}} ) {
! if ($count{$module}{executed}{$line} == 1) {
$total_executed += 1;
! } else {
! $total_not_executed += 1;
! }
}
! $files{$module} = int(100 * $total_executed / ( $total_executed + $total_not_executed ));
}
|