forked from qt-creator/qt-creator
Squish: Use new approach for recorder
Change-Id: I9fe897b0f38f418135b39904ea16737a60248b25 Reviewed-by: David Schulz <david.schulz@qt.io>
This commit is contained in:
@@ -33,6 +33,9 @@ void SquishRunnerProcess::setupProcess(RunnerMode mode)
|
|||||||
break;
|
break;
|
||||||
case QueryServer:
|
case QueryServer:
|
||||||
break;
|
break;
|
||||||
|
case Record:
|
||||||
|
m_process.setProcessMode(Utils::ProcessMode::Writer);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -52,6 +55,8 @@ void SquishRunnerProcess::onDone()
|
|||||||
const QString error = m_licenseIssues ? Tr::tr("Could not get Squish license from server.")
|
const QString error = m_licenseIssues ? Tr::tr("Could not get Squish license from server.")
|
||||||
: QString();
|
: QString();
|
||||||
emit queryDone(m_process.stdOut(), error);
|
emit queryDone(m_process.stdOut(), error);
|
||||||
|
} if (m_mode == Record) {
|
||||||
|
emit recorderDone();
|
||||||
} else {
|
} else {
|
||||||
emit runnerFinished(); // handle output file stuff - FIXME move over to runner?
|
emit runnerFinished(); // handle output file stuff - FIXME move over to runner?
|
||||||
}
|
}
|
||||||
@@ -134,6 +139,7 @@ static QString cmdToString(SquishRunnerProcess::RunnerCommand cmd)
|
|||||||
{
|
{
|
||||||
switch (cmd) {
|
switch (cmd) {
|
||||||
case SquishRunnerProcess::Continue: return "continue\n";
|
case SquishRunnerProcess::Continue: return "continue\n";
|
||||||
|
case SquishRunnerProcess::EndRecord: return "endrecord\n";
|
||||||
case SquishRunnerProcess::Exit: return "exit\n";
|
case SquishRunnerProcess::Exit: return "exit\n";
|
||||||
case SquishRunnerProcess::Next: return "next\n";
|
case SquishRunnerProcess::Next: return "next\n";
|
||||||
case SquishRunnerProcess::PrintVariables: return "print variables\n";
|
case SquishRunnerProcess::PrintVariables: return "print variables\n";
|
||||||
|
|||||||
@@ -15,8 +15,8 @@ class SquishRunnerProcess : public SquishProcessBase
|
|||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
enum RunnerCommand { Continue, Exit, Next, PrintVariables, Quit, Return, Step };
|
enum RunnerCommand { Continue, EndRecord, Exit, Next, PrintVariables, Quit, Return, Step };
|
||||||
enum RunnerMode { Run, StartAut, QueryServer };
|
enum RunnerMode { Run, StartAut, QueryServer, Record };
|
||||||
enum RunnerError { InvalidSocket, MappedAutMissing };
|
enum RunnerError { InvalidSocket, MappedAutMissing };
|
||||||
|
|
||||||
explicit SquishRunnerProcess(QObject *parent = nullptr);
|
explicit SquishRunnerProcess(QObject *parent = nullptr);
|
||||||
@@ -37,6 +37,7 @@ public:
|
|||||||
|
|
||||||
signals:
|
signals:
|
||||||
void queryDone(const QString &output, const QString &error);
|
void queryDone(const QString &output, const QString &error);
|
||||||
|
void recorderDone();
|
||||||
void runnerFinished();
|
void runnerFinished();
|
||||||
void interrupted(const QString &fileName, int line, int column);
|
void interrupted(const QString &fileName, int line, int column);
|
||||||
void localsUpdated(const QString &output);
|
void localsUpdated(const QString &output);
|
||||||
|
|||||||
@@ -589,14 +589,15 @@ void SquishTools::setupAndStartRecorder()
|
|||||||
args << "--useScriptedObjectMap";
|
args << "--useScriptedObjectMap";
|
||||||
args << "--autid" << QString::number(m_primaryRunner->autId());
|
args << "--autid" << QString::number(m_primaryRunner->autId());
|
||||||
|
|
||||||
m_secondaryRunner = new QtcProcess(this);
|
m_secondaryRunner = new SquishRunnerProcess(this);
|
||||||
m_secondaryRunner->setProcessMode(ProcessMode::Writer);
|
m_secondaryRunner->setupProcess(SquishRunnerProcess::Record);
|
||||||
m_secondaryRunner->setCommand({toolsSettings.runnerPath, args});
|
const CommandLine cmd = {toolsSettings.runnerPath, args};
|
||||||
connect(m_secondaryRunner, &QtcProcess::done, this, &SquishTools::onRecorderFinished);
|
connect(m_secondaryRunner, &SquishRunnerProcess::recorderDone,
|
||||||
qCDebug(LOG) << "Recorder starting:" << m_secondaryRunner->commandLine().toUserOutput();
|
this, &SquishTools::onRecorderFinished);
|
||||||
|
qCDebug(LOG) << "Recorder starting:" << cmd.toUserOutput();
|
||||||
if (m_suiteConf.objectMapPath().isReadableFile())
|
if (m_suiteConf.objectMapPath().isReadableFile())
|
||||||
Core::DocumentManager::expectFileChange(m_suiteConf.objectMapPath());
|
Core::DocumentManager::expectFileChange(m_suiteConf.objectMapPath());
|
||||||
m_secondaryRunner->start();
|
m_secondaryRunner->start(cmd, squishEnvironment());
|
||||||
}
|
}
|
||||||
|
|
||||||
void SquishTools::stopRecorder()
|
void SquishTools::stopRecorder()
|
||||||
@@ -604,10 +605,10 @@ void SquishTools::stopRecorder()
|
|||||||
QTC_ASSERT(m_secondaryRunner && m_secondaryRunner->isRunning(), return);
|
QTC_ASSERT(m_secondaryRunner && m_secondaryRunner->isRunning(), return);
|
||||||
if (m_squishRunnerState == RunnerState::CancelRequested) {
|
if (m_squishRunnerState == RunnerState::CancelRequested) {
|
||||||
qCDebug(LOG) << "Stopping recorder (exit)";
|
qCDebug(LOG) << "Stopping recorder (exit)";
|
||||||
m_secondaryRunner->write("exit\n");
|
m_secondaryRunner->writeCommand(SquishRunnerProcess::Exit);
|
||||||
} else {
|
} else {
|
||||||
qCDebug(LOG) << "Stopping recorder (endrecord)";
|
qCDebug(LOG) << "Stopping recorder (endrecord)";
|
||||||
m_secondaryRunner->write("endrecord\n");
|
m_secondaryRunner->writeCommand(SquishRunnerProcess::EndRecord);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -688,7 +689,7 @@ void SquishTools::onRunnerFinished()
|
|||||||
void SquishTools::onRecorderFinished()
|
void SquishTools::onRecorderFinished()
|
||||||
{
|
{
|
||||||
QTC_ASSERT(m_secondaryRunner, return);
|
QTC_ASSERT(m_secondaryRunner, return);
|
||||||
qCDebug(LOG) << "Recorder finished:" << m_secondaryRunner->exitCode();
|
qCDebug(LOG) << "Recorder finished"; // exit code?
|
||||||
m_secondaryRunner->deleteLater();
|
m_secondaryRunner->deleteLater();
|
||||||
m_secondaryRunner = nullptr;
|
m_secondaryRunner = nullptr;
|
||||||
|
|
||||||
|
|||||||
@@ -135,7 +135,7 @@ private:
|
|||||||
SquishServerProcess m_serverProcess;
|
SquishServerProcess m_serverProcess;
|
||||||
|
|
||||||
SquishRunnerProcess *m_primaryRunner = nullptr;
|
SquishRunnerProcess *m_primaryRunner = nullptr;
|
||||||
Utils::QtcProcess *m_secondaryRunner = nullptr;
|
SquishRunnerProcess *m_secondaryRunner = nullptr;
|
||||||
|
|
||||||
QString m_serverHost;
|
QString m_serverHost;
|
||||||
Request m_request = None;
|
Request m_request = None;
|
||||||
|
|||||||
Reference in New Issue
Block a user