Add test for mumps coverage. Also refactor code to prepare for cache coverage.

Add a simple test to make sure the GTM mumps coverage is working.
Also refactor the code so that cache coverage can be added.
This commit is contained in:
Bill Hoffman 2012-05-01 13:35:07 -04:00
parent 72210c2662
commit 319eeb0247
12 changed files with 1930 additions and 230 deletions

View File

@ -423,6 +423,7 @@ SET(CTEST_SRCS cmCTest.cxx
CTest/cmCTestConfigureHandler.cxx
CTest/cmCTestCoverageCommand.cxx
CTest/cmCTestCoverageHandler.cxx
CTest/cmParseMumpsCoverage.cxx
CTest/cmParseGTMCoverage.cxx
CTest/cmParsePHPCoverage.cxx
CTest/cmCTestEmptyBinaryDirectoryCommand.cxx

View File

@ -769,7 +769,13 @@ int cmCTestCoverageHandler::HandleGTMCoverage(
"/gtm_coverage.mcov";
if(cmSystemTools::FileExists(coverageFile.c_str()))
{
cov.ReadGTMCoverage(coverageFile.c_str());
cov.ReadCoverageFile(coverageFile.c_str());
}
else
{
cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT,
" Cannot find GTM coverage file: " << coverageFile
<< std::endl);
}
return static_cast<int>(cont->TotalCoverage.size());
}

View File

@ -8,120 +8,11 @@
cmParseGTMCoverage::cmParseGTMCoverage(cmCTestCoverageHandlerContainer& cont,
cmCTest* ctest)
:Coverage(cont), CTest(ctest)
cmCTest* ctest)
:cmParseMumpsCoverage(cont, ctest)
{
}
bool cmParseGTMCoverage::ReadGTMCoverage(const char* file)
{
// Read the gtm_coverage.mcov file, that has two lines of data:
// packages:/full/path/to/Vista/Packages
// coverage_dir:/full/path/to/dir/with/*.mcov
std::ifstream in(file);
if(!in)
{
return false;
}
std::string line;
cmSystemTools::GetLineFromStream(in, line);
std::string::size_type pos = line.find(':', 0);
std::string packages;
if(pos != std::string::npos)
{
packages = line.substr(pos+1);
}
cmSystemTools::GetLineFromStream(in, line);
pos = line.find(':', 0);
std::string coverage_dir;
if(pos != std::string::npos)
{
coverage_dir = line.substr(pos+1);
}
// load the mumps files from the packages directory
this->LoadPackages(packages.c_str());
// now load the *.mcov files from the coverage directory
this->LoadCoverageData(coverage_dir.c_str());
return true;
}
void cmParseGTMCoverage::InitializeFile(std::string& file)
{
// initialize the coverage information for a given mumps file
std::ifstream in(file.c_str());
if(!in)
{
return;
}
std::string line;
cmCTestCoverageHandlerContainer::SingleFileCoverageVector&
coverageVector = this->Coverage.TotalCoverage[file];
if(!cmSystemTools::GetLineFromStream(in, line))
{
return;
}
// first line of a .m file can never be run
coverageVector.push_back(-1);
while( cmSystemTools::GetLineFromStream(in, line) )
{
// putting in a 0 for a line means it is executable code
// putting in a -1 for a line means it is not executable code
int val = -1; // assume line is not executable
bool found = false;
std::string::size_type i = 0;
// (1) Search for the first whitespace or semicolon character on a line.
//This will skip over labels if the line starts with one, or will simply
//be the first character on the line for non-label lines.
for(; i < line.size(); ++i)
{
if(line[i] == ' ' || line[i] == '\t' || line[i] == ';')
{
found = true;
break;
}
}
if(found)
{
// (2) If the first character found above is whitespace 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'))
{
i++;
}
}
// (3) If the character found is not a semicolon then the line counts for
// coverage.
if(i < line.size() && line[i] != ';')
{
val = 0;
}
}
coverageVector.push_back(val);
}
}
bool cmParseGTMCoverage::LoadPackages(const char* d)
{
cmsys::Glob glob;
glob.RecurseOn();
std::string pat = d;
pat += "/*.m";
glob.FindFiles(pat.c_str());
std::vector<std::string>& files = glob.GetFiles();
std::vector<std::string>::iterator fileIt;
for ( fileIt = files.begin(); fileIt != files.end();
++ fileIt )
{
std::string name = cmSystemTools::GetFilenameName(*fileIt);
this->RoutineToDirectory[name.substr(0, name.size()-2)] = *fileIt;
// initialze each file, this is left out until CDash is fixed
// to handle large numbers of files
// this->InitializeFile(*fileIt);
}
return true;
}
bool cmParseGTMCoverage::LoadCoverageData(const char* d)
{
@ -155,9 +46,114 @@ bool cmParseGTMCoverage::LoadCoverageData(const char* d)
return true;
}
bool cmParseGTMCoverage::ParseFile(std::string& filepath,
std::string& function,
int& lineoffset)
bool cmParseGTMCoverage::ReadMCovFile(const char* file)
{
std::ifstream in(file);
if(!in)
{
return false;
}
std::string line;
std::string lastfunction;
std::string lastroutine;
std::string lastpath;
int lastoffset = 0;
while( cmSystemTools::GetLineFromStream(in, line))
{
// only look at lines that have coverage data
if(line.find("^COVERAGE") == line.npos)
{
continue;
}
std::string filepath;
std::string function;
std::string routine;
int linenumber = 0;
int count = 0;
this->ParseMCOVLine(line, routine, function, linenumber, count);
// skip this one
if(routine == "RSEL")
{
continue;
}
// no need to search the file if we just did it
if(function == lastfunction && lastroutine == routine)
{
if(lastpath.size())
{
this->Coverage.TotalCoverage[lastpath][lastoffset + linenumber]
+= count;
}
else
{
cmCTestLog(this->CTest, ERROR_MESSAGE,
"Can not find mumps file : "
<< lastroutine << " referenced in this line of mcov data:\n"
"[" << line << "]\n");
}
continue;
}
// Find the full path to the file
std::map<cmStdString, cmStdString>::iterator i =
this->RoutineToDirectory.find(routine);
bool found = false;
if(i != this->RoutineToDirectory.end())
{
filepath = i->second;
found = true;
}
else
{
// try some alternate names
const char* tryname[] = {"GUX", "GTM", "ONT", 0};
for(int k=0; tryname[k] != 0; k++)
{
std::string routine2 = routine + tryname[k];
i = this->RoutineToDirectory.find(routine2);
if(i != this->RoutineToDirectory.end())
{
found = true;
filepath = i->second;
break; // break out of tryname loop if found
}
}
}
if(found)
{
int lineoffset;
if(this->FindFunctionInMumpsFile(filepath,
function,
lineoffset))
{
// hack, this should be done on every file, but for now
// just do it on the ones that have coverage at all
if( this->Coverage.TotalCoverage[filepath].size() == 0)
{
this->InitializeMumpsFile(filepath);
}
cmCTestCoverageHandlerContainer::SingleFileCoverageVector&
coverageVector = this->Coverage.TotalCoverage[filepath];
coverageVector[lineoffset + linenumber] += count;
}
lastoffset = lineoffset;
}
else
{
cmCTestLog(this->CTest, ERROR_MESSAGE,
"Can not find mumps file : "
<< routine << " referenced in this line of mcov data:\n"
"[" << line << "]\n");
}
lastfunction = function;
lastroutine = routine;
lastpath = filepath;
}
return true;
}
bool cmParseGTMCoverage::FindFunctionInMumpsFile(std::string const& filepath,
std::string const& function,
int& lineoffset)
{
std::ifstream in(filepath.c_str());
if(!in)
@ -197,11 +193,11 @@ bool cmParseGTMCoverage::ParseFile(std::string& filepath,
return false;
}
bool cmParseGTMCoverage::ParseLine(std::string const& line,
std::string& routine,
std::string& function,
int& linenumber,
int& count)
bool cmParseGTMCoverage::ParseMCOVLine(std::string const& line,
std::string& routine,
std::string& function,
int& linenumber,
int& count)
{
// this method parses lines from the .mcov file
// each line has ^COVERAGE(...) in it, and there
@ -302,97 +298,3 @@ bool cmParseGTMCoverage::ParseLine(std::string const& line,
}
return true;
}
bool cmParseGTMCoverage::ReadMCovFile(const char* file)
{
std::ifstream in(file);
if(!in)
{
return false;
}
std::string line;
std::string lastfunction;
std::string lastroutine;
std::string lastpath;
int lastoffset = 0;
while( cmSystemTools::GetLineFromStream(in, line))
{
// only look at lines that have coverage data
if(line.find("^COVERAGE") == line.npos)
{
continue;
}
std::string filepath;
std::string function;
std::string routine;
int linenumber = 0;
int count = 0;
this->ParseLine(line, routine, function, linenumber, count);
// skip this one
if(routine == "RSEL")
{
continue;
}
// no need to search the file if we just did it
if(function == lastfunction && lastroutine == routine)
{
this->Coverage.TotalCoverage[lastpath][lastoffset + linenumber] += count;
continue;
}
// Find the full path to the file
std::map<cmStdString, cmStdString>::iterator i =
this->RoutineToDirectory.find(routine);
bool found = false;
if(i != this->RoutineToDirectory.end())
{
filepath = i->second;
found = true;
}
else
{
// try some alternate names
const char* tryname[] = {"GUX", "GTM", "ONT", 0};
for(int k=0; tryname[k] != 0; k++)
{
std::string routine2 = routine + tryname[k];
i = this->RoutineToDirectory.find(routine2);
if(i != this->RoutineToDirectory.end())
{
found = true;
filepath = i->second;
break; // break out of tryname loop if found
}
}
}
if(found)
{
int lineoffset;
if(this->ParseFile(filepath,
function,
lineoffset))
{
// hack, this should be done on every file, but for now
// just do it on the ones that have coverage at all
if( this->Coverage.TotalCoverage[filepath].size() == 0)
{
this->InitializeFile(filepath);
}
cmCTestCoverageHandlerContainer::SingleFileCoverageVector&
coverageVector = this->Coverage.TotalCoverage[filepath];
coverageVector[lineoffset + linenumber] += count;
}
lastoffset = lineoffset;
}
else
{
cmCTestLog(this->CTest, ERROR_MESSAGE,
"Can not find mumps file : "
<< routine << " referenced in this line of mcov data:\n"
"[" << line << "]\n");
}
lastfunction = function;
lastroutine = routine;
lastpath = filepath;
}
return true;
}

View File

@ -13,8 +13,7 @@
#ifndef cmParseGTMCoverage_h
#define cmParseGTMCoverage_h
#include "cmStandardIncludes.h"
#include "cmCTestCoverageHandler.h"
#include "cmParseMumpsCoverage.h"
/** \class cmParseGTMCoverage
* \brief Parse GTM coverage information
@ -22,28 +21,28 @@
* This class is used to parse GTM coverage information for
* mumps.
*/
class cmParseGTMCoverage
class cmParseGTMCoverage : public cmParseMumpsCoverage
{
public:
cmParseGTMCoverage(cmCTestCoverageHandlerContainer& cont,
cmCTest* ctest);
bool ReadGTMCoverage(const char* file);
private:
bool ParseFile(std::string& filepath,
std::string& function,
int& lineoffset);
bool ParseLine(std::string const& line,
protected:
// implement virtual from parent
bool LoadCoverageData(const char* dir);
// Read a single mcov file
bool ReadMCovFile(const char* f);
// find out what line in a mumps file (filepath) the given entry point
// or function is. lineoffset is set by this method.
bool FindFunctionInMumpsFile(std::string const& filepath,
std::string const& function,
int& lineoffset);
// parse a line from a .mcov file, and fill in the
// routine, function, linenumber and coverage count
bool ParseMCOVLine(std::string const& line,
std::string& routine,
std::string& function,
int& linenumber,
int& count);
bool LoadPackages(const char* dir);
bool LoadCoverageData(const char* dir);
bool ReadMCovFile(const char* f);
void InitializeFile(std::string& file);
std::map<cmStdString, cmStdString> RoutineToDirectory;
cmCTestCoverageHandlerContainer& Coverage;
cmCTest* CTest;
};

View File

@ -0,0 +1,125 @@
#include "cmStandardIncludes.h"
#include <stdio.h>
#include <stdlib.h>
#include "cmSystemTools.h"
#include "cmParseGTMCoverage.h"
#include <cmsys/Directory.hxx>
#include <cmsys/Glob.hxx>
cmParseMumpsCoverage::cmParseMumpsCoverage(
cmCTestCoverageHandlerContainer& cont,
cmCTest* ctest)
:Coverage(cont), CTest(ctest)
{
}
bool cmParseMumpsCoverage::ReadCoverageFile(const char* file)
{
// Read the gtm_coverage.mcov file, that has two lines of data:
// packages:/full/path/to/Vista/Packages
// coverage_dir:/full/path/to/dir/with/*.mcov
std::ifstream in(file);
if(!in)
{
return false;
}
std::string line;
cmSystemTools::GetLineFromStream(in, line);
std::string::size_type pos = line.find(':', 0);
std::string packages;
if(pos != std::string::npos)
{
packages = line.substr(pos+1);
}
cmSystemTools::GetLineFromStream(in, line);
pos = line.find(':', 0);
std::string coverage_dir;
if(pos != std::string::npos)
{
coverage_dir = line.substr(pos+1);
}
// load the mumps files from the packages directory
this->LoadPackages(packages.c_str());
// now load the *.mcov files from the coverage directory
this->LoadCoverageData(coverage_dir.c_str());
return true;
}
void cmParseMumpsCoverage::InitializeMumpsFile(std::string& file)
{
// initialize the coverage information for a given mumps file
std::ifstream in(file.c_str());
if(!in)
{
return;
}
std::string line;
cmCTestCoverageHandlerContainer::SingleFileCoverageVector&
coverageVector = this->Coverage.TotalCoverage[file];
if(!cmSystemTools::GetLineFromStream(in, line))
{
return;
}
// first line of a .m file can never be run
coverageVector.push_back(-1);
while( cmSystemTools::GetLineFromStream(in, line) )
{
// putting in a 0 for a line means it is executable code
// putting in a -1 for a line means it is not executable code
int val = -1; // assume line is not executable
bool found = false;
std::string::size_type i = 0;
// (1) Search for the first whitespace or semicolon character on a line.
//This will skip over labels if the line starts with one, or will simply
//be the first character on the line for non-label lines.
for(; i < line.size(); ++i)
{
if(line[i] == ' ' || line[i] == '\t' || line[i] == ';')
{
found = true;
break;
}
}
if(found)
{
// (2) If the first character found above is whitespace 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'))
{
i++;
}
}
// (3) If the character found is not a semicolon then the line counts for
// coverage.
if(i < line.size() && line[i] != ';')
{
val = 0;
}
}
coverageVector.push_back(val);
}
}
bool cmParseMumpsCoverage::LoadPackages(const char* d)
{
cmsys::Glob glob;
glob.RecurseOn();
std::string pat = d;
pat += "/*.m";
glob.FindFiles(pat.c_str());
std::vector<std::string>& files = glob.GetFiles();
std::vector<std::string>::iterator fileIt;
for ( fileIt = files.begin(); fileIt != files.end();
++ fileIt )
{
std::string name = cmSystemTools::GetFilenameName(*fileIt);
this->RoutineToDirectory[name.substr(0, name.size()-2)] = *fileIt;
// initialze each file, this is left out until CDash is fixed
// to handle large numbers of files
// this->InitializeMumpsFile(*fileIt);
}
return true;
}

View File

@ -0,0 +1,48 @@
/*============================================================================
CMake - Cross Platform Makefile Generator
Copyright 2000-2009 Kitware, Inc.
Distributed under the OSI-approved BSD License (the "License");
see accompanying file Copyright.txt for details.
This software is distributed WITHOUT ANY WARRANTY; without even the
implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the License for more information.
============================================================================*/
#ifndef cmParseMumpsCoverage_h
#define cmParseMumpsCoverage_h
#include "cmStandardIncludes.h"
#include "cmCTestCoverageHandler.h"
/** \class cmParseMumpsCoverage
* \brief Parse Mumps coverage information
*
* This class is used as the base class for Mumps coverage
* parsing.
*/
class cmParseMumpsCoverage
{
public:
cmParseMumpsCoverage(cmCTestCoverageHandlerContainer& cont,
cmCTest* ctest);
// This is the toplevel coverage file locating the coverage files
// and the mumps source code package tree.
bool ReadCoverageFile(const char* file);
protected:
// sub classes will use this to
// load all coverage files found in the given directory
virtual bool LoadCoverageData(const char* d) = 0;
// search the package directory for mumps files and fill
// in the RoutineToDirectory map
bool LoadPackages(const char* dir);
// initialize the coverage information for a single mumps file
void InitializeMumpsFile(std::string& file);
protected:
std::map<cmStdString, cmStdString> RoutineToDirectory;
cmCTestCoverageHandlerContainer& Coverage;
cmCTest* CTest;
};
#endif

View File

@ -1708,6 +1708,24 @@ ${CMake_BINARY_DIR}/bin/cmake -DVERSION=master -P ${CMake_SOURCE_DIR}/Utilities/
PASS_REGULAR_EXPRESSION
"Reading ctest configuration file: ${CTEST_TEST_ESCAPED_BINARY_DIR}.Tests.CTestTestConfigFileInBuildDir2.CTestConfig.cmake")
# test coverage for mumps
# create a MumpsCoverage dir in the binary tree under Testing to
# avoid the .NoDartCoverage files in the cmake testing tree
configure_file(
"${CMake_SOURCE_DIR}/Tests/MumpsCoverage/DartConfiguration.tcl.in"
"${CMake_BINARY_DIR}/Testing/MumpsCoverage/DartConfiguration.tcl")
configure_file(
"${CMake_SOURCE_DIR}/Tests/MumpsCoverage/gtm_coverage.mcov.in"
"${CMake_BINARY_DIR}/Testing/MumpsCoverage/gtm_coverage.mcov")
file(COPY "${CMake_SOURCE_DIR}/Tests/MumpsCoverage/VistA-FOIA"
DESTINATION "${CMake_BINARY_DIR}/Testing/MumpsCoverage")
add_test(NAME CTestGTMCoverage
WORKING_DIRECTORY "${CMake_BINARY_DIR}/Testing/MumpsCoverage"
COMMAND
${CMAKE_CTEST_COMMAND} -T Coverage --debug)
set_tests_properties(CTestGTMCoverage PROPERTIES
PASS_REGULAR_EXPRESSION
"Process file.*XINDEX.m.*Total LOC:.*127.*Percentage Coverage: 85.83.*")
# Use macro, not function so that build can still be driven by CMake 2.4.
# After 2.6 is required, this could be a function without the extra 'set'
# calls.

2
Tests/MumpsCoverage/.gitattributes vendored Normal file
View File

@ -0,0 +1,2 @@
*.cmcov -whitespace
*.mcov -whitespace

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,8 @@
# This file is configured by CMake automatically as DartConfiguration.tcl
# If you choose not to use CMake, this file may be hand configured, by
# filling in the required variables.
# Configuration directories and files
SourceDirectory: ${CMake_SOURCE_DIR}/Testing/MumpsCoverage
BuildDirectory: ${CMake_BINARY_DIR}/Testing/MumpsCoverage

View File

@ -0,0 +1,144 @@
XINDEX ;ISC/REL,GFT,GRK,RWF - INDEX & CROSS-REFERENCE ;08/04/08 13:19
;;7.3;TOOLKIT;**20,27,48,61,66,68,110,121,128**;Apr 25, 1995;Build 1
; Per VHA Directive 2004-038, this routine should not be modified.
G ^XINDX6
SEP F I=1:1 S CH=$E(LIN,I) D QUOTE:CH=Q Q:" "[CH
S ARG=$E(LIN,1,I-1) S:CH=" " I=I+1 S LIN=$E(LIN,I,999) Q
QUOTE F I=I+1:1 S CH=$E(LIN,I) Q:CH=""!(CH=Q)
Q:CH]"" S ERR=6 G ^XINDX1
ALIVE ;enter here from taskman
D SETUP^XINDX7 ;Get ready to process
A2 S RTN=$O(^UTILITY($J,RTN)) G ^XINDX5:RTN=""
S INDLC=(RTN?1"|"1.4L.NP) D LOAD:'INDLC
I $D(ZTQUEUED),$$S^%ZTLOAD S RTN="~",IND("QUIT")=1,ZTSTOP=1 G A2
I 'INDDS,INDLC W !!?10,"Data Dictionaries",! S INDDS=1
D BEG
G A2
;
LOAD S X=RTN,XCNP=0,DIF="^UTILITY("_$J_",1,RTN,0," X ^%ZOSF("TEST") Q:'$T X ^%ZOSF("LOAD") S ^UTILITY($J,1,RTN,0,0)=XCNP-1
I $D(^UTILITY($J,1,RTN,0,0)) S ^UTILITY($J,1,RTN,"RSUM")="B"_$$SUMB^XPDRSUM($NA(^UTILITY($J,1,RTN,0)))
Q
BEG ;
S %=INDLC*5 W:$X+10+%>IOM ! W RTN,$J("",10+%-$L(RTN))
S (IND("DO"),IND("SZT"),IND("SZC"),LABO)=0,LC=$G(^UTILITY($J,1,RTN,0,0))
I LC="" W !,">>>Routine '",RTN,"' not found <<<",! Q
S TXT="",LAB=$P(^UTILITY($J,1,RTN,0,1,0)," ") I RTN'=$P(LAB,"(") D E^XINDX1(17)
I 'INDLC,LAB["(" D E^XINDX1(55) S LAB=$P(LAB,"(")
;if M routine(not compiled template or DD) and has more than 2 lines, check lines 1 & 2
I 'INDLC,LC>2 D
. N LABO S LABO=1
. S LIN=$G(^UTILITY($J,1,RTN,0,1,0)),TXT=1
. ;check 1st line (site/dev - ) patch 128
. I $P(LIN,";",2,4)'?.E1"/".E.1"-".E D E^XINDX1(62)
. S LIN=$G(^UTILITY($J,1,RTN,0,2,0)),TXT=2
. ;check 2nd line (;;nn.nn[TV]nn;package;.anything)
. I $P(LIN,";",3,99)'?1.2N1"."1.2N.1(1"T",1"V").2N1";"1A.AP1";".E D E^XINDX1(44) ;patch 121
. I $L(INP(11)) X INP(11) ;Version number check
. I $L(INP(12)) X INP(12) ;Patch number check
B5 F TXT=1:1:LC S LIN=^UTILITY($J,1,RTN,0,TXT,0),LN=$L(LIN),IND("SZT")=IND("SZT")+LN+2 D LN,ST ;Process Line
S LAB="",LABO=0,TXT=0,^UTILITY($J,1,RTN,0)=IND("SZT")_"^"_LC_"^"_IND("SZC")
I IND("SZT")>INP("MAX"),'INDLC S ERR=35,ERR(1)=IND("SZT") D ^XINDX1
I IND("SZT")-IND("SZC")>INP("CMAX"),'INDLC S ERR=58,ERR(1)=IND("SZT")-IND("SZC") D ^XINDX1
D POSTRTN
Q
;Proccess one line, LN = Length, LIN = Line.
LN K V S (ARG,GRB,IND("COM"),IND("DOL"),IND("F"))="",X=$P(LIN," ")
I '$L(X) S LABO=LABO+1 G CD
S (IND("COM"),LAB)=$P(X,"("),ARG=$P($P(X,"(",2),")"),LABO=0,IND("PP")=X?1.8E1"(".E1")"
D:$L(ARG) NE^XINDX3 ;Process formal parameters as New list.
I 'INDLC,'$$VT^XINDX2(LAB) D E^XINDX1($S(LAB=$$CASE^XINDX52(LAB):37,1:55)) ;Check for bad labels
I $D(^UTILITY($J,1,RTN,"T",LAB)) D E^XINDX1(15) G CD ;DUP label
S ^UTILITY($J,1,RTN,"T",LAB)=""
CD I LN>245 D:'(LN=246&($E(RTN,1,3)="|dd")) E^XINDX1(19) ;patch 119
D:LIN'?1.ANP E^XINDX1(18)
S LIN=$P(LIN," ",2,999),IND("LCC")=1
I LIN="" D E^XINDX1(42) Q ;Blank line ;p110
S I=0 ;Watch the scope of I, counts dots
I " ."[$E(LIN) D S X=$L($E(LIN,1,I),".")-1,LIN=$E(LIN,I,999)
. F I=1:1:245 Q:". "'[$E(LIN,I)
. Q
;check dots against Do level IND("DO"), IND("DOL")=dot level
D:'I&$G(IND("DO1")) E^XINDX1(51) S IND("DO1")=0 S:'I IND("DO")=0
I I D:X>IND("DO") E^XINDX1(51) S (IND("DO"),IND("DOL"))=X
;Count Comment lines, skip ;; lines
I $E(LIN)=";",$E(LIN,2)'=";" S IND("SZC")=IND("SZC")+$L(LIN) ;p110
;Process commands on line.
EE I LIN="" D ^XINDX2 Q
S COM=$E(LIN),GK="",ARG=""
I COM=";" S LIN="" G EE ;p110
I COM=" " S ERR=$S(LIN?1." ":13,1:0),LIN=$S(ERR:"",1:$E(LIN,2,999)) D:ERR ^XINDX1 G EE
D SEP
S CM=$P(ARG,":",1),POST=$P(ARG,":",2,999),IND("COM")=IND("COM")_$C(9)_COM,ERR=48
D:ARG[":"&(POST']"") ^XINDX1 S:POST]"" GRB=GRB_$C(9)_POST,IND("COM")=IND("COM")_":"
;SAC now allows lowercase commands
I CM?.E1L.E S CM=$$CASE^XINDX52(CM),COM=$E(CM) ;I IND("LCC") S IND("LCC")=0 D E^XINDX1(47)
I CM="" D E^XINDX1(21) G EE ;Missing command
S CX=$G(IND("CMD",CM)) I CX="" D G:CX="" EE
. I $E(CM)="Z" S CX="^Z" Q ;Proccess Z commands
. D E^XINDX1(1) S LIN="" Q
S CX=$P(CX,"^",2,9)
D SEP I '$L(LIN),CH=" " D E^XINDX1(13) ;trailing space
I ARG="","CGJMORSUWX"[COM S ERR=49 G ^XINDX1
I CX>0 D E^XINDX1(CX) S CX=""
D:$L(CX) @CX S:ARG'="" GRB=GRB_$C(9)_ARG G EE
B S ERR=25 G ^XINDX1
C S ERR=29 G ^XINDX1
D G DG1^XINDX4
E Q:ARG="" S ERR=7 G ^XINDX1
F G:ARG]"" FR^XINDX4 S IND("F")=1 Q
G G DG^XINDX4
H Q:ARG'="" S ERR=32 G ^XINDX1
J S ERR=36,ARG="" G ^XINDX1
K S ERR=$S(ARG?1"(".E:22,ARG?." ":23,1:0) D:ERR ^XINDX1
G KL^XINDX3
L G LO^XINDX4
M G S^XINDX3
N G NE^XINDX3
O S ERR=34 D ^XINDX1,O^XINDX3 Q
Q Q:ARG="" G Q^XINDX4
R S RDTIME=0 G RD^XINDX3
S G S^XINDX3
TR Q ;What to process. p110
U S ARG=$P(ARG,":") Q
V S ARG="",ERR=20 G ^XINDX1
W G WR^XINDX4
X G XE^XINDX4
Z S ERR=2 D ^XINDX1 G ZC^XINDX4
;
;Save off items from line.
ST S R=LAB_$S(LABO:"+"_LABO,1:"")
;Local variable, Global, Marked Items, Naked global, Internal ref, eXternal ref., Tag ref.
S LOC="" F S LOC=$O(V(LOC)),S="" Q:LOC="" F S S=$O(V(LOC,S)) Q:S="" D SET
S ^UTILITY($J,1,RTN,"COM",TXT)=IND("COM")
Q
;
SET I V(LOC,S)]"" F %="!","~" I V(LOC,S)[%,$G(^UTILITY($J,1,RTN,LOC,S))'[% S ^(S)=$G(^(S))_%
S %=0
SE2 S ARG=$G(^UTILITY($J,1,RTN,LOC,S,%)) I $L(ARG)>230 S %=%+1 G SE2
S ^UTILITY($J,1,RTN,LOC,S,%)=ARG_R_V(LOC,S)_","
Q
;
POSTRTN ;Do more overall checking
N V,E,T,T1,T2
S T="" ;Check for missing Labels
F S T=$O(^UTILITY($J,1,RTN,"I",T)),T2=T Q:T="" S T1=$G(^(T,0)) D
. Q:$E(T2,1,2)="@("
. S:$E(T2,1,2)="$$" T2=$E(T2,3,99)
. I T2]"",'$D(^UTILITY($J,1,RTN,"T",$P(T2,"+",1))) D
. . F I=1:1:$L(T1,",")-1 S LAB=$P(T1,",",I),LABO=+$P(LAB,"+",2),LAB=$P(LAB,"+"),E=14,E(1)=T D E^XINDX1(.E)
. . Q
. Q
S LAB="",LABO=0 ;Check for valid label names
I 'INDLC F S LAB=$O(^UTILITY($J,1,RTN,"T",LAB)) Q:LAB="" D
. I '$$VA^XINDX2(LAB) D E^XINDX1(55) Q
. D:'$$VT^XINDX2(LAB) E^XINDX1(37)
. Q
S LAB="",LABO=0 ;Check for valid variable names.
F S LAB=$O(^UTILITY($J,1,RTN,"L",LAB)) Q:LAB="" D
. D VLNF^XINDX3($P(LAB,"("))
. Q
Q
;
QUICK ;Quick, Just get a routine an print the results
D QUICK^XINDX6()
Q

View File

@ -0,0 +1,2 @@
packages:${CMake_BINARY_DIR}/Testing/MumpsCoverage/VistA-FOIA/Packages
coverage_dir:${CMake_SOURCE_DIR}/Tests/MumpsCoverage