Squish: Fix querying server

Broke with switching the stdout handling from handling it
directly to using a callback in 27c8e2a638.

Change-Id: I69a9058b92807b0a4083b242eb7e4e982baa9096
Reviewed-by: David Schulz <david.schulz@qt.io>
This commit is contained in:
Christian Stenger
2022-09-02 14:55:27 +02:00
parent 5047802f0a
commit 61f1a40f4e
3 changed files with 11 additions and 6 deletions

View File

@@ -117,7 +117,7 @@ class SquishServerSettings : public AspectContainer
public: public:
SquishServerSettings(); SquishServerSettings();
void setFromXmlOutput(const QByteArray &output); void setFromXmlOutput(const QString &output);
QMap<QString, QString> mappedAuts; // name, path QMap<QString, QString> mappedAuts; // name, path
QMap<QString, QString> attachableAuts; // name, host:port QMap<QString, QString> attachableAuts; // name, host:port
@@ -181,7 +181,7 @@ InfoMode infoModeFromType(const QString &type)
return None; return None;
} }
void SquishServerSettings::setFromXmlOutput(const QByteArray &output) void SquishServerSettings::setFromXmlOutput(const QString &output)
{ {
SquishServerSettings newSettings; SquishServerSettings newSettings;
InfoMode infoMode = None; InfoMode infoMode = None;
@@ -403,7 +403,7 @@ SquishServerSettingsWidget::SquishServerSettingsWidget(QWidget *parent)
// query settings // query settings
SquishTools *squishTools = SquishTools::instance(); SquishTools *squishTools = SquishTools::instance();
connect(squishTools, &SquishTools::queryFinished, this, connect(squishTools, &SquishTools::queryFinished, this,
[this, progress] (const QByteArray &out) { [this, progress] (const QString &out) {
m_serverSettings.setFromXmlOutput(out); m_serverSettings.setFromXmlOutput(out);
m_originalSettings.setFromXmlOutput(out); m_originalSettings.setFromXmlOutput(out);
repopulateApplicationView(); repopulateApplicationView();

View File

@@ -202,6 +202,7 @@ void SquishTools::queryServerSettings()
return; return;
} }
m_squishRunnerMode = QueryMode; m_squishRunnerMode = QueryMode;
m_fullRunnerOutput.clear();
startSquishServer(RunnerQueryRequested); startSquishServer(RunnerQueryRequested);
} }
@@ -497,8 +498,9 @@ void SquishTools::onServerFinished()
void SquishTools::onRunnerFinished() void SquishTools::onRunnerFinished()
{ {
if (m_squishRunnerMode == QueryMode) { if (m_squishRunnerMode == QueryMode) {
emit queryFinished(m_runnerProcess.readAllStandardOutput()); emit queryFinished(m_fullRunnerOutput);
setState(RunnerStopped); setState(RunnerStopped);
m_fullRunnerOutput.clear();
return; return;
} }
@@ -663,8 +665,10 @@ void SquishTools::onRunnerErrorOutput()
void SquishTools::onRunnerStdOutput(const QString &lineIn) void SquishTools::onRunnerStdOutput(const QString &lineIn)
{ {
if (m_request == RunnerQueryRequested) // only handle test runs here if (m_request == RunnerQueryRequested) { // only handle test runs here
m_fullRunnerOutput.append(lineIn); // but store output for query, see onRunnerFinished()
return; return;
}
int fileLine = -1; int fileLine = -1;
int fileColumn = -1; int fileColumn = -1;

View File

@@ -61,7 +61,7 @@ signals:
void squishTestRunStarted(); void squishTestRunStarted();
void squishTestRunFinished(); void squishTestRunFinished();
void resultOutputCreated(const QByteArray &output); void resultOutputCreated(const QByteArray &output);
void queryFinished(const QByteArray &output); void queryFinished(const QString &output);
void configChangesFailed(QProcess::ProcessError error); void configChangesFailed(QProcess::ProcessError error);
void configChangesWritten(); void configChangesWritten();
void localsUpdated(const QString &output); void localsUpdated(const QString &output);
@@ -122,6 +122,7 @@ private:
QStringList m_testCases; QStringList m_testCases;
QStringList m_reportFiles; QStringList m_reportFiles;
QString m_currentResultsDirectory; QString m_currentResultsDirectory;
QString m_fullRunnerOutput; // used when querying the server
Utils::FilePath m_currentTestCasePath; Utils::FilePath m_currentTestCasePath;
QFile *m_currentResultsXML = nullptr; QFile *m_currentResultsXML = nullptr;
QFileSystemWatcher *m_resultsFileWatcher = nullptr; QFileSystemWatcher *m_resultsFileWatcher = nullptr;