| 1397 | } |
| 1398 | |
| 1399 | void cmCTestMultiProcessHandler::PrintOutputAsJson() |
| 1400 | { |
| 1401 | this->TestHandler->SetMaxIndex(this->FindMaxIndex()); |
| 1402 | |
| 1403 | Json::Value result = Json::objectValue; |
| 1404 | result["kind"] = "ctestInfo"; |
| 1405 | result["version"] = DumpVersion(1, 0); |
| 1406 | |
| 1407 | BacktraceData backtraceGraph; |
| 1408 | Json::Value tests = Json::arrayValue; |
| 1409 | for (auto& it : this->Properties) { |
| 1410 | cmCTestTestHandler::cmCTestTestProperties& p = *it.second; |
| 1411 | |
| 1412 | // Don't worry if this fails, we are only showing the test list, not |
| 1413 | // running the tests |
| 1414 | cmWorkingDirectory workdir(p.Directory); |
| 1415 | cmCTestRunTest testRun(*this, p.Index); |
| 1416 | testRun.ComputeArguments(); |
| 1417 | |
| 1418 | // Skip tests not available in this configuration. |
| 1419 | if (p.Args.size() >= 2 && p.Args[1] == "NOT_AVAILABLE") { |
| 1420 | continue; |
| 1421 | } |
| 1422 | |
| 1423 | Json::Value testInfo = DumpCTestInfo(testRun, p, backtraceGraph); |
| 1424 | tests.append(testInfo); |
| 1425 | } |
| 1426 | result["backtraceGraph"] = backtraceGraph.Dump(); |
| 1427 | result["tests"] = std::move(tests); |
| 1428 | |
| 1429 | Json::StreamWriterBuilder builder; |
| 1430 | builder["indentation"] = " "; |
| 1431 | std::unique_ptr<Json::StreamWriter> jout(builder.newStreamWriter()); |
| 1432 | jout->write(result, &std::cout); |
| 1433 | } |
| 1434 | |
| 1435 | // For ShowOnly mode |
| 1436 | void cmCTestMultiProcessHandler::PrintTestList() |
no test coverage detected