| 875 | } |
| 876 | |
| 877 | void cmCTestMultiProcessHandler::ReadCostData() |
| 878 | { |
| 879 | std::string fname = this->CTest->GetCostDataFile(); |
| 880 | |
| 881 | if (cmSystemTools::FileExists(fname, true)) { |
| 882 | cmsys::ifstream fin; |
| 883 | fin.open(fname.c_str()); |
| 884 | std::string line; |
| 885 | while (std::getline(fin, line)) { |
| 886 | if (line == "---") { |
| 887 | break; |
| 888 | } |
| 889 | |
| 890 | // Format: <name> <previous_runs> <avg_cost> |
| 891 | cm::optional<CostEntry> entry = splitCostLine(line); |
| 892 | |
| 893 | // Probably an older version of the file, will be fixed next run |
| 894 | if (!entry) { |
| 895 | fin.close(); |
| 896 | return; |
| 897 | } |
| 898 | |
| 899 | int index = this->SearchByName(entry->name); |
| 900 | if (index == -1) { |
| 901 | continue; |
| 902 | } |
| 903 | |
| 904 | this->Properties[index]->PreviousRuns = entry->prevRuns; |
| 905 | // When not running in parallel mode, don't use cost data |
| 906 | if (this->GetParallelLevel() > 1 && this->Properties[index] && |
| 907 | this->Properties[index]->Cost == 0) { |
| 908 | this->Properties[index]->Cost = entry->cost; |
| 909 | } |
| 910 | } |
| 911 | // Next part of the file is the failed tests |
| 912 | while (std::getline(fin, line)) { |
| 913 | if (!line.empty()) { |
| 914 | this->LastTestsFailed.push_back(line); |
| 915 | } |
| 916 | } |
| 917 | fin.close(); |
| 918 | } |
| 919 | } |
| 920 | |
| 921 | int cmCTestMultiProcessHandler::SearchByName(cm::string_view name) |
| 922 | { |
no test coverage detected