| 522 | } |
| 523 | |
| 524 | bool cmCTest::UpdateCTestConfiguration() |
| 525 | { |
| 526 | std::string fileName = this->Impl->BinaryDir + "/CTestConfiguration.ini"; |
| 527 | if (!cmSystemTools::FileExists(fileName)) { |
| 528 | fileName = this->Impl->BinaryDir + "/DartConfiguration.tcl"; |
| 529 | } |
| 530 | cmCTestLog(this, HANDLER_VERBOSE_OUTPUT, |
| 531 | "UpdateCTestConfiguration from :" << fileName << "\n"); |
| 532 | if (!cmSystemTools::FileExists(fileName)) { |
| 533 | // No need to exit if we are not producing XML |
| 534 | if (this->Impl->ProduceXML) { |
| 535 | cmCTestLog(this, WARNING, "Cannot find file: " << fileName << std::endl); |
| 536 | return false; |
| 537 | } |
| 538 | } else { |
| 539 | cmCTestLog(this, HANDLER_VERBOSE_OUTPUT, |
| 540 | "Parse Config file:" << fileName << "\n"); |
| 541 | // parse the dart test file |
| 542 | cmsys::ifstream fin(fileName.c_str()); |
| 543 | |
| 544 | if (!fin) { |
| 545 | return false; |
| 546 | } |
| 547 | |
| 548 | char buffer[1024]; |
| 549 | while (fin) { |
| 550 | buffer[0] = 0; |
| 551 | fin.getline(buffer, 1023); |
| 552 | buffer[1023] = 0; |
| 553 | std::string line = cmCTest::CleanString(buffer); |
| 554 | if (line.empty()) { |
| 555 | continue; |
| 556 | } |
| 557 | while (fin && (line.back() == '\\')) { |
| 558 | line.resize(line.size() - 1); |
| 559 | buffer[0] = 0; |
| 560 | fin.getline(buffer, 1023); |
| 561 | buffer[1023] = 0; |
| 562 | line += cmCTest::CleanString(buffer); |
| 563 | } |
| 564 | if (line[0] == '#') { |
| 565 | continue; |
| 566 | } |
| 567 | std::string::size_type cpos = line.find_first_of(':'); |
| 568 | if (cpos == std::string::npos) { |
| 569 | continue; |
| 570 | } |
| 571 | std::string key = line.substr(0, cpos); |
| 572 | std::string value = cmCTest::CleanString(line, cpos + 1); |
| 573 | this->Impl->CTestConfiguration[key] = value; |
| 574 | } |
| 575 | fin.close(); |
| 576 | } |
| 577 | if (!this->GetCTestConfiguration("BuildDirectory").empty()) { |
| 578 | this->Impl->BinaryDir = this->GetCTestConfiguration("BuildDirectory"); |
| 579 | if (this->Impl->TestDir.empty()) { |
| 580 | cmSystemTools::SetLogicalWorkingDirectory(this->Impl->BinaryDir); |
| 581 | } |
no test coverage detected