Merge authors:
  Dmitrijs Ledkovs (xnox)
Related merge proposals:
  https://code.launchpad.net/~xnox/upstart/lp1247521/+merge/194045
  proposed by: Dmitrijs Ledkovs (xnox)
------------------------------------------------------------
revno: 1558 [merge]
committer: Dmitrijs Ledkovs <[email protected]>
branch nick: upstart
timestamp: Wed 2013-11-06 03:41:04 +0000
message:
  Skip quiesce tests, when precise timing information is not available.
modified:
  test/test_util_common.c
  test/test_util_common.h
  util/tests/test_initctl.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 'test/test_util_common.c'
--- test/test_util_common.c	2013-11-03 02:54:03 +0000
+++ test/test_util_common.c	2013-11-03 05:08:35 +0000
@@ -39,6 +39,7 @@
 #include <sys/types.h>
 #include <sys/stat.h>
 #include <ctype.h>
+#include <time.h>
 
 #include <nih-dbus/dbus_error.h>
 #include <nih-dbus/dbus_connection.h>
@@ -269,6 +270,23 @@
 }
 
 /**
+ * have_timed_waitpid
+ *
+ * Return TRUE if precise timing information is available for timing
+ * tests.
+ **/
+int
+have_timed_waitpid (void)
+{
+	struct timespec res;
+
+	if (clock_getres (CLOCK_MONOTONIC_RAW, &res) < 0)
+		return FALSE;
+
+	return TRUE;
+}
+
+/**
  * timed_waitpid:
  *
  * @pid: pid to wait for,

=== modified file 'test/test_util_common.h'
--- test/test_util_common.h	2013-10-18 09:13:36 +0000
+++ test/test_util_common.h	2013-11-03 05:08:35 +0000
@@ -692,6 +692,9 @@
 
 void wait_for_upstart (int session_init_pid);
 
+int have_timed_waitpid (void)
+	__attribute__ ((warn_unused_result));
+
 pid_t timed_waitpid (pid_t pid, time_t timeout)
 	__attribute__ ((warn_unused_result));
 

=== modified file 'util/tests/test_initctl.c'
--- util/tests/test_initctl.c	2013-11-06 03:35:22 +0000
+++ util/tests/test_initctl.c	2013-11-06 03:41:04 +0000
@@ -17132,12 +17132,20 @@
 	test_job_env ();
 	test_reexec ();
 	test_list_sessions ();
-	test_quiesce ();
+	if (have_timed_waitpid ()) {
+		test_quiesce ();
+	} else {
+		fprintf (stderr, "\n\n"
+				"WARNING: not running quiesce tests, "
+				"as no precise timing information available "
+				"\n\n");
+	}
+
 	test_umask ();
 	test_no_dbus ();
 
 	if (in_chroot () && !dbus_configured ()) {
-		fprintf(stderr, "\n\n"
+		fprintf (stderr, "\n\n"
 				"WARNING: not running show-config, "
 				"check-config & notify-disk-writeable tests within chroot "
 				"as no D-Bus, or D-Bus not configured (lp:#728988)"

-- 
upstart-devel mailing list
[email protected]
Modify settings or unsubscribe at: 
https://lists.ubuntu.com/mailman/listinfo/upstart-devel

Reply via email to