Allow controlling collection timeout over environment variable VTEST_RUN_TIMEOUT. #79
This commit is contained in:
parent
ce8f369d60
commit
34fd0b81bf
|
@ -352,9 +352,29 @@ QString AbstractTest::TranslationsPath() const
|
||||||
return QCoreApplication::applicationDirPath() + QStringLiteral("/../../../app/valentina/bin/translations");
|
return QCoreApplication::applicationDirPath() + QStringLiteral("/../../../app/valentina/bin/translations");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
int AbstractTest::RunTimeout(int defMsecs)
|
||||||
|
{
|
||||||
|
#if QT_VERSION < QT_VERSION_CHECK(5, 10, 0)
|
||||||
|
QString timeout = QString::fromLocal8Bit(qgetenv("VTEST_RUN_TIMEOUT"));
|
||||||
|
if (timeout.isEmpty())
|
||||||
|
{
|
||||||
|
return defMsecs;
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
QString timeout = qEnvironmentVariable("VTEST_RUN_TIMEOUT", QString::number(msecs));
|
||||||
|
#endif
|
||||||
|
|
||||||
|
bool ok = false;
|
||||||
|
int msecs = timeout.toInt(&ok);
|
||||||
|
return ok ? msecs : defMsecs;
|
||||||
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
int AbstractTest::Run(int exit, const QString &program, const QStringList &arguments, QString &error, int msecs)
|
int AbstractTest::Run(int exit, const QString &program, const QStringList &arguments, QString &error, int msecs)
|
||||||
{
|
{
|
||||||
|
msecs = AbstractTest::RunTimeout(msecs);
|
||||||
|
|
||||||
const QString parameters = QStringLiteral("Program: %1 \nArguments: %2.")
|
const QString parameters = QStringLiteral("Program: %1 \nArguments: %2.")
|
||||||
.arg(program, arguments.join(QStringLiteral(", ")));
|
.arg(program, arguments.join(QStringLiteral(", ")));
|
||||||
|
|
||||||
|
|
|
@ -85,6 +85,8 @@ protected:
|
||||||
QString TapePath() const;
|
QString TapePath() const;
|
||||||
QString TranslationsPath() const;
|
QString TranslationsPath() const;
|
||||||
|
|
||||||
|
static int RunTimeout(int defMsecs);
|
||||||
|
|
||||||
int Run(int exit, const QString &program, const QStringList &arguments, QString &error, int msecs = 120000);
|
int Run(int exit, const QString &program, const QStringList &arguments, QString &error, int msecs = 120000);
|
||||||
bool CopyRecursively(const QString &srcFilePath, const QString &tgtFilePath) const;
|
bool CopyRecursively(const QString &srcFilePath, const QString &tgtFilePath) const;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user