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 <david.schulz@qt.io>
This commit is contained in:
Christian Stenger
2023-02-01 11:32:57 +01:00
parent 2b00256ebf
commit 1e41170123
2 changed files with 13 additions and 0 deletions

View File

@@ -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();

View File

@@ -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);