mirror of
https://github.com/OPM/ResInsight.git
synced 2025-01-21 05:53:25 -06:00
#2554 Regression Test : Detect command files and execute content
This commit is contained in:
parent
b2204fb22a
commit
ce2b4febbb
@ -164,6 +164,7 @@ namespace RegTestNames
|
|||||||
const QString testFolderFilter = "TestCase*";
|
const QString testFolderFilter = "TestCase*";
|
||||||
const QString imageCompareExeName = "compare";
|
const QString imageCompareExeName = "compare";
|
||||||
const QString reportFileName = "ResInsightRegressionTestReport.html";
|
const QString reportFileName = "ResInsightRegressionTestReport.html";
|
||||||
|
const QString commandFileFilter = "commandfile-*";
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@ -1998,7 +1999,6 @@ void RiaApplication::runRegressionTest(const QString& testRootPath, QStringList*
|
|||||||
QString baseFolderName = RegTestNames::baseFolderName;
|
QString baseFolderName = RegTestNames::baseFolderName;
|
||||||
QString regTestProjectName = RegTestNames::testProjectName;
|
QString regTestProjectName = RegTestNames::testProjectName;
|
||||||
QString regTestFolderFilter = RegTestNames::testFolderFilter;
|
QString regTestFolderFilter = RegTestNames::testFolderFilter;
|
||||||
|
|
||||||
// Find all sub folders
|
// Find all sub folders
|
||||||
|
|
||||||
QDir testDir(testRootPath); // If string is empty it will end up as cwd
|
QDir testDir(testRootPath); // If string is empty it will end up as cwd
|
||||||
@ -2091,6 +2091,39 @@ void RiaApplication::runRegressionTest(const QString& testRootPath, QStringList*
|
|||||||
{
|
{
|
||||||
QDir testCaseFolder(folderList[dirIdx].filePath());
|
QDir testCaseFolder(folderList[dirIdx].filePath());
|
||||||
|
|
||||||
|
// Detect any command files
|
||||||
|
QStringList filterList;
|
||||||
|
filterList << RegTestNames::commandFileFilter;
|
||||||
|
|
||||||
|
QFileInfoList commandFileEntries = testCaseFolder.entryInfoList(filterList);
|
||||||
|
if (!commandFileEntries.empty())
|
||||||
|
{
|
||||||
|
QString currentApplicationPath = QDir::current().absolutePath();
|
||||||
|
|
||||||
|
// Set current path to the folder containing the command file, as this is required when using file references
|
||||||
|
// in the command file
|
||||||
|
QDir::setCurrent(folderList[dirIdx].filePath());
|
||||||
|
|
||||||
|
for (const auto& fileInfo : commandFileEntries)
|
||||||
|
{
|
||||||
|
QString commandFile = fileInfo.absoluteFilePath();
|
||||||
|
|
||||||
|
QFile file(commandFile);
|
||||||
|
if (!file.open(QIODevice::ReadOnly | QIODevice::Text))
|
||||||
|
{
|
||||||
|
RiaLogging::error("Failed to open command file : " + commandFile);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
QTextStream in(&file);
|
||||||
|
RicfCommandFileExecutor::instance()->executeCommands(in);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
QDir::setCurrent(currentApplicationPath);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
QString projectFileName;
|
QString projectFileName;
|
||||||
|
|
||||||
if (testCaseFolder.exists(regTestProjectName + ".rip"))
|
if (testCaseFolder.exists(regTestProjectName + ".rip"))
|
||||||
|
Loading…
Reference in New Issue
Block a user