|
|
@@ -1709,29 +1709,26 @@ int cmCTestCoverageHandler::HandleTracePyCoverage(
|
|
|
|
|
|
// Read the coverage count from the beginning of the Trace.py output
|
|
|
// line
|
|
|
- std::string prefix = nl.substr(0, 6);
|
|
|
- if (prefix[5] != ' ' && prefix[5] != ':') {
|
|
|
- // This is a hack. We should really do something more elaborate
|
|
|
- prefix = nl.substr(0, 7);
|
|
|
- if (prefix[6] != ' ' && prefix[6] != ':') {
|
|
|
- prefix = nl.substr(0, 8);
|
|
|
- if (prefix[7] != ' ' && prefix[7] != ':') {
|
|
|
- cmCTestLog(this->CTest, ERROR_MESSAGE,
|
|
|
- "Currently the limit is maximum coverage of 999999"
|
|
|
- << std::endl);
|
|
|
- }
|
|
|
+ std::string::size_type pos;
|
|
|
+ int cov = 0;
|
|
|
+ // This is a hack. We should really do something more elaborate
|
|
|
+ for (pos = 5; pos < 8; pos++) {
|
|
|
+ if (nl[pos] == ' ') {
|
|
|
+ // This line does not have ':' so no coverage here. That said,
|
|
|
+ // Trace.py does not handle not covered lines versus comments etc.
|
|
|
+ // So, this will be set to 0.
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ if (nl[pos] == ':') {
|
|
|
+ cov = atoi(nl.substr(0, pos - 1).c_str());
|
|
|
+ break;
|
|
|
}
|
|
|
}
|
|
|
- int cov = atoi(prefix.c_str());
|
|
|
- if (prefix[prefix.size() - 1] != ':') {
|
|
|
- // This line does not have ':' so no coverage here. That said,
|
|
|
- // Trace.py does not handle not covered lines versus comments etc.
|
|
|
- // So, this will be set to 0.
|
|
|
- cov = 0;
|
|
|
+ if (pos == 8) {
|
|
|
+ cmCTestLog(this->CTest, ERROR_MESSAGE,
|
|
|
+ "Currently the limit is maximum coverage of 999999"
|
|
|
+ << std::endl);
|
|
|
}
|
|
|
- cmCTestOptionalLog(
|
|
|
- this->CTest, DEBUG,
|
|
|
- "Prefix: " << prefix << " cov: " << cov << std::endl, this->Quiet);
|
|
|
// Read the line number starting at the 10th character of the gcov
|
|
|
// output line
|
|
|
long lineIdx = cnt;
|