From 1e411701238f9353cd3cb54e2898b9cf707ff6bf Mon Sep 17 00:00:00 2001 From: Christian Stenger Date: Wed, 1 Feb 2023 11:32:57 +0100 Subject: [PATCH] Squish: Improve handling of license issues When running a test case and having no license present we do not get any result, so do not try to merge the result files at all. Additionally inform the user about the license issue directly and avoid starting multiple test runners when executing e.g. a complete suite and the runner had already an license issue. Change-Id: Idf6c07e95b81228775f7d6ef691c31efaf6ecdbc Reviewed-by: David Schulz --- src/plugins/squish/squishrunnerprocess.h | 2 ++ src/plugins/squish/squishtools.cpp | 11 +++++++++++ 2 files changed, 13 insertions(+) diff --git a/src/plugins/squish/squishrunnerprocess.h b/src/plugins/squish/squishrunnerprocess.h index b3200eb89d9..b1c98220c17 100644 --- a/src/plugins/squish/squishrunnerprocess.h +++ b/src/plugins/squish/squishrunnerprocess.h @@ -35,6 +35,8 @@ public: void requestExpanded(const QString &variableName); Utils::Links setBreakpoints(const QString &scriptExtension); + bool lastRunHadLicenseIssues() const { return m_licenseIssues; } + signals: void queryDone(const QString &output, const QString &error); void recorderDone(); diff --git a/src/plugins/squish/squishtools.cpp b/src/plugins/squish/squishtools.cpp index 107a3c6bfab..58be2a78c30 100644 --- a/src/plugins/squish/squishtools.cpp +++ b/src/plugins/squish/squishtools.cpp @@ -452,6 +452,10 @@ void SquishTools::onRunnerStopped() m_request = ServerStopRequested; qCInfo(LOG) << "Stopping server from RunnerStopped"; stopSquishServer(); + if (QTC_GUARD(m_primaryRunner) && m_primaryRunner->lastRunHadLicenseIssues()) { + SquishMessages::criticalMessage(Tr::tr("Could not get Squish license from server.")); + return; + } QString error; SquishXmlOutputHandler::mergeResultFiles(m_reportFiles, m_currentResultsDirectory, @@ -461,6 +465,13 @@ void SquishTools::onRunnerStopped() SquishMessages::criticalMessage(error); logrotateTestResults(); } else { + if (QTC_GUARD(m_primaryRunner) && m_primaryRunner->lastRunHadLicenseIssues()) { + m_request = ServerStopRequested; + qCInfo(LOG) << "Stopping server from RunnerStopped (multiple testcases, no license)"; + stopSquishServer(); + SquishMessages::criticalMessage(Tr::tr("Could not get Squish license from server.")); + return; + } m_xmlOutputHandler->clearForNextRun(); m_perspective.setPerspectiveMode(SquishPerspective::Running); logAndChangeRunnerState(RunnerState::Starting);