| 87 | } |
| 88 | |
| 89 | void CTestRunJob::start() |
| 90 | { |
| 91 | // if (!m_suite->cases().isEmpty()) |
| 92 | // { |
| 93 | // TODO: Find a better way of determining whether QTestLib is used by this test |
| 94 | // qCDebug(CMAKE_TESTING) << "Setting a QtTestDelegate"; |
| 95 | // setDelegate(new QtTestDelegate); |
| 96 | // } |
| 97 | // setStandardToolView(IOutputView::RunView); |
| 98 | |
| 99 | QStringList arguments = m_cases; |
| 100 | if (m_cases.isEmpty() && !m_suite->arguments().isEmpty()) |
| 101 | { |
| 102 | arguments = m_suite->arguments(); |
| 103 | } |
| 104 | |
| 105 | QStringList cases_selected = arguments; |
| 106 | arguments.prepend(m_suite->executable().toLocalFile()); |
| 107 | const QString workingDirectory = m_suite->properties().value(QStringLiteral("WORKING_DIRECTORY"), QString()); |
| 108 | |
| 109 | m_job = createTestJob(QStringLiteral("execute"), arguments, workingDirectory); |
| 110 | |
| 111 | // If the native app job that we are looking for has no dependency, |
| 112 | // it is run by itself. Cast to check this possibility. |
| 113 | auto* outputJob = qobject_cast<OutputJob*>(m_job); |
| 114 | if (!outputJob) { |
| 115 | // The native app job and its BuilderJob dependency can be |
| 116 | // packaged in an ExecuteCompositeJob. Try to find it there. |
| 117 | if (auto* cjob = qobject_cast<ExecuteCompositeJob*>(m_job)) { |
| 118 | outputJob = cjob->findChild<OutputJob*>(); |
| 119 | } |
| 120 | } |
| 121 | if (outputJob) { |
| 122 | outputJob->setVerbosity(m_verbosity); |
| 123 | |
| 124 | QString testName = m_suite->name(); |
| 125 | QString title; |
| 126 | if (cases_selected.count() == 1) |
| 127 | title = i18nc("running test %1, %2 test case", "CTest %1: %2", testName, cases_selected.value(0)); |
| 128 | else |
| 129 | title = i18ncp("running test %1, %2 number of test cases", "CTest %2 (%1)", "CTest %2 (%1)", |
| 130 | cases_selected.count(), testName); |
| 131 | |
| 132 | outputJob->setTitle(title); |
| 133 | |
| 134 | m_outputModel = qobject_cast<OutputModel*>(outputJob->model()); |
| 135 | connect(m_outputModel, &QAbstractItemModel::rowsInserted, this, &CTestRunJob::rowsInserted); |
| 136 | } |
| 137 | |
| 138 | connect(m_job, &KJob::finished, this, &CTestRunJob::processFinished); |
| 139 | |
| 140 | ICore::self()->testController()->notifyTestRunStarted(m_suite, cases_selected); |
| 141 | } |
| 142 | |
| 143 | bool CTestRunJob::doKill() |
| 144 | { |
no test coverage detected