mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
Use a mutex to make sure all command objects have completed before issuing snapshots in the regression tests.
p4#: 22400
This commit is contained in:
parent
1543f05794
commit
74b6b858d3
@ -356,6 +356,10 @@ bool RiaApplication::loadProject(const QString& projectFileName)
|
||||
m_commandQueue.push_back(m_project->commandObjects[i]);
|
||||
}
|
||||
|
||||
// Lock the command queue
|
||||
m_commandQueueLock.lock();
|
||||
|
||||
// Execute command objects, and release the mutex when the queue is empty
|
||||
executeCommandObjects();
|
||||
|
||||
onProjectOpenedOrClosed();
|
||||
@ -1374,6 +1378,14 @@ void RiaApplication::runRegressionTest(const QString& testRootPath)
|
||||
if (testCaseFolder.exists(regTestProjectName))
|
||||
{
|
||||
loadProject(testCaseFolder.filePath(regTestProjectName));
|
||||
|
||||
// Wait until all command objects have completed
|
||||
while (!m_commandQueueLock.tryLock())
|
||||
{
|
||||
processEvents();
|
||||
}
|
||||
m_commandQueueLock.unlock();
|
||||
|
||||
saveSnapshotForAllViews(generatedFolderName);
|
||||
|
||||
QDir baseDir(testCaseFolder.filePath(baseFolderName));
|
||||
@ -1716,5 +1728,10 @@ void RiaApplication::executeCommandObjects()
|
||||
|
||||
m_commandQueue.pop_front();
|
||||
}
|
||||
else
|
||||
{
|
||||
// Unlock the command queue lock when the command queue is empty
|
||||
m_commandQueueLock.unlock();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -19,6 +19,8 @@
|
||||
#pragma once
|
||||
#include <QApplication>
|
||||
#include <QProcess>
|
||||
#include <QMutex>
|
||||
|
||||
#include "cafPdmObject.h"
|
||||
#include "cafPdmField.h"
|
||||
#include "cvfBase.h"
|
||||
@ -174,4 +176,5 @@ private:
|
||||
QMap<QString, QVariant> m_sessionCache; // Session cache used to store username/passwords per session
|
||||
|
||||
std::list<RimCommandObject*> m_commandQueue;
|
||||
QMutex m_commandQueueLock;
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user