~ci-train-bot/qtmir/qtmir-ubuntu-zesty-2668

« back to all changes in this revision

Viewing changes to src/platforms/mirserver/qmirserver.cpp

  • Committer: Bileto Bot
  • Author(s): Gerry Boland
  • Date: 2017-03-20 21:15:29 UTC
  • mfrom: (617.2.3 allow-valgrind1)
  • Revision ID: ci-train-bot@canonical.com-20170320211529-zrbpo2l1bwmdcx5m
Extend timeouts when running under valgrind

When QMirServer is starting up, it spawns a separate thread for Mir to startup and waits for it. As valgrind slows execution greatly, the QMirServer timeout triggers before Mir has started, causing the QMirServer to think it failed and exit.

This patch adds ability to detect when running under valgrind and extending timeouts to suit.

Approved by: Daniel d'Andrada, Unity8 CI Bot

Show diffs side-by-side

added added

removed removed

Lines of Context:
18
18
#include <QObject>
19
19
#include <QDebug>
20
20
 
 
21
#include <valgrind.h>
 
22
 
21
23
// local
22
24
#include "qmirserver.h"
23
25
#include "qmirserver_p.h"
58
60
 
59
61
    if (d->serverThread->isRunning()) {
60
62
        d->stop();
61
 
        if (!d->serverThread->wait(10000)) {
 
63
 
 
64
        const int timeout = RUNNING_ON_VALGRIND ? 100 : 10; // else timeout triggers before Mir done
 
65
        if (!d->serverThread->wait(timeout * 1000)) {
62
66
            // do something to indicate fail during shutdown
63
67
            qCritical() << "ERROR: QMirServer - Mir failed to shut down correctly, terminating it";
64
68
            d->serverThread->terminate();