AutoTest: Support durations for all frameworks

Even if the test framework has no builtin support for displaying
durations we are able to give at least an approximation of the
used time.
So, use the process execution duration as proximity for the
duration of all tests of an executable to avoid displaying
even more wrong summaries (when mixing frameworks with and
without duration support).
This enables the summary duration for Boost tests.

Task-number: QTCREATORBUG-31242
Change-Id: Ifa00038150cc35b66b3f20cc617e15f98b7264ca
Reviewed-by: David Schulz <david.schulz@qt.io>
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
This commit is contained in:
Christian Stenger
2024-09-03 09:32:24 +02:00
parent 4c4ad3b567
commit c740cd3cb1
2 changed files with 3 additions and 4 deletions

View File

@@ -25,8 +25,7 @@ public:
int disabledTests() const { return m_disabled; }
bool hasSummary() const { return !m_summary.isEmpty(); }
QHash<ResultType, int> summary() const { return m_summary; }
bool hasDuration() const { return m_executionDuration.has_value(); }
int duration() const { return m_executionDuration.value(); }
std::optional<int> duration() const { return m_executionDuration; }
void setId(const QString &id) { m_id = id; }
QString id() const { return m_id; }

View File

@@ -454,8 +454,8 @@ void TestRunner::runTestsHelper()
emit hadDisabledTests(disabled);
if (testStorage->m_outputReader->hasSummary())
emit reportSummary(testStorage->m_outputReader->id(), testStorage->m_outputReader->summary());
if (testStorage->m_outputReader->hasDuration())
emit reportDuration(testStorage->m_outputReader->duration());
emit reportDuration(testStorage->m_outputReader->duration().value_or(
process.processDuration().count()));
testStorage->m_outputReader->resetCommandlineColor();
}