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
=== modified file 'util/tests/test_sysv.c'
--- util/tests/test_sysv.c 2009-07-09 11:50:19 +0000
+++ util/tests/test_sysv.c 2012-12-18 16:40:57 +0000
@@ -203,6 +203,8 @@
203 gettimeofday (&tv, NULL);203 gettimeofday (&tv, NULL);
204 record.ut_tv.tv_sec = tv.tv_sec;204 record.ut_tv.tv_sec = tv.tv_sec;
205 record.ut_tv.tv_usec = tv.tv_usec;205 record.ut_tv.tv_usec = tv.tv_usec;
206 /* See comment in test_utmp */
207 usleep(200);
206208
207 utmpxname (utmp_file);209 utmpxname (utmp_file);
208210
@@ -806,6 +808,8 @@
806 gettimeofday (&tv, NULL);808 gettimeofday (&tv, NULL);
807 record.ut_tv.tv_sec = tv.tv_sec;809 record.ut_tv.tv_sec = tv.tv_sec;
808 record.ut_tv.tv_usec = tv.tv_usec;810 record.ut_tv.tv_usec = tv.tv_usec;
811 /* See comment in test_utmp */
812 usleep(200);
809813
810 utmpxname (utmp_file);814 utmpxname (utmp_file);
811815
812816
=== modified file 'util/tests/test_utmp.c'
--- util/tests/test_utmp.c 2009-07-14 11:04:34 +0000
+++ util/tests/test_utmp.c 2012-12-18 16:40:57 +0000
@@ -857,6 +857,13 @@
857 gettimeofday (&tv, NULL);857 gettimeofday (&tv, NULL);
858 record.ut_tv.tv_sec = tv.tv_sec;858 record.ut_tv.tv_sec = tv.tv_sec;
859 record.ut_tv.tv_usec = tv.tv_usec;859 record.ut_tv.tv_usec = tv.tv_usec;
860 /* utmp/wtmp records do not have nanosecond resolution
861 * yet the tests expect time to lapse, but it might not
862 * on very, very fast machines.
863 * https://jenkins.qa.ubuntu.com/view/Raring/view/AutoPkgTest/job/raring-adt-upstart/
864 * Is there a better way to fix the tests?
865 */
866 usleep(200);
860867
861 utmpxname (utmp_file);868 utmpxname (utmp_file);
862869

Subscribers

People subscribed via source and target branches