From 6d66e396a1b534e7f13a8e4be83820c5a06d0265 Mon Sep 17 00:00:00 2001 From: Joseph Snyder Date: Fri, 15 Aug 2014 10:50:36 -0400 Subject: CTEST: Fix MUMPS file parser and update test The current file parser for a MUMPS routine uses a period "." as the one of the signals that a line of MUMPS code is executable. This is not a correct assumption. Add the period to the list of characters that CTest will not consider the start of a line of code. Update the test routine to have an entry point with code to match the scenario mentioned above. --- Source/CTest/cmParseMumpsCoverage.cxx | 8 ++- Tests/CMakeLists.txt | 4 +- .../VistA-FOIA/Packages/Uncategorized/ZZCOVTST.m | 7 +++ Tests/MumpsCoverage/ZZCOVTST.cmcov | 65 ++++++++++++---------- Tests/MumpsCoverage/ZZCOVTST.mcov | 62 ++++++++++++--------- 5 files changed, 85 insertions(+), 61 deletions(-) diff --git a/Source/CTest/cmParseMumpsCoverage.cxx b/Source/CTest/cmParseMumpsCoverage.cxx index 6236211..225e704 100644 --- a/Source/CTest/cmParseMumpsCoverage.cxx +++ b/Source/CTest/cmParseMumpsCoverage.cxx @@ -96,11 +96,13 @@ void cmParseMumpsCoverage::InitializeMumpsFile(std::string& file) } if(found) { - // (2) If the first character found above is whitespace then continue the - // search for the first following non-whitespace character. + // (2) If the first character found above is whitespace or a period + // then continue the search for the first following non-whitespace + // character. if(line[i] == ' ' || line[i] == '\t') { - while(i < line.size() && (line[i] == ' ' || line[i] == '\t')) + while(i < line.size() && (line[i] == ' ' || line[i] == '\t' + || line[i] == '.')) { i++; } diff --git a/Tests/CMakeLists.txt b/Tests/CMakeLists.txt index ca7fcdc..89debc5 100644 --- a/Tests/CMakeLists.txt +++ b/Tests/CMakeLists.txt @@ -2160,7 +2160,7 @@ ${CMake_BINARY_DIR}/bin/cmake -DDIR=dev -P ${CMake_SOURCE_DIR}/Utilities/Release $ -T Coverage --debug) set_tests_properties(CTestGTMCoverage PROPERTIES PASS_REGULAR_EXPRESSION - "Process file.*ZZCOVTST.m.*Total LOC:.*23.*Percentage Coverage: 82.61*" + "Process file.*ZZCOVTST.m.*Total LOC:.*30.*Percentage Coverage: 80.00*" ENVIRONMENT COVFILE=) configure_file( @@ -2178,7 +2178,7 @@ ${CMake_BINARY_DIR}/bin/cmake -DDIR=dev -P ${CMake_SOURCE_DIR}/Utilities/Release $ -T Coverage --debug) set_tests_properties(CTestCacheCoverage PROPERTIES PASS_REGULAR_EXPRESSION - "Process file.*ZZCOVTST.m.*Total LOC:.*22.*Percentage Coverage: 86.36.*" + "Process file.*ZZCOVTST.m.*Total LOC:.*29.*Percentage Coverage: 86.21.*" ENVIRONMENT COVFILE=) # Adding a test case for Python Coverage diff --git a/Tests/MumpsCoverage/VistA-FOIA/Packages/Uncategorized/ZZCOVTST.m b/Tests/MumpsCoverage/VistA-FOIA/Packages/Uncategorized/ZZCOVTST.m index 9a08edf..ee70682 100644 --- a/Tests/MumpsCoverage/VistA-FOIA/Packages/Uncategorized/ZZCOVTST.m +++ b/Tests/MumpsCoverage/VistA-FOIA/Packages/Uncategorized/ZZCOVTST.m @@ -10,6 +10,7 @@ EN ; This entry point shouldn't be found without fixing I '$$T5 W "RETURNED FROM t5",! Q ; This line not executable + D T6^ZZCOVTST ; T1 ; This line should always be found N D @@ -33,4 +34,10 @@ T4 N D S D=5 W "Shouldn't be executed" T5(EQ) ;this entry point is called with a $$ notation W "THIS IS THE $$ NOTATION!",! Q 0 +T6 ; An entry point to show comments inside of "DO" blocks + D + . W "This is executable code",! + . ;This is a comment inside the do block, not executable + . S ZZBLAH="blah" + W "Ending T6",! ; diff --git a/Tests/MumpsCoverage/ZZCOVTST.cmcov b/Tests/MumpsCoverage/ZZCOVTST.cmcov index 798e5b2..7a5df61 100644 --- a/Tests/MumpsCoverage/ZZCOVTST.cmcov +++ b/Tests/MumpsCoverage/ZZCOVTST.cmcov @@ -1,5 +1,5 @@ Routine,Line,RtnLine,Code -ZZCOVTST,1,0,"ZZCOVTST;OSEHRA/JPS -- Test routine for Coverage Parsing;4/28/2014" +ZZCOVTST,1,1,"ZZCOVTST;OSEHRA/JPS -- Test routine for Coverage Parsing;4/28/2014" ,2,0," ; (tab) This is series of comments" ,3,0," ; (tab) it should all be not executable" ,4,0," ; (spaces) one of these sets might be a problem" @@ -8,31 +8,38 @@ ZZCOVTST,1,0,"ZZCOVTST;OSEHRA/JPS -- Test routine for Coverage Parsing;4/28/2014 ,7,1," N D" ,8,1," S D=1 ;An executable line" ,9,1," D T1^ZZCOVTST" -,10,1,"I '$$T5 W ""RETURNED FROM t5"",!" -,11,1," Q" -,12,0," ; This line not executable" -,13,0," ;" -,14,0,"T1 ; This line should always be found" -,15,1," N D" -,16,1," S D=2" -,17,1," W !,D,!,""This is the second entry point"",!" -,18,1," D T2^ZZCOVTST(D)" -,19,1," Q" -,20,0," ;" -,21,0,"T2(EQ) ; This is debatable" -,22,1," N D" -,23,1," S D=3" -,24,1," W !,D,!,EQ,""This is the third entry point"",!" -,25,1," D T3^ZZCOVTST" -,26,1," Q" -,27,0," ;" -,28,1,"T3 N D S D=4 W D,!,""Fourth Entry point"",! Q" -,29,0," ;" -,30,0,"T4 N D S D=5 W ""Shouldn't be executed""" -,31,0," W ""Lots to not do""" -,32,0," Q" -,33,1,"T5()" -,34,1," W ""THIS IS ONE WITH $$ NOTATION"",1" -,35,1," Q 0" -,36,0," ;" -Totals for ZZCOVTST,,19, +,10,1," I '$$T5 W ""RETURNED FROM t5"",!" +,11,1," D T6^ZZCOVTST" +,12,1," Q" +,13,0," ; This line not executable" +,14,0," ;" +,15,0,"T1 ; This line should always be found" +,16,1," N D" +,17,1," S D=2" +,18,1," W !,D,!,""This is the second entry point"",!" +,19,1," D T2^ZZCOVTST(D)" +,20,1," Q" +,21,0," ;" +,22,0,"T2(EQ) ; This is debatable and only called with ENT^ROU notation" +,23,1," N D" +,24,1," S D=3" +,25,1," W !,D,!,EQ,""This is the third entry point"",!" +,26,1," D T3^ZZCOVTST" +,27,1," Q" +,28,0," ;" +,29,1,"T3 N D S D=4 W D,!,""Fourth Entry point"",! Q" +,30,0," ;" +,31,0,"T4 N D S D=5 W ""Shouldn't be executed""" +,32,0," W ""Lots to not do""" +,33,0," Q" +,34,1,"T5(EQ) ;this entry point is called with a $$ notation" +,35,1," W ""THIS IS THE $$ NOTATION!"",!" +,36,1," Q 0" +,37,0,"T6 ; An entry point to show comments inside of ""DO"" blocks" +,38,1," D" +,39,1," . W ""This is executable code"",!" +,40,0," . ; This is a comment inside the do block, not executable" +,41,1," . S ZZBLAH=""blah""" +,42,1," W ""Ending T6"",!" +,43,0," ;" +Totals for ZZCOVTST,,25, \ No newline at end of file diff --git a/Tests/MumpsCoverage/ZZCOVTST.mcov b/Tests/MumpsCoverage/ZZCOVTST.mcov index f73d354..b2608d9 100644 --- a/Tests/MumpsCoverage/ZZCOVTST.mcov +++ b/Tests/MumpsCoverage/ZZCOVTST.mcov @@ -1,30 +1,38 @@ %GO Global Output Utility -GT.M 30-APR-2014 14:24:46 ZWR -^ZZCOVERAGE("*CHILDREN")="0:0:0" -^ZZCOVERAGE("*RUN")="24000:88000:112000" -^ZZCOVERAGE("ZZCOVTST","EN")="1:4000:8000:12000:6464583" -^ZZCOVERAGE("ZZCOVTST","EN",1)="1:0:0:0:20" -^ZZCOVERAGE("ZZCOVTST","EN",2)="1:0:0:0:14" -^ZZCOVERAGE("ZZCOVTST","EN",3)="1:0:0:0:26" -^ZZCOVERAGE("ZZCOVTST","EN",4)="1:0:0:0:228" -^ZZCOVERAGE("ZZCOVTST","T1")="1:0:0:0:92" -^ZZCOVERAGE("ZZCOVTST","T1",1)="1:0:0:0:13" -^ZZCOVERAGE("ZZCOVTST","T1",2)="1:0:0:0:12" -^ZZCOVERAGE("ZZCOVTST","T1",3)="1:0:0:0:14" -^ZZCOVERAGE("ZZCOVTST","T1",4)="1:0:0:0:29" -^ZZCOVERAGE("ZZCOVTST","T1",5)="1:0:0:0:12" -^ZZCOVERAGE("ZZCOVTST","T2")="1:0:0:0:102" -^ZZCOVERAGE("ZZCOVTST","T2",0)="1:0:0:0:14" -^ZZCOVERAGE("ZZCOVTST","T2",1)="1:0:0:0:12" -^ZZCOVERAGE("ZZCOVTST","T2",2)="1:0:0:0:12" -^ZZCOVERAGE("ZZCOVTST","T2",3)="1:0:0:0:14" -^ZZCOVERAGE("ZZCOVTST","T2",4)="1:0:0:0:25" -^ZZCOVERAGE("ZZCOVTST","T2",5)="1:0:0:0:12" -^ZZCOVERAGE("ZZCOVTST","T3")="1:0:0:0:28" -^ZZCOVERAGE("ZZCOVTST","T3",0)="1:0:0:0:17" -^ZZCOVERAGE("ZZCOVTST","T5")="1:0:0:0:388" -^ZZCOVERAGE("ZZCOVTST","T5",0)="1:0:0:0:114" -^ZZCOVERAGE("ZZCOVTST","T5",1)="1:0:0:0:28" -^ZZCOVERAGE("ZZCOVTST","T5",2)="1:0:0:0:14" +GT.M 15-AUG-2014 10:14:32 ZWR +^ZZCOVERAGE("*CHILDREN")="212000:68000:280000" +^ZZCOVERAGE("*RUN")="56000:136000:192000" +^ZZCOVERAGE("ZZCOVTST","EN")="1:4000:4000:8000:8627798" +^ZZCOVERAGE("ZZCOVTST","EN",1)="1:0:0:0:27" +^ZZCOVERAGE("ZZCOVTST","EN",2)="1:0:0:0:23" +^ZZCOVERAGE("ZZCOVTST","EN",3)="1:0:0:0:70" +^ZZCOVERAGE("ZZCOVTST","EN",4)="1:0:0:0:74" +^ZZCOVERAGE("ZZCOVTST","EN",5)="1:0:0:0:66" +^ZZCOVERAGE("ZZCOVTST","EN",6)="1:0:0:0:40" +^ZZCOVERAGE("ZZCOVTST","T1")="1:0:0:0:208" +^ZZCOVERAGE("ZZCOVTST","T1",1)="1:0:0:0:23" +^ZZCOVERAGE("ZZCOVTST","T1",2)="1:0:0:0:24" +^ZZCOVERAGE("ZZCOVTST","T1",3)="1:0:0:0:26" +^ZZCOVERAGE("ZZCOVTST","T1",4)="1:0:0:0:73" +^ZZCOVERAGE("ZZCOVTST","T1",5)="1:0:0:0:40" +^ZZCOVERAGE("ZZCOVTST","T2")="1:0:0:0:1783" +^ZZCOVERAGE("ZZCOVTST","T2",0)="1:0:0:0:25" +^ZZCOVERAGE("ZZCOVTST","T2",1)="1:0:0:0:524" +^ZZCOVERAGE("ZZCOVTST","T2",2)="1:0:0:0:40" +^ZZCOVERAGE("ZZCOVTST","T2",3)="1:0:0:0:95" +^ZZCOVERAGE("ZZCOVTST","T2",4)="1:0:0:0:607" +^ZZCOVERAGE("ZZCOVTST","T2",5)="1:0:0:0:470" +^ZZCOVERAGE("ZZCOVTST","T3")="1:0:0:0:254" +^ZZCOVERAGE("ZZCOVTST","T3",0)="1:0:0:0:76" +^ZZCOVERAGE("ZZCOVTST","T5")="1:0:0:0:153" +^ZZCOVERAGE("ZZCOVTST","T5",0)="1:0:0:0:40" +^ZZCOVERAGE("ZZCOVTST","T5",1)="1:0:0:0:41" +^ZZCOVERAGE("ZZCOVTST","T5",2)="1:0:0:0:41" +^ZZCOVERAGE("ZZCOVTST","T6")="1:0:0:0:227" +^ZZCOVERAGE("ZZCOVTST","T6",1)="1:0:0:0:41" +^ZZCOVERAGE("ZZCOVTST","T6",2)="1:0:0:0:42" +^ZZCOVERAGE("ZZCOVTST","T6",4)="1:0:0:0:41" +^ZZCOVERAGE("ZZCOVTST","T6",5)="1:0:0:0:34" +^ZZCOVERAGE("ZZCOVTST","T6",6)="1:0:0:0:38" -- cgit v0.12