Merge topic 'mumps_coverage'

c806b23 CDash now supports lots of files in coverage. So, show all files.
761d931 Do not try to run bullseye coverage if COVFILE env is empty.
5b69ce4 Update test data to match new coverage format.
1b418f1 Change GT.M Coverage Parser global
b0c07a1 Disable bullseye coverage for mumps coverage test.
0a169e6 Remove uncovered files from cache coverage data.
a7abf5e Add ability to specify more than one package directory or coverage directory.
220afca Use <TARGET_FILE> expression to run ctest so it works with Xcode and VS IDE.
62f6bce Use a script to run the test because WORKING_DIRECTORY is not in 2.8.2.
f5c5db0 Fix some warnings and a bug where it went past the length of a vector.
7955e99 Add support for Cache coverage.
a86cd33 Add virutal destructor to silence warning.
319eeb0 Add test for mumps coverage. Also refactor code to prepare for cache coverage.
72210c2 Fix line length.
dd07161 Fix warning about char* instead of const char*.
e6412e0 Add support to ctest for GTM mumps coverage.
This commit is contained in:
David Cole 2012-05-17 14:58:54 -04:00 committed by CMake Topic Stage
commit 8e9101a0cb
19 changed files with 2807 additions and 4 deletions

View File

@ -425,6 +425,9 @@ SET(CTEST_SRCS cmCTest.cxx
CTest/cmCTestConfigureHandler.cxx
CTest/cmCTestCoverageCommand.cxx
CTest/cmCTestCoverageHandler.cxx
CTest/cmParseMumpsCoverage.cxx
CTest/cmParseCacheCoverage.cxx
CTest/cmParseGTMCoverage.cxx
CTest/cmParsePHPCoverage.cxx
CTest/cmCTestEmptyBinaryDirectoryCommand.cxx
CTest/cmCTestGenericHandler.cxx

View File

@ -11,6 +11,8 @@
============================================================================*/
#include "cmCTestCoverageHandler.h"
#include "cmParsePHPCoverage.h"
#include "cmParseGTMCoverage.h"
#include "cmParseCacheCoverage.h"
#include "cmCTest.h"
#include "cmake.h"
#include "cmMakefile.h"
@ -373,21 +375,29 @@ int cmCTestCoverageHandler::ProcessHandler()
}
int file_count = 0;
file_count += this->HandleGCovCoverage(&cont);
error = cont.Error;
if ( file_count < 0 )
{
return error;
}
file_count += this->HandleTracePyCoverage(&cont);
error = cont.Error;
if ( file_count < 0 )
{
return error;
}
file_count += this->HandlePHPCoverage(&cont);
error = cont.Error;
if ( file_count < 0 )
{
return error;
}
file_count += this->HandleMumpsCoverage(&cont);
error = cont.Error;
if ( file_count < 0 )
{
return error;
}
std::set<std::string> uncovered = this->FindUncoveredFiles(&cont);
@ -751,6 +761,46 @@ int cmCTestCoverageHandler::HandlePHPCoverage(
}
return static_cast<int>(cont->TotalCoverage.size());
}
//----------------------------------------------------------------------
int cmCTestCoverageHandler::HandleMumpsCoverage(
cmCTestCoverageHandlerContainer* cont)
{
// try gtm coverage
cmParseGTMCoverage cov(*cont, this->CTest);
std::string coverageFile = this->CTest->GetBinaryDir() +
"/gtm_coverage.mcov";
if(cmSystemTools::FileExists(coverageFile.c_str()))
{
cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT,
"Parsing Cache Coverage: " << coverageFile
<< std::endl);
cov.ReadCoverageFile(coverageFile.c_str());
return static_cast<int>(cont->TotalCoverage.size());
}
else
{
cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT,
" Cannot find foobar GTM coverage file: " << coverageFile
<< std::endl);
}
cmParseCacheCoverage ccov(*cont, this->CTest);
coverageFile = this->CTest->GetBinaryDir() +
"/cache_coverage.cmcov";
if(cmSystemTools::FileExists(coverageFile.c_str()))
{
cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT,
"Parsing Cache Coverage: " << coverageFile
<< std::endl);
ccov.ReadCoverageFile(coverageFile.c_str());
}
else
{
cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT,
" Cannot find Cache coverage file: " << coverageFile
<< std::endl);
}
return static_cast<int>(cont->TotalCoverage.size());
}
struct cmCTestCoverageHandlerLocale
{
@ -1806,7 +1856,7 @@ int cmCTestCoverageHandler::HandleBullseyeCoverage(
cmCTestCoverageHandlerContainer* cont)
{
const char* covfile = cmSystemTools::GetEnv("COVFILE");
if(!covfile)
if(!covfile || strlen(covfile) == 0)
{
cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT,
" COVFILE environment variable not found, not running "

View File

@ -70,6 +70,8 @@ private:
//! Handle coverage using xdebug php coverage
int HandlePHPCoverage(cmCTestCoverageHandlerContainer* cont);
//! Handle coverage for mumps
int HandleMumpsCoverage(cmCTestCoverageHandlerContainer* cont);
//! Handle coverage using Bullseye
int HandleBullseyeCoverage(cmCTestCoverageHandlerContainer* cont);

View File

@ -0,0 +1,220 @@
#include "cmStandardIncludes.h"
#include <stdio.h>
#include <stdlib.h>
#include "cmSystemTools.h"
#include "cmParseCacheCoverage.h"
#include <cmsys/Directory.hxx>
#include <cmsys/Glob.hxx>
cmParseCacheCoverage::cmParseCacheCoverage(
cmCTestCoverageHandlerContainer& cont,
cmCTest* ctest)
:cmParseMumpsCoverage(cont, ctest)
{
}
bool cmParseCacheCoverage::LoadCoverageData(const char* d)
{
// load all the .mcov files in the specified directory
cmsys::Directory dir;
if(!dir.Load(d))
{
return false;
}
size_t numf;
unsigned int i;
numf = dir.GetNumberOfFiles();
for (i = 0; i < numf; i++)
{
std::string file = dir.GetFile(i);
if(file != "." && file != ".."
&& !cmSystemTools::FileIsDirectory(file.c_str()))
{
std::string path = d;
path += "/";
path += file;
if(cmSystemTools::GetFilenameLastExtension(path) == ".cmcov")
{
if(!this->ReadCMCovFile(path.c_str()))
{
return false;
}
}
}
}
return true;
}
// not currently used, but leave it in case we want it in the future
void cmParseCacheCoverage::RemoveUnCoveredFiles()
{
// loop over the coverage data computed and remove all files
// that only have -1 or 0 for the lines.
cmCTestCoverageHandlerContainer::TotalCoverageMap::iterator ci =
this->Coverage.TotalCoverage.begin();
while(ci != this->Coverage.TotalCoverage.end())
{
cmCTestCoverageHandlerContainer::SingleFileCoverageVector& v =
ci->second;
bool nothing = true;
for(cmCTestCoverageHandlerContainer::SingleFileCoverageVector::iterator i=
v.begin(); i != v.end(); ++i)
{
if(*i > 0)
{
nothing = false;
break;
}
}
if(nothing)
{
cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT,
"No coverage found in: " << ci->first
<< std::endl);
this->Coverage.TotalCoverage.erase(ci++);
}
else
{
++ci;
}
}
}
bool cmParseCacheCoverage::SplitString(std::vector<std::string>& args,
std::string const& line)
{
std::string::size_type pos1 = 0;
std::string::size_type pos2 = line.find(',', 0);
if(pos2 == std::string::npos)
{
return false;
}
std::string arg;
while(pos2 != std::string::npos)
{
arg = line.substr(pos1, pos2-pos1);
args.push_back(arg);
pos1 = pos2+1;
pos2 = line.find(',',pos1);
}
arg = line.substr(pos1);
args.push_back(arg);
return true;
}
bool cmParseCacheCoverage::ReadCMCovFile(const char* file)
{
std::ifstream in(file);
if(!in)
{
cmCTestLog(this->CTest, ERROR_MESSAGE,
"Can not open : "
<< file << "\n");
return false;
}
std::string line;
std::vector<std::string> separateLine;
if(!cmSystemTools::GetLineFromStream(in, line))
{
cmCTestLog(this->CTest, ERROR_MESSAGE,
"Empty file : "
<< file << " referenced in this line of cmcov data:\n"
"[" << line << "]\n");
return false;
}
separateLine.clear();
this->SplitString(separateLine, line);
if(separateLine.size() !=4 || separateLine[0] != "Routine"
|| separateLine[1] != "Line" || separateLine[2] != "RtnLine"
|| separateLine[3] != "Code")
{
cmCTestLog(this->CTest, ERROR_MESSAGE,
"Bad first line of cmcov file : "
<< file << " line:\n"
"[" << line << "]\n");
}
std::string routine;
std::string filepath;
while(cmSystemTools::GetLineFromStream(in, line))
{
// clear out line argument vector
separateLine.clear();
// parse the comma separated line
this->SplitString(separateLine, line);
// might have more because code could have a quoted , in it
// but we only care about the first 3 args anyway
if(separateLine.size() < 4)
{
cmCTestLog(this->CTest, ERROR_MESSAGE,
"Bad line of cmcov file expected at least 4 found: "
<< separateLine.size() << " "
<< file << " line:\n"
"[" << line << "]\n");
for(std::string::size_type i = 0; i < separateLine.size(); ++i)
{
cmCTestLog(this->CTest, ERROR_MESSAGE,""
<< separateLine[1] << " ");
}
cmCTestLog(this->CTest, ERROR_MESSAGE, "\n");
return false;
}
// if we do not have a routine yet, then it should be
// the first argument in the vector
if(routine.size() == 0)
{
routine = separateLine[0];
// Find the full path to the file
if(!this->FindMumpsFile(routine, filepath))
{
cmCTestLog(this->CTest, ERROR_MESSAGE,
"Could not find mumps file for routine: "
<< routine << "\n");
filepath = "";
continue; // move to next line
}
}
// if we have a routine name, check for end of routine
else
{
// Totals in arg 0 marks the end of a routine
if(separateLine[0].substr(0, 6) == "Totals")
{
routine = ""; // at the end of this routine
filepath = "";
continue; // move to next line
}
}
// if the file path was not found for the routine
// move to next line. We should have already warned
// after the call to FindMumpsFile that we did not find
// it, so don't report again to cut down on output
if(filepath.size() == 0)
{
continue;
}
// now we are ready to set the coverage from the line of data
cmCTestCoverageHandlerContainer::SingleFileCoverageVector&
coverageVector = this->Coverage.TotalCoverage[filepath];
std::string::size_type linenumber = atoi(separateLine[1].c_str()) -1;
int count = atoi(separateLine[2].c_str());
if(linenumber > coverageVector.size())
{
cmCTestLog(this->CTest, ERROR_MESSAGE,
"Parse error line is greater than number of lines in file: "
<< linenumber << " " << filepath << "\n");
continue; // skip setting count to avoid crash
}
// now add to count for linenumber
// for some reason the cache coverage adds extra lines to the
// end of the file in some cases. Since they do not exist, we will
// mark them as non executable
while(linenumber >= coverageVector.size())
{
coverageVector.push_back(-1);
}
coverageVector[linenumber] += count;
}
return true;
}

View File

@ -0,0 +1,42 @@
/*============================================================================
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 cmParseCacheCoverage_h
#define cmParseCacheCoverage_h
#include "cmParseMumpsCoverage.h"
/** \class cmParseCacheCoverage
* \brief Parse Cache coverage information
*
* This class is used to parse Cache coverage information for
* mumps.
*/
class cmParseCacheCoverage : public cmParseMumpsCoverage
{
public:
cmParseCacheCoverage(cmCTestCoverageHandlerContainer& cont,
cmCTest* ctest);
protected:
// implement virtual from parent
bool LoadCoverageData(const char* dir);
// remove files with no coverage
void RemoveUnCoveredFiles();
// Read a single mcov file
bool ReadCMCovFile(const char* f);
// split a string based on ,
bool SplitString(std::vector<std::string>& args,
std::string const& line);
};
#endif

View File

@ -0,0 +1,272 @@
#include "cmStandardIncludes.h"
#include <stdio.h>
#include <stdlib.h>
#include "cmSystemTools.h"
#include "cmParseGTMCoverage.h"
#include <cmsys/Directory.hxx>
#include <cmsys/Glob.hxx>
cmParseGTMCoverage::cmParseGTMCoverage(cmCTestCoverageHandlerContainer& cont,
cmCTest* ctest)
:cmParseMumpsCoverage(cont, ctest)
{
}
bool cmParseGTMCoverage::LoadCoverageData(const char* d)
{
// load all the .mcov files in the specified directory
cmsys::Directory dir;
if(!dir.Load(d))
{
return false;
}
size_t numf;
unsigned int i;
numf = dir.GetNumberOfFiles();
for (i = 0; i < numf; i++)
{
std::string file = dir.GetFile(i);
if(file != "." && file != ".."
&& !cmSystemTools::FileIsDirectory(file.c_str()))
{
std::string path = d;
path += "/";
path += file;
if(cmSystemTools::GetFilenameLastExtension(path) == ".mcov")
{
if(!this->ReadMCovFile(path.c_str()))
{
return false;
}
}
}
}
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("^ZZCOVERAGE") == 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
bool found = this->FindMumpsFile(routine, filepath);
if(found)
{
int lineoffset;
if(this->FindFunctionInMumpsFile(filepath,
function,
lineoffset))
{
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)
{
return false;
}
std::string line;
int linenum = 0;
while( cmSystemTools::GetLineFromStream(in, line))
{
std::string::size_type pos = line.find(function.c_str());
if(pos == 0)
{
char nextchar = line[function.size()];
if(nextchar == ' ' || nextchar == '(')
{
lineoffset = linenum;
return true;
}
}
if(pos == 1)
{
char prevchar = line[0];
char nextchar = line[function.size()+1];
if(prevchar == '%' && (nextchar == ' ' || nextchar == '('))
{
lineoffset = linenum;
return true;
}
}
linenum++; // move to next line count
}
lineoffset = 0;
cmCTestLog(this->CTest, ERROR_MESSAGE,
"Could not find entry point : "
<< function << " in " << filepath << "\n");
return false;
}
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
// are several varients of coverage lines:
//
// ^COVERAGE("DIC11","PR1",0)="2:0:0:0"
// ( file , entry, line ) = "number_executed:timing_info"
// ^COVERAGE("%RSEL","SRC")="1:0:0:0"
// ( file , entry ) = "number_executed:timing_info"
// ^COVERAGE("%RSEL","init",8,"FOR_LOOP",1)=1
// ( file , entry, line, IGNORE ) =number_executed
std::vector<cmStdString> args;
std::string::size_type pos = line.find('(', 0);
// if no ( is found, then return line has no coverage
if(pos == std::string::npos)
{
return false;
}
std::string arg;
bool done = false;
// separate out all of the comma separated arguments found
// in the COVERAGE(...) line
while(line[pos] && !done)
{
// save the char we are looking at
char cur = line[pos];
// , or ) means end of argument
if(cur == ',' || cur == ')')
{
// save the argument into the argument vector
args.push_back(arg);
// start on a new argument
arg = "";
// if we are at the end of the ), then finish while loop
if(cur == ')')
{
done = true;
}
}
else
{
// all chars except ", (, and % get stored in the arg string
if(cur != '\"' && cur != '(' && cur != '%')
{
arg.append(1, line[pos]);
}
}
// move to next char
pos++;
}
// now parse the right hand side of the =
pos = line.find('=');
// no = found, this is an error
if(pos == line.npos)
{
return false;
}
pos++; // move past =
// if the next positing is not a ", then this is a
// COVERAGE(..)=count line and turn the rest of the string
// past the = into an integer and set it to count
if(line[pos] != '\"')
{
count = atoi(line.substr(pos).c_str());
}
else
{
// this means line[pos] is a ", and we have a
// COVERAGE(...)="1:0:0:0" type of line
pos++; // move past "
// find the first : past the "
std::string::size_type pos2 = line.find(':', pos);
// turn the string between the " and the first : into an integer
// and set it to count
count = atoi(line.substr(pos, pos2-pos).c_str());
}
// less then two arguments is an error
if(args.size() < 2)
{
cmCTestLog(this->CTest, ERROR_MESSAGE,
"Error parsing mcov line: [" << line << "]\n");
return false;
}
routine = args[0]; // the routine is the first argument
function = args[1]; // the function in the routine is the second
// in the two argument only format
// ^COVERAGE("%RSEL","SRC"), the line offset is 0
if(args.size() == 2)
{
linenumber = 0;
}
else
{
// this is the format for this line
// ^COVERAGE("%RSEL","SRC",count)
linenumber = atoi(args[2].c_str());
}
return true;
}

View File

@ -0,0 +1,49 @@
/*============================================================================
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 cmParseGTMCoverage_h
#define cmParseGTMCoverage_h
#include "cmParseMumpsCoverage.h"
/** \class cmParseGTMCoverage
* \brief Parse GTM coverage information
*
* This class is used to parse GTM coverage information for
* mumps.
*/
class cmParseGTMCoverage : public cmParseMumpsCoverage
{
public:
cmParseGTMCoverage(cmCTestCoverageHandlerContainer& cont,
cmCTest* ctest);
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);
};
#endif

View File

@ -0,0 +1,165 @@
#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)
{
}
cmParseMumpsCoverage::~cmParseMumpsCoverage()
{
}
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;
while(cmSystemTools::GetLineFromStream(in, line))
{
std::string::size_type pos = line.find(':', 0);
std::string packages;
if(pos != std::string::npos)
{
std::string type = line.substr(0, pos);
std::string path = line.substr(pos+1);
if(type == "packages")
{
this->LoadPackages(path.c_str());
}
else if(type == "coverage_dir")
{
this->LoadCoverageData(path.c_str());
}
else
{
cmCTestLog(this->CTest, ERROR_MESSAGE,
"Parse Error in Mumps coverage file :\n"
<< file <<
"\ntype: [" << type << "]\npath:[" << path << "]\n"
"input line: [" << line << "]\n");
}
}
}
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;
}
bool cmParseMumpsCoverage::FindMumpsFile(std::string const& routine,
std::string& filepath)
{
std::map<cmStdString, cmStdString>::iterator i =
this->RoutineToDirectory.find(routine);
if(i != this->RoutineToDirectory.end())
{
filepath = i->second;
return 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())
{
filepath = i->second;
return true;
}
}
}
return false;
}

View File

@ -0,0 +1,52 @@
/*============================================================================
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);
virtual ~cmParseMumpsCoverage();
// 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);
// Find mumps file for routine
bool FindMumpsFile(std::string const& routine,
std::string& filepath);
protected:
std::map<cmStdString, cmStdString> RoutineToDirectory;
cmCTestCoverageHandlerContainer& Coverage;
cmCTest* CTest;
};
#endif

View File

@ -37,9 +37,6 @@ private:
bool ReadInt(std::ifstream& in, int& v);
bool ReadCoverageArray(std::ifstream& in, cmStdString const&);
bool ReadUntil(std::ifstream& in, char until);
typedef std::map<int, int> FileLineCoverage;
std::map<cmStdString, FileLineCoverage> FileToCoverage;
std::map<int, int> FileCoverage;
cmCTestCoverageHandlerContainer& Coverage;
cmCTest* CTest;
};

View File

@ -1708,6 +1708,42 @@ ${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
COMMAND cmake -E chdir
${CMake_BINARY_DIR}/Testing/MumpsCoverage
$<TARGET_FILE:ctest> -T Coverage --debug)
set_tests_properties(CTestGTMCoverage PROPERTIES
PASS_REGULAR_EXPRESSION
"Process file.*XINDEX.m.*Total LOC:.*127.*Percentage Coverage: 85.83.*"
ENVIRONMENT COVFILE=)
configure_file(
"${CMake_SOURCE_DIR}/Tests/MumpsCoverage/DartConfiguration.cache.tcl.in"
"${CMake_BINARY_DIR}/Testing/MumpsCacheCoverage/DartConfiguration.tcl")
configure_file(
"${CMake_SOURCE_DIR}/Tests/MumpsCoverage/cache_coverage.cmcov.in"
"${CMake_BINARY_DIR}/Testing/MumpsCacheCoverage/cache_coverage.cmcov")
file(COPY "${CMake_SOURCE_DIR}/Tests/MumpsCoverage/VistA-FOIA"
DESTINATION "${CMake_BINARY_DIR}/Testing/MumpsCacheCoverage")
add_test(NAME CTestCacheCoverage
COMMAND cmake -E chdir
${CMake_BINARY_DIR}/Testing/MumpsCacheCoverage
$<TARGET_FILE:ctest> -T Coverage --debug)
set_tests_properties(CTestCacheCoverage PROPERTIES
PASS_REGULAR_EXPRESSION
"Process file.*XINDEX.m.*Total LOC:.*125.*Percentage Coverage: 85.60.*"
ENVIRONMENT COVFILE=)
# 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 -crlf -whitespace
*.mcov -crlf -whitespace

View File

@ -0,0 +1,304 @@
Routine,Line,RtnLine,Code
DDIOL,1,0,"DDIOL ;SFISC/MKO-THE LOADER ;1:53 PM 12 Sep 1995"
,2,0," ;;22.0;VA FileMan;;Mar 30, 1999"
,3,0," ;Per VHA Directive 10-93-142, this routine should not be modified."
,4,0," ;"
,5,0,"EN(A,G,FMT) ;Write the text contained in local array A or global array G"
,6,0," ;If one string passed, use format FMT"
,7,0," N %,Y,DINAKED"
,8,0," S DINAKED=$$LGR^%ZOSV"
,9,0," ;"
,10,0," S:'$D(A) A="""""
,11,0," I $G(A)="""",$D(A)<9,$G(FMT)="""",$G(G)'?1""^""1A.7AN,$G(G)'?1""^""1A.7AN1""("".E1"")"" Q"
,12,0," ;"
,13,0," G:$D(DDS) SM"
,14,0," G:$D(DIQUIET) LD"
,15,0," ;"
,16,0," N F,I,S"
,17,0," I $D(A)=1,$G(G)="""" D"
,18,0," . S F=$S($G(FMT)]"""":FMT,1:""!"")"
,19,0," . W @F,A"
,20,0," ;"
,21,0," E I $D(A)>9 S I=0 F S I=$O(A(I)) Q:I'=+$P(I,""E"") D"
,22,0," . S F=$G(A(I,""F""),""!"") S:F="""" F=""?0"""
,23,0," . W @F,$G(A(I))"
,24,0," ;"
,25,0," E S I=0 F S I=$O(@G@(I)) Q:I'=+$P(I,""E"") D"
,26,0," . S S=$G(@G@(I,0),$G(@G@(I)))"
,27,0," . S F=$G(@G@(I,""F""),""!"") S:F="""" F=""?0"""
,28,0," . W @F,S"
,29,0," ;"
,30,0," I DINAKED]"""" S DINAKED=$S(DINAKED["""""""""""":$O(@DINAKED),1:$D(@DINAKED))"
,31,0," Q"
,32,0," ;"
,33,0,"LD ;Load text into ^TMP"
,34,0," N I,N,T"
,35,0," S T=$S($G(DDIOLFLG)[""H"":""DIHELP"",1:""DIMSG"")"
,36,0," S N=$O(^TMP(T,$J,"" ""),-1)"
,37,0," ;"
,38,0," I $D(A)=1,$G(G)="""" D"
,39,0," . D LD1(A,$S($G(FMT)]"""":FMT,1:""!""))"
,40,0," ;"
,41,0," E I $D(A)>9 S I=0 F S I=$O(A(I)) Q:I'=+$P(I,""E"") D"
,42,0," . D LD1($G(A(I)),$G(A(I,""F""),""!""))"
,43,0," ;"
,44,0," E S I=0 F S I=$O(@G@(I)) Q:I'=+$P(I,""E"") D"
,45,0," . D LD1($G(@G@(I),$G(@G@(I,0))),$G(@G@(I,""F""),""!""))"
,46,0," ;"
,47,0," K:'N @T S:N @T=N"
,48,0," I DINAKED]"""" S DINAKED=$S(DINAKED["""""""""""":$O(@DINAKED),1:$D(@DINAKED))"
,49,0," Q"
,50,0," ;"
,51,0,"LD1(S,F) ;Load string S, with format F"
,52,0," ;In: N and T"
,53,0," N C,J,L"
,54,0," S:S[$C(7) S=$TR(S,$C(7),"""")"
,55,0," F J=1:1:$L(F,""!"")-1 S N=N+1,^TMP(T,$J,N)="""""
,56,0," S:'N N=1"
,57,0," S:F[""?"" @(""C=""_$P(F,""?"",2))"
,58,0," S L=$G(^TMP(T,$J,N))"
,59,0," S ^TMP(T,$J,N)=L_$J("""",$G(C)-$L(L))_S"
,60,0," Q"
,61,0," ;"
,62,0,"SM ;Print text in ScreenMan's Command Area"
,63,0," I $D(DDSID),$D(DTOUT)!$D(DUOUT) G SMQ"
,64,0," N DDIOL"
,65,0," S DDIOL=1"
,66,0," ;"
,67,0," I $D(A)=1&($G(G)="""")!($D(A)>9) D"
,68,0," . D MSG^DDSMSG(.A,"""",$G(FMT))"
,69,0," E I $D(@G@(+$O(@G@(0)),0))#2 D"
,70,0," . D WP^DDSMSG(G)"
,71,0," E D HLP^DDSMSG(G)"
,72,0," ;"
,73,0,"SMQ I DINAKED]"""" S DINAKED=$S(DINAKED["""""""""""":$O(@DINAKED),1:$D(@DINAKED))"
,74,0," Q"
Totals for DDIOL,,0,
XINDEX,1,0,"XINDEX ;ISC/REL,GFT,GRK,RWF - INDEX & CROSS-REFERENCE ;08/04/08 13:19"
,2,1," ;;7.3;TOOLKIT;**20,27,48,61,66,68,110,121,128**;Apr 25, 1995;Build 1"
,3,0," ; Per VHA Directive 2004-038, this routine should not be modified."
,4,1," G ^XINDX6"
,5,107216,"SEP F I=1:1 S CH=$E(LIN,I) D QUOTE:CH=Q Q:"" ""[CH"
,6,107216," S ARG=$E(LIN,1,I-1) S:CH="" "" I=I+1 S LIN=$E(LIN,I,999) Q"
,7,36371,"QUOTE F I=I+1:1 S CH=$E(LIN,I) Q:CH=""""!(CH=Q)"
,8,36371," Q:CH]"""" S ERR=6 G ^XINDX1"
,9,0,"ALIVE ;enter here from taskman"
,10,1," D SETUP^XINDX7 ;Get ready to process"
,11,468,"A2 S RTN=$O(^UTILITY($J,RTN)) G ^XINDX5:RTN="""""
,12,467," S INDLC=(RTN?1""|""1.4L.NP) D LOAD:'INDLC"
,13,467," I $D(ZTQUEUED),$$S^%ZTLOAD S RTN=""~"",IND(""QUIT"")=1,ZTSTOP=1 G A2"
,14,467," I 'INDDS,INDLC W !!?10,""Data Dictionaries"",! S INDDS=1"
,15,467," D BEG"
,16,467," G A2"
,17,0," ;"
,18,467,"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"
,19,467," I $D(^UTILITY($J,1,RTN,0,0)) S ^UTILITY($J,1,RTN,""RSUM"")=""B""_$$SUMB^XPDRSUM($NA(^UTILITY($J,1,RTN,0)))"
,20,467," Q"
,21,0,"BEG ;"
,22,467," S %=INDLC*5 W:$X+10+%>IOM ! W RTN,$J("""",10+%-$L(RTN))"
,23,467," S (IND(""DO""),IND(""SZT""),IND(""SZC""),LABO)=0,LC=$G(^UTILITY($J,1,RTN,0,0))"
,24,467," I LC="""" W !,"">>>Routine '"",RTN,""' not found <<<"",! Q"
,25,467," S TXT="""",LAB=$P(^UTILITY($J,1,RTN,0,1,0),"" "") I RTN'=$P(LAB,""("") D E^XINDX1(17)"
,26,467," I 'INDLC,LAB[""("" D E^XINDX1(55) S LAB=$P(LAB,""("")"
,27,0," ;if M routine(not compiled template or DD) and has more than 2 lines, check lines 1 & 2"
,28,467," I 'INDLC,LC>2 D"
,29,467," . N LABO S LABO=1"
,30,467," . S LIN=$G(^UTILITY($J,1,RTN,0,1,0)),TXT=1"
,31,0," . ;check 1st line (site/dev - ) patch 128"
,32,467," . I $P(LIN,"";"",2,4)'?.E1""/"".E.1""-"".E D E^XINDX1(62)"
,33,467," . S LIN=$G(^UTILITY($J,1,RTN,0,2,0)),TXT=2"
,34,0," . ;check 2nd line (;;nn.nn[TV]nn;package;.anything)"
,35,467," . I $P(LIN,"";"",3,99)'?1.2N1"".""1.2N.1(1""T"",1""V"").2N1"";""1A.AP1"";"".E D E^XINDX1(44) ;patch 121"
,36,467," . I $L(INP(11)) X INP(11) ;Version number check"
,37,467," . I $L(INP(12)) X INP(12) ;Patch number check"
,38,467,"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"
,39,467," S LAB="""",LABO=0,TXT=0,^UTILITY($J,1,RTN,0)=IND(""SZT"")_""^""_LC_""^""_IND(""SZC"")"
,40,467," I IND(""SZT"")>INP(""MAX""),'INDLC S ERR=35,ERR(1)=IND(""SZT"") D ^XINDX1"
,41,467," I IND(""SZT"")-IND(""SZC"")>INP(""CMAX""),'INDLC S ERR=58,ERR(1)=IND(""SZT"")-IND(""SZC"") D ^XINDX1"
,42,467," D POSTRTN"
,43,467," Q"
,44,0," ;Proccess one line, LN = Length, LIN = Line."
,45,44620,"LN K V S (ARG,GRB,IND(""COM""),IND(""DOL""),IND(""F""))="""",X=$P(LIN,"" "")"
,46,44620," I '$L(X) S LABO=LABO+1 G CD"
,47,5073," S (IND(""COM""),LAB)=$P(X,""(""),ARG=$P($P(X,""("",2),"")""),LABO=0,IND(""PP"")=X?1.8E1""("".E1"")"""
,48,5073," D:$L(ARG) NE^XINDX3 ;Process formal parameters as New list."
,49,5073," I 'INDLC,'$$VT^XINDX2(LAB) D E^XINDX1($S(LAB=$$CASE^XINDX52(LAB):37,1:55)) ;Check for bad labels"
,50,5073," I $D(^UTILITY($J,1,RTN,""T"",LAB)) D E^XINDX1(15) G CD ;DUP label"
,51,5073," S ^UTILITY($J,1,RTN,""T"",LAB)="""""
,52,44620,"CD I LN>245 D:'(LN=246&($E(RTN,1,3)=""|dd"")) E^XINDX1(19) ;patch 119"
,53,44620," D:LIN'?1.ANP E^XINDX1(18)"
,54,44620," S LIN=$P(LIN,"" "",2,999),IND(""LCC"")=1"
,55,44620," I LIN="""" D E^XINDX1(42) Q ;Blank line ;p110"
,56,44620," S I=0 ;Watch the scope of I, counts dots"
,57,44620," I "" .""[$E(LIN) D S X=$L($E(LIN,1,I),""."")-1,LIN=$E(LIN,I,999)"
,58,10770," . F I=1:1:245 Q:"". ""'[$E(LIN,I)"
,59,10770," . Q"
,60,0," ;check dots against Do level IND(""DO""), IND(""DOL"")=dot level"
,61,44620," D:'I&$G(IND(""DO1"")) E^XINDX1(51) S IND(""DO1"")=0 S:'I IND(""DO"")=0"
,62,44620," I I D:X>IND(""DO"") E^XINDX1(51) S (IND(""DO""),IND(""DOL""))=X"
,63,0," ;Count Comment lines, skip ;; lines"
,64,44620," I $E(LIN)="";"",$E(LIN,2)'="";"" S IND(""SZC"")=IND(""SZC"")+$L(LIN) ;p110"
,65,0," ;Process commands on line."
,66,116081,"EE I LIN="""" D ^XINDX2 Q"
,67,71461," S COM=$E(LIN),GK="""",ARG="""""
,68,71461," I COM="";"" S LIN="""" G EE ;p110"
,69,54870," I COM="" "" S ERR=$S(LIN?1."" "":13,1:0),LIN=$S(ERR:"""",1:$E(LIN,2,999)) D:ERR ^XINDX1 G EE"
,70,53608," D SEP"
,71,53608," S CM=$P(ARG,"":"",1),POST=$P(ARG,"":"",2,999),IND(""COM"")=IND(""COM"")_$C(9)_COM,ERR=48"
,72,53608," D:ARG["":""&(POST']"""") ^XINDX1 S:POST]"""" GRB=GRB_$C(9)_POST,IND(""COM"")=IND(""COM"")_"":"""
,73,0," ;SAC now allows lowercase commands"
,74,53608," I CM?.E1L.E S CM=$$CASE^XINDX52(CM),COM=$E(CM) ;I IND(""LCC"") S IND(""LCC"")=0 D E^XINDX1(47)"
,75,53608," I CM="""" D E^XINDX1(21) G EE ;Missing command"
,76,53608," S CX=$G(IND(""CMD"",CM)) I CX="""" D G:CX="""" EE"
,77,0," . I $E(CM)=""Z"" S CX=""^Z"" Q ;Proccess Z commands"
,78,0," . D E^XINDX1(1) S LIN="""" Q"
,79,53608," S CX=$P(CX,""^"",2,9)"
,80,53608," D SEP I '$L(LIN),CH="" "" D E^XINDX1(13) ;trailing space"
,81,53608," I ARG="""",""CGJMORSUWX""[COM S ERR=49 G ^XINDX1"
,82,53608," I CX>0 D E^XINDX1(CX) S CX="""""
,83,53608," D:$L(CX) @CX S:ARG'="""" GRB=GRB_$C(9)_ARG G EE"
,84,0,"B S ERR=25 G ^XINDX1"
,85,0,"C S ERR=29 G ^XINDX1"
,86,0,"D G DG1^XINDX4"
,87,0,"E Q:ARG="""" S ERR=7 G ^XINDX1"
,88,1559,"F G:ARG]"""" FR^XINDX4 S IND(""F"")=1 Q"
,89,1932,"G G DG^XINDX4"
,90,11,"H Q:ARG'="""" S ERR=32 G ^XINDX1"
,91,0,"J S ERR=36,ARG="""" G ^XINDX1"
,92,2218,"K S ERR=$S(ARG?1""("".E:22,ARG?."" "":23,1:0) D:ERR ^XINDX1"
,93,2218," G KL^XINDX3"
,94,259,"L G LO^XINDX4"
,95,30,"M G S^XINDX3"
,96,1721,"N G NE^XINDX3"
,97,0,"O S ERR=34 D ^XINDX1,O^XINDX3 Q"
,98,7762,"Q Q:ARG="""" G Q^XINDX4"
,99,85,"R S RDTIME=0 G RD^XINDX3"
,100,17549,"S G S^XINDX3"
,101,0,"TR Q ;What to process. p110"
,102,72,"U S ARG=$P(ARG,"":"") Q"
,103,0,"V S ARG="""",ERR=20 G ^XINDX1"
,104,4584,"W G WR^XINDX4"
,105,220,"X G XE^XINDX4"
,106,0,"Z S ERR=2 D ^XINDX1 G ZC^XINDX4"
,107,0," ;"
,108,0," ;Save off items from line."
,109,44620,"ST S R=LAB_$S(LABO:""+""_LABO,1:"""")"
,110,0," ;Local variable, Global, Marked Items, Naked global, Internal ref, eXternal ref., Tag ref."
,111,44620," S LOC="""" F S LOC=$O(V(LOC)),S="""" Q:LOC="""" F S S=$O(V(LOC,S)) Q:S="""" D SET"
,112,44620," S ^UTILITY($J,1,RTN,""COM"",TXT)=IND(""COM"")"
,113,44620," Q"
,114,0," ;"
,115,85079,"SET I V(LOC,S)]"""" F %=""!"",""~"" I V(LOC,S)[%,$G(^UTILITY($J,1,RTN,LOC,S))'[% S ^(S)=$G(^(S))_%"
,116,85079," S %=0"
,117,86891,"SE2 S ARG=$G(^UTILITY($J,1,RTN,LOC,S,%)) I $L(ARG)>230 S %=%+1 G SE2"
,118,85079," S ^UTILITY($J,1,RTN,LOC,S,%)=ARG_R_V(LOC,S)_"","""
,119,85079," Q"
,120,0," ;"
,121,0,"POSTRTN ;Do more overall checking"
,122,467," N V,E,T,T1,T2"
,123,467," S T="""" ;Check for missing Labels"
,124,467," F S T=$O(^UTILITY($J,1,RTN,""I"",T)),T2=T Q:T="""" S T1=$G(^(T,0)) D"
,125,2091," . Q:$E(T2,1,2)=""@("""
,126,2044," . S:$E(T2,1,2)=""$$"" T2=$E(T2,3,99)"
,127,2044," . I T2]"""",'$D(^UTILITY($J,1,RTN,""T"",$P(T2,""+"",1))) D"
,128,0," . . 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)"
,129,0," . . Q"
,130,2044," . Q"
,131,467," S LAB="""",LABO=0 ;Check for valid label names"
,132,467," I 'INDLC F S LAB=$O(^UTILITY($J,1,RTN,""T"",LAB)) Q:LAB="""" D"
,133,5073," . I '$$VA^XINDX2(LAB) D E^XINDX1(55) Q"
,134,5073," . D:'$$VT^XINDX2(LAB) E^XINDX1(37)"
,135,5073," . Q"
,136,467," S LAB="""",LABO=0 ;Check for valid variable names."
,137,467," F S LAB=$O(^UTILITY($J,1,RTN,""L"",LAB)) Q:LAB="""" D"
,138,15909," . D VLNF^XINDX3($P(LAB,""(""))"
,139,15909," . Q"
,140,467," Q"
,141,0," ;"
,142,0,"QUICK ;Quick, Just get a routine an print the results"
,143,0," D QUICK^XINDX6()"
,144,0," Q"
Totals for XINDEX,,2446443,
XINDX1,1,0,"XINDX1 ;ISC/REL,GRK,RWF - ERROR ROUTINE ;08/05/08 13:59"
,2,2," ;;7.3;TOOLKIT;**20,61,66,68,110,121,128**;Apr 25, 1995;Build 1"
,3,0," ; Per VHA Directive 2004-038, this routine should not be modified."
,4,2," G A"
,5,0,"E(ERR) ;"
,6,75,"A N %,%1 ;TXT is the line of the error."
,7,75," S ERTX=LAB_$S(LABO:""+""_LABO,1:"""")_$C(9),%1=$T(ERROR+ERR),ERTX=ERTX_$S(ERR:$P(%1,"";"",4,9),1:ERR) ;p110"
,8,75," I ERTX[""|"" F %=1:1 S ERTX=$P(ERTX,""|"")_$S($D(ERR(%)):ERR(%),1:""??"")_$P(ERTX,""|"",%+1,99) Q:ERTX'[""|"""
,9,75,"B I $P(%1,"";"",3)]"""" D Q:%1]"""" ;Don't flag kernel doing kernel."
,10,0," . S %1=$P(%1,"";"",3)"
,11,0," . F Q:RTN[$P(%1,"","") S %1=$P(%1,"","",2,99) ;quit if RTN[%1 or null."
,12,0," . Q"
,13,75," I ERR=17,$E(RTN)'=""%"",$E(LAB)=""%"" Q ;Don't flag %RTN w/o %."
,14,0," ;Global is Error Line,tab,error tag,tab,error text"
,15,75," S %=$G(^UTILITY($J,1,RTN,""E"",0))+1,^(0)=%,^(%)=TXT_$C(9)_ERTX"
,16,75," Q"
,17,0," ;"
,18,0," ;F = Fatal, S = Standard, W = Warning, I = Info"
,19,0,"ERROR ;"
,20,0,"1 ;;;F - UNDEFINED COMMAND (rest of line not checked)."
,21,0,"2 ;;;F - Non-standard (Undefined) 'Z' command."
,22,0,"3 ;;XTRMON;F - Undefined Function."
,23,0,"4 ;;;F - Undefined Special Variable."
,24,0,"5 ;;;F - Unmatched Parenthesis."
,25,0,"6 ;;;F - Unmatched Quotation Marks."
,26,0,"7 ;;;F - ELSE Command followed by only one space."
,27,0,"8 ;;;F - FOR Command did not contain '='."
,28,0,"9 ;;;I - QUIT Command followed by only one space."
,29,0,"10 ;;;F - Unrecognized argument in SET command."
,30,0,"11 ;;;W - Invalid local variable name."
,31,0,"12 ;;;W - Invalid global variable name."
,32,0,"13 ;;;W - Blank(s) at end of line."
,33,0,"14 ;;;F - Call to missing label '|' in this routine."
,34,0,"15 ;;;W - Duplicate label. (M57)"
,35,0,"16 ;;;F - Error in pattern code."
,36,0,"17 ;;;W - First line label NOT routine name."
,37,0,"18 ;;;W - Line contains a CONTROL (non-graphic) character."
,38,0,"19 ;;;S - Line is longer than 245 bytes."
,39,0,"20 ;;;S - View command used."
,40,0,"21 ;;;F - General Syntax Error."
,41,0,"22 ;;;S - Exclusive Kill."
,42,0,"23 ;;;S - Unargumented Kill."
,43,0,"24 ;;;S - Kill of an unsubscripted global."
,44,0,"25 ;;;S - Break command used."
,45,0,"26 ;;;S - Exclusive or Unargumented NEW command."
,46,0,"27 ;;;S - $View function used."
,47,0,"28 ;;ZOSV,ZIS,ZT;S - Non-standard $Z special variable used."
,48,0,"29 ;;ZIS,ZTM;S - 'Close' command should be invoked through 'D ^%ZISC'."
,49,0,"30 ;;;S - LABEL+OFFSET syntax."
,50,0,"31 ;;ZOSV,ZIS,ZT;S - Non-standard $Z function used."
,51,0,"32 ;;;S - 'HALT' command should be invoked through 'G ^XUSCLEAN'."
,52,0,"33 ;;;S - Read command doesn't have a timeout."
,53,0,"34 ;;ZIS;S - 'OPEN' command should be invoked through ^%ZIS."
,54,0,"35 ;;;S - Routine exceeds SACC maximum size of 20000 (|)."
,55,0,"36 ;;ZTM;S - Should use 'TASKMAN' instead of 'JOB' command."
,56,0,"37 ;;;F - Label is not valid."
,57,0,"38 ;;;F - Call to this |"
,58,0,"39 ;;ZIS,XUS,XUP;S - Kill of a protected variable (|)."
,59,0,"40 ;;;S - Space where a command should be."
,60,0,"41 ;;;I - Star or pound READ used."
,61,0,"42 ;;;W - Null line (no commands or comment)."
,62,0,"43 ;;;F - Invalid or wrong number of arguments to a function."
,63,0,"44 ;;;S - 2nd line of routine violates the SAC."
,64,0,"45 ;;ZT,ZIS,XUTM,XTER;S - Set to a '%' global."
,65,0,"46 ;;;F - Quoted string not followed by a separator."
,66,0,"47 ;;;S - Lowercase command(s) used in line."
,67,0,"48 ;;;F - Missing argument to a command post-conditional."
,68,0,"49 ;;;F - Command missing an argument."
,69,0,"50 ;;ZTM;S - Extended reference."
,70,0,"51 ;;;F - Block structure mismatch."
,71,0,"52 ;;;F - Reference to routine '^|'. That isn't in this UCI."
,72,0,"53 ;;;F - Bad Number."
,73,0,"54 ;;XG;S - Access to SSVN's restricted to Kernel."
,74,0,"55 ;;;S - Violates VA programming standards."
,75,0,"56 ;;;S - Patch number '|' missing from second line."
,76,0,"57 ;;;S - Lower/Mixed case Variable name used."
,77,0,"58 ;;;S - Routine code exceeds SACC maximum size of 15000 (|)."
,78,0,"59 ;;;F - Bad WRITE syntax."
,79,0,"60 ;;;S - Lock missing Timeout."
,80,0,"61 ;;;S - Non-Incremental Lock."
,81,0,"62 ;;;S - First line of routine violates the SAC."
,82,0,"63 ;;;F - GO or DO mismatch from block structure (M45)."
Totals for XINDX1,,529,

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/MumpsCacheCoverage

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

View File

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