mirror of
https://github.com/OPM/ResInsight.git
synced 2025-01-03 20:57:39 -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 imageCompareExeName = "compare";
|
||||
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 regTestProjectName = RegTestNames::testProjectName;
|
||||
QString regTestFolderFilter = RegTestNames::testFolderFilter;
|
||||
|
||||
// Find all sub folders
|
||||
|
||||
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());
|
||||
|
||||
// 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;
|
||||
|
||||
if (testCaseFolder.exists(regTestProjectName + ".rip"))
|
||||
|
Loading…
Reference in New Issue
Block a user