Merge lp:~gerboland/qtmir/allow-valgrind into lp:qtmir

Proposed by Gerry Boland
Status: Merged
Approved by: Lukáš Tinkl
Approved revision: 620
Merged at revision: 623
Proposed branch: lp:~gerboland/qtmir/allow-valgrind
Merge into: lp:qtmir
Diff against target: 84 lines (+14/-2)
5 files modified
CMakeLists.txt (+1/-0)
debian/control (+1/-0)
src/platforms/mirserver/CMakeLists.txt (+2/-0)
src/platforms/mirserver/qmirserver.cpp (+5/-1)
src/platforms/mirserver/qmirserver_p.cpp (+5/-1)
To merge this branch: bzr merge lp:~gerboland/qtmir/allow-valgrind
Reviewer Review Type Date Requested Status
Unity8 CI Bot (community) continuous-integration Approve
Daniel d'Andrada (community) Approve
Albert Astals Cid (community) Needs Fixing
Review via email: mp+318470@code.launchpad.net

Commit message

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.

To post a comment you must log in.
Revision history for this message
Unity8 CI Bot (unity8-ci-bot) wrote :

PASSED: Continuous integration, rev:610
https://unity8-jenkins.ubuntu.com/job/lp-qtmir-ci/528/
Executed test runs:
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build/4232
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-0-fetch/4260
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=xenial+overlay/4095
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=xenial+overlay/4095/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=zesty/4095
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=zesty/4095/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=xenial+overlay/4095
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=xenial+overlay/4095/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=zesty/4095
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=zesty/4095/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=xenial+overlay/4095
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=xenial+overlay/4095/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=zesty/4095
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=zesty/4095/artifact/output/*zip*/output.zip

Click here to trigger a rebuild:
https://unity8-jenkins.ubuntu.com/job/lp-qtmir-ci/528/rebuild

review: Approve (continuous-integration)
Revision history for this message
Daniel d'Andrada (dandrader) wrote :
Revision history for this message
Daniel d'Andrada (dandrader) wrote :

Couldn't reproduce the problem when running qml-demo-shell on my PC but that MP looks harmless enough.

review: Approve
Revision history for this message
Albert Astals Cid (aacid) wrote :

Text conflict in src/platforms/mirserver/qmirserver_p.cpp
1 conflicts encountered

Was already top approved.

review: Needs Fixing
Revision history for this message
Daniel d'Andrada (dandrader) wrote :

"""
timeout = RUNNING_ON_VALGRIND ? 10 : 100
"""

Now having a second look at it. Shouldn't be the other way around? Ie:

timeout = RUNNING_ON_VALGRIND ? 100 : 10

review: Needs Information
Revision history for this message
Gerry Boland (gerboland) wrote :

@dandrader - yes totally. Now I'm confused as I tested the bad code and it worked.. I'll retest to be sure

Revision history for this message
Gerry Boland (gerboland) wrote :

Ok, tested, works as expected now

Revision history for this message
Daniel d'Andrada (dandrader) wrote :

ok

review: Approve
Revision history for this message
Unity8 CI Bot (unity8-ci-bot) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
Unity8 CI Bot (unity8-ci-bot) wrote :

PASSED: Continuous integration, rev:620
https://unity8-jenkins.ubuntu.com/job/lp-qtmir-ci/600/
Executed test runs:
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build/4572
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-0-fetch/4600
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=xenial+overlay/4427
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=xenial+overlay/4427/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=zesty/4427
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=zesty/4427/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=xenial+overlay/4427
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=xenial+overlay/4427/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=zesty/4427
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=zesty/4427/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=xenial+overlay/4427
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=xenial+overlay/4427/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=zesty/4427
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=zesty/4427/artifact/output/*zip*/output.zip

Click here to trigger a rebuild:
https://unity8-jenkins.ubuntu.com/job/lp-qtmir-ci/600/rebuild

review: Approve (continuous-integration)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'CMakeLists.txt'
2--- CMakeLists.txt 2017-02-08 19:53:50 +0000
3+++ CMakeLists.txt 2017-03-14 13:49:50 +0000
4@@ -93,6 +93,7 @@
5 pkg_check_modules(APPLICATION_API REQUIRED unity-shell-application=26)
6 pkg_check_modules(CGMANAGER libcgmanager REQUIRED)
7 pkg_check_modules(CONTENT_HUB libcontent-hub>=0.2 REQUIRED)
8+pkg_check_modules(VALGRIND valgrind REQUIRED)
9
10 include_directories(SYSTEM ${APPLICATION_API_INCLUDE_DIRS})
11
12
13=== modified file 'debian/control'
14--- debian/control 2017-03-07 23:41:44 +0000
15+++ debian/control 2017-03-14 13:49:50 +0000
16@@ -40,6 +40,7 @@
17 qtdeclarative5-dev,
18 qtdeclarative5-private-dev,
19 quilt,
20+ valgrind,
21 # libmirserver-dev should have brought this dep. Bug lp:1617435
22 uuid-dev,
23 # mirtest pkgconfig requires these, but doesn't have a deb dependency. Bug lp:1633537
24
25=== modified file 'src/platforms/mirserver/CMakeLists.txt'
26--- src/platforms/mirserver/CMakeLists.txt 2017-02-15 13:21:50 +0000
27+++ src/platforms/mirserver/CMakeLists.txt 2017-03-14 13:49:50 +0000
28@@ -46,6 +46,8 @@
29 ${APPLICATION_API_INCLUDE_DIRS}
30
31 ${CONTENT_HUB_INCLUDE_DIRS}
32+
33+ ${VALGRIND_INCLUDE_DIRS}
34 )
35
36 # We have to remove -pedantic for tracepoints.c
37
38=== modified file 'src/platforms/mirserver/qmirserver.cpp'
39--- src/platforms/mirserver/qmirserver.cpp 2017-02-21 18:53:48 +0000
40+++ src/platforms/mirserver/qmirserver.cpp 2017-03-14 13:49:50 +0000
41@@ -18,6 +18,8 @@
42 #include <QObject>
43 #include <QDebug>
44
45+#include <valgrind.h>
46+
47 // local
48 #include "qmirserver.h"
49 #include "qmirserver_p.h"
50@@ -58,7 +60,9 @@
51
52 if (d->serverThread->isRunning()) {
53 d->stop();
54- if (!d->serverThread->wait(10000)) {
55+
56+ const int timeout = RUNNING_ON_VALGRIND ? 100 : 10; // else timeout triggers before Mir done
57+ if (!d->serverThread->wait(timeout * 1000)) {
58 // do something to indicate fail during shutdown
59 qCritical() << "ERROR: QMirServer - Mir failed to shut down correctly, terminating it";
60 d->serverThread->terminate();
61
62=== modified file 'src/platforms/mirserver/qmirserver_p.cpp'
63--- src/platforms/mirserver/qmirserver_p.cpp 2017-02-21 18:53:48 +0000
64+++ src/platforms/mirserver/qmirserver_p.cpp 2017-03-14 13:49:50 +0000
65@@ -36,6 +36,8 @@
66 #include <QCoreApplication>
67 #include <QOpenGLContext>
68
69+#include <valgrind.h>
70+
71 static int qtmirArgc{1};
72 static const char *qtmirArgv[]{"qtmir"};
73
74@@ -55,8 +57,10 @@
75
76 bool MirServerThread::waitForMirStartup()
77 {
78+ const int timeout = RUNNING_ON_VALGRIND ? 100 : 10; // else timeout triggers before Mir ready
79+
80 std::unique_lock<decltype(mutex)> lock(mutex);
81- started_cv.wait_for(lock, std::chrono::seconds{10}, [&]{ return mir_running; });
82+ started_cv.wait_for(lock, std::chrono::seconds{timeout}, [&]{ return mir_running; });
83 return mir_running;
84 }
85

Subscribers

People subscribed via source and target branches