Merge lp://staging/~ted/ubuntu-app-launch/eventually-tests into lp://staging/ubuntu-app-launch/16.10
- eventually-tests
- Merge into trunk.16.10
Status: | Merged |
---|---|
Approved by: | Charles Kerr |
Approved revision: | 265 |
Merged at revision: | 241 |
Proposed branch: | lp://staging/~ted/ubuntu-app-launch/eventually-tests |
Merge into: | lp://staging/ubuntu-app-launch/16.10 |
Diff against target: |
1327 lines (+400/-421) 6 files modified
tests/CMakeLists.txt (+1/-1) tests/eventually-fixture.h (+145/-0) tests/failure-test.cc (+6/-29) tests/libual-cpp-test.cc (+80/-170) tests/libual-test.cc (+59/-121) tests/zg-test.cc (+109/-100) |
To merge this branch: | bzr merge lp://staging/~ted/ubuntu-app-launch/eventually-tests |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
dobey (community) | Abstain | ||
unity-api-1-bot | continuous-integration | Needs Fixing | |
Charles Kerr (community) | Approve | ||
Review via email:
|
Commit message
Add in eventually timeouts in tests to make them more robust
Description of the change
This steals from indicator-sound the EXPECT_EVENTUALLY* functions so that we can remove fixed timeouts, hopefully making the tests more robust on slower builders. *cough* Jenkins *cough* Also makes the tests run faster on my laptop.
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
unity-api-1-bot (unity-api-1-bot) wrote : | # |
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
unity-api-1-bot (unity-api-1-bot) wrote : | # |
FAILED: Continuous integration, rev:243
https:/
Executed test runs:
FAILURE: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
deb: https:/
FAILURE: https:/
SUCCESS: https:/
deb: https:/
FAILURE: https:/
SUCCESS: https:/
deb: https:/
FAILURE: https:/
SUCCESS: https:/
deb: https:/
FAILURE: https:/
SUCCESS: https:/
deb: https:/
Click here to trigger a rebuild:
https:/
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
unity-api-1-bot (unity-api-1-bot) wrote : | # |
FAILED: Continuous integration, rev:244
https:/
Executed test runs:
FAILURE: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
FAILURE: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
FAILURE: https:/
FAILURE: https:/
FAILURE: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
Click here to trigger a rebuild:
https:/
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
unity-api-1-bot (unity-api-1-bot) wrote : | # |
FAILED: Continuous integration, rev:245
https:/
Executed test runs:
FAILURE: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
FAILURE: https:/
FAILURE: https:/
FAILURE: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
Click here to trigger a rebuild:
https:/
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
unity-api-1-bot (unity-api-1-bot) wrote : | # |
FAILED: Continuous integration, rev:246
https:/
Executed test runs:
FAILURE: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
deb: https:/
FAILURE: https:/
SUCCESS: https:/
deb: https:/
FAILURE: https:/
FAILURE: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
Click here to trigger a rebuild:
https:/
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
unity-api-1-bot (unity-api-1-bot) wrote : | # |
FAILED: Continuous integration, rev:248
https:/
Executed test runs:
FAILURE: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
FAILURE: https:/
SUCCESS: https:/
deb: https:/
FAILURE: https:/
FAILURE: https:/
FAILURE: https:/
FAILURE: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
Click here to trigger a rebuild:
https:/
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
unity-api-1-bot (unity-api-1-bot) wrote : | # |
PASSED: Continuous integration, rev:250
https:/
Executed test runs:
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
Click here to trigger a rebuild:
https:/
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
unity-api-1-bot (unity-api-1-bot) wrote : | # |
PASSED: Continuous integration, rev:251
https:/
Executed test runs:
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
Click here to trigger a rebuild:
https:/
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
unity-api-1-bot (unity-api-1-bot) wrote : | # |
PASSED: Continuous integration, rev:252
https:/
Executed test runs:
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
Click here to trigger a rebuild:
https:/
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
dobey (dobey) wrote : | # |
Do we really want to get into the habit of copy+pasting code across multiple projects as a means of working around bad tests?
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
Ted Gould (ted) wrote : | # |
On Mon, 2016-08-08 at 14:18 +0000, Rodney Dawes wrote:
> Do we really want to get into the habit of copy+pasting code across
> multiple projects as a means of working around bad tests?
We don't have a shared place to put it today. And it isn't a copy, only
really in spirit, though it is more generic in this instance.
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
Charles Kerr (charlesk) wrote : | # |
About the patch iteself:
Coding comments inline.
I have a lot of comments and questions, a few needs fixings, but nothing that can't be churned through. In general I think this MR is an unambiguous improvement.
About Dobey's comment:
1. copy-paste: FWIW I've borrowed parts of the i-sound fixture for other indicators, cutting out the pieces I didn't need for the task at hand. So yes we already have a lot of slightly different versions of this floating around. We really do need a build-depends place for these things to live so that we can avoid lossy duplication.
2. "working around": _EVENTUALLY is an objectively better idiom than the tests' previous approach of hardcoding a sleep interval. With _EVENTUALLY you no longer have to find the goldilox sleep interval (sleep too little? tests fail on that 4bit MIPS box in the CI pool. sleep too much? tests take forever on your dev box).
3. Maybe I'm reading too much into the comment, but the implication I'm reading is that you're concerned this MR will make bad tests pass. If that's a concern, what are the runtime steps that would lead to that?
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
Ted Gould (ted) wrote : | # |
On Wed, 2016-08-17 at 02:08 +0000, Charles Kerr wrote:
> > + static gboolean timeout_cb(gpointer user_data)
> > + {
> > + GMainLoop *loop = static_
> type specified twice; use auto on lhs
Fixed r253
> > + void pause(unsigned int ms = 0)
> 1. is 0ms a meaningful default? What happens when you call
> g_timeout_add(0)?
>
> 2. is this called anywhere? If not, do we really need it?
Yes, it is used in libual tests. What it does is basically add an event
at the end of the event queue. So it'll flush all the events on the
mainloop that are currently queued.
> > + testing:
> > expectEventuall
> > &testfunc)
> Slightly misleading function name as it doesn't `expect' in the gtest
> sense
r254
> > + auto loop =
> > std::shared_
> > [](GMainLoop *loop) {
> > + if (loop != nullptr)
> > + g_main_
> 1. Are we really worried about g_main_
> returning nullptr? :)
>
> 2. (opinion) g_clear_
> cleaner
r255, you never know :-) I think the issue would be if someone called
reset on it twice.
> + std::function<
> > &testfunc, &start, this]() -> int {
> shouldn't the signature be <gboolean(void)> ?
Good catch r256
> > + if (result == false && _eventuallyTime >
> > (std::chrono:
> 'result == false' called twice, here and below. Use a temp variable
> instead?
>
> 'std::chrono:
> below. Use a temp variable instead?
r257
> + g_idle_add(
> (idle prattle) We really really need a lambda-friendly wrapper to
> g_idle_add() / g_timeout_add() et al
I kinda like the ones on glib-thread.h/cpp, we should figure out how to
have them work on the main thread as well. Topic for another branch :-)
> And to finish my point about the 'misleading function names' above, a
> bunch of ASSERT_
> very little work.
r258
> > #include <future>
> > #include <thread>
> >
> > +#include "eventually-
> > +#include "mir-mock.h"
> > +#include <gio/gio.h>
> > #include <gtest/gtest.h>
> > -#include <gio/gio.h>
> > #include <zeitgeist.h>
> > -#include "mir-mock.h"
> >
> > -#include "registry.h"
> > #include "application.h"
> > #include "helper.h"
> > +#include "registry.h"
> These #includes are all over the place -- C++ system files, then
> local files, then other libraries' headers, then local files again.
>
> I don't want to be overly pedantic, but mixing local files around the
> #include section like this is too much :)
>
> Please follow the standard Names and Order of Includes guidelines.
r259
> For a discouraged function, AppID::operator std::string() sure shows
> up a lot
It is good for test suites.
> > + /* Not sure why, but this makes this test better, hopefully we
> > can
> That's pretty vague.
>
> I'm not opposed to it being handled in a separate MR, but could you
> do some due dili...
- 253. By Ted Gould
-
Going on auto
- 254. By Ted Gould
-
Switch function name to better describe what it does
- 255. By Ted Gould
-
Switch to g_clear_pointer()
- 256. By Ted Gould
-
Change return type to gboolean
- 257. By Ted Gould
-
Capture temporary variables
- 258. By Ted Gould
-
Add some assert defines
- 259. By Ted Gould
-
Sort includes
- 260. By Ted Gould
-
Change to C++ style declaration
- 261. By Ted Gould
-
Pass TRUE to setenv
- 262. By Ted Gould
-
Fix assert ordering
- 263. By Ted Gould
-
Remove timing other than eventually
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
unity-api-1-bot (unity-api-1-bot) wrote : | # |
PASSED: Continuous integration, rev:263
https:/
Executed test runs:
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
Click here to trigger a rebuild:
https:/
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
unity-api-1-bot (unity-api-1-bot) wrote : | # |
FAILED: Continuous integration, rev:264
https:/
Executed test runs:
FAILURE: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
FAILURE: https:/
SUCCESS: https:/
deb: https:/
SUCCESS: https:/
deb: https:/
Click here to trigger a rebuild:
https:/
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
dobey (dobey) : | # |
FAILED: Continuous integration, rev:242 /jenkins. canonical. com/unity- api-1/job/ lp-ubuntu- app-launch- ci/32/ /jenkins. canonical. com/unity- api-1/job/ build/303/ console /jenkins. canonical. com/unity- api-1/job/ build-0- fetch/309 /jenkins. canonical. com/unity- api-1/job/ build-1- sourcepkg/ release= vivid+overlay/ 238 /jenkins. canonical. com/unity- api-1/job/ build-1- sourcepkg/ release= xenial+ overlay/ 238 /jenkins. canonical. com/unity- api-1/job/ build-1- sourcepkg/ release= yakkety/ 238 /jenkins. canonical. com/unity- api-1/job/ build-2- binpkg/ arch=amd64, release= vivid+overlay/ 167/console /jenkins. canonical. com/unity- api-1/job/ build-2- binpkg/ arch=amd64, release= xenial+ overlay/ 167/console /jenkins. canonical. com/unity- api-1/job/ build-2- binpkg/ arch=amd64, release= yakkety/ 167/console /jenkins. canonical. com/unity- api-1/job/ build-2- binpkg/ arch=armhf, release= vivid+overlay/ 167/console /jenkins. canonical. com/unity- api-1/job/ build-2- binpkg/ arch=armhf, release= xenial+ overlay/ 167/console /jenkins. canonical. com/unity- api-1/job/ build-2- binpkg/ arch=armhf, release= yakkety/ 167/console /jenkins. canonical. com/unity- api-1/job/ build-2- binpkg/ arch=i386, release= vivid+overlay/ 167/console /jenkins. canonical. com/unity- api-1/job/ build-2- binpkg/ arch=i386, release= xenial+ overlay/ 167/console /jenkins. canonical. com/unity- api-1/job/ build-2- binpkg/ arch=i386, release= yakkety/ 167/console
https:/
Executed test runs:
FAILURE: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
FAILURE: https:/
FAILURE: https:/
FAILURE: https:/
FAILURE: https:/
FAILURE: https:/
FAILURE: https:/
FAILURE: https:/
FAILURE: https:/
FAILURE: https:/
Click here to trigger a rebuild: /jenkins. canonical. com/unity- api-1/job/ lp-ubuntu- app-launch- ci/32/rebuild
https:/