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;
|
||||
case QueryServer:
|
||||
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.")
|
||||
: QString();
|
||||
emit queryDone(m_process.stdOut(), error);
|
||||
} if (m_mode == Record) {
|
||||
emit recorderDone();
|
||||
} else {
|
||||
emit runnerFinished(); // handle output file stuff - FIXME move over to runner?
|
||||
}
|
||||
@@ -134,6 +139,7 @@ static QString cmdToString(SquishRunnerProcess::RunnerCommand cmd)
|
||||
{
|
||||
switch (cmd) {
|
||||
case SquishRunnerProcess::Continue: return "continue\n";
|
||||
case SquishRunnerProcess::EndRecord: return "endrecord\n";
|
||||
case SquishRunnerProcess::Exit: return "exit\n";
|
||||
case SquishRunnerProcess::Next: return "next\n";
|
||||
case SquishRunnerProcess::PrintVariables: return "print variables\n";
|
||||
|
||||
@@ -15,8 +15,8 @@ class SquishRunnerProcess : public SquishProcessBase
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
enum RunnerCommand { Continue, Exit, Next, PrintVariables, Quit, Return, Step };
|
||||
enum RunnerMode { Run, StartAut, QueryServer };
|
||||
enum RunnerCommand { Continue, EndRecord, Exit, Next, PrintVariables, Quit, Return, Step };
|
||||
enum RunnerMode { Run, StartAut, QueryServer, Record };
|
||||
enum RunnerError { InvalidSocket, MappedAutMissing };
|
||||
|
||||
explicit SquishRunnerProcess(QObject *parent = nullptr);
|
||||
@@ -37,6 +37,7 @@ public:
|
||||
|
||||
signals:
|
||||
void queryDone(const QString &output, const QString &error);
|
||||
void recorderDone();
|
||||
void runnerFinished();
|
||||
void interrupted(const QString &fileName, int line, int column);
|
||||
void localsUpdated(const QString &output);
|
||||
|
||||
@@ -589,14 +589,15 @@ void SquishTools::setupAndStartRecorder()
|
||||
args << "--useScriptedObjectMap";
|
||||
args << "--autid" << QString::number(m_primaryRunner->autId());
|
||||
|
||||
m_secondaryRunner = new QtcProcess(this);
|
||||
m_secondaryRunner->setProcessMode(ProcessMode::Writer);
|
||||
m_secondaryRunner->setCommand({toolsSettings.runnerPath, args});
|
||||
connect(m_secondaryRunner, &QtcProcess::done, this, &SquishTools::onRecorderFinished);
|
||||
qCDebug(LOG) << "Recorder starting:" << m_secondaryRunner->commandLine().toUserOutput();
|
||||
m_secondaryRunner = new SquishRunnerProcess(this);
|
||||
m_secondaryRunner->setupProcess(SquishRunnerProcess::Record);
|
||||
const CommandLine cmd = {toolsSettings.runnerPath, args};
|
||||
connect(m_secondaryRunner, &SquishRunnerProcess::recorderDone,
|
||||
this, &SquishTools::onRecorderFinished);
|
||||
qCDebug(LOG) << "Recorder starting:" << cmd.toUserOutput();
|
||||
if (m_suiteConf.objectMapPath().isReadableFile())
|
||||
Core::DocumentManager::expectFileChange(m_suiteConf.objectMapPath());
|
||||
m_secondaryRunner->start();
|
||||
m_secondaryRunner->start(cmd, squishEnvironment());
|
||||
}
|
||||
|
||||
void SquishTools::stopRecorder()
|
||||
@@ -604,10 +605,10 @@ void SquishTools::stopRecorder()
|
||||
QTC_ASSERT(m_secondaryRunner && m_secondaryRunner->isRunning(), return);
|
||||
if (m_squishRunnerState == RunnerState::CancelRequested) {
|
||||
qCDebug(LOG) << "Stopping recorder (exit)";
|
||||
m_secondaryRunner->write("exit\n");
|
||||
m_secondaryRunner->writeCommand(SquishRunnerProcess::Exit);
|
||||
} else {
|
||||
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()
|
||||
{
|
||||
QTC_ASSERT(m_secondaryRunner, return);
|
||||
qCDebug(LOG) << "Recorder finished:" << m_secondaryRunner->exitCode();
|
||||
qCDebug(LOG) << "Recorder finished"; // exit code?
|
||||
m_secondaryRunner->deleteLater();
|
||||
m_secondaryRunner = nullptr;
|
||||
|
||||
|
||||
@@ -135,7 +135,7 @@ private:
|
||||
SquishServerProcess m_serverProcess;
|
||||
|
||||
SquishRunnerProcess *m_primaryRunner = nullptr;
|
||||
Utils::QtcProcess *m_secondaryRunner = nullptr;
|
||||
SquishRunnerProcess *m_secondaryRunner = nullptr;
|
||||
|
||||
QString m_serverHost;
|
||||
Request m_request = None;
|
||||
|
||||
Reference in New Issue
Block a user