|
From: <jgr...@us...> - 2003-08-28 15:27:20
|
Update of /cvsroot/popfile/engine/Devel
In directory sc8-pr-cvs1:/tmp/cvs-serv20847/Devel
Modified Files:
TestCoverage.pm
Log Message:
Add new PROFILE PLATFORM START directive to mark blocks of code as platform specific so that the profiler can ignore them
Index: TestCoverage.pm
===================================================================
RCS file: /cvsroot/popfile/engine/Devel/TestCoverage.pm,v
retrieving revision 1.12
retrieving revision 1.13
diff -C2 -d -r1.12 -r1.13
*** TestCoverage.pm 31 Jul 2003 16:32:21 -0000 1.12
--- TestCoverage.pm 28 Aug 2003 15:26:44 -0000 1.13
***************
*** 59,68 ****
{
# Print out information for each file
! for my $file (keys %count)
{
if ( ( $file =~ /^[^\/]/ ) && ( $file ne '../tests.pl' ) && !( $file =~ /^..\/\/Test\// ) ) {
my $current_line = 0;
my $block_executed = 0;
!
open SOURCE_FILE, "<$file";
my $clean = $file;
--- 59,69 ----
{
# Print out information for each file
!
! for my $file (keys %count)
{
if ( ( $file =~ /^[^\/]/ ) && ( $file ne '../tests.pl' ) && !( $file =~ /^..\/\/Test\// ) ) {
my $current_line = 0;
my $block_executed = 0;
!
open SOURCE_FILE, "<$file";
my $clean = $file;
***************
*** 75,86 ****
# %count hash for each file: total_lines, total_executable_lines
# and total_executed
while (<SOURCE_FILE>)
{
# Keep count of the total number of lines in this file
$current_line += 1;
!
# We do not count lines that are blank or exclusively
# comments or just have braces on them or
# just an else or just a subroutine definition
if ( ( ( /^\s*\#/ == 0 ) &&
( /^\s*$/ == 0 ) &&
--- 76,90 ----
# %count hash for each file: total_lines, total_executable_lines
# and total_executed
+
while (<SOURCE_FILE>)
{
# Keep count of the total number of lines in this file
+
$current_line += 1;
!
# We do not count lines that are blank or exclusively
# comments or just have braces on them or
# just an else or just a subroutine definition
+
if ( ( ( /^\s*\#/ == 0 ) &&
( /^\s*$/ == 0 ) &&
***************
*** 89,96 ****
( /^\s*package / == 0 ) ) || ( $block_executed ) ) {
$count{$file}{total_executable_lines} += 1;
!
# If this line was executed then keep count of
# that fact
!
if ( ( $count{$file}{$current_line} > 0 ) || ( $block_executed ) ) {
print LINE_DATA "1\n";
--- 93,104 ----
( /^\s*package / == 0 ) ) || ( $block_executed ) ) {
$count{$file}{total_executable_lines} += 1;
!
# If this line was executed then keep count of
# that fact
!
! if ( /\# PROFILE PLATFORM START ([^\r\n]+)/ ) {
! $block_executed = ( $1 ne $^O );
! }
!
if ( ( $count{$file}{$current_line} > 0 ) || ( $block_executed ) ) {
print LINE_DATA "1\n";
***************
*** 107,110 ****
--- 115,122 ----
$block_executed = 0;
}
+
+ if ( /\# PROFILE PLATFORM STOP/ ) {
+ $block_executed = 0;
+ }
} else {
print LINE_DATA "0\n";
***************
*** 114,118 ****
}
}
!
close SOURCE_FILE;
close LINE_DATA;
--- 126,130 ----
}
}
!
close SOURCE_FILE;
close LINE_DATA;
***************
*** 121,125 ****
if ( $block_executed ) {
! print "WARNING: unterminated PROFILE BLOCK detected; did you forget a PROFILE BLOCK STOP in $file?\n";
}
}
--- 133,137 ----
if ( $block_executed ) {
! print "WARNING: unterminated PROFILE BLOCK/PLATFORM detected; did you forget a PROFILE BLOCK/PLATFORM STOP in $file?\n";
}
}
|