Merge lp:~xnox/ubuntu/raring/upstart/autopkgtest-cleanedup into lp:ubuntu/raring/upstart

Proposed by Dimitri John Ledkov
Status: Merged
Merged at revision: 1410
Proposed branch: lp:~xnox/ubuntu/raring/upstart/autopkgtest-cleanedup
Merge into: lp:ubuntu/raring/upstart
Diff against target: 174 lines (+116/-0)
8 files modified
dbus/Upstart.conf.upstream (+27/-0)
debian/changelog (+3/-0)
debian/control (+1/-0)
debian/rules (+9/-0)
debian/tests/control (+3/-0)
debian/tests/run_initctl2dot (+15/-0)
debian/tests/test_setup (+25/-0)
debian/tests/user_sessions (+33/-0)
To merge this branch: bzr merge lp:~xnox/ubuntu/raring/upstart/autopkgtest-cleanedup
Reviewer Review Type Date Requested Status
James Hunt (community) Approve
Ubuntu branches Pending
Review via email: mp+138920@code.launchpad.net

Description of the change

This adds autopkgtest suite.
Runs unit-tests, user-session tests.
While the initctl2dot test is added, it's not enabled as python3 port is not included in 1.6.1.

To post a comment you must log in.
1408. By Dimitri John Ledkov

merge lp:ubuntu/upstart

Revision history for this message
James Hunt (jamesodhunt) wrote :

I'll merge this with very minor tweaks:

- drop debian/tests/run_initctl2dot for now as discussed since:

  a) the version in upstart 1.6.1 doesn't include the fix for bug 1058029.
  b) cherry-picking in the fix for bug 1058029 from lp:upstart would necessitate making upstart depend on python3, or having us modify the lp:upstart version to change the shebang to reference python2.7.

- I'll take my version of debian/tests/user_sessions since it uses 'sh -e' so we get a test failure even if modifying the dbus configuration occurs.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== added file 'dbus/Upstart.conf.upstream'
2--- dbus/Upstart.conf.upstream 1970-01-01 00:00:00 +0000
3+++ dbus/Upstart.conf.upstream 2012-12-10 09:23:21 +0000
4@@ -0,0 +1,27 @@
5+<?xml version="1.0" encoding="UTF-8" ?>
6+<!DOCTYPE busconfig PUBLIC
7+ "-//freedesktop//DTD D-BUS Bus Configuration 1.0//EN"
8+ "http://www.freedesktop.org/standards/dbus/1.0/busconfig.dtd">
9+
10+<busconfig>
11+ <!-- Only the root user can own the Upstart name -->
12+ <policy user="root">
13+ <allow own="com.ubuntu.Upstart" />
14+ </policy>
15+
16+ <!-- Allow any user to invoke all of the methods on Upstart, its jobs
17+ or their instances, and to get and set properties - since Upstart
18+ isolates commands by user. -->
19+ <policy context="default">
20+ <allow send_destination="com.ubuntu.Upstart"
21+ send_interface="org.freedesktop.DBus.Introspectable" />
22+ <allow send_destination="com.ubuntu.Upstart"
23+ send_interface="org.freedesktop.DBus.Properties" />
24+ <allow send_destination="com.ubuntu.Upstart"
25+ send_interface="com.ubuntu.Upstart0_6" />
26+ <allow send_destination="com.ubuntu.Upstart"
27+ send_interface="com.ubuntu.Upstart0_6.Job" />
28+ <allow send_destination="com.ubuntu.Upstart"
29+ send_interface="com.ubuntu.Upstart0_6.Instance" />
30+ </policy>
31+</busconfig>
32
33=== modified file 'debian/changelog'
34--- debian/changelog 2012-12-04 23:14:53 +0000
35+++ debian/changelog 2012-12-10 09:23:21 +0000
36@@ -17,6 +17,9 @@
37 This prevents the output of running-in-container from being appended to
38 rsyslog's upstart log (and any other job calling apparmor-profile-load).
39
40+ [ Dmitrijs Ledkovs, James Hunt ]
41+ * Add autopkgtests.
42+
43 -- Steve Langasek <steve.langasek@ubuntu.com> Thu, 15 Nov 2012 09:26:10 -0800
44
45 upstart (1.5-0ubuntu9) quantal-proposed; urgency=low
46
47=== modified file 'debian/control'
48--- debian/control 2012-11-15 19:54:44 +0000
49+++ debian/control 2012-12-10 09:23:21 +0000
50@@ -6,6 +6,7 @@
51 Standards-Version: 3.8.4.0
52 Build-Depends: debhelper (>= 9), pkg-config (>= 0.22), libnih-dev (>= 1.0.3), libnih-dbus-dev (>= 1.0.3), nih-dbus-tool (>= 1.0.3), libdbus-1-dev (>= 1.2.16), libexpat1-dev (>= 2.0.0), libudev-dev (>= 151-5), libjson0-dev, dbus, bash-completion
53 Homepage: http://upstart.ubuntu.com/
54+XS-Testsuite: autopkgtest
55
56 Package: upstart
57 Architecture: any
58
59=== modified file 'debian/rules'
60--- debian/rules 2012-11-18 05:18:50 +0000
61+++ debian/rules 2012-12-10 09:23:21 +0000
62@@ -20,6 +20,15 @@
63 override_dh_auto_configure:
64 dh_auto_configure -- --exec-prefix=
65
66+override_dh_auto_test:
67+ifeq (0,$(shell id -u))
68+ # WARNING: RUNNING TESTS AS ROOT IS KNOWN TO FAIL
69+ # WARNING: WILL RUN TESTS, BUT WILL IGNORE FAILURE
70+ -dh_auto_test
71+else
72+ dh_auto_test
73+endif
74+
75 override_dh_fixperms:
76 dh_fixperms
77 chmod 755 debian/upstart/lib/init/upstart-job
78
79=== added directory 'debian/tests'
80=== added file 'debian/tests/control'
81--- debian/tests/control 1970-01-01 00:00:00 +0000
82+++ debian/tests/control 2012-12-10 09:23:21 +0000
83@@ -0,0 +1,3 @@
84+Tests: user_sessions
85+Depends: @, dbus
86+Restrictions: needs-root build-needed
87
88=== added file 'debian/tests/run_initctl2dot'
89--- debian/tests/run_initctl2dot 1970-01-01 00:00:00 +0000
90+++ debian/tests/run_initctl2dot 2012-12-10 09:23:21 +0000
91@@ -0,0 +1,15 @@
92+#!/bin/sh -e
93+#---------------------------------------------------------------------
94+# Attempt to generate an image of the available jobs on the system.
95+#---------------------------------------------------------------------
96+# Depends: graphviz
97+
98+. $(dirname $0)/test_setup
99+
100+outfile=upstart.png
101+
102+#------------------------------
103+# Init
104+
105+initctl2dot -o - | dot -Tpng -o $ADTTMP/$outfile
106+
107
108=== added file 'debian/tests/test_setup'
109--- debian/tests/test_setup 1970-01-01 00:00:00 +0000
110+++ debian/tests/test_setup 2012-12-10 09:23:21 +0000
111@@ -0,0 +1,25 @@
112+#---------------------------------------------------------------------
113+# Source this file in all tests
114+#---------------------------------------------------------------------
115+
116+# user provided by auto-package-testing environment
117+user=ubuntu
118+
119+#------------------------------
120+# Assertions
121+
122+# We must be running as root initially to perform setup
123+test $(id -u) -eq 0 || { echo "ERROR: not root"; exit 1; }
124+
125+# User must exist
126+getent passwd $user >/dev/null 2>&1 || \
127+ { echo "ERROR: no user '$user'"; exit 1; }
128+
129+#------------------------------
130+# Init
131+
132+# we need to run as root, but that means all unpacked files are owned by
133+# root too.
134+chown -R ${user}: . ..
135+
136+#---------------------------------------------------------------------
137
138=== added file 'debian/tests/user_sessions'
139--- debian/tests/user_sessions 1970-01-01 00:00:00 +0000
140+++ debian/tests/user_sessions 2012-12-10 09:23:21 +0000
141@@ -0,0 +1,33 @@
142+#!/bin/sh
143+#---------------------------------------------------------------------
144+# Run Upstart User Session tests in DEP-8 environment.
145+#---------------------------------------------------------------------
146+
147+. $(dirname $0)/test_setup
148+
149+#------------------------------
150+# Init
151+
152+# Backup original config
153+cp /etc/dbus-1/system.d/Upstart.conf \
154+ /etc/dbus-1/system.d/Upstart.conf.ORIG
155+
156+# Enable user jobs (takes effect immediately)
157+cp dbus/Upstart.conf.upstream \
158+ /etc/dbus-1/system.d/Upstart.conf
159+
160+#------------------------------
161+# test!
162+
163+su -c 'sh util/tests/test_user_sessions.sh' $user
164+RET=$?
165+
166+#------------------------------
167+# clean up
168+
169+# disable user jobs by reverting to original config
170+cp /etc/dbus-1/system.d/Upstart.conf.ORIG \
171+ /etc/dbus-1/system.d/Upstart.conf
172+
173+#------------------------------
174+exit $RET

Subscribers

People subscribed via source and target branches