MCPcopy Create free account
hub / github.com/Kitware/CMake / ReadCMCovFile

Method ReadCMCovFile

Source/CTest/cmParseCacheCoverage.cxx:73–178  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

71}
72
73bool cmParseCacheCoverage::ReadCMCovFile(char const* file)
74{
75 cmsys::ifstream in(file);
76 if (!in) {
77 cmCTestLog(this->CTest, ERROR_MESSAGE, "Can not open : " << file << "\n");
78 return false;
79 }
80 std::string line;
81 if (!cmSystemTools::GetLineFromStream(in, line)) {
82 cmCTestLog(this->CTest, ERROR_MESSAGE,
83 "Empty file : " << file
84 << " referenced in this line of cmcov data:\n"
85 "["
86 << line << "]\n");
87 return false;
88 }
89 std::vector<std::string> separateLine =
90 cmSystemTools::SplitString(line, ',');
91 if (separateLine.size() != 4 || separateLine[0] != "Routine" ||
92 separateLine[1] != "Line" || separateLine[2] != "RtnLine" ||
93 separateLine[3] != "Code") {
94 cmCTestLog(this->CTest, ERROR_MESSAGE,
95 "Bad first line of cmcov file : " << file
96 << " line:\n"
97 "["
98 << line << "]\n");
99 }
100 std::string routine;
101 std::string filepath;
102 while (cmSystemTools::GetLineFromStream(in, line)) {
103 // parse the comma separated line
104 separateLine = cmSystemTools::SplitString(line, ',');
105 // might have more because code could have a quoted , in it
106 // but we only care about the first 3 args anyway
107 if (separateLine.size() < 4) {
108 cmCTestLog(this->CTest, ERROR_MESSAGE,
109 "Bad line of cmcov file expected at least 4 found: "
110 << separateLine.size() << " " << file
111 << " line:\n"
112 "["
113 << line << "]\n");
114 for (std::string::size_type i = 0; i < separateLine.size(); ++i) {
115 cmCTestLog(this->CTest, ERROR_MESSAGE, "" << separateLine[1] << " ");
116 }
117 cmCTestLog(this->CTest, ERROR_MESSAGE, "\n");
118 return false;
119 }
120 // if we do not have a routine yet, then it should be
121 // the first argument in the vector
122 if (routine.empty()) {
123 routine = separateLine[0];
124 // Find the full path to the file
125 if (!this->FindMumpsFile(routine, filepath)) {
126 cmCTestLog(this->CTest, ERROR_MESSAGE,
127 "Could not find mumps file for routine: " << routine
128 << "\n");
129 filepath.clear();
130 continue; // move to next line

Callers 1

LoadCoverageDataMethod · 0.95

Calls 7

cmHasLiteralPrefixFunction · 0.85
FindMumpsFileMethod · 0.80
c_strMethod · 0.80
push_backMethod · 0.80
sizeMethod · 0.45
emptyMethod · 0.45
clearMethod · 0.45

Tested by

no test coverage detected