aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>2017-06-28 15:18:50 +0200
committerEskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>2017-06-29 05:51:20 +0000
commita379d290669c6c6a2676e4405e2ab79343b668e0 (patch)
tree3ecf614a715590258dbbb10762eba90ee8aa005c
parent8606a511b44d66882ca950e1161c8f668f9a283a (diff)
Add --timeout option
This allows you to override the default timeout of 10 minutes for cases where one of the benchmarks is exceedingly slow, but you still would like to collect the data for the others. Change-Id: Ifcfc304a21e643d938e53bfd36ddaf6df6a8d515 Reviewed-by: Robin Burchell <robin.burchell@crimson.no>
-rw-r--r--src/main.cpp9
-rw-r--r--src/options.h2
2 files changed, 10 insertions, 1 deletions
diff --git a/src/main.cpp b/src/main.cpp
index 45bc9c3..2861da6 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -84,6 +84,12 @@ QStringList processCommandLineArguments(const QCoreApplication &app)
QStringLiteral("2000"));
parser.addOption(delayOption);
+ QCommandLineOption timeoutOption(QStringLiteral("timeout"),
+ QStringLiteral("Sets the maximum time in milliseconds that a test is allowed to run before it is aborted. The default is 10 minutes. Set this to -1 to disable the timeout."),
+ QStringLiteral("timeout"),
+ QStringLiteral("600000"));
+ parser.addOption(timeoutOption);
+
QCommandLineOption widthOption(QStringLiteral("width"),
QStringLiteral("Window Width"),
QStringLiteral("width"),
@@ -171,6 +177,7 @@ QStringList processCommandLineArguments(const QCoreApplication &app)
Options::instance.hardwareMultiplier = parser.value(hardwareMultiplierOption).toDouble();
Options::instance.frameCountInterval = parser.value(frameCountInterval).toInt();
Options::instance.destroyViewEachRun = parser.isSet(destroyViewOption);
+ Options::instance.timeout = parser.value(timeoutOption).toInt();
QSize size(parser.value(widthOption).toInt(),
parser.value(heightOption).toInt());
@@ -330,7 +337,7 @@ int runHostProcess(const QCoreApplication &app, const QStringList &positionalArg
if (ret == 0) {
p->start(app.arguments().first(), sanitizedArgCopy);
- if (!p->waitForFinished(60*10*1000)) {
+ if (!p->waitForFinished(Options::instance.timeout)) {
qWarning() << "Test hung (probably indefinitely) indefinitely when run with arguments: " << sanitizedArgCopy.join(' ');
qWarning("Aborting test run, as this probably means benchmark setup is screwed up or the hardware needs resetting!");
diff --git a/src/options.h b/src/options.h
index 67b2050..f01884e 100644
--- a/src/options.h
+++ b/src/options.h
@@ -51,6 +51,7 @@ struct Options
, windowSize(800, 600)
, hardwareMultiplier(1.0)
, destroyViewEachRun(false)
+ , timeout(10*60*1000)
{
}
@@ -72,6 +73,7 @@ struct Options
double hardwareMultiplier;
QList<Benchmark> benchmarks;
bool destroyViewEachRun;
+ int timeout;
static Options instance;
};