Merge authors:
  James Hunt (jamesodhunt)
Related merge proposals:
  https://code.launchpad.net/~jamesodhunt/upstart/bug-1089159/+merge/189032
  proposed by: James Hunt (jamesodhunt)
------------------------------------------------------------
revno: 1539 [merge]
committer: Dmitrijs Ledkovs <[email protected]>
branch nick: upstart
timestamp: Thu 2013-10-03 11:26:05 +0100
message:
  Merge lp:~jamesodhunt/upstart/bug-1089159
modified:
  ChangeLog
  util/tests/test_utmp.c


--
lp:upstart
https://code.launchpad.net/~upstart-devel/upstart/trunk

Your team Upstart Reviewers is subscribed to branch lp:upstart.
To unsubscribe from this branch go to 
https://code.launchpad.net/~upstart-devel/upstart/trunk/+edit-subscription
=== modified file 'ChangeLog'
--- ChangeLog	2013-10-02 08:59:20 +0000
+++ ChangeLog	2013-10-03 10:10:56 +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:10:56 +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

Reply via email to