James Hunt has proposed merging lp:~jamesodhunt/upstart/bug-1089159 into lp:upstart.
Requested reviews: Upstart Reviewers (upstart-reviewers) For more details, see: https://code.launchpad.net/~jamesodhunt/upstart/bug-1089159/+merge/189032 * util/tests/test_utmp.c: Update remaining tests to pause between writing utmp(x) records and reading them back to allow tests to detect whether the expected new records have replaced the artificially created original ones (LP: #1089159). -- https://code.launchpad.net/~jamesodhunt/upstart/bug-1089159/+merge/189032 Your team Upstart Reviewers is requested to review the proposed merge of lp:~jamesodhunt/upstart/bug-1089159 into lp:upstart.
=== modified file 'ChangeLog' --- ChangeLog 2013-10-02 08:59:20 +0000 +++ ChangeLog 2013-10-03 10:13:41 +0000 @@ -1,3 +1,10 @@ +2013-10-03 James Hunt <[email protected]> + + * util/tests/test_utmp.c: Update remaining tests to pause + between writing utmp(x) records and reading them back to allow + tests to detect whether the expected new records have replaced + the artificially created original ones (LP: #1089159). + 2013-10-02 James Hunt <[email protected]> * test/test_util_common.c: === modified file 'util/tests/test_utmp.c' --- util/tests/test_utmp.c 2012-12-18 16:37:38 +0000 +++ util/tests/test_utmp.c 2013-10-03 10:13:41 +0000 @@ -857,21 +857,21 @@ gettimeofday (&tv, NULL); record.ut_tv.tv_sec = tv.tv_sec; record.ut_tv.tv_usec = tv.tv_usec; + utmpxname (utmp_file); + + setutxent (); + pututxline (&record); + endutxent (); + + updwtmpx (wtmp_file, &record); + /* utmp/wtmp records do not have nanosecond resolution * yet the tests expect time to lapse, but it might not * on very, very fast machines. * https://jenkins.qa.ubuntu.com/view/Raring/view/AutoPkgTest/job/raring-adt-upstart/ * Is there a better way to fix the tests? */ - usleep(200); - - utmpxname (utmp_file); - - setutxent (); - pututxline (&record); - endutxent (); - - updwtmpx (wtmp_file, &record); + usleep (200); ret = utmp_write_runlevel (utmp_file, wtmp_file, '5', '2'); @@ -970,6 +970,13 @@ updwtmpx (wtmp_file, &record); + /* Allow time to pass so that the timestamp for the new + * record is guaranteed to be different to the existing + * timestamp allowing the test to detect if a record + * other than the artificially-created existing one was + * read back. + */ + usleep (200); ret = utmp_write_runlevel (utmp_file, wtmp_file, '2', 'S'); @@ -1077,6 +1084,13 @@ updwtmpx (wtmp_file, &record); + /* Allow time to pass so that the timestamp for the new + * record is guaranteed to be different to the existing + * timestamp allowing the test to detect if a record + * other than the artificially-created existing one was + * read back. + */ + usleep (200); ret = utmp_write_runlevel (utmp_file, wtmp_file, '2', 'S'); @@ -1349,6 +1363,14 @@ updwtmpx (wtmp_file, &record); + /* Allow time to pass so that the timestamp for the new + * record is guaranteed to be different to the existing + * timestamp allowing the test to detect if a record + * other than the artificially-created existing one was + * read back. + */ + usleep (200); + ret = utmp_write_shutdown (utmp_file, wtmp_file); TEST_EQ (ret, 0);
-- upstart-devel mailing list [email protected] Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/upstart-devel
