Merge lp:~xnox/upstart/utmp-usleep into lp:upstart

Proposed by Dimitri John Ledkov
Status: Merged
Merged at revision: 1417
Proposed branch: lp:~xnox/upstart/utmp-usleep
Merge into: lp:upstart
Diff against target: 38 lines (+11/-0)
2 files modified
util/tests/test_sysv.c (+4/-0)
util/tests/test_utmp.c (+7/-0)
To merge this branch: bzr merge lp:~xnox/upstart/utmp-usleep
Reviewer Review Type Date Requested Status
James Hunt Approve
Review via email: mp+140490@code.launchpad.net
To post a comment you must log in.
Revision history for this message
James Hunt (jamesodhunt) wrote :

> Is there a better way to fix the tests?
Sleeps are generally dubious, but aside from spinning calling gettimeofday() until the time changes, this looks like the best solution.

Merged.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'util/tests/test_sysv.c'
2--- util/tests/test_sysv.c 2009-07-09 11:50:19 +0000
3+++ util/tests/test_sysv.c 2012-12-18 16:40:57 +0000
4@@ -203,6 +203,8 @@
5 gettimeofday (&tv, NULL);
6 record.ut_tv.tv_sec = tv.tv_sec;
7 record.ut_tv.tv_usec = tv.tv_usec;
8+ /* See comment in test_utmp */
9+ usleep(200);
10
11 utmpxname (utmp_file);
12
13@@ -806,6 +808,8 @@
14 gettimeofday (&tv, NULL);
15 record.ut_tv.tv_sec = tv.tv_sec;
16 record.ut_tv.tv_usec = tv.tv_usec;
17+ /* See comment in test_utmp */
18+ usleep(200);
19
20 utmpxname (utmp_file);
21
22
23=== modified file 'util/tests/test_utmp.c'
24--- util/tests/test_utmp.c 2009-07-14 11:04:34 +0000
25+++ util/tests/test_utmp.c 2012-12-18 16:40:57 +0000
26@@ -857,6 +857,13 @@
27 gettimeofday (&tv, NULL);
28 record.ut_tv.tv_sec = tv.tv_sec;
29 record.ut_tv.tv_usec = tv.tv_usec;
30+ /* utmp/wtmp records do not have nanosecond resolution
31+ * yet the tests expect time to lapse, but it might not
32+ * on very, very fast machines.
33+ * https://jenkins.qa.ubuntu.com/view/Raring/view/AutoPkgTest/job/raring-adt-upstart/
34+ * Is there a better way to fix the tests?
35+ */
36+ usleep(200);
37
38 utmpxname (utmp_file);
39

Subscribers

People subscribed via source and target branches