CTest: Fix GTM coverage handling of entry point named "%"

Removing the "%" character from the name of the routine in the line
parser causes CTest to be unable to find a routine entry point that is
only named "%".  Instead leave it during line parsing and handle routine
names ending in "%" explicitly when loading files.
This commit is contained in:
Joseph Snyder
2018-10-15 13:57:42 +00:00
committed by Brad King
parent 6c281138a5
commit f7d92deff4
5 changed files with 48 additions and 34 deletions

View File

@@ -1,5 +1,6 @@
#include "cmParseGTMCoverage.h" #include "cmParseGTMCoverage.h"
#include "cmAlgorithms.h"
#include "cmCTest.h" #include "cmCTest.h"
#include "cmCTestCoverageHandler.h" #include "cmCTestCoverageHandler.h"
#include "cmSystemTools.h" #include "cmSystemTools.h"
@@ -86,6 +87,10 @@ bool cmParseGTMCoverage::ReadMCovFile(const char* file)
} }
// Find the full path to the file // Find the full path to the file
bool found = this->FindMumpsFile(routine, filepath); bool found = this->FindMumpsFile(routine, filepath);
if (!found && cmHasLiteralSuffix(routine, "%")) {
routine.erase(0, 1);
found = this->FindMumpsFile(routine, filepath);
}
if (found) { if (found) {
int lineoffset = 0; int lineoffset = 0;
if (this->FindFunctionInMumpsFile(filepath, function, lineoffset)) { if (this->FindFunctionInMumpsFile(filepath, function, lineoffset)) {
@@ -192,8 +197,8 @@ bool cmParseGTMCoverage::ParseMCOVLine(std::string const& line,
done = true; done = true;
} }
} else { } else {
// all chars except ", (, and % get stored in the arg string // all chars except " and ( get stored in the arg string
if (cur != '\"' && cur != '(' && cur != '%') { if (cur != '\"' && cur != '(') {
arg.append(1, line[pos]); arg.append(1, line[pos]);
} }
} }

View File

@@ -2669,7 +2669,7 @@ ${CMake_BINARY_DIR}/bin/cmake -DDIR=dev -P ${CMake_SOURCE_DIR}/Utilities/Release
$<TARGET_FILE:ctest> -T Coverage --debug) $<TARGET_FILE:ctest> -T Coverage --debug)
set_tests_properties(CTestGTMCoverage PROPERTIES set_tests_properties(CTestGTMCoverage PROPERTIES
PASS_REGULAR_EXPRESSION PASS_REGULAR_EXPRESSION
"Process file.*ZZCOVTST.m.*Total LOC:.*30.*Percentage Coverage: 80.00*" "Process file.*ZZCOVTST.m.*Total LOC:.*32.*Percentage Coverage: 81.25*"
ENVIRONMENT COVFILE=) ENVIRONMENT COVFILE=)
configure_file( configure_file(
@@ -2687,7 +2687,7 @@ ${CMake_BINARY_DIR}/bin/cmake -DDIR=dev -P ${CMake_SOURCE_DIR}/Utilities/Release
$<TARGET_FILE:ctest> -T Coverage --debug) $<TARGET_FILE:ctest> -T Coverage --debug)
set_tests_properties(CTestCacheCoverage PROPERTIES set_tests_properties(CTestCacheCoverage PROPERTIES
PASS_REGULAR_EXPRESSION PASS_REGULAR_EXPRESSION
"Process file.*ZZCOVTST.m.*Total LOC:.*29.*Percentage Coverage: 86.21.*" "Process file.*ZZCOVTST.m.*Total LOC:.*32.*Percentage Coverage: 87.50.*"
ENVIRONMENT COVFILE=) ENVIRONMENT COVFILE=)
# Adding a test case for Python Coverage # Adding a test case for Python Coverage

View File

@@ -12,6 +12,9 @@ EN ; This entry point shouldn't be found without fixing
; This line not executable ; This line not executable
D T6^ZZCOVTST D T6^ZZCOVTST
; ;
% ; a line to test for a problem where % was dropped
N Do,Re,Mi
S Do="A#"
T1 ; This line should always be found T1 ; This line should always be found
N D N D
S D=2 S D=2

View File

@@ -13,33 +13,36 @@ ZZCOVTST,1,1,"ZZCOVTST;OSEHRA/JPS -- Test routine for Coverage Parsing;4/28/2014
,12,1," Q" ,12,1," Q"
,13,0," ; This line not executable" ,13,0," ; This line not executable"
,14,0," ;" ,14,0," ;"
,15,0,"T1 ; This line should always be found" ,15,1,"% ; a line to test for a problem where % was dropped"
,16,1," N D" ,16,1,"N Do,Re,Mi"
,17,1," S D=2" ,17,1,"S Do=""A#"""
,18,1," W !,D,!,""This is the second entry point"",!" ,18,0,"T1 ; This line should always be found"
,19,1," D T2^ZZCOVTST(D)" ,19,1," N D"
,20,1," Q" ,20,1," S D=2"
,21,0," ;" ,21,1," W !,D,!,""This is the second entry point"",!"
,22,0,"T2(EQ) ; This is debatable and only called with ENT^ROU notation" ,22,1," D T2^ZZCOVTST(D)"
,23,1," N D" ,23,1," Q"
,24,1," S D=3" ,24,0," ;"
,25,1," W !,D,!,EQ,""This is the third entry point"",!" ,25,0,"T2(EQ) ; This is debatable and only called with ENT^ROU notation"
,26,1," D T3^ZZCOVTST" ,26,1," N D"
,27,1," Q" ,27,1," S D=3"
,28,0," ;" ,28,1," W !,D,!,EQ,""This is the third entry point"",!"
,29,1,"T3 N D S D=4 W D,!,""Fourth Entry point"",! Q" ,29,1," D T3^ZZCOVTST"
,30,0," ;" ,30,1," Q"
,31,0,"T4 N D S D=5 W ""Shouldn't be executed""" ,31,0," ;"
,32,0," W ""Lots to not do""" ,32,1,"T3 N D S D=4 W D,!,""Fourth Entry point"",! Q"
,33,0," Q" ,33,0," ;"
,34,1,"T5(EQ) ;this entry point is called with a $$ notation" ,34,0,"T4 N D S D=5 W ""Shouldn't be executed"""
,35,1," W ""THIS IS THE $$ NOTATION!"",!" ,35,0," W ""Lots to not do"""
,36,1," Q 0" ,36,0," Q"
,37,0,"T6 ; An entry point to show comments inside of ""DO"" blocks" ,37,1,"T5(EQ) ;this entry point is called with a $$ notation"
,38,1," D" ,38,1," W ""THIS IS THE $$ NOTATION!"",!"
,39,1," . W ""This is executable code"",!" ,39,1," Q 0"
,40,0," . ; This is a comment inside the do block, not executable" ,40,0,"T6 ; An entry point to show comments inside of ""DO"" blocks"
,41,1," . S ZZBLAH=""blah""" ,41,1," D"
,42,1," W ""Ending T6"",!" ,42,1," . W ""This is executable code"",!"
,43,0," ;" ,43,0," . ; This is a comment inside the do block, not executable"
Totals for ZZCOVTST,,25, ,44,1," . S ZZBLAH=""blah"""
,45,1," W ""Ending T6"",!"
,46,0," ;"
Toals for ZZCOVTST,,28,

View File

@@ -9,6 +9,9 @@ GT.M 15-AUG-2014 10:14:32 ZWR
^ZZCOVERAGE("ZZCOVTST","EN",4)="1:0:0:0:74" ^ZZCOVERAGE("ZZCOVTST","EN",4)="1:0:0:0:74"
^ZZCOVERAGE("ZZCOVTST","EN",5)="1:0:0:0:66" ^ZZCOVERAGE("ZZCOVTST","EN",5)="1:0:0:0:66"
^ZZCOVERAGE("ZZCOVTST","EN",6)="1:0:0:0:40" ^ZZCOVERAGE("ZZCOVTST","EN",6)="1:0:0:0:40"
^ZZCOVERAGE("ZZCOVTST","%")="2:0:0:0:208"
^ZZCOVERAGE("ZZCOVTST","%",1)="2:0:0:0:208"
^ZZCOVERAGE("ZZCOVTST","%",2)="2:0:0:0:208"
^ZZCOVERAGE("ZZCOVTST","T1")="1:0:0:0:208" ^ZZCOVERAGE("ZZCOVTST","T1")="1:0:0:0:208"
^ZZCOVERAGE("ZZCOVTST","T1",1)="1:0:0:0:23" ^ZZCOVERAGE("ZZCOVTST","T1",1)="1:0:0:0:23"
^ZZCOVERAGE("ZZCOVTST","T1",2)="1:0:0:0:24" ^ZZCOVERAGE("ZZCOVTST","T1",2)="1:0:0:0:24"