Merge lp:~xnox/upstart/lp1247521 into lp:upstart

Proposed by Dimitri John Ledkov on 2013-11-06
Status: Merged
Merged at revision: 1558
Proposed branch: lp:~xnox/upstart/lp1247521
Merge into: lp:upstart
Diff against target: 76 lines (+31/-2)
3 files modified
test/test_util_common.c (+18/-0)
test/test_util_common.h (+3/-0)
util/tests/test_initctl.c (+10/-2)
To merge this branch: bzr merge lp:~xnox/upstart/lp1247521
Reviewer Review Type Date Requested Status
Upstart Reviewers 2013-11-06 Pending
Review via email: mp+194045@code.launchpad.net
To post a comment you must log in.
Dimitri John Ledkov (xnox) wrote :

select rounds up timeout based on resolution, but on some platforms precise timing is not available and hence no resolution. And then the below tests timeout. No point in measuring time, if there is no clock to measure it with.

Dimitri John Ledkov (xnox) wrote :

CLOCK_MONOTONIC_RAW is not available on Virtualised PPAs, this partially resolves FTBFS in virtualised PPAs.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'test/test_util_common.c'
2--- test/test_util_common.c 2013-11-03 02:54:03 +0000
3+++ test/test_util_common.c 2013-11-06 01:02:55 +0000
4@@ -39,6 +39,7 @@
5 #include <sys/types.h>
6 #include <sys/stat.h>
7 #include <ctype.h>
8+#include <time.h>
9
10 #include <nih-dbus/dbus_error.h>
11 #include <nih-dbus/dbus_connection.h>
12@@ -269,6 +270,23 @@
13 }
14
15 /**
16+ * have_timed_waitpid
17+ *
18+ * Return TRUE if precise timing information is available for timing
19+ * tests.
20+ **/
21+int
22+have_timed_waitpid (void)
23+{
24+ struct timespec res;
25+
26+ if (clock_getres (CLOCK_MONOTONIC_RAW, &res) < 0)
27+ return FALSE;
28+
29+ return TRUE;
30+}
31+
32+/**
33 * timed_waitpid:
34 *
35 * @pid: pid to wait for,
36
37=== modified file 'test/test_util_common.h'
38--- test/test_util_common.h 2013-10-18 09:13:36 +0000
39+++ test/test_util_common.h 2013-11-06 01:02:55 +0000
40@@ -692,6 +692,9 @@
41
42 void wait_for_upstart (int session_init_pid);
43
44+int have_timed_waitpid (void)
45+ __attribute__ ((warn_unused_result));
46+
47 pid_t timed_waitpid (pid_t pid, time_t timeout)
48 __attribute__ ((warn_unused_result));
49
50
51=== modified file 'util/tests/test_initctl.c'
52--- util/tests/test_initctl.c 2013-11-05 16:15:19 +0000
53+++ util/tests/test_initctl.c 2013-11-06 01:02:55 +0000
54@@ -17090,12 +17090,20 @@
55 test_job_env ();
56 test_reexec ();
57 test_list_sessions ();
58- test_quiesce ();
59+ if (have_timed_waitpid ()) {
60+ test_quiesce ();
61+ } else {
62+ fprintf (stderr, "\n\n"
63+ "WARNING: not running quiesce tests, "
64+ "as no precise timing information available "
65+ "\n\n");
66+ }
67+
68 test_umask ();
69 test_no_dbus ();
70
71 if (in_chroot () && !dbus_configured ()) {
72- fprintf(stderr, "\n\n"
73+ fprintf (stderr, "\n\n"
74 "WARNING: not running show-config, "
75 "check-config & notify-disk-writeable tests within chroot "
76 "as no D-Bus, or D-Bus not configured (lp:#728988)"

Subscribers

People subscribed via source and target branches