Merge lp:~jamesodhunt/ubuntu/natty/upstart/fix-chroot-sessions into lp:ubuntu/natty/upstart
- Natty (11.04)
- fix-chroot-sessions
- Merge into natty
Proposed by
James Hunt
Status: | Merged | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Merge reported by: | Clint Byrum | ||||||||||||
Merged at revision: | not available | ||||||||||||
Proposed branch: | lp:~jamesodhunt/ubuntu/natty/upstart/fix-chroot-sessions | ||||||||||||
Merge into: | lp:ubuntu/natty/upstart | ||||||||||||
Diff against target: |
4753 lines (+842/-700) 38 files modified
ChangeLog (+62/-0) NEWS (+21/-0) configure.ac (+1/-1) debian/changelog (+28/-0) debian/upstart-job (+14/-4) init/Makefile.am (+4/-2) init/conf.c (+18/-12) init/conf.h (+1/-1) init/control.c (+5/-1) init/job.c (+8/-2) init/job_class.c (+34/-14) init/job_process.c (+59/-0) init/job_process.h (+3/-1) init/main.c (+8/-0) init/man/init.5 (+0/-38) init/man/init.8 (+11/-7) init/parse_job.c (+2/-2) init/session.c (+21/-8) init/session.h (+27/-2) init/tests/test_blocked.c (+4/-6) init/tests/test_conf.c (+15/-22) init/tests/test_control.c (+11/-12) init/tests/test_environ.c (+3/-0) init/tests/test_event.c (+28/-40) init/tests/test_event_operator.c (+3/-0) init/tests/test_job.c (+70/-148) init/tests/test_job_class.c (+54/-145) init/tests/test_job_process.c (+34/-59) init/tests/test_parse_conf.c (+3/-0) init/tests/test_parse_job.c (+3/-0) init/tests/test_process.c (+3/-0) init/tests/test_system.c (+3/-0) po/upstart.pot (+152/-136) scripts/init-checkconf.sh (+34/-10) scripts/man/init-checkconf.8 (+22/-10) util/initctl.c (+16/-5) util/man/initctl.8 (+3/-1) util/tests/test_initctl.c (+54/-11) |
||||||||||||
To merge this branch: | bzr merge lp:~jamesodhunt/ubuntu/natty/upstart/fix-chroot-sessions | ||||||||||||
Related bugs: |
|
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Clint Byrum (community) | Approve | ||
Review via email: mp+58249@code.launchpad.net |
Commit message
Description of the change
* Important fixes for user sessions (currently disabled in Ubuntu) and chroot sessions (which previously could cause an out-of-memory condition).
* Clints fix for bug 707479.
To post a comment you must log in.
Preview Diff
[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1 | === modified file 'ChangeLog' | |||
2 | --- ChangeLog 2011-03-24 14:33:36 +0000 | |||
3 | +++ ChangeLog 2011-04-19 09:27:29 +0000 | |||
4 | @@ -1,3 +1,65 @@ | |||
5 | 1 | 2011-04-15 James Hunt <james.hunt@ubuntu.com> | ||
6 | 2 | |||
7 | 3 | * init/conf.c: | ||
8 | 4 | - conf_source_reload_file(): Added missing error return if override | ||
9 | 5 | doesn't parse (code path currently unused). | ||
10 | 6 | - Documentation updates. | ||
11 | 7 | * init/job.c: job_new(): Fix for nasty OOM scenario when an attempt is made | ||
12 | 8 | to start a chroot job with same name as running single-instance non-chroot | ||
13 | 9 | job. Previously, the path for a chrooted Job was set from the (nul) instance | ||
14 | 10 | name of its parent JobClass. However, since that job instance name already | ||
15 | 11 | existed outside the chroot and was already D-Bus registered, | ||
16 | 12 | nih_dbus_object_new() (which allocates storage and is called by | ||
17 | 13 | job_register()) returned NULL and kept doing so due to being called | ||
18 | 14 | within NIH_MUST(). This resulted in OOM due to an as-yet unidentified | ||
19 | 15 | D-Bus bug (possibly a leak in find_subtree_recurse()). | ||
20 | 16 | * init/session.h: Documentation updates. | ||
21 | 17 | * util/test_initctl.c: Cleaned up variable names | ||
22 | 18 | in RUN_COMMAND macro. | ||
23 | 19 | * init/parse_job.c: Documentation updates. | ||
24 | 20 | |||
25 | 21 | 2011-04-06 James Hunt <james.hunt@ubuntu.com> | ||
26 | 22 | |||
27 | 23 | * init/conf.c: conf_select_job(): Added Session parameter. | ||
28 | 24 | * init/control.c: control_get_job_by_name(): Handle multiple jobs with same | ||
29 | 25 | name (but different session) in job_classes hash. | ||
30 | 26 | * init/job_class.c: | ||
31 | 27 | - job_class_remove(): Added Session parameter. | ||
32 | 28 | - job_class_consider(): Handle multiple jobs with same name | ||
33 | 29 | (but different session) in job_classes hash. | ||
34 | 30 | - job_class_reconsider(): Handle multiple jobs with same name | ||
35 | 31 | (but different session) in job_classes hash. | ||
36 | 32 | - job_class_remove(): Handle incorrect session. | ||
37 | 33 | * init/job_process.c: job_process_spawn(): Updated for sessions and | ||
38 | 34 | chroots. | ||
39 | 35 | * init/job_process.h: New enums for: | ||
40 | 36 | - JOB_PROCESS_ERROR_SETUID | ||
41 | 37 | - JOB_PROCESS_ERROR_SETGID | ||
42 | 38 | * init/session.c: | ||
43 | 39 | - session_from_dbus(): Added ability to disable sessions. | ||
44 | 40 | - Added disable_sessions variable, set via main(). | ||
45 | 41 | * init/session.h: Added tabular comment summarising Session object | ||
46 | 42 | contents for different environments. | ||
47 | 43 | * init/Makefile.am: Reverted special-casing for session.c. | ||
48 | 44 | * init/main.c: Addition of new command-line option "--no-sessions" to | ||
49 | 45 | disable chroot+user sessions (providing a "traditional" Upstart | ||
50 | 46 | environment. The primary use for this option is the test suite. | ||
51 | 47 | * init/man/init.8: Updates for "--no-sessions". | ||
52 | 48 | * init/tests/test_*.c: Replaced explicit Sessions with NULL | ||
53 | 49 | session since tests are not yet session-aware (with the exception of | ||
54 | 50 | test_job_process.c, all main() functions now set the | ||
55 | 51 | UPSTART_NO_SESSIONS variable to disable sessions). | ||
56 | 52 | * util/tests/test_initctl.c: | ||
57 | 53 | - START_UPSTART now specifies "--no-sessions" | ||
58 | 54 | - test_check_config(): Added test for "--warn". | ||
59 | 55 | * scripts/init-checkconf.sh: Script now also checks any script | ||
60 | 56 | sections found unless the new "--noscript" option is specified. | ||
61 | 57 | Added required "--no-sessions" option to upstart_cmd to ensure Upstart | ||
62 | 58 | treats clients requests in traditional manner. | ||
63 | 59 | * scripts/man/init-checkconf.8: Update for "--noscript". | ||
64 | 60 | * util/initctl.c: Added "--warn" option for check-config command to | ||
65 | 61 | warn if any events or jobs are not known. | ||
66 | 62 | |||
67 | 1 | 2011-03-24 James Hunt <james.hunt@ubuntu.com> | 63 | 2011-03-24 James Hunt <james.hunt@ubuntu.com> |
68 | 2 | 64 | ||
69 | 3 | * init/tests/test_control.c: Added comment. | 65 | * init/tests/test_control.c: Added comment. |
70 | 4 | 66 | ||
71 | === modified file 'NEWS' | |||
72 | --- NEWS 2011-03-24 14:33:36 +0000 | |||
73 | +++ NEWS 2011-04-19 09:27:29 +0000 | |||
74 | @@ -1,3 +1,24 @@ | |||
75 | 1 | 0.9.6 2011-04-15 | ||
76 | 2 | |||
77 | 3 | * Fix for nasty OOM scenario when an attempt is made to start | ||
78 | 4 | a chroot job with same name as running single-instance | ||
79 | 5 | non-chroot job. Previously, the path for a chrooted Job | ||
80 | 6 | was set from the (nul) instance name of its parent JobClass. | ||
81 | 7 | However, since that job instance name already existed | ||
82 | 8 | outside the chroot and was already D-Bus registered, | ||
83 | 9 | nih_dbus_object_new() (which allocates storage and is | ||
84 | 10 | called by job_register()) returned NULL and kept doing so | ||
85 | 11 | due to being called within NIH_MUST(). This resulted in | ||
86 | 12 | OOM due to an as-yet unidentified D-Bus bug (possibly a | ||
87 | 13 | leak in find_subtree_recurse()). | ||
88 | 14 | |||
89 | 15 | 0.9.5 2011-04-06 | ||
90 | 16 | |||
91 | 17 | * Important fixes for user and chroot sessions. | ||
92 | 18 | * scripts/init-checkconf.sh: Now checks script sections too. | ||
93 | 19 | * util/initctl.c: Added "--warn" option for check-config command | ||
94 | 20 | to warn if any events or jobs are not known. | ||
95 | 21 | |||
96 | 1 | 0.9.4 2011-03-24 | 22 | 0.9.4 2011-03-24 |
97 | 2 | 23 | ||
98 | 3 | * scripts/initctl2dot.py: Fix to handle 'emits' glob syntax | 24 | * scripts/initctl2dot.py: Fix to handle 'emits' glob syntax |
99 | 4 | 25 | ||
100 | === modified file 'configure.ac' | |||
101 | --- configure.ac 2011-03-24 14:33:36 +0000 | |||
102 | +++ configure.ac 2011-04-19 09:27:29 +0000 | |||
103 | @@ -1,7 +1,7 @@ | |||
104 | 1 | # Process this file with autoconf to produce a configure script. | 1 | # Process this file with autoconf to produce a configure script. |
105 | 2 | 2 | ||
106 | 3 | AC_PREREQ(2.61) | 3 | AC_PREREQ(2.61) |
108 | 4 | AC_INIT([upstart], [0.9.4], [upstart-devel@lists.ubuntu.com]) | 4 | AC_INIT([upstart], [0.9.6], [upstart-devel@lists.ubuntu.com]) |
109 | 5 | NIH_COPYRIGHT([[Copyright © 2011 Canonical Ltd.]]) | 5 | NIH_COPYRIGHT([[Copyright © 2011 Canonical Ltd.]]) |
110 | 6 | AC_CONFIG_SRCDIR([init/main.c]) | 6 | AC_CONFIG_SRCDIR([init/main.c]) |
111 | 7 | AC_CONFIG_MACRO_DIR([m4]) | 7 | AC_CONFIG_MACRO_DIR([m4]) |
112 | 8 | 8 | ||
113 | === modified file 'debian/changelog' | |||
114 | --- debian/changelog 2011-03-24 14:35:14 +0000 | |||
115 | +++ debian/changelog 2011-04-19 09:27:29 +0000 | |||
116 | @@ -1,3 +1,31 @@ | |||
117 | 1 | upstart (0.9.6-1ubuntu1) natty; urgency=low | ||
118 | 2 | |||
119 | 3 | * init/man/init.5: Remove mention of user jobs since facility is | ||
120 | 4 | disabled. | ||
121 | 5 | |||
122 | 6 | -- James Hunt <james.hunt@ubuntu.com> Fri, 15 Apr 2011 15:37:57 +0100 | ||
123 | 7 | |||
124 | 8 | upstart (0.9.6-1) natty; urgency=low | ||
125 | 9 | |||
126 | 10 | * New upstream release 0.9.6: Important session+chroot fixes. | ||
127 | 11 | |||
128 | 12 | -- James Hunt <james.hunt@ubuntu.com> Fri, 15 Apr 2011 15:36:40 +0100 | ||
129 | 13 | |||
130 | 14 | upstart (0.9.5-1ubuntu1) natty; urgency=low | ||
131 | 15 | |||
132 | 16 | [ Clint Byrum ] | ||
133 | 17 | * debian/upstart-job: change behavior to reload job configuration on | ||
134 | 18 | restart, which more closely matches expected sysvinit script | ||
135 | 19 | behavior. (LP: #707479) | ||
136 | 20 | |||
137 | 21 | -- James Hunt <james.hunt@ubuntu.com> Wed, 06 Apr 2011 17:50:53 +0100 | ||
138 | 22 | |||
139 | 23 | upstart (0.9.5-1) natty; urgency=low | ||
140 | 24 | |||
141 | 25 | * New upstream release 0.9.5. | ||
142 | 26 | |||
143 | 27 | -- James Hunt <james.hunt@ubuntu.com> Wed, 06 Apr 2011 17:45:38 +0100 | ||
144 | 28 | |||
145 | 1 | upstart (0.9.4-1ubuntu1) natty; urgency=low | 29 | upstart (0.9.4-1ubuntu1) natty; urgency=low |
146 | 2 | 30 | ||
147 | 3 | * debian/manpages/upstart-events.7: | 31 | * debian/manpages/upstart-events.7: |
148 | 4 | 32 | ||
149 | === modified file 'debian/upstart-job' | |||
150 | --- debian/upstart-job 2011-01-26 21:52:39 +0000 | |||
151 | +++ debian/upstart-job 2011-04-19 09:27:29 +0000 | |||
152 | @@ -44,7 +44,7 @@ | |||
153 | 44 | $ECHO "Upstart job, you may also use the $COMMAND(8) utility, e.g. $COMMAND $JOB" | 44 | $ECHO "Upstart job, you may also use the $COMMAND(8) utility, e.g. $COMMAND $JOB" |
154 | 45 | $COMMAND "$JOB" | 45 | $COMMAND "$JOB" |
155 | 46 | ;; | 46 | ;; |
157 | 47 | start|stop|restart) | 47 | start|stop) |
158 | 48 | $ECHO | 48 | $ECHO |
159 | 49 | $ECHO "Since the script you are attempting to invoke has been converted to an" | 49 | $ECHO "Since the script you are attempting to invoke has been converted to an" |
160 | 50 | $ECHO "Upstart job, you may also use the $COMMAND(8) utility, e.g. $COMMAND $JOB" | 50 | $ECHO "Upstart job, you may also use the $COMMAND(8) utility, e.g. $COMMAND $JOB" |
161 | @@ -55,12 +55,22 @@ | |||
162 | 55 | exit 0 | 55 | exit 0 |
163 | 56 | elif [ -n "$RUNNING" ] && [ "$COMMAND" = "start" ]; then | 56 | elif [ -n "$RUNNING" ] && [ "$COMMAND" = "start" ]; then |
164 | 57 | exit 0 | 57 | exit 0 |
165 | 58 | elif [ -z "$RUNNING" ] && [ "$COMMAND" = "restart" ]; then | ||
166 | 59 | start "$JOB" | ||
167 | 60 | exit 0 | ||
168 | 61 | fi | 58 | fi |
169 | 62 | $COMMAND "$JOB" | 59 | $COMMAND "$JOB" |
170 | 63 | ;; | 60 | ;; |
171 | 61 | restart) | ||
172 | 62 | $ECHO | ||
173 | 63 | $ECHO "Since the script you are attempting to invoke has been converted to an" | ||
174 | 64 | $ECHO "Upstart job, you may also use the stop(8) and then start(8) utilities," | ||
175 | 65 | $ECHO "e.g. stop $JOB ; start $JOB. The restart(8) utility is also available." | ||
176 | 66 | if status "$JOB" 2>/dev/null | grep -q ' start/'; then | ||
177 | 67 | RUNNING=1 | ||
178 | 68 | fi | ||
179 | 69 | if [ -n "$RUNNING" ] ; then | ||
180 | 70 | stop "$JOB" | ||
181 | 71 | fi | ||
182 | 72 | start "$JOB" | ||
183 | 73 | ;; | ||
184 | 64 | reload|force-reload) | 74 | reload|force-reload) |
185 | 65 | $ECHO | 75 | $ECHO |
186 | 66 | $ECHO "Since the script you are attempting to invoke has been converted to an" | 76 | $ECHO "Since the script you are attempting to invoke has been converted to an" |
187 | 67 | 77 | ||
188 | === modified file 'init/Makefile.am' | |||
189 | --- init/Makefile.am 2011-02-24 15:41:04 +0000 | |||
190 | +++ init/Makefile.am 2011-04-19 09:27:29 +0000 | |||
191 | @@ -273,24 +273,26 @@ | |||
192 | 273 | $(NIH_DBUS_LIBS) \ | 273 | $(NIH_DBUS_LIBS) \ |
193 | 274 | $(DBUS_LIBS) | 274 | $(DBUS_LIBS) |
194 | 275 | 275 | ||
196 | 276 | test_conf_SOURCES = tests/test_conf.c session.c | 276 | test_conf_SOURCES = tests/test_conf.c |
197 | 277 | test_conf_CFLAGS = $(AM_CFLAGS) -DTEST | 277 | test_conf_CFLAGS = $(AM_CFLAGS) -DTEST |
198 | 278 | test_conf_LDADD = \ | 278 | test_conf_LDADD = \ |
199 | 279 | system.o environ.o process.o \ | 279 | system.o environ.o process.o \ |
200 | 280 | job_class.o job_process.o job.o event.o event_operator.o blocked.o \ | 280 | job_class.o job_process.o job.o event.o event_operator.o blocked.o \ |
201 | 281 | parse_job.o parse_conf.o conf.o control.o \ | 281 | parse_job.o parse_conf.o conf.o control.o \ |
202 | 282 | session.o \ | ||
203 | 282 | com.ubuntu.Upstart.o \ | 283 | com.ubuntu.Upstart.o \ |
204 | 283 | com.ubuntu.Upstart.Job.o com.ubuntu.Upstart.Instance.o \ | 284 | com.ubuntu.Upstart.Job.o com.ubuntu.Upstart.Instance.o \ |
205 | 284 | $(NIH_LIBS) \ | 285 | $(NIH_LIBS) \ |
206 | 285 | $(NIH_DBUS_LIBS) \ | 286 | $(NIH_DBUS_LIBS) \ |
207 | 286 | $(DBUS_LIBS) | 287 | $(DBUS_LIBS) |
208 | 287 | 288 | ||
210 | 288 | test_control_SOURCES = tests/test_control.c session.c | 289 | test_control_SOURCES = tests/test_control.c |
211 | 289 | test_control_CFLAGS = $(AM_CFLAGS) -DTEST | 290 | test_control_CFLAGS = $(AM_CFLAGS) -DTEST |
212 | 290 | test_control_LDADD = \ | 291 | test_control_LDADD = \ |
213 | 291 | system.o environ.o process.o \ | 292 | system.o environ.o process.o \ |
214 | 292 | job_class.o job_process.o job.o event.o event_operator.o blocked.o \ | 293 | job_class.o job_process.o job.o event.o event_operator.o blocked.o \ |
215 | 293 | parse_job.o parse_conf.o conf.o control.o \ | 294 | parse_job.o parse_conf.o conf.o control.o \ |
216 | 295 | session.o \ | ||
217 | 294 | com.ubuntu.Upstart.o \ | 296 | com.ubuntu.Upstart.o \ |
218 | 295 | com.ubuntu.Upstart.Job.o com.ubuntu.Upstart.Instance.o \ | 297 | com.ubuntu.Upstart.Job.o com.ubuntu.Upstart.Instance.o \ |
219 | 296 | $(NIH_LIBS) \ | 298 | $(NIH_LIBS) \ |
220 | 297 | 299 | ||
221 | === modified file 'init/conf.c' | |||
222 | --- init/conf.c 2011-02-23 11:04:27 +0000 | |||
223 | +++ init/conf.c 2011-04-19 09:27:29 +0000 | |||
224 | @@ -517,13 +517,10 @@ | |||
225 | 517 | nih_debug ("Updating configuration for %s from %s", | 517 | nih_debug ("Updating configuration for %s from %s", |
226 | 518 | source->path, override_path); | 518 | source->path, override_path); |
227 | 519 | if (conf_reload_path (source, source->path, override_path) < 0) { | 519 | if (conf_reload_path (source, source->path, override_path) < 0) { |
229 | 520 | NihError *err; | 520 | if (err) |
230 | 521 | nih_free (err); | ||
231 | 521 | 522 | ||
237 | 522 | err = nih_error_get (); | 523 | return -1; |
233 | 523 | nih_error ("%s: %s: %s", override_path, | ||
234 | 524 | _("Error while reloading configuration file"), | ||
235 | 525 | err->message); | ||
236 | 526 | nih_free (err); | ||
238 | 527 | } | 524 | } |
239 | 528 | 525 | ||
240 | 529 | return 0; | 526 | return 0; |
241 | @@ -935,7 +932,7 @@ | |||
242 | 935 | * conf_reload_path: | 932 | * conf_reload_path: |
243 | 936 | * @source: configuration source, | 933 | * @source: configuration source, |
244 | 937 | * @path: path of conf file to be reloaded. | 934 | * @path: path of conf file to be reloaded. |
246 | 938 | * @override_path: if TRUE and @path refers to a path associated with @source, | 935 | * @override_path: if not NULL and @path refers to a path associated with @source, |
247 | 939 | * overlay the contents of @path into the existing @source entry for | 936 | * overlay the contents of @path into the existing @source entry for |
248 | 940 | * @path. If FALSE, discard any existing knowledge of @path. | 937 | * @path. If FALSE, discard any existing knowledge of @path. |
249 | 941 | * | 938 | * |
250 | @@ -946,7 +943,8 @@ | |||
251 | 946 | * | 943 | * |
252 | 947 | * If the file has been parsed before, then the existing item is deleted and | 944 | * If the file has been parsed before, then the existing item is deleted and |
253 | 948 | * freed if the file fails to load, or after the new item has been parsed. | 945 | * freed if the file fails to load, or after the new item has been parsed. |
255 | 949 | * Items are not reused between reloads. | 946 | * Items are only reused between reloads if @override_path is |
256 | 947 | * non-NULL. | ||
257 | 950 | * | 948 | * |
258 | 951 | * Physical errors are returned, parse errors are not. | 949 | * Physical errors are returned, parse errors are not. |
259 | 952 | * | 950 | * |
260 | @@ -968,12 +966,16 @@ | |||
261 | 968 | nih_assert (source != NULL); | 966 | nih_assert (source != NULL); |
262 | 969 | nih_assert (path != NULL); | 967 | nih_assert (path != NULL); |
263 | 970 | 968 | ||
265 | 971 | path_to_load = ( override_path ? override_path : path); | 969 | path_to_load = (override_path ? override_path : path); |
266 | 972 | 970 | ||
267 | 973 | /* If there is no corresponding override file, look up the old | 971 | /* If there is no corresponding override file, look up the old |
268 | 974 | * conf file in memory, and then free it. In cases of failure, | 972 | * conf file in memory, and then free it. In cases of failure, |
269 | 975 | * we discard it anyway, so there's no particular reason | 973 | * we discard it anyway, so there's no particular reason |
270 | 976 | * to keep it around anymore. | 974 | * to keep it around anymore. |
271 | 975 | * | ||
272 | 976 | * Note: if @override_path has been specified, do not | ||
273 | 977 | * free the file if found, since we want to _update_ the | ||
274 | 978 | * existing entry. | ||
275 | 977 | */ | 979 | */ |
276 | 978 | file = (ConfFile *)nih_hash_lookup (source->files, path); | 980 | file = (ConfFile *)nih_hash_lookup (source->files, path); |
277 | 979 | if (! override_path && file) | 981 | if (! override_path && file) |
278 | @@ -987,7 +989,7 @@ | |||
279 | 987 | if (! buf) | 989 | if (! buf) |
280 | 988 | return -1; | 990 | return -1; |
281 | 989 | 991 | ||
283 | 990 | /* Create a new ConfFile structure (if no override_path was specified) */ | 992 | /* Create a new ConfFile structure (if no @override_path specified) */ |
284 | 991 | file = (ConfFile *)nih_hash_lookup (source->files, path); | 993 | file = (ConfFile *)nih_hash_lookup (source->files, path); |
285 | 992 | if (! file) | 994 | if (! file) |
286 | 993 | file = NIH_MUST (conf_file_new (source, path)); | 995 | file = NIH_MUST (conf_file_new (source, path)); |
287 | @@ -1144,7 +1146,8 @@ | |||
288 | 1144 | 1146 | ||
289 | 1145 | /** | 1147 | /** |
290 | 1146 | * conf_select_job: | 1148 | * conf_select_job: |
292 | 1147 | * @name: name of job class to locate. | 1149 | * @name: name of job class to locate, |
293 | 1150 | * @session: session class name belongs to. | ||
294 | 1148 | * | 1151 | * |
295 | 1149 | * Select the best available class of a job named @name from the registered | 1152 | * Select the best available class of a job named @name from the registered |
296 | 1150 | * configuration sources. | 1153 | * configuration sources. |
297 | @@ -1152,7 +1155,7 @@ | |||
298 | 1152 | * Returns: Best available job class or NULL if none available. | 1155 | * Returns: Best available job class or NULL if none available. |
299 | 1153 | **/ | 1156 | **/ |
300 | 1154 | JobClass * | 1157 | JobClass * |
302 | 1155 | conf_select_job (const char *name) | 1158 | conf_select_job (const char *name, const Session *session) |
303 | 1156 | { | 1159 | { |
304 | 1157 | nih_assert (name != NULL); | 1160 | nih_assert (name != NULL); |
305 | 1158 | 1161 | ||
306 | @@ -1164,6 +1167,9 @@ | |||
307 | 1164 | if (source->type != CONF_JOB_DIR) | 1167 | if (source->type != CONF_JOB_DIR) |
308 | 1165 | continue; | 1168 | continue; |
309 | 1166 | 1169 | ||
310 | 1170 | if (source->session != session) | ||
311 | 1171 | continue; | ||
312 | 1172 | |||
313 | 1167 | NIH_HASH_FOREACH (source->files, file_iter) { | 1173 | NIH_HASH_FOREACH (source->files, file_iter) { |
314 | 1168 | ConfFile *file = (ConfFile *)file_iter; | 1174 | ConfFile *file = (ConfFile *)file_iter; |
315 | 1169 | 1175 | ||
316 | 1170 | 1176 | ||
317 | === modified file 'init/conf.h' | |||
318 | --- init/conf.h 2011-02-23 11:04:27 +0000 | |||
319 | +++ init/conf.h 2011-04-19 09:27:29 +0000 | |||
320 | @@ -125,7 +125,7 @@ | |||
321 | 125 | 125 | ||
322 | 126 | int conf_file_destroy (ConfFile *file); | 126 | int conf_file_destroy (ConfFile *file); |
323 | 127 | 127 | ||
325 | 128 | JobClass * conf_select_job (const char *name); | 128 | JobClass * conf_select_job (const char *name, const Session *session); |
326 | 129 | 129 | ||
327 | 130 | char *toggle_conf_name (const void *parent, const char *path) | 130 | char *toggle_conf_name (const void *parent, const char *path) |
328 | 131 | __attribute__ ((warn_unused_result, malloc)); | 131 | __attribute__ ((warn_unused_result, malloc)); |
329 | 132 | 132 | ||
330 | === modified file 'init/control.c' | |||
331 | --- init/control.c 2011-03-10 14:06:37 +0000 | |||
332 | +++ init/control.c 2011-04-19 09:27:29 +0000 | |||
333 | @@ -417,7 +417,11 @@ | |||
334 | 417 | session = session_from_dbus (NULL, message); | 417 | session = session_from_dbus (NULL, message); |
335 | 418 | 418 | ||
336 | 419 | /* Lookup the job */ | 419 | /* Lookup the job */ |
338 | 420 | class = (JobClass *)nih_hash_lookup (job_classes, name); | 420 | class = (JobClass *)nih_hash_search (job_classes, name, NULL); |
339 | 421 | |||
340 | 422 | while (class && class->session != session) { | ||
341 | 423 | class = (JobClass *)nih_hash_search (job_classes, name, &class->entry); | ||
342 | 424 | } | ||
343 | 421 | 425 | ||
344 | 422 | if (class && ! session) | 426 | if (class && ! session) |
345 | 423 | class->session = session; | 427 | class->session = session; |
346 | 424 | 428 | ||
347 | === modified file 'init/job.c' | |||
348 | --- init/job.c 2011-02-23 10:38:33 +0000 | |||
349 | +++ init/job.c 2011-04-19 09:27:29 +0000 | |||
350 | @@ -100,8 +100,14 @@ | |||
351 | 100 | 100 | ||
352 | 101 | job->class = class; | 101 | job->class = class; |
353 | 102 | 102 | ||
356 | 103 | job->path = nih_dbus_path (job, DBUS_PATH_UPSTART, "jobs", | 103 | if (job->class->session && job->class->session->chroot) { |
357 | 104 | class->name, job->name, NULL); | 104 | /* JobClass already contains a valid D-Bus path prefix for the job */ |
358 | 105 | job->path = nih_dbus_path (job, class->path, job->name, NULL); | ||
359 | 106 | } else { | ||
360 | 107 | job->path = nih_dbus_path (job, DBUS_PATH_UPSTART, "jobs", | ||
361 | 108 | class->name, job->name, NULL); | ||
362 | 109 | } | ||
363 | 110 | |||
364 | 105 | if (! job->path) | 111 | if (! job->path) |
365 | 106 | goto error; | 112 | goto error; |
366 | 107 | 113 | ||
367 | 108 | 114 | ||
368 | === modified file 'init/job_class.c' | |||
369 | --- init/job_class.c 2011-02-23 11:04:27 +0000 | |||
370 | +++ init/job_class.c 2011-04-19 09:27:29 +0000 | |||
371 | @@ -100,7 +100,7 @@ | |||
372 | 100 | 100 | ||
373 | 101 | /* Prototypes for static functions */ | 101 | /* Prototypes for static functions */ |
374 | 102 | static void job_class_add (JobClass *class); | 102 | static void job_class_add (JobClass *class); |
376 | 103 | static int job_class_remove (JobClass *class); | 103 | static int job_class_remove (JobClass *class, const Session *session); |
377 | 104 | 104 | ||
378 | 105 | 105 | ||
379 | 106 | /** | 106 | /** |
380 | @@ -280,19 +280,27 @@ | |||
381 | 280 | int | 280 | int |
382 | 281 | job_class_consider (JobClass *class) | 281 | job_class_consider (JobClass *class) |
383 | 282 | { | 282 | { |
385 | 283 | JobClass *registered, *best; | 283 | JobClass *registered = NULL, *best = NULL; |
386 | 284 | 284 | ||
387 | 285 | nih_assert (class != NULL); | 285 | nih_assert (class != NULL); |
388 | 286 | 286 | ||
389 | 287 | job_class_init (); | 287 | job_class_init (); |
390 | 288 | 288 | ||
392 | 289 | best = conf_select_job (class->name); | 289 | best = conf_select_job (class->name, class->session); |
393 | 290 | nih_assert (best != NULL); | 290 | nih_assert (best != NULL); |
396 | 291 | 291 | nih_assert (best->session == class->session); | |
397 | 292 | registered = (JobClass *)nih_hash_lookup (job_classes, class->name); | 292 | |
398 | 293 | registered = (JobClass *)nih_hash_search (job_classes, class->name, NULL); | ||
399 | 294 | |||
400 | 295 | /* If we found an entry, ensure we only consider the appropriate session */ | ||
401 | 296 | while (registered && registered->session != class->session) | ||
402 | 297 | { | ||
403 | 298 | registered = (JobClass *)nih_hash_search (job_classes, class->name, ®istered->entry); | ||
404 | 299 | } | ||
405 | 300 | |||
406 | 293 | if (registered != best) { | 301 | if (registered != best) { |
407 | 294 | if (registered) | 302 | if (registered) |
409 | 295 | if (! job_class_remove (registered)) | 303 | if (! job_class_remove (registered, class->session)) |
410 | 296 | return FALSE; | 304 | return FALSE; |
411 | 297 | 305 | ||
412 | 298 | job_class_add (best); | 306 | job_class_add (best); |
413 | @@ -317,18 +325,25 @@ | |||
414 | 317 | int | 325 | int |
415 | 318 | job_class_reconsider (JobClass *class) | 326 | job_class_reconsider (JobClass *class) |
416 | 319 | { | 327 | { |
418 | 320 | JobClass *registered, *best; | 328 | JobClass *registered = NULL, *best = NULL; |
419 | 321 | 329 | ||
420 | 322 | nih_assert (class != NULL); | 330 | nih_assert (class != NULL); |
421 | 323 | 331 | ||
422 | 324 | job_class_init (); | 332 | job_class_init (); |
423 | 325 | 333 | ||
427 | 326 | best = conf_select_job (class->name); | 334 | best = conf_select_job (class->name, class->session); |
428 | 327 | 335 | ||
429 | 328 | registered = (JobClass *)nih_hash_lookup (job_classes, class->name); | 336 | registered = (JobClass *)nih_hash_search (job_classes, class->name, NULL); |
430 | 337 | |||
431 | 338 | /* If we found an entry, ensure we only consider the appropriate session */ | ||
432 | 339 | while (registered && registered->session != class->session) | ||
433 | 340 | { | ||
434 | 341 | registered = (JobClass *)nih_hash_search (job_classes, class->name, ®istered->entry); | ||
435 | 342 | } | ||
436 | 343 | |||
437 | 329 | if (registered == class) { | 344 | if (registered == class) { |
438 | 330 | if (class != best) { | 345 | if (class != best) { |
440 | 331 | if (! job_class_remove (class)) | 346 | if (! job_class_remove (class, class->session)) |
441 | 332 | return FALSE; | 347 | return FALSE; |
442 | 333 | 348 | ||
443 | 334 | job_class_add (best); | 349 | job_class_add (best); |
444 | @@ -369,19 +384,24 @@ | |||
445 | 369 | 384 | ||
446 | 370 | /** | 385 | /** |
447 | 371 | * job_class_remove: | 386 | * job_class_remove: |
449 | 372 | * @class: class to remove. | 387 | * @class: class to remove, |
450 | 388 | * @session: Session of @class. | ||
451 | 373 | * | 389 | * |
452 | 374 | * Removes @class from the hash table and unregisters it from all current | 390 | * Removes @class from the hash table and unregisters it from all current |
453 | 375 | * D-Bus connections. | 391 | * D-Bus connections. |
454 | 376 | * | 392 | * |
455 | 377 | * Returns: TRUE if class could be unregistered, FALSE if there are | 393 | * Returns: TRUE if class could be unregistered, FALSE if there are |
457 | 378 | * active instances that prevent unregistration. | 394 | * active instances that prevent unregistration, or if @session |
458 | 395 | * does not match the session associated with @class. | ||
459 | 379 | **/ | 396 | **/ |
460 | 380 | static int | 397 | static int |
462 | 381 | job_class_remove (JobClass *class) | 398 | job_class_remove (JobClass *class, const Session *session) |
463 | 382 | { | 399 | { |
464 | 383 | nih_assert (class != NULL); | 400 | nih_assert (class != NULL); |
465 | 384 | 401 | ||
466 | 402 | if (class->session != session) | ||
467 | 403 | return FALSE; | ||
468 | 404 | |||
469 | 385 | control_init (); | 405 | control_init (); |
470 | 386 | 406 | ||
471 | 387 | /* Return if we have any active instances */ | 407 | /* Return if we have any active instances */ |
472 | 388 | 408 | ||
473 | === modified file 'init/job_process.c' | |||
474 | --- init/job_process.c 2011-02-24 15:41:04 +0000 | |||
475 | +++ init/job_process.c 2011-04-19 09:27:29 +0000 | |||
476 | @@ -40,6 +40,7 @@ | |||
477 | 40 | #include <unistd.h> | 40 | #include <unistd.h> |
478 | 41 | #include <utmp.h> | 41 | #include <utmp.h> |
479 | 42 | #include <utmpx.h> | 42 | #include <utmpx.h> |
480 | 43 | #include <pwd.h> | ||
481 | 43 | 44 | ||
482 | 44 | #include <nih/macros.h> | 45 | #include <nih/macros.h> |
483 | 45 | #include <nih/alloc.h> | 46 | #include <nih/alloc.h> |
484 | @@ -503,6 +504,16 @@ | |||
485 | 503 | } | 504 | } |
486 | 504 | } | 505 | } |
487 | 505 | 506 | ||
488 | 507 | /* Handle changing a chroot session job prior to dealing with | ||
489 | 508 | * the 'chroot' stanza. | ||
490 | 509 | */ | ||
491 | 510 | if (class->session && class->session->chroot) { | ||
492 | 511 | if (chroot (class->session->chroot) < 0) { | ||
493 | 512 | nih_error_raise_system (); | ||
494 | 513 | job_process_error_abort (fds[1], JOB_PROCESS_ERROR_CHROOT, 0); | ||
495 | 514 | } | ||
496 | 515 | } | ||
497 | 516 | |||
498 | 506 | /* Change the root directory, confining path resolution within it; | 517 | /* Change the root directory, confining path resolution within it; |
499 | 507 | * we do this before the working directory call so that is always | 518 | * we do this before the working directory call so that is always |
500 | 508 | * relative to the new root. | 519 | * relative to the new root. |
501 | @@ -558,6 +569,54 @@ | |||
502 | 558 | } | 569 | } |
503 | 559 | } | 570 | } |
504 | 560 | 571 | ||
505 | 572 | /* Handle unprivileged user job by dropping privileges to | ||
506 | 573 | * their level. | ||
507 | 574 | */ | ||
508 | 575 | if (class->session && class->session->user) { | ||
509 | 576 | uid_t uid = class->session->user; | ||
510 | 577 | struct passwd *pw = NULL; | ||
511 | 578 | |||
512 | 579 | /* D-Bus does not expose a public API call to allow | ||
513 | 580 | * us to query a users primary group. | ||
514 | 581 | * _dbus_user_info_fill_uid () seems to exist for this | ||
515 | 582 | * purpose, but is a "secret" API. It is unclear why | ||
516 | 583 | * D-Bus neglects the gid when it allows the uid | ||
517 | 584 | * to be queried directly. | ||
518 | 585 | * | ||
519 | 586 | * Our only recourse is to disallow user sessions in a | ||
520 | 587 | * chroot and assume that all other user sessions | ||
521 | 588 | * originate from the local system. In this way, we can | ||
522 | 589 | * bypass D-Bus and use getpwuid (). | ||
523 | 590 | */ | ||
524 | 591 | |||
525 | 592 | if (class->session->chroot) { | ||
526 | 593 | /* We cannot determine the group id of the user | ||
527 | 594 | * session in the chroot via D-Bus, so disallow | ||
528 | 595 | * all jobs in such an environment. | ||
529 | 596 | */ | ||
530 | 597 | _nih_error_raise (__FILE__, __LINE__, __FUNCTION__, | ||
531 | 598 | EPERM, strerror (EPERM)); | ||
532 | 599 | } | ||
533 | 600 | |||
534 | 601 | pw = getpwuid (uid); | ||
535 | 602 | |||
536 | 603 | if (!pw) | ||
537 | 604 | nih_return_system_error (-1); | ||
538 | 605 | |||
539 | 606 | nih_assert (pw->pw_uid == uid); | ||
540 | 607 | |||
541 | 608 | if (uid && setuid (uid) < 0) { | ||
542 | 609 | nih_error_raise_system (); | ||
543 | 610 | job_process_error_abort (fds[1], JOB_PROCESS_ERROR_SETUID, 0); | ||
544 | 611 | } | ||
545 | 612 | |||
546 | 613 | if (pw->pw_gid && setgid (pw->pw_gid) < 0) { | ||
547 | 614 | nih_error_raise_system (); | ||
548 | 615 | job_process_error_abort (fds[1], JOB_PROCESS_ERROR_SETGID, 0); | ||
549 | 616 | } | ||
550 | 617 | } | ||
551 | 618 | |||
552 | 619 | |||
553 | 561 | /* Execute the process, if we escape from here it failed */ | 620 | /* Execute the process, if we escape from here it failed */ |
554 | 562 | if (execvp (argv[0], argv) < 0) { | 621 | if (execvp (argv[0], argv) < 0) { |
555 | 563 | nih_error_raise_system (); | 622 | nih_error_raise_system (); |
556 | 564 | 623 | ||
557 | === modified file 'init/job_process.h' | |||
558 | --- init/job_process.h 2009-07-09 11:01:53 +0000 | |||
559 | +++ init/job_process.h 2011-04-19 09:27:29 +0000 | |||
560 | @@ -45,7 +45,9 @@ | |||
561 | 45 | JOB_PROCESS_ERROR_CHROOT, | 45 | JOB_PROCESS_ERROR_CHROOT, |
562 | 46 | JOB_PROCESS_ERROR_CHDIR, | 46 | JOB_PROCESS_ERROR_CHDIR, |
563 | 47 | JOB_PROCESS_ERROR_PTRACE, | 47 | JOB_PROCESS_ERROR_PTRACE, |
565 | 48 | JOB_PROCESS_ERROR_EXEC | 48 | JOB_PROCESS_ERROR_EXEC, |
566 | 49 | JOB_PROCESS_ERROR_SETUID, | ||
567 | 50 | JOB_PROCESS_ERROR_SETGID, | ||
568 | 49 | } JobProcessErrorType; | 51 | } JobProcessErrorType; |
569 | 50 | 52 | ||
570 | 51 | /** | 53 | /** |
571 | 52 | 54 | ||
572 | === modified file 'init/main.c' | |||
573 | --- init/main.c 2011-03-10 14:23:57 +0000 | |||
574 | +++ init/main.c 2011-04-19 09:27:29 +0000 | |||
575 | @@ -117,6 +117,8 @@ | |||
576 | 117 | 117 | ||
577 | 118 | extern int use_session_bus; | 118 | extern int use_session_bus; |
578 | 119 | 119 | ||
579 | 120 | extern int disable_sessions; | ||
580 | 121 | |||
581 | 120 | /** | 122 | /** |
582 | 121 | * options: | 123 | * options: |
583 | 122 | * | 124 | * |
584 | @@ -132,6 +134,9 @@ | |||
585 | 132 | { 0, "no-startup-event", N_("do not emit any startup event (for testing)"), | 134 | { 0, "no-startup-event", N_("do not emit any startup event (for testing)"), |
586 | 133 | NULL, NULL, &disable_startup_event, NULL }, | 135 | NULL, NULL, &disable_startup_event, NULL }, |
587 | 134 | 136 | ||
588 | 137 | { 0, "no-sessions", N_("Disable user and chroot sessions"), | ||
589 | 138 | NULL, NULL, &disable_sessions, NULL }, | ||
590 | 139 | |||
591 | 135 | { 0, "restart", NULL, NULL, NULL, &restart, NULL }, | 140 | { 0, "restart", NULL, NULL, NULL, &restart, NULL }, |
592 | 136 | 141 | ||
593 | 137 | { 0, "session", N_("use D-Bus session bus rather than system bus (for testing)"), | 142 | { 0, "session", N_("use D-Bus session bus rather than system bus (for testing)"), |
594 | @@ -459,6 +464,9 @@ | |||
595 | 459 | sigprocmask (SIG_SETMASK, &mask, NULL); | 464 | sigprocmask (SIG_SETMASK, &mask, NULL); |
596 | 460 | } | 465 | } |
597 | 461 | 466 | ||
598 | 467 | if (disable_sessions) | ||
599 | 468 | nih_debug ("Sessions disabled"); | ||
600 | 469 | |||
601 | 462 | /* Run through the loop at least once to deal with signals that were | 470 | /* Run through the loop at least once to deal with signals that were |
602 | 463 | * delivered to the previous process while the mask was set or to | 471 | * delivered to the previous process while the mask was set or to |
603 | 464 | * process the startup event we emitted. | 472 | * process the startup event we emitted. |
604 | 465 | 473 | ||
605 | === modified file 'init/man/init.5' | |||
606 | --- init/man/init.5 2011-03-15 12:15:28 +0000 | |||
607 | +++ init/man/init.5 2011-04-19 09:27:29 +0000 | |||
608 | @@ -5,8 +5,6 @@ | |||
609 | 5 | .\" | 5 | .\" |
610 | 6 | .SH SYNOPSIS | 6 | .SH SYNOPSIS |
611 | 7 | .B /etc/init/ | 7 | .B /etc/init/ |
612 | 8 | |||
613 | 9 | .B $HOME/.init/ | ||
614 | 10 | .\" | 8 | .\" |
615 | 11 | .SH DESCRIPTION | 9 | .SH DESCRIPTION |
616 | 12 | On startup, the Upstart | 10 | On startup, the Upstart |
617 | @@ -16,11 +14,6 @@ | |||
618 | 16 | directory, and watches for future changes to these files using | 14 | directory, and watches for future changes to these files using |
619 | 17 | .BR inotify (7). | 15 | .BR inotify (7). |
620 | 18 | 16 | ||
621 | 19 | If D\-Bus has been configured to allow non\-privileged users to invoke all | ||
622 | 20 | Upstart D\-Bus methods, Upstart is also able to manage User Jobs. See | ||
623 | 21 | .B User Jobs | ||
624 | 22 | for further details. | ||
625 | 23 | |||
626 | 24 | To be considered by Upstart, files in this directory must have a | 17 | To be considered by Upstart, files in this directory must have a |
627 | 25 | recognized suffix and may also be present in sub\-directories. There are | 18 | recognized suffix and may also be present in sub\-directories. There are |
628 | 26 | two recognized suffixes: | 19 | two recognized suffixes: |
629 | @@ -72,37 +65,6 @@ | |||
630 | 72 | 65 | ||
631 | 73 | Configuration files are plain text and should not be executable. | 66 | Configuration files are plain text and should not be executable. |
632 | 74 | .\" | 67 | .\" |
633 | 75 | .SS User Jobs | ||
634 | 76 | |||
635 | 77 | A User Job is a job configuration file created by a non\-privileged user | ||
636 | 78 | in the | ||
637 | 79 | .B $HOME/.init/ | ||
638 | 80 | directory. Job configuration files in this directory have | ||
639 | 81 | the same syntax as system job configuration files. | ||
640 | 82 | |||
641 | 83 | Any user can create user jobs, but that user can control | ||
642 | 84 | .I only | ||
643 | 85 | jobs they create. | ||
644 | 86 | |||
645 | 87 | Users are able to manage their jobs using the standard | ||
646 | 88 | .BR initctl (8) | ||
647 | 89 | facility. | ||
648 | 90 | |||
649 | 91 | Note that a user job configuration file cannot have the same name as a | ||
650 | 92 | system job configuration file. | ||
651 | 93 | |||
652 | 94 | .\" | ||
653 | 95 | .SS Chroot Support | ||
654 | 96 | |||
655 | 97 | Upstart is able to manage jobs within a \fBchroot\fP(2). To control jobs | ||
656 | 98 | within the chroot environment, use the standard | ||
657 | 99 | .BR initctl (8) | ||
658 | 100 | facility. Note that it is not necessary to install D\-Bus within the | ||
659 | 101 | chroot (in fact it is not recommended). | ||
660 | 102 | |||
661 | 103 | Note that User Jobs can be created within a chroot environment. | ||
662 | 104 | |||
663 | 105 | .\" | ||
664 | 106 | .SS Configuration File Format | 68 | .SS Configuration File Format |
665 | 107 | Each line begins with a configuration stanza and continues until either | 69 | Each line begins with a configuration stanza and continues until either |
666 | 108 | the end of the line or a line containing a closing stanza. Line breaks | 70 | the end of the line or a line containing a closing stanza. Line breaks |
667 | 109 | 71 | ||
668 | === modified file 'init/man/init.8' | |||
669 | --- init/man/init.8 2011-03-10 14:23:57 +0000 | |||
670 | +++ init/man/init.8 2011-04-19 09:27:29 +0000 | |||
671 | @@ -1,4 +1,4 @@ | |||
673 | 1 | .TH init 8 2011-03-03 "Upstart" | 1 | .TH init 8 2011-04-06 "Upstart" |
674 | 2 | .\" | 2 | .\" |
675 | 3 | .SH NAME | 3 | .SH NAME |
676 | 4 | init \- Upstart process management daemon | 4 | init \- Upstart process management daemon |
677 | @@ -68,28 +68,32 @@ | |||
678 | 68 | by placing them on the kernel command-line. | 68 | by placing them on the kernel command-line. |
679 | 69 | .\" | 69 | .\" |
680 | 70 | .TP | 70 | .TP |
682 | 71 | .B --confdir \fIdirectory\fP | 71 | .B \-\-confdir \fIdirectory\fP |
683 | 72 | Read job configuration files from a directory other than | 72 | Read job configuration files from a directory other than |
684 | 73 | \fI/etc/init\fP. | 73 | \fI/etc/init\fP. |
685 | 74 | .\" | 74 | .\" |
686 | 75 | .TP | 75 | .TP |
688 | 76 | .B --no-startup-event | 76 | .B \-\-no\-sessions |
689 | 77 | Disable user and chroot sessions. | ||
690 | 78 | .\" | ||
691 | 79 | .TP | ||
692 | 80 | .B \-\-no\-startup\-event | ||
693 | 77 | Suppress emission of the initial startup event. This option should only | 81 | Suppress emission of the initial startup event. This option should only |
694 | 78 | be used for testing since it will stop the | 82 | be used for testing since it will stop the |
695 | 79 | .BR init (8) | 83 | .BR init (8) |
696 | 80 | daemon from starting \fBany\fP jobs automatically. | 84 | daemon from starting \fBany\fP jobs automatically. |
697 | 81 | .\" | 85 | .\" |
698 | 82 | .TP | 86 | .TP |
700 | 83 | .B --session | 87 | .B \-\-session |
701 | 84 | Connect to the D-Bus session bus. This should only be used for testing. | 88 | Connect to the D-Bus session bus. This should only be used for testing. |
702 | 85 | .\" | 89 | .\" |
703 | 86 | .TP | 90 | .TP |
705 | 87 | .B --startup-event \fIevent\fP | 91 | .B \-\-startup-event \fIevent\fP |
706 | 88 | Specify a different initial startup event from the standard | 92 | Specify a different initial startup event from the standard |
707 | 89 | .BR startup (7) . | 93 | .BR startup (7) . |
708 | 90 | .\" | 94 | .\" |
709 | 91 | .TP | 95 | .TP |
711 | 92 | .B --verbose | 96 | .B \-\-verbose |
712 | 93 | Outputs verbose messages about job state changes and event emissions to the | 97 | Outputs verbose messages about job state changes and event emissions to the |
713 | 94 | system console or log, useful for debugging boot. | 98 | system console or log, useful for debugging boot. |
714 | 95 | .\" | 99 | .\" |
715 | @@ -123,7 +127,7 @@ | |||
716 | 123 | warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | 127 | warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
717 | 124 | .\" | 128 | .\" |
718 | 125 | .SH SEE ALSO | 129 | .SH SEE ALSO |
720 | 126 | .BR control-alt-delete (7) | 130 | .BR control\-alt\-delete (7) |
721 | 127 | .BR init (5) | 131 | .BR init (5) |
722 | 128 | .BR initctl (8) | 132 | .BR initctl (8) |
723 | 129 | .BR runlevel (7) | 133 | .BR runlevel (7) |
724 | 130 | 134 | ||
725 | === modified file 'init/parse_job.c' | |||
726 | --- init/parse_job.c 2011-02-24 15:41:04 +0000 | |||
727 | +++ init/parse_job.c 2011-04-19 09:27:29 +0000 | |||
728 | @@ -280,8 +280,8 @@ | |||
729 | 280 | * of the returned job are freed, the returned job will also be | 280 | * of the returned job are freed, the returned job will also be |
730 | 281 | * freed. | 281 | * freed. |
731 | 282 | * | 282 | * |
734 | 283 | * Returns: if @update is NULL, returns new JobClass structure on success, NULL on raised error. | 283 | * Returns: If @update is NULL, returns new JobClass structure on success, NULL on raised error. |
735 | 284 | * If @update is not NULL, returns @update or NULL on error. | 284 | * If @update is not NULL, returns @update on success, or NULL on error. |
736 | 285 | **/ | 285 | **/ |
737 | 286 | JobClass * | 286 | JobClass * |
738 | 287 | parse_job (const void *parent, | 287 | parse_job (const void *parent, |
739 | 288 | 288 | ||
740 | === modified file 'init/session.c' | |||
741 | --- init/session.c 2011-02-23 09:35:03 +0000 | |||
742 | +++ init/session.c 2011-04-19 09:27:29 +0000 | |||
743 | @@ -56,6 +56,14 @@ | |||
744 | 56 | **/ | 56 | **/ |
745 | 57 | NihList *sessions = NULL; | 57 | NihList *sessions = NULL; |
746 | 58 | 58 | ||
747 | 59 | /** | ||
748 | 60 | * disable_sessions: | ||
749 | 61 | * | ||
750 | 62 | * If TRUE, disable user and chroot sessions, resulting in a | ||
751 | 63 | * "traditional" (pre-session support) system. | ||
752 | 64 | **/ | ||
753 | 65 | int disable_sessions = FALSE; | ||
754 | 66 | |||
755 | 59 | 67 | ||
756 | 60 | /* Prototypes for static functions */ | 68 | /* Prototypes for static functions */ |
757 | 61 | static void session_create_conf_source (Session *sesson); | 69 | static void session_create_conf_source (Session *sesson); |
758 | @@ -113,22 +121,23 @@ | |||
759 | 113 | } | 121 | } |
760 | 114 | 122 | ||
761 | 115 | Session * | 123 | Session * |
763 | 116 | session_from_dbus (const void * parent, | 124 | session_from_dbus (const void *parent, |
764 | 117 | NihDBusMessage *message) | 125 | NihDBusMessage *message) |
765 | 118 | { | 126 | { |
767 | 119 | const char * sender; | 127 | const char *sender; |
768 | 120 | DBusError dbus_error; | 128 | DBusError dbus_error; |
769 | 121 | unsigned long unix_user; | 129 | unsigned long unix_user; |
770 | 122 | unsigned long unix_process_id; | 130 | unsigned long unix_process_id; |
771 | 123 | char root[PATH_MAX]; | 131 | char root[PATH_MAX]; |
773 | 124 | Session * session; | 132 | Session *session; |
774 | 125 | 133 | ||
775 | 126 | nih_assert (message != NULL); | 134 | nih_assert (message != NULL); |
776 | 127 | 135 | ||
781 | 128 | #ifdef TEST | 136 | /* Handle explicit command-line request and alternative request |
782 | 129 | /* Return "NULL session" for testing framework. */ | 137 | * method (primarily for test framework) to disable session support. |
783 | 130 | return NULL; | 138 | */ |
784 | 131 | #endif | 139 | if (disable_sessions || getenv ("UPSTART_NO_SESSIONS")) |
785 | 140 | return NULL; | ||
786 | 132 | 141 | ||
787 | 133 | session_init (); | 142 | session_init (); |
788 | 134 | 143 | ||
789 | @@ -160,7 +169,7 @@ | |||
790 | 160 | } | 169 | } |
791 | 161 | 170 | ||
792 | 162 | /* If we retrieved a process id, look up the root path for it; | 171 | /* If we retrieved a process id, look up the root path for it; |
794 | 163 | * if it's just / don't worry so much about it. | 172 | * if it's just '/' don't worry so much about it. |
795 | 164 | */ | 173 | */ |
796 | 165 | if (unix_process_id) { | 174 | if (unix_process_id) { |
797 | 166 | nih_local char *symlink = NULL; | 175 | nih_local char *symlink = NULL; |
798 | @@ -193,15 +202,19 @@ | |||
799 | 193 | if (unix_process_id) { | 202 | if (unix_process_id) { |
800 | 194 | if (! session->chroot) | 203 | if (! session->chroot) |
801 | 195 | continue; | 204 | continue; |
802 | 205 | |||
803 | 206 | /* ignore sessions relating to other chroots */ | ||
804 | 196 | if (strcmp (session->chroot, root)) | 207 | if (strcmp (session->chroot, root)) |
805 | 197 | continue; | 208 | continue; |
806 | 198 | } | 209 | } |
807 | 199 | 210 | ||
808 | 211 | /* ignore sessions relating to other users */ | ||
809 | 200 | if (unix_user != session->user) | 212 | if (unix_user != session->user) |
810 | 201 | continue; | 213 | continue; |
811 | 202 | 214 | ||
812 | 203 | if (! session->conf_path) | 215 | if (! session->conf_path) |
813 | 204 | session_create_conf_source (session); | 216 | session_create_conf_source (session); |
814 | 217 | |||
815 | 205 | return session; | 218 | return session; |
816 | 206 | } | 219 | } |
817 | 207 | 220 | ||
818 | 208 | 221 | ||
819 | === modified file 'init/session.h' | |||
820 | --- init/session.h 2010-12-10 03:17:53 +0000 | |||
821 | +++ init/session.h 2011-04-19 09:27:29 +0000 | |||
822 | @@ -35,8 +35,33 @@ | |||
823 | 35 | * @user: uid all jobs are switched to, | 35 | * @user: uid all jobs are switched to, |
824 | 36 | * @conf_path: configuration path. | 36 | * @conf_path: configuration path. |
825 | 37 | * | 37 | * |
828 | 38 | * This structure is used to identify collections of jobs that share either | 38 | * This structure is used to identify collections of jobs |
829 | 39 | * a common @chroot and/or common @user. | 39 | * that share either a common @chroot and/or common @user. |
830 | 40 | * | ||
831 | 41 | * Summary of Session values for different environments: | ||
832 | 42 | * | ||
833 | 43 | * +-------------+---------------------------------------+ | ||
834 | 44 | * | D-Bus | Session | | ||
835 | 45 | * +------+------+--------+-----+------------------------+ | ||
836 | 46 | * | user | PID | chroot | uid | Object contents | | ||
837 | 47 | * +------+------+--------+-----+------------------------+ | ||
838 | 48 | * | 0 | >0 | no | 0 | NULL (*1) | | ||
839 | 49 | * | >0 | "0" | no | >0 | only uid set. | | ||
840 | 50 | * | 0 | >0 | yes | 0 | chroot + conf_path set | | ||
841 | 51 | * | >0 | ?? | yes | >0 | XXX: fails (*2) | | ||
842 | 52 | * +------+------+--------+-----+------------------------+ | ||
843 | 53 | * | ||
844 | 54 | * Notes: | ||
845 | 55 | * | ||
846 | 56 | * (*1) - The "NULL session" represents the "traditional" environment | ||
847 | 57 | * before sessions were introduced (namely a non-chroot environment | ||
848 | 58 | * where all job and event operations were handled by uid 0 (root)). | ||
849 | 59 | * | ||
850 | 60 | * (*2) - error is: | ||
851 | 61 | * | ||
852 | 62 | * initctl: Unable to connect to system bus: Failed to connect to socket | ||
853 | 63 | * /var/run/dbus/system_bus_socket: No such file or directory | ||
854 | 64 | * | ||
855 | 40 | **/ | 65 | **/ |
856 | 41 | typedef struct session { | 66 | typedef struct session { |
857 | 42 | NihList entry; | 67 | NihList entry; |
858 | 43 | 68 | ||
859 | === modified file 'init/tests/test_blocked.c' | |||
860 | --- init/tests/test_blocked.c 2011-02-23 09:35:03 +0000 | |||
861 | +++ init/tests/test_blocked.c 2011-04-19 09:27:29 +0000 | |||
862 | @@ -38,10 +38,6 @@ | |||
863 | 38 | Job *job; | 38 | Job *job; |
864 | 39 | Event *event; | 39 | Event *event; |
865 | 40 | NihDBusMessage *message = NULL; | 40 | NihDBusMessage *message = NULL; |
866 | 41 | Session *session; | ||
867 | 42 | |||
868 | 43 | session = session_new (NULL, NULL, getuid ()); | ||
869 | 44 | TEST_NE_P (session, NULL); | ||
870 | 45 | 41 | ||
871 | 46 | TEST_FUNCTION ("blocked_new"); | 42 | TEST_FUNCTION ("blocked_new"); |
872 | 47 | 43 | ||
873 | @@ -50,7 +46,7 @@ | |||
874 | 50 | * in a list. | 46 | * in a list. |
875 | 51 | */ | 47 | */ |
876 | 52 | TEST_FEATURE ("with job"); | 48 | TEST_FEATURE ("with job"); |
878 | 53 | class = job_class_new (NULL, "test", session); | 49 | class = job_class_new (NULL, "test", NULL); |
879 | 54 | job = job_new (class, ""); | 50 | job = job_new (class, ""); |
880 | 55 | 51 | ||
881 | 56 | TEST_ALLOC_FAIL { | 52 | TEST_ALLOC_FAIL { |
882 | @@ -361,7 +357,6 @@ | |||
883 | 361 | nih_free (blocked); | 357 | nih_free (blocked); |
884 | 362 | TEST_FREE (message); | 358 | TEST_FREE (message); |
885 | 363 | } | 359 | } |
886 | 364 | nih_free (session); | ||
887 | 365 | } | 360 | } |
888 | 366 | 361 | ||
889 | 367 | 362 | ||
890 | @@ -369,6 +364,9 @@ | |||
891 | 369 | main (int argc, | 364 | main (int argc, |
892 | 370 | char *argv[]) | 365 | char *argv[]) |
893 | 371 | { | 366 | { |
894 | 367 | /* run tests in legacy (pre-session support) mode */ | ||
895 | 368 | setenv ("UPSTART_NO_SESSIONS", "1", 1); | ||
896 | 369 | |||
897 | 372 | test_new (); | 370 | test_new (); |
898 | 373 | 371 | ||
899 | 374 | return 0; | 372 | return 0; |
900 | 375 | 373 | ||
901 | === modified file 'init/tests/test_conf.c' | |||
902 | --- init/tests/test_conf.c 2011-02-23 11:04:27 +0000 | |||
903 | +++ init/tests/test_conf.c 2011-04-19 09:27:29 +0000 | |||
904 | @@ -4443,22 +4443,18 @@ | |||
905 | 4443 | ConfFile *file; | 4443 | ConfFile *file; |
906 | 4444 | JobClass *job, *other, *ptr; | 4444 | JobClass *job, *other, *ptr; |
907 | 4445 | Job *instance; | 4445 | Job *instance; |
908 | 4446 | Session *session; | ||
909 | 4447 | 4446 | ||
910 | 4448 | TEST_FUNCTION ("conf_file_destroy"); | 4447 | TEST_FUNCTION ("conf_file_destroy"); |
911 | 4449 | source = conf_source_new (NULL, "/path", CONF_JOB_DIR); | 4448 | source = conf_source_new (NULL, "/path", CONF_JOB_DIR); |
912 | 4450 | 4449 | ||
913 | 4451 | session = session_new (NULL, NULL, getuid ()); | ||
914 | 4452 | TEST_NE_P (session, NULL); | ||
915 | 4453 | |||
916 | 4454 | /* Check that when a ConfFile for a job is freed, the attached | 4450 | /* Check that when a ConfFile for a job is freed, the attached |
917 | 4455 | * job is also freed if it is not the current job. | 4451 | * job is also freed if it is not the current job. |
918 | 4456 | */ | 4452 | */ |
919 | 4457 | TEST_FEATURE ("with not-current job"); | 4453 | TEST_FEATURE ("with not-current job"); |
920 | 4458 | file = conf_file_new (source, "/path/to/file"); | 4454 | file = conf_file_new (source, "/path/to/file"); |
922 | 4459 | job = file->job = job_class_new (NULL, "foo", session); | 4455 | job = file->job = job_class_new (NULL, "foo", NULL); |
923 | 4460 | 4456 | ||
925 | 4461 | other = job_class_new (NULL, "foo", session); | 4457 | other = job_class_new (NULL, "foo", NULL); |
926 | 4462 | nih_hash_add (job_classes, &other->entry); | 4458 | nih_hash_add (job_classes, &other->entry); |
927 | 4463 | 4459 | ||
928 | 4464 | TEST_FREE_TAG (job); | 4460 | TEST_FREE_TAG (job); |
929 | @@ -4478,7 +4474,7 @@ | |||
930 | 4478 | */ | 4474 | */ |
931 | 4479 | TEST_FEATURE ("with stopped job"); | 4475 | TEST_FEATURE ("with stopped job"); |
932 | 4480 | file = conf_file_new (source, "/path/to/file"); | 4476 | file = conf_file_new (source, "/path/to/file"); |
934 | 4481 | job = file->job = job_class_new (NULL, "foo", session); | 4477 | job = file->job = job_class_new (NULL, "foo", NULL); |
935 | 4482 | 4478 | ||
936 | 4483 | nih_hash_add (job_classes, &job->entry); | 4479 | nih_hash_add (job_classes, &job->entry); |
937 | 4484 | 4480 | ||
938 | @@ -4498,7 +4494,7 @@ | |||
939 | 4498 | */ | 4494 | */ |
940 | 4499 | TEST_FEATURE ("with running job"); | 4495 | TEST_FEATURE ("with running job"); |
941 | 4500 | file = conf_file_new (source, "/path/to/file"); | 4496 | file = conf_file_new (source, "/path/to/file"); |
943 | 4501 | job = file->job = job_class_new (NULL, "foo", session); | 4497 | job = file->job = job_class_new (NULL, "foo", NULL); |
944 | 4502 | 4498 | ||
945 | 4503 | nih_hash_add (job_classes, &job->entry); | 4499 | nih_hash_add (job_classes, &job->entry); |
946 | 4504 | 4500 | ||
947 | @@ -4522,7 +4518,6 @@ | |||
948 | 4522 | nih_free (job); | 4518 | nih_free (job); |
949 | 4523 | 4519 | ||
950 | 4524 | nih_free (source); | 4520 | nih_free (source); |
951 | 4525 | nih_free (session); | ||
952 | 4526 | } | 4521 | } |
953 | 4527 | 4522 | ||
954 | 4528 | 4523 | ||
955 | @@ -4532,10 +4527,6 @@ | |||
956 | 4532 | ConfSource *source1, *source2, *source3; | 4527 | ConfSource *source1, *source2, *source3; |
957 | 4533 | ConfFile *file1, *file2, *file3, *file4, *file5; | 4528 | ConfFile *file1, *file2, *file3, *file4, *file5; |
958 | 4534 | JobClass *class1, *class2, *class3, *class4, *ptr; | 4529 | JobClass *class1, *class2, *class3, *class4, *ptr; |
959 | 4535 | Session *session; | ||
960 | 4536 | |||
961 | 4537 | session = session_new (NULL, NULL, getuid ()); | ||
962 | 4538 | TEST_NE_P (session, NULL); | ||
963 | 4539 | 4530 | ||
964 | 4540 | TEST_FUNCTION ("conf_select_job"); | 4531 | TEST_FUNCTION ("conf_select_job"); |
965 | 4541 | source1 = conf_source_new (NULL, "/tmp/foo", CONF_DIR); | 4532 | source1 = conf_source_new (NULL, "/tmp/foo", CONF_DIR); |
966 | @@ -4543,26 +4534,26 @@ | |||
967 | 4543 | source2 = conf_source_new (NULL, "/tmp/bar", CONF_JOB_DIR); | 4534 | source2 = conf_source_new (NULL, "/tmp/bar", CONF_JOB_DIR); |
968 | 4544 | 4535 | ||
969 | 4545 | file1 = conf_file_new (source2, "/tmp/bar/frodo"); | 4536 | file1 = conf_file_new (source2, "/tmp/bar/frodo"); |
971 | 4546 | class1 = file1->job = job_class_new (NULL, "frodo", session); | 4537 | class1 = file1->job = job_class_new (NULL, "frodo", NULL); |
972 | 4547 | 4538 | ||
973 | 4548 | file2 = conf_file_new (source2, "/tmp/bar/bilbo"); | 4539 | file2 = conf_file_new (source2, "/tmp/bar/bilbo"); |
974 | 4549 | 4540 | ||
975 | 4550 | file3 = conf_file_new (source2, "/tmp/bar/drogo"); | 4541 | file3 = conf_file_new (source2, "/tmp/bar/drogo"); |
977 | 4551 | class2 = file3->job = job_class_new (NULL, "drogo", session); | 4542 | class2 = file3->job = job_class_new (NULL, "drogo", NULL); |
978 | 4552 | 4543 | ||
979 | 4553 | source3 = conf_source_new (NULL, "/tmp/baz", CONF_JOB_DIR); | 4544 | source3 = conf_source_new (NULL, "/tmp/baz", CONF_JOB_DIR); |
980 | 4554 | 4545 | ||
981 | 4555 | file4 = conf_file_new (source3, "/tmp/baz/frodo"); | 4546 | file4 = conf_file_new (source3, "/tmp/baz/frodo"); |
983 | 4556 | class3 = file4->job = job_class_new (NULL, "frodo", session); | 4547 | class3 = file4->job = job_class_new (NULL, "frodo", NULL); |
984 | 4557 | 4548 | ||
985 | 4558 | file5 = conf_file_new (source2, "/tmp/bar/bilbo"); | 4549 | file5 = conf_file_new (source2, "/tmp/bar/bilbo"); |
987 | 4559 | class4 = file5->job = job_class_new (NULL, "bilbo", session); | 4550 | class4 = file5->job = job_class_new (NULL, "bilbo", NULL); |
988 | 4560 | 4551 | ||
989 | 4561 | 4552 | ||
990 | 4562 | /* Check that a job with only one file is returned. | 4553 | /* Check that a job with only one file is returned. |
991 | 4563 | */ | 4554 | */ |
992 | 4564 | TEST_FEATURE ("with one file"); | 4555 | TEST_FEATURE ("with one file"); |
994 | 4565 | ptr = conf_select_job ("drogo"); | 4556 | ptr = conf_select_job ("drogo", NULL); |
995 | 4566 | 4557 | ||
996 | 4567 | TEST_EQ_P (ptr, class2); | 4558 | TEST_EQ_P (ptr, class2); |
997 | 4568 | 4559 | ||
998 | @@ -4571,7 +4562,7 @@ | |||
999 | 4571 | * returned. | 4562 | * returned. |
1000 | 4572 | */ | 4563 | */ |
1001 | 4573 | TEST_FEATURE ("with multiple files"); | 4564 | TEST_FEATURE ("with multiple files"); |
1003 | 4574 | ptr = conf_select_job ("frodo"); | 4565 | ptr = conf_select_job ("frodo", NULL); |
1004 | 4575 | 4566 | ||
1005 | 4576 | TEST_EQ_P (ptr, class1); | 4567 | TEST_EQ_P (ptr, class1); |
1006 | 4577 | 4568 | ||
1007 | @@ -4579,7 +4570,7 @@ | |||
1008 | 4579 | /* Check that files with no attached job are ignored. | 4570 | /* Check that files with no attached job are ignored. |
1009 | 4580 | */ | 4571 | */ |
1010 | 4581 | TEST_FEATURE ("with file but no attached job"); | 4572 | TEST_FEATURE ("with file but no attached job"); |
1012 | 4582 | ptr = conf_select_job ("bilbo"); | 4573 | ptr = conf_select_job ("bilbo", NULL); |
1013 | 4583 | 4574 | ||
1014 | 4584 | TEST_EQ_P (ptr, class4); | 4575 | TEST_EQ_P (ptr, class4); |
1015 | 4585 | 4576 | ||
1016 | @@ -4587,7 +4578,7 @@ | |||
1017 | 4587 | /* Check that when there is no match, NULL is returned. | 4578 | /* Check that when there is no match, NULL is returned. |
1018 | 4588 | */ | 4579 | */ |
1019 | 4589 | TEST_FEATURE ("with no match"); | 4580 | TEST_FEATURE ("with no match"); |
1021 | 4590 | ptr = conf_select_job ("meep"); | 4581 | ptr = conf_select_job ("meep", NULL); |
1022 | 4591 | 4582 | ||
1023 | 4592 | TEST_EQ_P (ptr, NULL); | 4583 | TEST_EQ_P (ptr, NULL); |
1024 | 4593 | 4584 | ||
1025 | @@ -4595,7 +4586,6 @@ | |||
1026 | 4595 | nih_free (source3); | 4586 | nih_free (source3); |
1027 | 4596 | nih_free (source2); | 4587 | nih_free (source2); |
1028 | 4597 | nih_free (source1); | 4588 | nih_free (source1); |
1029 | 4598 | nih_free (session); | ||
1030 | 4599 | } | 4589 | } |
1031 | 4600 | 4590 | ||
1032 | 4601 | 4591 | ||
1033 | @@ -4603,6 +4593,9 @@ | |||
1034 | 4603 | main (int argc, | 4593 | main (int argc, |
1035 | 4604 | char *argv[]) | 4594 | char *argv[]) |
1036 | 4605 | { | 4595 | { |
1037 | 4596 | /* run tests in legacy (pre-session support) mode */ | ||
1038 | 4597 | setenv ("UPSTART_NO_SESSIONS", "1", 1); | ||
1039 | 4598 | |||
1040 | 4606 | test_source_new (); | 4599 | test_source_new (); |
1041 | 4607 | test_file_new (); | 4600 | test_file_new (); |
1042 | 4608 | test_source_reload_job_dir (); | 4601 | test_source_reload_job_dir (); |
1043 | 4609 | 4602 | ||
1044 | === modified file 'init/tests/test_control.c' | |||
1045 | --- init/tests/test_control.c 2011-03-24 13:11:53 +0000 | |||
1046 | +++ init/tests/test_control.c 2011-04-19 09:27:29 +0000 | |||
1047 | @@ -154,7 +154,6 @@ | |||
1048 | 154 | Job *job1, *job2; | 154 | Job *job1, *job2; |
1049 | 155 | pid_t pid; | 155 | pid_t pid; |
1050 | 156 | int fd, wait_fd, status; | 156 | int fd, wait_fd, status; |
1051 | 157 | Session *session = NULL; | ||
1052 | 158 | 157 | ||
1053 | 159 | TEST_FUNCTION ("control_server_connect"); | 158 | TEST_FUNCTION ("control_server_connect"); |
1054 | 160 | program_name = "test"; | 159 | program_name = "test"; |
1055 | @@ -234,10 +233,10 @@ | |||
1056 | 234 | * new connection has them automatically registered. | 233 | * new connection has them automatically registered. |
1057 | 235 | */ | 234 | */ |
1058 | 236 | TEST_FEATURE ("with existing jobs"); | 235 | TEST_FEATURE ("with existing jobs"); |
1060 | 237 | class1 = job_class_new (NULL, "foo", session); | 236 | class1 = job_class_new (NULL, "foo", NULL); |
1061 | 238 | nih_hash_add (job_classes, &class1->entry); | 237 | nih_hash_add (job_classes, &class1->entry); |
1062 | 239 | 238 | ||
1064 | 240 | class2 = job_class_new (NULL, "bar", session); | 239 | class2 = job_class_new (NULL, "bar", NULL); |
1065 | 241 | job1 = job_new (class2, "test1"); | 240 | job1 = job_new (class2, "test1"); |
1066 | 242 | job2 = job_new (class2, "test2"); | 241 | job2 = job_new (class2, "test2"); |
1067 | 243 | nih_hash_add (job_classes, &class2->entry); | 242 | nih_hash_add (job_classes, &class2->entry); |
1068 | @@ -439,7 +438,6 @@ | |||
1069 | 439 | NihDBusObject *object; | 438 | NihDBusObject *object; |
1070 | 440 | pid_t pid; | 439 | pid_t pid; |
1071 | 441 | int ret, wait_fd, fd, status; | 440 | int ret, wait_fd, fd, status; |
1072 | 442 | Session *session = NULL; | ||
1073 | 443 | 441 | ||
1074 | 444 | TEST_FUNCTION ("control_bus_open"); | 442 | TEST_FUNCTION ("control_bus_open"); |
1075 | 445 | program_name = "test"; | 443 | program_name = "test"; |
1076 | @@ -535,10 +533,10 @@ | |||
1077 | 535 | refuse_registration = FALSE; | 533 | refuse_registration = FALSE; |
1078 | 536 | server_conn = NULL; | 534 | server_conn = NULL; |
1079 | 537 | 535 | ||
1081 | 538 | class1 = job_class_new (NULL, "foo", session); | 536 | class1 = job_class_new (NULL, "foo", NULL); |
1082 | 539 | nih_hash_add (job_classes, &class1->entry); | 537 | nih_hash_add (job_classes, &class1->entry); |
1083 | 540 | 538 | ||
1085 | 541 | class2 = job_class_new (NULL, "bar", session); | 539 | class2 = job_class_new (NULL, "bar", NULL); |
1086 | 542 | job1 = job_new (class2, "test1"); | 540 | job1 = job_new (class2, "test1"); |
1087 | 543 | job2 = job_new (class2, "test2"); | 541 | job2 = job_new (class2, "test2"); |
1088 | 544 | nih_hash_add (job_classes, &class2->entry); | 542 | nih_hash_add (job_classes, &class2->entry); |
1089 | @@ -985,13 +983,12 @@ | |||
1090 | 985 | NihError *error; | 983 | NihError *error; |
1091 | 986 | NihDBusError *dbus_error; | 984 | NihDBusError *dbus_error; |
1092 | 987 | int ret; | 985 | int ret; |
1093 | 988 | Session *session = NULL; | ||
1094 | 989 | 986 | ||
1095 | 990 | TEST_FUNCTION ("control_get_job_by_name"); | 987 | TEST_FUNCTION ("control_get_job_by_name"); |
1096 | 991 | nih_error_init (); | 988 | nih_error_init (); |
1097 | 992 | job_class_init (); | 989 | job_class_init (); |
1098 | 993 | 990 | ||
1100 | 994 | class = job_class_new (NULL, "test", session); | 991 | class = job_class_new (NULL, "test", NULL); |
1101 | 995 | nih_hash_add (job_classes, &class->entry); | 992 | nih_hash_add (job_classes, &class->entry); |
1102 | 996 | 993 | ||
1103 | 997 | 994 | ||
1104 | @@ -1096,7 +1093,6 @@ | |||
1105 | 1096 | NihError *error; | 1093 | NihError *error; |
1106 | 1097 | char **paths; | 1094 | char **paths; |
1107 | 1098 | int ret; | 1095 | int ret; |
1108 | 1099 | Session *session = NULL; | ||
1109 | 1100 | 1096 | ||
1110 | 1101 | TEST_FUNCTION ("control_get_all_jobs"); | 1097 | TEST_FUNCTION ("control_get_all_jobs"); |
1111 | 1102 | nih_error_init (); | 1098 | nih_error_init (); |
1112 | @@ -1107,13 +1103,13 @@ | |||
1113 | 1107 | * in an array allocated as a child of the message structure. | 1103 | * in an array allocated as a child of the message structure. |
1114 | 1108 | */ | 1104 | */ |
1115 | 1109 | TEST_FEATURE ("with registered jobs"); | 1105 | TEST_FEATURE ("with registered jobs"); |
1117 | 1110 | class1 = job_class_new (NULL, "frodo", session); | 1106 | class1 = job_class_new (NULL, "frodo", NULL); |
1118 | 1111 | nih_hash_add (job_classes, &class1->entry); | 1107 | nih_hash_add (job_classes, &class1->entry); |
1119 | 1112 | 1108 | ||
1121 | 1113 | class2 = job_class_new (NULL, "bilbo", session); | 1109 | class2 = job_class_new (NULL, "bilbo", NULL); |
1122 | 1114 | nih_hash_add (job_classes, &class2->entry); | 1110 | nih_hash_add (job_classes, &class2->entry); |
1123 | 1115 | 1111 | ||
1125 | 1116 | class3 = job_class_new (NULL, "sauron", session); | 1112 | class3 = job_class_new (NULL, "sauron", NULL); |
1126 | 1117 | nih_hash_add (job_classes, &class3->entry); | 1113 | nih_hash_add (job_classes, &class3->entry); |
1127 | 1118 | 1114 | ||
1128 | 1119 | TEST_ALLOC_FAIL { | 1115 | TEST_ALLOC_FAIL { |
1129 | @@ -2223,6 +2219,9 @@ | |||
1130 | 2223 | main (int argc, | 2219 | main (int argc, |
1131 | 2224 | char *argv[]) | 2220 | char *argv[]) |
1132 | 2225 | { | 2221 | { |
1133 | 2222 | /* run tests in legacy (pre-session support) mode */ | ||
1134 | 2223 | setenv ("UPSTART_NO_SESSIONS", "1", 1); | ||
1135 | 2224 | |||
1136 | 2226 | test_server_open (); | 2225 | test_server_open (); |
1137 | 2227 | test_server_connect (); | 2226 | test_server_connect (); |
1138 | 2228 | test_server_close (); | 2227 | test_server_close (); |
1139 | 2229 | 2228 | ||
1140 | === modified file 'init/tests/test_environ.c' | |||
1141 | --- init/tests/test_environ.c 2009-06-23 09:29:35 +0000 | |||
1142 | +++ init/tests/test_environ.c 2011-04-19 09:27:29 +0000 | |||
1143 | @@ -1692,6 +1692,9 @@ | |||
1144 | 1692 | main (int argc, | 1692 | main (int argc, |
1145 | 1693 | char *argv[]) | 1693 | char *argv[]) |
1146 | 1694 | { | 1694 | { |
1147 | 1695 | /* run tests in legacy (pre-session support) mode */ | ||
1148 | 1696 | setenv ("UPSTART_NO_SESSIONS", "1", 1); | ||
1149 | 1697 | |||
1150 | 1695 | test_add (); | 1698 | test_add (); |
1151 | 1696 | test_append (); | 1699 | test_append (); |
1152 | 1697 | test_set (); | 1700 | test_set (); |
1153 | 1698 | 1701 | ||
1154 | === modified file 'init/tests/test_event.c' | |||
1155 | --- init/tests/test_event.c 2011-02-23 09:35:03 +0000 | |||
1156 | +++ init/tests/test_event.c 2011-04-19 09:27:29 +0000 | |||
1157 | @@ -222,10 +222,6 @@ | |||
1158 | 222 | JobClass *class = NULL; | 222 | JobClass *class = NULL; |
1159 | 223 | Job *job; | 223 | Job *job; |
1160 | 224 | Event *event = NULL; | 224 | Event *event = NULL; |
1161 | 225 | Session *session; | ||
1162 | 226 | |||
1163 | 227 | session = session_new (NULL, NULL, getuid ()); | ||
1164 | 228 | TEST_NE_P (session, NULL); | ||
1165 | 229 | 225 | ||
1166 | 230 | /* Check that a pending event in the queue results in jobs being | 226 | /* Check that a pending event in the queue results in jobs being |
1167 | 231 | * started and/or stopped and gets moved into the handling state. | 227 | * started and/or stopped and gets moved into the handling state. |
1168 | @@ -237,7 +233,7 @@ | |||
1169 | 237 | TEST_ALLOC_SAFE { | 233 | TEST_ALLOC_SAFE { |
1170 | 238 | event = event_new (NULL, "test", NULL); | 234 | event = event_new (NULL, "test", NULL); |
1171 | 239 | 235 | ||
1173 | 240 | class = job_class_new (NULL, "test", session); | 236 | class = job_class_new (NULL, "test", NULL); |
1174 | 241 | class->task = TRUE; | 237 | class->task = TRUE; |
1175 | 242 | class->process[PROCESS_MAIN] = process_new (class->process); | 238 | class->process[PROCESS_MAIN] = process_new (class->process); |
1176 | 243 | class->process[PROCESS_MAIN]->command = "echo"; | 239 | class->process[PROCESS_MAIN]->command = "echo"; |
1177 | @@ -266,7 +262,6 @@ | |||
1178 | 266 | nih_free (class); | 262 | nih_free (class); |
1179 | 267 | nih_free (event); | 263 | nih_free (event); |
1180 | 268 | } | 264 | } |
1181 | 269 | nih_free (session); | ||
1182 | 270 | } | 265 | } |
1183 | 271 | 266 | ||
1184 | 272 | void | 267 | void |
1185 | @@ -280,10 +275,6 @@ | |||
1186 | 280 | EventOperator *oper; | 275 | EventOperator *oper; |
1187 | 281 | Blocked *blocked = NULL, *blocked1 = NULL, *blocked2 = NULL; | 276 | Blocked *blocked = NULL, *blocked1 = NULL, *blocked2 = NULL; |
1188 | 282 | char **env1 = NULL, **env2 = NULL; | 277 | char **env1 = NULL, **env2 = NULL; |
1189 | 283 | Session *session; | ||
1190 | 284 | |||
1191 | 285 | session = session_new (NULL, NULL, getuid ()); | ||
1192 | 286 | TEST_NE_P (session, NULL); | ||
1193 | 287 | 278 | ||
1194 | 288 | TEST_FUNCTION ("event_pending_handle_jobs"); | 279 | TEST_FUNCTION ("event_pending_handle_jobs"); |
1195 | 289 | program_name = "test"; | 280 | program_name = "test"; |
1196 | @@ -301,7 +292,7 @@ | |||
1197 | 301 | 292 | ||
1198 | 302 | TEST_FREE_TAG (event1); | 293 | TEST_FREE_TAG (event1); |
1199 | 303 | 294 | ||
1201 | 304 | class = job_class_new (NULL, "test", session); | 295 | class = job_class_new (NULL, "test", NULL); |
1202 | 305 | class->task = TRUE; | 296 | class->task = TRUE; |
1203 | 306 | 297 | ||
1204 | 307 | class->start_on = event_operator_new ( | 298 | class->start_on = event_operator_new ( |
1205 | @@ -336,7 +327,7 @@ | |||
1206 | 336 | 327 | ||
1207 | 337 | TEST_FREE_TAG (event1); | 328 | TEST_FREE_TAG (event1); |
1208 | 338 | 329 | ||
1210 | 339 | class = job_class_new (NULL, "test", session); | 330 | class = job_class_new (NULL, "test", NULL); |
1211 | 340 | class->task = TRUE; | 331 | class->task = TRUE; |
1212 | 341 | 332 | ||
1213 | 342 | class->start_on = event_operator_new ( | 333 | class->start_on = event_operator_new ( |
1214 | @@ -395,7 +386,7 @@ | |||
1215 | 395 | TEST_FREE_TAG (event1); | 386 | TEST_FREE_TAG (event1); |
1216 | 396 | TEST_FREE_TAG (event2); | 387 | TEST_FREE_TAG (event2); |
1217 | 397 | 388 | ||
1219 | 398 | class = job_class_new (NULL, "test", session); | 389 | class = job_class_new (NULL, "test", NULL); |
1220 | 399 | class->task = TRUE; | 390 | class->task = TRUE; |
1221 | 400 | 391 | ||
1222 | 401 | assert (nih_str_array_add (&(class->env), class, | 392 | assert (nih_str_array_add (&(class->env), class, |
1223 | @@ -511,7 +502,7 @@ | |||
1224 | 511 | 502 | ||
1225 | 512 | TEST_FREE_TAG (event2); | 503 | TEST_FREE_TAG (event2); |
1226 | 513 | 504 | ||
1228 | 514 | class = job_class_new (NULL, "test", session); | 505 | class = job_class_new (NULL, "test", NULL); |
1229 | 515 | class->task = TRUE; | 506 | class->task = TRUE; |
1230 | 516 | 507 | ||
1231 | 517 | assert (nih_str_array_add (&(class->env), class, | 508 | assert (nih_str_array_add (&(class->env), class, |
1232 | @@ -637,7 +628,7 @@ | |||
1233 | 637 | 628 | ||
1234 | 638 | TEST_FREE_TAG (event2); | 629 | TEST_FREE_TAG (event2); |
1235 | 639 | 630 | ||
1237 | 640 | class = job_class_new (NULL, "test", session); | 631 | class = job_class_new (NULL, "test", NULL); |
1238 | 641 | class->task = TRUE; | 632 | class->task = TRUE; |
1239 | 642 | 633 | ||
1240 | 643 | assert (nih_str_array_add (&(class->env), class, | 634 | assert (nih_str_array_add (&(class->env), class, |
1241 | @@ -805,7 +796,7 @@ | |||
1242 | 805 | 796 | ||
1243 | 806 | TEST_FREE_TAG (event2); | 797 | TEST_FREE_TAG (event2); |
1244 | 807 | 798 | ||
1246 | 808 | class = job_class_new (NULL, "test", session); | 799 | class = job_class_new (NULL, "test", NULL); |
1247 | 809 | class->task = TRUE; | 800 | class->task = TRUE; |
1248 | 810 | 801 | ||
1249 | 811 | assert (nih_str_array_add (&(class->env), class, | 802 | assert (nih_str_array_add (&(class->env), class, |
1250 | @@ -930,7 +921,7 @@ | |||
1251 | 930 | 921 | ||
1252 | 931 | TEST_FREE_TAG (event1); | 922 | TEST_FREE_TAG (event1); |
1253 | 932 | 923 | ||
1255 | 933 | class = job_class_new (NULL, "test", session); | 924 | class = job_class_new (NULL, "test", NULL); |
1256 | 934 | class->instance = "$FRODO"; | 925 | class->instance = "$FRODO"; |
1257 | 935 | class->task = TRUE; | 926 | class->task = TRUE; |
1258 | 936 | 927 | ||
1259 | @@ -1009,7 +1000,7 @@ | |||
1260 | 1009 | 1000 | ||
1261 | 1010 | TEST_FREE_TAG (event1); | 1001 | TEST_FREE_TAG (event1); |
1262 | 1011 | 1002 | ||
1264 | 1012 | class = job_class_new (NULL, "test", session); | 1003 | class = job_class_new (NULL, "test", NULL); |
1265 | 1013 | class->instance = "$FRODO"; | 1004 | class->instance = "$FRODO"; |
1266 | 1014 | class->task = TRUE; | 1005 | class->task = TRUE; |
1267 | 1015 | 1006 | ||
1268 | @@ -1093,7 +1084,7 @@ | |||
1269 | 1093 | 1084 | ||
1270 | 1094 | TEST_FREE_TAG (event1); | 1085 | TEST_FREE_TAG (event1); |
1271 | 1095 | 1086 | ||
1273 | 1096 | class = job_class_new (NULL, "test", session); | 1087 | class = job_class_new (NULL, "test", NULL); |
1274 | 1097 | class->instance = "$TIPPLE"; | 1088 | class->instance = "$TIPPLE"; |
1275 | 1098 | class->task = TRUE; | 1089 | class->task = TRUE; |
1276 | 1099 | 1090 | ||
1277 | @@ -1136,7 +1127,7 @@ | |||
1278 | 1136 | 1127 | ||
1279 | 1137 | TEST_FREE_TAG (event1); | 1128 | TEST_FREE_TAG (event1); |
1280 | 1138 | 1129 | ||
1282 | 1139 | class = job_class_new (NULL, "test", session); | 1130 | class = job_class_new (NULL, "test", NULL); |
1283 | 1140 | class->task = TRUE; | 1131 | class->task = TRUE; |
1284 | 1141 | 1132 | ||
1285 | 1142 | class->process[PROCESS_POST_STOP] = process_new (class); | 1133 | class->process[PROCESS_POST_STOP] = process_new (class); |
1286 | @@ -1184,7 +1175,7 @@ | |||
1287 | 1184 | 1175 | ||
1288 | 1185 | TEST_FREE_TAG (event1); | 1176 | TEST_FREE_TAG (event1); |
1289 | 1186 | 1177 | ||
1291 | 1187 | class = job_class_new (NULL, "test", session); | 1178 | class = job_class_new (NULL, "test", NULL); |
1292 | 1188 | class->task = TRUE; | 1179 | class->task = TRUE; |
1293 | 1189 | 1180 | ||
1294 | 1190 | class->process[PROCESS_POST_STOP] = process_new (class); | 1181 | class->process[PROCESS_POST_STOP] = process_new (class); |
1295 | @@ -1259,7 +1250,7 @@ | |||
1296 | 1259 | 1250 | ||
1297 | 1260 | TEST_FREE_TAG (event1); | 1251 | TEST_FREE_TAG (event1); |
1298 | 1261 | 1252 | ||
1300 | 1262 | class = job_class_new (NULL, "test", session); | 1253 | class = job_class_new (NULL, "test", NULL); |
1301 | 1263 | class->task = TRUE; | 1254 | class->task = TRUE; |
1302 | 1264 | 1255 | ||
1303 | 1265 | class->process[PROCESS_POST_STOP] = process_new (class); | 1256 | class->process[PROCESS_POST_STOP] = process_new (class); |
1304 | @@ -1338,7 +1329,7 @@ | |||
1305 | 1338 | 1329 | ||
1306 | 1339 | TEST_FREE_TAG (event1); | 1330 | TEST_FREE_TAG (event1); |
1307 | 1340 | 1331 | ||
1309 | 1341 | class = job_class_new (NULL, "test", session); | 1332 | class = job_class_new (NULL, "test", NULL); |
1310 | 1342 | class->task = TRUE; | 1333 | class->task = TRUE; |
1311 | 1343 | 1334 | ||
1312 | 1344 | class->process[PROCESS_POST_STOP] = process_new (class); | 1335 | class->process[PROCESS_POST_STOP] = process_new (class); |
1313 | @@ -1448,7 +1439,7 @@ | |||
1314 | 1448 | 1439 | ||
1315 | 1449 | TEST_FREE_TAG (event1); | 1440 | TEST_FREE_TAG (event1); |
1316 | 1450 | 1441 | ||
1318 | 1451 | class = job_class_new (NULL, "test", session); | 1442 | class = job_class_new (NULL, "test", NULL); |
1319 | 1452 | class->task = TRUE; | 1443 | class->task = TRUE; |
1320 | 1453 | 1444 | ||
1321 | 1454 | class->process[PROCESS_POST_STOP] = process_new (class); | 1445 | class->process[PROCESS_POST_STOP] = process_new (class); |
1322 | @@ -1536,7 +1527,7 @@ | |||
1323 | 1536 | 1527 | ||
1324 | 1537 | TEST_FREE_TAG (event1); | 1528 | TEST_FREE_TAG (event1); |
1325 | 1538 | 1529 | ||
1327 | 1539 | class = job_class_new (NULL, "test", session); | 1530 | class = job_class_new (NULL, "test", NULL); |
1328 | 1540 | class->task = TRUE; | 1531 | class->task = TRUE; |
1329 | 1541 | 1532 | ||
1330 | 1542 | class->process[PROCESS_POST_STOP] = process_new (class); | 1533 | class->process[PROCESS_POST_STOP] = process_new (class); |
1331 | @@ -1607,7 +1598,6 @@ | |||
1332 | 1607 | } | 1598 | } |
1333 | 1608 | 1599 | ||
1334 | 1609 | fclose (output); | 1600 | fclose (output); |
1335 | 1610 | nih_free (session); | ||
1336 | 1611 | } | 1601 | } |
1337 | 1612 | 1602 | ||
1338 | 1613 | 1603 | ||
1339 | @@ -1619,10 +1609,6 @@ | |||
1340 | 1619 | Event *event = NULL, *bevent = NULL; | 1609 | Event *event = NULL, *bevent = NULL; |
1341 | 1620 | Blocked *blocked = NULL; | 1610 | Blocked *blocked = NULL; |
1342 | 1621 | EventOperator *oper; | 1611 | EventOperator *oper; |
1343 | 1622 | Session *session; | ||
1344 | 1623 | |||
1345 | 1624 | session = session_new (NULL, NULL, getuid ()); | ||
1346 | 1625 | TEST_NE_P (session, NULL); | ||
1347 | 1626 | 1612 | ||
1348 | 1627 | TEST_FUNCTION ("event_finished"); | 1613 | TEST_FUNCTION ("event_finished"); |
1349 | 1628 | 1614 | ||
1350 | @@ -1637,7 +1623,7 @@ | |||
1351 | 1637 | 1623 | ||
1352 | 1638 | TEST_FREE_TAG (event); | 1624 | TEST_FREE_TAG (event); |
1353 | 1639 | 1625 | ||
1355 | 1640 | class = job_class_new (NULL, "test", session); | 1626 | class = job_class_new (NULL, "test", NULL); |
1356 | 1641 | class->process[PROCESS_MAIN] = process_new (class->process); | 1627 | class->process[PROCESS_MAIN] = process_new (class->process); |
1357 | 1642 | class->process[PROCESS_MAIN]->command = "echo"; | 1628 | class->process[PROCESS_MAIN]->command = "echo"; |
1358 | 1643 | 1629 | ||
1359 | @@ -1671,7 +1657,7 @@ | |||
1360 | 1671 | 1657 | ||
1361 | 1672 | TEST_FREE_TAG (event); | 1658 | TEST_FREE_TAG (event); |
1362 | 1673 | 1659 | ||
1364 | 1674 | class = job_class_new (NULL, "test", session); | 1660 | class = job_class_new (NULL, "test", NULL); |
1365 | 1675 | class->process[PROCESS_MAIN] = process_new (class->process); | 1661 | class->process[PROCESS_MAIN] = process_new (class->process); |
1366 | 1676 | class->process[PROCESS_MAIN]->command = "echo"; | 1662 | class->process[PROCESS_MAIN]->command = "echo"; |
1367 | 1677 | 1663 | ||
1368 | @@ -1713,7 +1699,7 @@ | |||
1369 | 1713 | 1699 | ||
1370 | 1714 | TEST_FREE_TAG (event); | 1700 | TEST_FREE_TAG (event); |
1371 | 1715 | 1701 | ||
1373 | 1716 | class = job_class_new (NULL, "test", session); | 1702 | class = job_class_new (NULL, "test", NULL); |
1374 | 1717 | class->process[PROCESS_MAIN] = process_new (class->process); | 1703 | class->process[PROCESS_MAIN] = process_new (class->process); |
1375 | 1718 | class->process[PROCESS_MAIN]->command = "echo"; | 1704 | class->process[PROCESS_MAIN]->command = "echo"; |
1376 | 1719 | 1705 | ||
1377 | @@ -1754,7 +1740,7 @@ | |||
1378 | 1754 | 1740 | ||
1379 | 1755 | TEST_FREE_TAG (event); | 1741 | TEST_FREE_TAG (event); |
1380 | 1756 | 1742 | ||
1382 | 1757 | class = job_class_new (NULL, "foo", session); | 1743 | class = job_class_new (NULL, "foo", NULL); |
1383 | 1758 | 1744 | ||
1384 | 1759 | job = job_new (class, ""); | 1745 | job = job_new (class, ""); |
1385 | 1760 | job->goal = JOB_STOP; | 1746 | job->goal = JOB_STOP; |
1386 | @@ -1787,7 +1773,7 @@ | |||
1387 | 1787 | 1773 | ||
1388 | 1788 | TEST_FREE_TAG (event); | 1774 | TEST_FREE_TAG (event); |
1389 | 1789 | 1775 | ||
1391 | 1790 | class = job_class_new (NULL, "foo", session); | 1776 | class = job_class_new (NULL, "foo", NULL); |
1392 | 1791 | 1777 | ||
1393 | 1792 | job = job_new (class, ""); | 1778 | job = job_new (class, ""); |
1394 | 1793 | job->goal = JOB_START; | 1779 | job->goal = JOB_START; |
1395 | @@ -1818,7 +1804,7 @@ | |||
1396 | 1818 | 1804 | ||
1397 | 1819 | TEST_FREE_TAG (event); | 1805 | TEST_FREE_TAG (event); |
1398 | 1820 | 1806 | ||
1400 | 1821 | class = job_class_new (NULL, "foo", session); | 1807 | class = job_class_new (NULL, "foo", NULL); |
1401 | 1822 | 1808 | ||
1402 | 1823 | job = job_new (class, ""); | 1809 | job = job_new (class, ""); |
1403 | 1824 | job->goal = JOB_STOP; | 1810 | job->goal = JOB_STOP; |
1404 | @@ -1860,7 +1846,7 @@ | |||
1405 | 1860 | 1846 | ||
1406 | 1861 | TEST_FREE_TAG (event); | 1847 | TEST_FREE_TAG (event); |
1407 | 1862 | 1848 | ||
1409 | 1863 | class = job_class_new (NULL, "foo", session); | 1849 | class = job_class_new (NULL, "foo", NULL); |
1410 | 1864 | 1850 | ||
1411 | 1865 | job = job_new (class, ""); | 1851 | job = job_new (class, ""); |
1412 | 1866 | job->goal = JOB_START; | 1852 | job->goal = JOB_START; |
1413 | @@ -1903,7 +1889,7 @@ | |||
1414 | 1903 | 1889 | ||
1415 | 1904 | TEST_FREE_TAG (event); | 1890 | TEST_FREE_TAG (event); |
1416 | 1905 | 1891 | ||
1418 | 1906 | class = job_class_new (NULL, "foo", session); | 1892 | class = job_class_new (NULL, "foo", NULL); |
1419 | 1907 | class->process[PROCESS_POST_STOP] = process_new (class); | 1893 | class->process[PROCESS_POST_STOP] = process_new (class); |
1420 | 1908 | class->process[PROCESS_POST_STOP]->command = "echo"; | 1894 | class->process[PROCESS_POST_STOP]->command = "echo"; |
1421 | 1909 | 1895 | ||
1422 | @@ -1948,7 +1934,7 @@ | |||
1423 | 1948 | 1934 | ||
1424 | 1949 | TEST_FREE_TAG (event); | 1935 | TEST_FREE_TAG (event); |
1425 | 1950 | 1936 | ||
1427 | 1951 | class = job_class_new (NULL, "foo", session); | 1937 | class = job_class_new (NULL, "foo", NULL); |
1428 | 1952 | class->process[PROCESS_PRE_START] = process_new (class); | 1938 | class->process[PROCESS_PRE_START] = process_new (class); |
1429 | 1953 | class->process[PROCESS_PRE_START]->command = "echo"; | 1939 | class->process[PROCESS_PRE_START]->command = "echo"; |
1430 | 1954 | 1940 | ||
1431 | @@ -1981,7 +1967,6 @@ | |||
1432 | 1981 | 1967 | ||
1433 | 1982 | nih_free (class); | 1968 | nih_free (class); |
1434 | 1983 | } | 1969 | } |
1435 | 1984 | nih_free (session); | ||
1436 | 1985 | } | 1970 | } |
1437 | 1986 | 1971 | ||
1438 | 1987 | 1972 | ||
1439 | @@ -1989,6 +1974,9 @@ | |||
1440 | 1989 | main (int argc, | 1974 | main (int argc, |
1441 | 1990 | char *argv[]) | 1975 | char *argv[]) |
1442 | 1991 | { | 1976 | { |
1443 | 1977 | /* run tests in legacy (pre-session support) mode */ | ||
1444 | 1978 | setenv ("UPSTART_NO_SESSIONS", "1", 1); | ||
1445 | 1979 | |||
1446 | 1992 | test_new (); | 1980 | test_new (); |
1447 | 1993 | test_block (); | 1981 | test_block (); |
1448 | 1994 | test_unblock (); | 1982 | test_unblock (); |
1449 | 1995 | 1983 | ||
1450 | === modified file 'init/tests/test_event_operator.c' | |||
1451 | --- init/tests/test_event_operator.c 2010-02-04 20:08:59 +0000 | |||
1452 | +++ init/tests/test_event_operator.c 2011-04-19 09:27:29 +0000 | |||
1453 | @@ -1325,6 +1325,9 @@ | |||
1454 | 1325 | main (int argc, | 1325 | main (int argc, |
1455 | 1326 | char *argv[]) | 1326 | char *argv[]) |
1456 | 1327 | { | 1327 | { |
1457 | 1328 | /* run tests in legacy (pre-session support) mode */ | ||
1458 | 1329 | setenv ("UPSTART_NO_SESSIONS", "1", 1); | ||
1459 | 1330 | |||
1460 | 1328 | test_operator_new (); | 1331 | test_operator_new (); |
1461 | 1329 | test_operator_copy (); | 1332 | test_operator_copy (); |
1462 | 1330 | test_operator_destroy (); | 1333 | test_operator_destroy (); |
1463 | 1331 | 1334 | ||
1464 | === modified file 'init/tests/test_job.c' | |||
1465 | --- init/tests/test_job.c 2011-02-23 09:35:03 +0000 | |||
1466 | +++ init/tests/test_job.c 2011-04-19 09:27:29 +0000 | |||
1467 | @@ -72,10 +72,6 @@ | |||
1468 | 72 | NihDBusObject *object; | 72 | NihDBusObject *object; |
1469 | 73 | char *path; | 73 | char *path; |
1470 | 74 | int i; | 74 | int i; |
1471 | 75 | Session *session; | ||
1472 | 76 | |||
1473 | 77 | session = session_new (NULL, NULL, getuid ()); | ||
1474 | 78 | TEST_NE_P (session, NULL); | ||
1475 | 79 | 75 | ||
1476 | 80 | TEST_FUNCTION ("job_new"); | 76 | TEST_FUNCTION ("job_new"); |
1477 | 81 | nih_error_init (); | 77 | nih_error_init (); |
1478 | @@ -90,7 +86,7 @@ | |||
1479 | 90 | * list of the class and have sensible defaults. | 86 | * list of the class and have sensible defaults. |
1480 | 91 | */ | 87 | */ |
1481 | 92 | TEST_FEATURE ("with no name"); | 88 | TEST_FEATURE ("with no name"); |
1483 | 93 | class = job_class_new (NULL, "test", session); | 89 | class = job_class_new (NULL, "test", NULL); |
1484 | 94 | class->stop_on = event_operator_new (class, EVENT_MATCH, "baz", NULL); | 90 | class->stop_on = event_operator_new (class, EVENT_MATCH, "baz", NULL); |
1485 | 95 | 91 | ||
1486 | 96 | TEST_ALLOC_FAIL { | 92 | TEST_ALLOC_FAIL { |
1487 | @@ -259,7 +255,6 @@ | |||
1488 | 259 | event_operator_reset (class->stop_on); | 255 | event_operator_reset (class->stop_on); |
1489 | 260 | 256 | ||
1490 | 261 | nih_free (class); | 257 | nih_free (class); |
1491 | 262 | nih_free (session); | ||
1492 | 263 | } | 258 | } |
1493 | 264 | 259 | ||
1494 | 265 | void | 260 | void |
1495 | @@ -273,10 +268,6 @@ | |||
1496 | 273 | Job *job; | 268 | Job *job; |
1497 | 274 | NihDBusObject *object; | 269 | NihDBusObject *object; |
1498 | 275 | char *path; | 270 | char *path; |
1499 | 276 | Session *session; | ||
1500 | 277 | |||
1501 | 278 | session = session_new (NULL, NULL, getuid ()); | ||
1502 | 279 | TEST_NE_P (session, NULL); | ||
1503 | 280 | 271 | ||
1504 | 281 | TEST_FUNCTION ("job_register"); | 272 | TEST_FUNCTION ("job_register"); |
1505 | 282 | dbus_error_init (&dbus_error); | 273 | dbus_error_init (&dbus_error); |
1506 | @@ -293,7 +284,7 @@ | |||
1507 | 293 | * using its path, and have a InstanceAdded signal emitted. | 284 | * using its path, and have a InstanceAdded signal emitted. |
1508 | 294 | */ | 285 | */ |
1509 | 295 | TEST_FEATURE ("with signal emission"); | 286 | TEST_FEATURE ("with signal emission"); |
1511 | 296 | class = job_class_new (NULL, "test", session); | 287 | class = job_class_new (NULL, "test", NULL); |
1512 | 297 | job = job_new (class, "fred"); | 288 | job = job_new (class, "fred"); |
1513 | 298 | 289 | ||
1514 | 299 | assert (dbus_connection_get_object_path_data (conn, job->path, | 290 | assert (dbus_connection_get_object_path_data (conn, job->path, |
1515 | @@ -333,7 +324,7 @@ | |||
1516 | 333 | * is still registered. | 324 | * is still registered. |
1517 | 334 | */ | 325 | */ |
1518 | 335 | TEST_FEATURE ("without signal emission"); | 326 | TEST_FEATURE ("without signal emission"); |
1520 | 336 | class = job_class_new (NULL, "test", session); | 327 | class = job_class_new (NULL, "test", NULL); |
1521 | 337 | job = job_new (class, "fred"); | 328 | job = job_new (class, "fred"); |
1522 | 338 | 329 | ||
1523 | 339 | assert (dbus_connection_get_object_path_data (conn, job->path, | 330 | assert (dbus_connection_get_object_path_data (conn, job->path, |
1524 | @@ -367,7 +358,6 @@ | |||
1525 | 367 | dbus_message_unref (message); | 358 | dbus_message_unref (message); |
1526 | 368 | 359 | ||
1527 | 369 | nih_free (class); | 360 | nih_free (class); |
1528 | 370 | nih_free (session); | ||
1529 | 371 | 361 | ||
1530 | 372 | TEST_DBUS_CLOSE (conn); | 362 | TEST_DBUS_CLOSE (conn); |
1531 | 373 | TEST_DBUS_CLOSE (client_conn); | 363 | TEST_DBUS_CLOSE (client_conn); |
1532 | @@ -389,17 +379,13 @@ | |||
1533 | 389 | NihListEntry *entry = NULL; | 379 | NihListEntry *entry = NULL; |
1534 | 390 | DBusMessage *message; | 380 | DBusMessage *message; |
1535 | 391 | char *job_path = NULL, *goal, *state; | 381 | char *job_path = NULL, *goal, *state; |
1536 | 392 | Session *session; | ||
1537 | 393 | |||
1538 | 394 | session = session_new (NULL, NULL, getuid ()); | ||
1539 | 395 | TEST_NE_P (session, NULL); | ||
1540 | 396 | 382 | ||
1541 | 397 | TEST_FUNCTION ("job_change_goal"); | 383 | TEST_FUNCTION ("job_change_goal"); |
1542 | 398 | event_init (); | 384 | event_init (); |
1543 | 399 | 385 | ||
1544 | 400 | program_name = "test"; | 386 | program_name = "test"; |
1545 | 401 | 387 | ||
1547 | 402 | class = job_class_new (NULL, "test", session); | 388 | class = job_class_new (NULL, "test", NULL); |
1548 | 403 | class->process[PROCESS_MAIN] = process_new (class); | 389 | class->process[PROCESS_MAIN] = process_new (class); |
1549 | 404 | class->process[PROCESS_MAIN]->command = "echo"; | 390 | class->process[PROCESS_MAIN]->command = "echo"; |
1550 | 405 | class->process[PROCESS_PRE_START] = process_new (class); | 391 | class->process[PROCESS_PRE_START] = process_new (class); |
1551 | @@ -671,7 +657,6 @@ | |||
1552 | 671 | 657 | ||
1553 | 672 | 658 | ||
1554 | 673 | nih_free (class); | 659 | nih_free (class); |
1555 | 674 | nih_free (session); | ||
1556 | 675 | event_poll (); | 660 | event_poll (); |
1557 | 676 | } | 661 | } |
1558 | 677 | 662 | ||
1559 | @@ -697,10 +682,6 @@ | |||
1560 | 697 | DBusMessage *message; | 682 | DBusMessage *message; |
1561 | 698 | char *path, *job_path = NULL, *state; | 683 | char *path, *job_path = NULL, *state; |
1562 | 699 | int status; | 684 | int status; |
1563 | 700 | Session *session; | ||
1564 | 701 | |||
1565 | 702 | session = session_new (NULL, NULL, getuid ()); | ||
1566 | 703 | TEST_NE_P (session, NULL); | ||
1567 | 704 | 685 | ||
1568 | 705 | TEST_FUNCTION ("job_change_state"); | 686 | TEST_FUNCTION ("job_change_state"); |
1569 | 706 | program_name = "test"; | 687 | program_name = "test"; |
1570 | @@ -709,7 +690,7 @@ | |||
1571 | 709 | TEST_FILENAME (dirname); | 690 | TEST_FILENAME (dirname); |
1572 | 710 | mkdir (dirname, 0700); | 691 | mkdir (dirname, 0700); |
1573 | 711 | 692 | ||
1575 | 712 | class = job_class_new (NULL, "test", session); | 693 | class = job_class_new (NULL, "test", NULL); |
1576 | 713 | class->process[PROCESS_MAIN] = process_new (class); | 694 | class->process[PROCESS_MAIN] = process_new (class); |
1577 | 714 | class->process[PROCESS_MAIN]->command = nih_sprintf ( | 695 | class->process[PROCESS_MAIN]->command = nih_sprintf ( |
1578 | 715 | class->process[PROCESS_MAIN], "touch %s/run", dirname); | 696 | class->process[PROCESS_MAIN], "touch %s/run", dirname); |
1579 | @@ -3754,7 +3735,7 @@ | |||
1580 | 3754 | TEST_ALLOC_SAFE { | 3735 | TEST_ALLOC_SAFE { |
1581 | 3755 | source = conf_source_new (NULL, "/tmp", CONF_JOB_DIR); | 3736 | source = conf_source_new (NULL, "/tmp", CONF_JOB_DIR); |
1582 | 3756 | file = conf_file_new (source, "/tmp/test"); | 3737 | file = conf_file_new (source, "/tmp/test"); |
1584 | 3757 | file->job = job_class_new (NULL, "test", session); | 3738 | file->job = job_class_new (NULL, "test", NULL); |
1585 | 3758 | replacement = file->job; | 3739 | replacement = file->job; |
1586 | 3759 | 3740 | ||
1587 | 3760 | job = job_new (class, ""); | 3741 | job = job_new (class, ""); |
1588 | @@ -3823,7 +3804,7 @@ | |||
1589 | 3823 | TEST_ALLOC_SAFE { | 3804 | TEST_ALLOC_SAFE { |
1590 | 3824 | source = conf_source_new (NULL, "/tmp", CONF_JOB_DIR); | 3805 | source = conf_source_new (NULL, "/tmp", CONF_JOB_DIR); |
1591 | 3825 | file = conf_file_new (source, "/tmp/test"); | 3806 | file = conf_file_new (source, "/tmp/test"); |
1593 | 3826 | file->job = job_class_new (NULL, "test", session); | 3807 | file->job = job_class_new (NULL, "test", NULL); |
1594 | 3827 | replacement = file->job; | 3808 | replacement = file->job; |
1595 | 3828 | 3809 | ||
1596 | 3829 | job = job_new (class, ""); | 3810 | job = job_new (class, ""); |
1597 | @@ -3900,7 +3881,7 @@ | |||
1598 | 3900 | TEST_FEATURE ("post-stop to waiting for deleted job"); | 3881 | TEST_FEATURE ("post-stop to waiting for deleted job"); |
1599 | 3901 | source = conf_source_new (NULL, "/tmp", CONF_JOB_DIR); | 3882 | source = conf_source_new (NULL, "/tmp", CONF_JOB_DIR); |
1600 | 3902 | file = conf_file_new (source, "/tmp/test"); | 3883 | file = conf_file_new (source, "/tmp/test"); |
1602 | 3903 | file->job = job_class_new (NULL, "test", session); | 3884 | file->job = job_class_new (NULL, "test", NULL); |
1603 | 3904 | replacement = file->job; | 3885 | replacement = file->job; |
1604 | 3905 | 3886 | ||
1605 | 3906 | class->deleted = TRUE; | 3887 | class->deleted = TRUE; |
1606 | @@ -3963,7 +3944,6 @@ | |||
1607 | 3963 | rmdir (dirname); | 3944 | rmdir (dirname); |
1608 | 3964 | 3945 | ||
1609 | 3965 | nih_free (cause); | 3946 | nih_free (cause); |
1610 | 3966 | nih_free (session); | ||
1611 | 3967 | event_poll (); | 3947 | event_poll (); |
1612 | 3968 | } | 3948 | } |
1613 | 3969 | 3949 | ||
1614 | @@ -3972,13 +3952,9 @@ | |||
1615 | 3972 | { | 3952 | { |
1616 | 3973 | JobClass *class; | 3953 | JobClass *class; |
1617 | 3974 | Job *job; | 3954 | Job *job; |
1618 | 3975 | Session *session; | ||
1619 | 3976 | |||
1620 | 3977 | session = session_new (NULL, NULL, getuid ()); | ||
1621 | 3978 | TEST_NE_P (session, NULL); | ||
1622 | 3979 | 3955 | ||
1623 | 3980 | TEST_FUNCTION ("job_next_state"); | 3956 | TEST_FUNCTION ("job_next_state"); |
1625 | 3981 | class = job_class_new (NULL, "test", session); | 3957 | class = job_class_new (NULL, "test", NULL); |
1626 | 3982 | class->process[PROCESS_MAIN] = process_new (class); | 3958 | class->process[PROCESS_MAIN] = process_new (class); |
1627 | 3983 | class->process[PROCESS_MAIN]->command = "echo"; | 3959 | class->process[PROCESS_MAIN]->command = "echo"; |
1628 | 3984 | 3960 | ||
1629 | @@ -4215,7 +4191,6 @@ | |||
1630 | 4215 | 4191 | ||
1631 | 4216 | 4192 | ||
1632 | 4217 | nih_free (class); | 4193 | nih_free (class); |
1633 | 4218 | nih_free (session); | ||
1634 | 4219 | } | 4194 | } |
1635 | 4220 | 4195 | ||
1636 | 4221 | 4196 | ||
1637 | @@ -4226,10 +4201,6 @@ | |||
1638 | 4226 | Job *job; | 4201 | Job *job; |
1639 | 4227 | Blocked *blocked1, *blocked2; | 4202 | Blocked *blocked1, *blocked2; |
1640 | 4228 | Event *event1, *event2; | 4203 | Event *event1, *event2; |
1641 | 4229 | Session *session; | ||
1642 | 4230 | |||
1643 | 4231 | session = session_new (NULL, NULL, getuid ()); | ||
1644 | 4232 | TEST_NE_P (session, NULL); | ||
1645 | 4233 | 4204 | ||
1646 | 4234 | TEST_FUNCTION ("job_failed"); | 4205 | TEST_FUNCTION ("job_failed"); |
1647 | 4235 | 4206 | ||
1648 | @@ -4238,7 +4209,7 @@ | |||
1649 | 4238 | * as failed before freeing the blocking list. | 4209 | * as failed before freeing the blocking list. |
1650 | 4239 | */ | 4210 | */ |
1651 | 4240 | TEST_FEATURE ("with no current failure"); | 4211 | TEST_FEATURE ("with no current failure"); |
1653 | 4241 | class = job_class_new (NULL, "test", session); | 4212 | class = job_class_new (NULL, "test", NULL); |
1654 | 4242 | job = job_new (class, ""); | 4213 | job = job_new (class, ""); |
1655 | 4243 | 4214 | ||
1656 | 4244 | event1 = event_new (NULL, "foo", NULL); | 4215 | event1 = event_new (NULL, "foo", NULL); |
1657 | @@ -4279,7 +4250,7 @@ | |||
1658 | 4279 | * since these were added after the first failure. | 4250 | * since these were added after the first failure. |
1659 | 4280 | */ | 4251 | */ |
1660 | 4281 | TEST_FEATURE ("with previous failure"); | 4252 | TEST_FEATURE ("with previous failure"); |
1662 | 4282 | class = job_class_new (NULL, "test", session); | 4253 | class = job_class_new (NULL, "test", NULL); |
1663 | 4283 | job = job_new (class, ""); | 4254 | job = job_new (class, ""); |
1664 | 4284 | job->failed = TRUE; | 4255 | job->failed = TRUE; |
1665 | 4285 | job->failed_process = PROCESS_PRE_START; | 4256 | job->failed_process = PROCESS_PRE_START; |
1666 | @@ -4316,7 +4287,6 @@ | |||
1667 | 4316 | TEST_FALSE (event2->failed); | 4287 | TEST_FALSE (event2->failed); |
1668 | 4317 | 4288 | ||
1669 | 4318 | nih_free (class); | 4289 | nih_free (class); |
1670 | 4319 | nih_free (session); | ||
1671 | 4320 | 4290 | ||
1672 | 4321 | event_poll (); | 4291 | event_poll (); |
1673 | 4322 | } | 4292 | } |
1674 | @@ -4328,10 +4298,6 @@ | |||
1675 | 4328 | Job *job; | 4298 | Job *job; |
1676 | 4329 | Blocked *blocked1, *blocked2; | 4299 | Blocked *blocked1, *blocked2; |
1677 | 4330 | Event *event1, *event2; | 4300 | Event *event1, *event2; |
1678 | 4331 | Session *session; | ||
1679 | 4332 | |||
1680 | 4333 | session = session_new (NULL, NULL, getuid ()); | ||
1681 | 4334 | TEST_NE_P (session, NULL); | ||
1682 | 4335 | 4301 | ||
1683 | 4336 | TEST_FUNCTION ("job_finished"); | 4302 | TEST_FUNCTION ("job_finished"); |
1684 | 4337 | 4303 | ||
1685 | @@ -4339,7 +4305,7 @@ | |||
1686 | 4339 | * is unblocked and the list itself is then freed. | 4305 | * is unblocked and the list itself is then freed. |
1687 | 4340 | */ | 4306 | */ |
1688 | 4341 | TEST_FEATURE ("with blocked events"); | 4307 | TEST_FEATURE ("with blocked events"); |
1690 | 4342 | class = job_class_new (NULL, "test", session); | 4308 | class = job_class_new (NULL, "test", NULL); |
1691 | 4343 | job = job_new (class, ""); | 4309 | job = job_new (class, ""); |
1692 | 4344 | 4310 | ||
1693 | 4345 | event1 = event_new (NULL, "foo", NULL); | 4311 | event1 = event_new (NULL, "foo", NULL); |
1694 | @@ -4375,7 +4341,7 @@ | |||
1695 | 4375 | * unblocked and marked as failed. | 4341 | * unblocked and marked as failed. |
1696 | 4376 | */ | 4342 | */ |
1697 | 4377 | TEST_FEATURE ("with blocked events and failure"); | 4343 | TEST_FEATURE ("with blocked events and failure"); |
1699 | 4378 | class = job_class_new (NULL, "test", session); | 4344 | class = job_class_new (NULL, "test", NULL); |
1700 | 4379 | job = job_new (class, ""); | 4345 | job = job_new (class, ""); |
1701 | 4380 | 4346 | ||
1702 | 4381 | event1 = event_new (NULL, "foo", NULL); | 4347 | event1 = event_new (NULL, "foo", NULL); |
1703 | @@ -4411,7 +4377,7 @@ | |||
1704 | 4411 | * still works (and just does nothing). | 4377 | * still works (and just does nothing). |
1705 | 4412 | */ | 4378 | */ |
1706 | 4413 | TEST_FEATURE ("without blocked events"); | 4379 | TEST_FEATURE ("without blocked events"); |
1708 | 4414 | class = job_class_new (NULL, "test", session); | 4380 | class = job_class_new (NULL, "test", NULL); |
1709 | 4415 | job = job_new (class, ""); | 4381 | job = job_new (class, ""); |
1710 | 4416 | 4382 | ||
1711 | 4417 | job_finished (job, TRUE); | 4383 | job_finished (job, TRUE); |
1712 | @@ -4419,7 +4385,6 @@ | |||
1713 | 4419 | TEST_LIST_EMPTY (&job->blocking); | 4385 | TEST_LIST_EMPTY (&job->blocking); |
1714 | 4420 | 4386 | ||
1715 | 4421 | nih_free (class); | 4387 | nih_free (class); |
1716 | 4422 | nih_free (session); | ||
1717 | 4423 | 4388 | ||
1718 | 4424 | event_poll (); | 4389 | event_poll (); |
1719 | 4425 | } | 4390 | } |
1720 | @@ -4432,10 +4397,6 @@ | |||
1721 | 4432 | Job *job; | 4397 | Job *job; |
1722 | 4433 | Event *event; | 4398 | Event *event; |
1723 | 4434 | Blocked *blocked; | 4399 | Blocked *blocked; |
1724 | 4435 | Session *session; | ||
1725 | 4436 | |||
1726 | 4437 | session = session_new (NULL, NULL, getuid ()); | ||
1727 | 4438 | TEST_NE_P (session, NULL); | ||
1728 | 4439 | 4400 | ||
1729 | 4440 | TEST_FUNCTION ("job_emit_event"); | 4401 | TEST_FUNCTION ("job_emit_event"); |
1730 | 4441 | 4402 | ||
1731 | @@ -4443,7 +4404,7 @@ | |||
1732 | 4443 | * event event emitted with the job name set. | 4404 | * event event emitted with the job name set. |
1733 | 4444 | */ | 4405 | */ |
1734 | 4445 | TEST_FEATURE ("with singleton in starting state"); | 4406 | TEST_FEATURE ("with singleton in starting state"); |
1736 | 4446 | class = job_class_new (NULL, "test", session); | 4407 | class = job_class_new (NULL, "test", NULL); |
1737 | 4447 | 4408 | ||
1738 | 4448 | job = job_new (class, ""); | 4409 | job = job_new (class, ""); |
1739 | 4449 | job->goal = JOB_START; | 4410 | job->goal = JOB_START; |
1740 | @@ -4482,7 +4443,7 @@ | |||
1741 | 4482 | * instance name set. | 4443 | * instance name set. |
1742 | 4483 | */ | 4444 | */ |
1743 | 4484 | TEST_FEATURE ("with instance in starting state"); | 4445 | TEST_FEATURE ("with instance in starting state"); |
1745 | 4485 | class = job_class_new (NULL, "test", session); | 4446 | class = job_class_new (NULL, "test", NULL); |
1746 | 4486 | class->instance = "$FOO"; | 4447 | class->instance = "$FOO"; |
1747 | 4487 | 4448 | ||
1748 | 4488 | job = job_new (class, "foo"); | 4449 | job = job_new (class, "foo"); |
1749 | @@ -4522,7 +4483,7 @@ | |||
1750 | 4522 | * event emitted with the job name set. | 4483 | * event emitted with the job name set. |
1751 | 4523 | */ | 4484 | */ |
1752 | 4524 | TEST_FEATURE ("with singleton in running state"); | 4485 | TEST_FEATURE ("with singleton in running state"); |
1754 | 4525 | class = job_class_new (NULL, "test", session); | 4486 | class = job_class_new (NULL, "test", NULL); |
1755 | 4526 | 4487 | ||
1756 | 4527 | job = job_new (class, ""); | 4488 | job = job_new (class, ""); |
1757 | 4528 | job->goal = JOB_START; | 4489 | job->goal = JOB_START; |
1758 | @@ -4552,7 +4513,7 @@ | |||
1759 | 4552 | * instance name set. | 4513 | * instance name set. |
1760 | 4553 | */ | 4514 | */ |
1761 | 4554 | TEST_FEATURE ("with instance in running state"); | 4515 | TEST_FEATURE ("with instance in running state"); |
1763 | 4555 | class = job_class_new (NULL, "test", session); | 4516 | class = job_class_new (NULL, "test", NULL); |
1764 | 4556 | class->instance = "$FOO"; | 4517 | class->instance = "$FOO"; |
1765 | 4557 | 4518 | ||
1766 | 4558 | job = job_new (class, "foo"); | 4519 | job = job_new (class, "foo"); |
1767 | @@ -4584,7 +4545,7 @@ | |||
1768 | 4584 | * result as "ok" | 4545 | * result as "ok" |
1769 | 4585 | */ | 4546 | */ |
1770 | 4586 | TEST_FEATURE ("with non-failed singleton in stopping state"); | 4547 | TEST_FEATURE ("with non-failed singleton in stopping state"); |
1772 | 4587 | class = job_class_new (NULL, "test", session); | 4548 | class = job_class_new (NULL, "test", NULL); |
1773 | 4588 | 4549 | ||
1774 | 4589 | job = job_new (class, ""); | 4550 | job = job_new (class, ""); |
1775 | 4590 | job->goal = JOB_STOP; | 4551 | job->goal = JOB_STOP; |
1776 | @@ -4624,7 +4585,7 @@ | |||
1777 | 4624 | * also has the instance name set before the result information. | 4585 | * also has the instance name set before the result information. |
1778 | 4625 | */ | 4586 | */ |
1779 | 4626 | TEST_FEATURE ("with non-failed instance in stopping state"); | 4587 | TEST_FEATURE ("with non-failed instance in stopping state"); |
1781 | 4627 | class = job_class_new (NULL, "test", session); | 4588 | class = job_class_new (NULL, "test", NULL); |
1782 | 4628 | class->instance = "$FOO"; | 4589 | class->instance = "$FOO"; |
1783 | 4629 | 4590 | ||
1784 | 4630 | job = job_new (class, "foo"); | 4591 | job = job_new (class, "foo"); |
1785 | @@ -4667,7 +4628,7 @@ | |||
1786 | 4667 | * exit status members set. | 4628 | * exit status members set. |
1787 | 4668 | */ | 4629 | */ |
1788 | 4669 | TEST_FEATURE ("with failed singleton in stopping state"); | 4630 | TEST_FEATURE ("with failed singleton in stopping state"); |
1790 | 4670 | class = job_class_new (NULL, "test", session); | 4631 | class = job_class_new (NULL, "test", NULL); |
1791 | 4671 | 4632 | ||
1792 | 4672 | job = job_new (class, ""); | 4633 | job = job_new (class, ""); |
1793 | 4673 | job->goal = JOB_STOP; | 4634 | job->goal = JOB_STOP; |
1794 | @@ -4713,7 +4674,7 @@ | |||
1795 | 4713 | * set before the result information. | 4674 | * set before the result information. |
1796 | 4714 | */ | 4675 | */ |
1797 | 4715 | TEST_FEATURE ("with failed instance in stopping state"); | 4676 | TEST_FEATURE ("with failed instance in stopping state"); |
1799 | 4716 | class = job_class_new (NULL, "test", session); | 4677 | class = job_class_new (NULL, "test", NULL); |
1800 | 4717 | class->instance = "$FOO"; | 4678 | class->instance = "$FOO"; |
1801 | 4718 | 4679 | ||
1802 | 4719 | job = job_new (class, "foo"); | 4680 | job = job_new (class, "foo"); |
1803 | @@ -4761,7 +4722,7 @@ | |||
1804 | 4761 | * members set. | 4722 | * members set. |
1805 | 4762 | */ | 4723 | */ |
1806 | 4763 | TEST_FEATURE ("with killed singleton in stopping state"); | 4724 | TEST_FEATURE ("with killed singleton in stopping state"); |
1808 | 4764 | class = job_class_new (NULL, "test", session); | 4725 | class = job_class_new (NULL, "test", NULL); |
1809 | 4765 | 4726 | ||
1810 | 4766 | job = job_new (class, ""); | 4727 | job = job_new (class, ""); |
1811 | 4767 | job->goal = JOB_STOP; | 4728 | job->goal = JOB_STOP; |
1812 | @@ -4807,7 +4768,7 @@ | |||
1813 | 4807 | * result information. | 4768 | * result information. |
1814 | 4808 | */ | 4769 | */ |
1815 | 4809 | TEST_FEATURE ("with killed instance in stopping state"); | 4770 | TEST_FEATURE ("with killed instance in stopping state"); |
1817 | 4810 | class = job_class_new (NULL, "test", session); | 4771 | class = job_class_new (NULL, "test", NULL); |
1818 | 4811 | class->instance = "$FOO"; | 4772 | class->instance = "$FOO"; |
1819 | 4812 | 4773 | ||
1820 | 4813 | job = job_new (class, "foo"); | 4774 | job = job_new (class, "foo"); |
1821 | @@ -4855,7 +4816,7 @@ | |||
1822 | 4855 | * signal members set. | 4816 | * signal members set. |
1823 | 4856 | */ | 4817 | */ |
1824 | 4857 | TEST_FEATURE ("with unknown killed singleton in stopping state"); | 4818 | TEST_FEATURE ("with unknown killed singleton in stopping state"); |
1826 | 4858 | class = job_class_new (NULL, "test", session); | 4819 | class = job_class_new (NULL, "test", NULL); |
1827 | 4859 | 4820 | ||
1828 | 4860 | job = job_new (class, ""); | 4821 | job = job_new (class, ""); |
1829 | 4861 | job->goal = JOB_STOP; | 4822 | job->goal = JOB_STOP; |
1830 | @@ -4901,7 +4862,7 @@ | |||
1831 | 4901 | * the result information. | 4862 | * the result information. |
1832 | 4902 | */ | 4863 | */ |
1833 | 4903 | TEST_FEATURE ("with unknown killed instance in stopping state"); | 4864 | TEST_FEATURE ("with unknown killed instance in stopping state"); |
1835 | 4904 | class = job_class_new (NULL, "test", session); | 4865 | class = job_class_new (NULL, "test", NULL); |
1836 | 4905 | class->instance = "$FOO"; | 4866 | class->instance = "$FOO"; |
1837 | 4906 | 4867 | ||
1838 | 4907 | job = job_new (class, "foo"); | 4868 | job = job_new (class, "foo"); |
1839 | @@ -4948,7 +4909,7 @@ | |||
1840 | 4948 | * the job name set, the result as failed, and just the process set. | 4909 | * the job name set, the result as failed, and just the process set. |
1841 | 4949 | */ | 4910 | */ |
1842 | 4950 | TEST_FEATURE ("with unstarted singleton in stopping state"); | 4911 | TEST_FEATURE ("with unstarted singleton in stopping state"); |
1844 | 4951 | class = job_class_new (NULL, "test", session); | 4912 | class = job_class_new (NULL, "test", NULL); |
1845 | 4952 | 4913 | ||
1846 | 4953 | job = job_new (class, ""); | 4914 | job = job_new (class, ""); |
1847 | 4954 | job->goal = JOB_STOP; | 4915 | job->goal = JOB_STOP; |
1848 | @@ -4993,7 +4954,7 @@ | |||
1849 | 4993 | * the result information. | 4954 | * the result information. |
1850 | 4994 | */ | 4955 | */ |
1851 | 4995 | TEST_FEATURE ("with unstarted instance in stopping state"); | 4956 | TEST_FEATURE ("with unstarted instance in stopping state"); |
1853 | 4996 | class = job_class_new (NULL, "test", session); | 4957 | class = job_class_new (NULL, "test", NULL); |
1854 | 4997 | class->instance = "$FOO"; | 4958 | class->instance = "$FOO"; |
1855 | 4998 | 4959 | ||
1856 | 4999 | job = job_new (class, "foo"); | 4960 | job = job_new (class, "foo"); |
1857 | @@ -5039,7 +5000,7 @@ | |||
1858 | 5039 | * the result as failed and the process set to respawn. | 5000 | * the result as failed and the process set to respawn. |
1859 | 5040 | */ | 5001 | */ |
1860 | 5041 | TEST_FEATURE ("with failed respawn singleton in stopping state"); | 5002 | TEST_FEATURE ("with failed respawn singleton in stopping state"); |
1862 | 5042 | class = job_class_new (NULL, "test", session); | 5003 | class = job_class_new (NULL, "test", NULL); |
1863 | 5043 | 5004 | ||
1864 | 5044 | job = job_new (class, ""); | 5005 | job = job_new (class, ""); |
1865 | 5045 | job->goal = JOB_STOP; | 5006 | job->goal = JOB_STOP; |
1866 | @@ -5084,7 +5045,7 @@ | |||
1867 | 5084 | * information. | 5045 | * information. |
1868 | 5085 | */ | 5046 | */ |
1869 | 5086 | TEST_FEATURE ("with failed respawn instance in stopping state"); | 5047 | TEST_FEATURE ("with failed respawn instance in stopping state"); |
1871 | 5087 | class = job_class_new (NULL, "test", session); | 5048 | class = job_class_new (NULL, "test", NULL); |
1872 | 5088 | class->instance = "$FOO"; | 5049 | class->instance = "$FOO"; |
1873 | 5089 | 5050 | ||
1874 | 5090 | job = job_new (class, "foo"); | 5051 | job = job_new (class, "foo"); |
1875 | @@ -5130,7 +5091,7 @@ | |||
1876 | 5130 | * result as "ok" | 5091 | * result as "ok" |
1877 | 5131 | */ | 5092 | */ |
1878 | 5132 | TEST_FEATURE ("with non-failed singleton in stopped state"); | 5093 | TEST_FEATURE ("with non-failed singleton in stopped state"); |
1880 | 5133 | class = job_class_new (NULL, "test", session); | 5094 | class = job_class_new (NULL, "test", NULL); |
1881 | 5134 | 5095 | ||
1882 | 5135 | job = job_new (class, ""); | 5096 | job = job_new (class, ""); |
1883 | 5136 | job->goal = JOB_STOP; | 5097 | job->goal = JOB_STOP; |
1884 | @@ -5161,7 +5122,7 @@ | |||
1885 | 5161 | * also has the instance name set before the result information. | 5122 | * also has the instance name set before the result information. |
1886 | 5162 | */ | 5123 | */ |
1887 | 5163 | TEST_FEATURE ("with non-failed instance in waiting state"); | 5124 | TEST_FEATURE ("with non-failed instance in waiting state"); |
1889 | 5164 | class = job_class_new (NULL, "test", session); | 5125 | class = job_class_new (NULL, "test", NULL); |
1890 | 5165 | class->instance = "$FOO"; | 5126 | class->instance = "$FOO"; |
1891 | 5166 | 5127 | ||
1892 | 5167 | job = job_new (class, "foo"); | 5128 | job = job_new (class, "foo"); |
1893 | @@ -5195,7 +5156,7 @@ | |||
1894 | 5195 | * exit status members set. | 5156 | * exit status members set. |
1895 | 5196 | */ | 5157 | */ |
1896 | 5197 | TEST_FEATURE ("with failed singleton in waiting state"); | 5158 | TEST_FEATURE ("with failed singleton in waiting state"); |
1898 | 5198 | class = job_class_new (NULL, "test", session); | 5159 | class = job_class_new (NULL, "test", NULL); |
1899 | 5199 | 5160 | ||
1900 | 5200 | job = job_new (class, ""); | 5161 | job = job_new (class, ""); |
1901 | 5201 | job->goal = JOB_STOP; | 5162 | job->goal = JOB_STOP; |
1902 | @@ -5232,7 +5193,7 @@ | |||
1903 | 5232 | * set before the result information. | 5193 | * set before the result information. |
1904 | 5233 | */ | 5194 | */ |
1905 | 5234 | TEST_FEATURE ("with failed instance in waiting state"); | 5195 | TEST_FEATURE ("with failed instance in waiting state"); |
1907 | 5235 | class = job_class_new (NULL, "test", session); | 5196 | class = job_class_new (NULL, "test", NULL); |
1908 | 5236 | class->instance = "$FOO"; | 5197 | class->instance = "$FOO"; |
1909 | 5237 | 5198 | ||
1910 | 5238 | job = job_new (class, "foo"); | 5199 | job = job_new (class, "foo"); |
1911 | @@ -5271,7 +5232,7 @@ | |||
1912 | 5271 | * members set. | 5232 | * members set. |
1913 | 5272 | */ | 5233 | */ |
1914 | 5273 | TEST_FEATURE ("with killed singleton in waiting state"); | 5234 | TEST_FEATURE ("with killed singleton in waiting state"); |
1916 | 5274 | class = job_class_new (NULL, "test", session); | 5235 | class = job_class_new (NULL, "test", NULL); |
1917 | 5275 | 5236 | ||
1918 | 5276 | job = job_new (class, ""); | 5237 | job = job_new (class, ""); |
1919 | 5277 | job->goal = JOB_STOP; | 5238 | job->goal = JOB_STOP; |
1920 | @@ -5308,7 +5269,7 @@ | |||
1921 | 5308 | * result information. | 5269 | * result information. |
1922 | 5309 | */ | 5270 | */ |
1923 | 5310 | TEST_FEATURE ("with killed instance in waiting state"); | 5271 | TEST_FEATURE ("with killed instance in waiting state"); |
1925 | 5311 | class = job_class_new (NULL, "test", session); | 5272 | class = job_class_new (NULL, "test", NULL); |
1926 | 5312 | class->instance = "$FOO"; | 5273 | class->instance = "$FOO"; |
1927 | 5313 | 5274 | ||
1928 | 5314 | job = job_new (class, "foo"); | 5275 | job = job_new (class, "foo"); |
1929 | @@ -5347,7 +5308,7 @@ | |||
1930 | 5347 | * signal members set. | 5308 | * signal members set. |
1931 | 5348 | */ | 5309 | */ |
1932 | 5349 | TEST_FEATURE ("with unknown killed singleton in waiting state"); | 5310 | TEST_FEATURE ("with unknown killed singleton in waiting state"); |
1934 | 5350 | class = job_class_new (NULL, "test", session); | 5311 | class = job_class_new (NULL, "test", NULL); |
1935 | 5351 | 5312 | ||
1936 | 5352 | job = job_new (class, ""); | 5313 | job = job_new (class, ""); |
1937 | 5353 | job->goal = JOB_STOP; | 5314 | job->goal = JOB_STOP; |
1938 | @@ -5384,7 +5345,7 @@ | |||
1939 | 5384 | * the result information. | 5345 | * the result information. |
1940 | 5385 | */ | 5346 | */ |
1941 | 5386 | TEST_FEATURE ("with unknown killed instance in waiting state"); | 5347 | TEST_FEATURE ("with unknown killed instance in waiting state"); |
1943 | 5387 | class = job_class_new (NULL, "test", session); | 5348 | class = job_class_new (NULL, "test", NULL); |
1944 | 5388 | class->instance = "$FOO"; | 5349 | class->instance = "$FOO"; |
1945 | 5389 | 5350 | ||
1946 | 5390 | job = job_new (class, "foo"); | 5351 | job = job_new (class, "foo"); |
1947 | @@ -5422,7 +5383,7 @@ | |||
1948 | 5422 | * the job name set, the result as failed, and just the process set. | 5383 | * the job name set, the result as failed, and just the process set. |
1949 | 5423 | */ | 5384 | */ |
1950 | 5424 | TEST_FEATURE ("with unstarted singleton in waiting state"); | 5385 | TEST_FEATURE ("with unstarted singleton in waiting state"); |
1952 | 5425 | class = job_class_new (NULL, "test", session); | 5386 | class = job_class_new (NULL, "test", NULL); |
1953 | 5426 | 5387 | ||
1954 | 5427 | job = job_new (class, ""); | 5388 | job = job_new (class, ""); |
1955 | 5428 | job->goal = JOB_STOP; | 5389 | job->goal = JOB_STOP; |
1956 | @@ -5458,7 +5419,7 @@ | |||
1957 | 5458 | * the result information. | 5419 | * the result information. |
1958 | 5459 | */ | 5420 | */ |
1959 | 5460 | TEST_FEATURE ("with unstarted instance in waiting state"); | 5421 | TEST_FEATURE ("with unstarted instance in waiting state"); |
1961 | 5461 | class = job_class_new (NULL, "test", session); | 5422 | class = job_class_new (NULL, "test", NULL); |
1962 | 5462 | class->instance = "$FOO"; | 5423 | class->instance = "$FOO"; |
1963 | 5463 | 5424 | ||
1964 | 5464 | job = job_new (class, "foo"); | 5425 | job = job_new (class, "foo"); |
1965 | @@ -5495,7 +5456,7 @@ | |||
1966 | 5495 | * the result as failed and the process set to respawn. | 5456 | * the result as failed and the process set to respawn. |
1967 | 5496 | */ | 5457 | */ |
1968 | 5497 | TEST_FEATURE ("with failed respawn singleton in waiting state"); | 5458 | TEST_FEATURE ("with failed respawn singleton in waiting state"); |
1970 | 5498 | class = job_class_new (NULL, "test", session); | 5459 | class = job_class_new (NULL, "test", NULL); |
1971 | 5499 | 5460 | ||
1972 | 5500 | job = job_new (class, ""); | 5461 | job = job_new (class, ""); |
1973 | 5501 | job->goal = JOB_STOP; | 5462 | job->goal = JOB_STOP; |
1974 | @@ -5531,7 +5492,7 @@ | |||
1975 | 5531 | * information. | 5492 | * information. |
1976 | 5532 | */ | 5493 | */ |
1977 | 5533 | TEST_FEATURE ("with failed respawn instance in waiting state"); | 5494 | TEST_FEATURE ("with failed respawn instance in waiting state"); |
1979 | 5534 | class = job_class_new (NULL, "test", session); | 5495 | class = job_class_new (NULL, "test", NULL); |
1980 | 5535 | class->instance = "$FOO"; | 5496 | class->instance = "$FOO"; |
1981 | 5536 | 5497 | ||
1982 | 5537 | job = job_new (class, "foo"); | 5498 | job = job_new (class, "foo"); |
1983 | @@ -5561,7 +5522,6 @@ | |||
1984 | 5561 | } | 5522 | } |
1985 | 5562 | 5523 | ||
1986 | 5563 | nih_free (class); | 5524 | nih_free (class); |
1987 | 5564 | nih_free (session); | ||
1988 | 5565 | } | 5525 | } |
1989 | 5566 | 5526 | ||
1990 | 5567 | 5527 | ||
1991 | @@ -5572,16 +5532,12 @@ | |||
1992 | 5572 | Job *job; | 5532 | Job *job; |
1993 | 5573 | const char *ret; | 5533 | const char *ret; |
1994 | 5574 | char *name; | 5534 | char *name; |
1995 | 5575 | Session *session; | ||
1996 | 5576 | |||
1997 | 5577 | session = session_new (NULL, NULL, getuid ()); | ||
1998 | 5578 | TEST_NE_P (session, NULL); | ||
1999 | 5579 | 5535 | ||
2000 | 5580 | TEST_FUNCTION ("job_name"); | 5536 | TEST_FUNCTION ("job_name"); |
2001 | 5581 | 5537 | ||
2002 | 5582 | /* Check that the name of a non-instance job is returned. */ | 5538 | /* Check that the name of a non-instance job is returned. */ |
2003 | 5583 | TEST_FEATURE ("with non-instance job"); | 5539 | TEST_FEATURE ("with non-instance job"); |
2005 | 5584 | class = job_class_new (NULL, "test", session); | 5540 | class = job_class_new (NULL, "test", NULL); |
2006 | 5585 | job = job_new (class, ""); | 5541 | job = job_new (class, ""); |
2007 | 5586 | 5542 | ||
2008 | 5587 | TEST_ALLOC_FAIL { | 5543 | TEST_ALLOC_FAIL { |
2009 | @@ -5595,7 +5551,7 @@ | |||
2010 | 5595 | 5551 | ||
2011 | 5596 | /* Check that the name of an instance job is returned. */ | 5552 | /* Check that the name of an instance job is returned. */ |
2012 | 5597 | TEST_FEATURE ("with instance job"); | 5553 | TEST_FEATURE ("with instance job"); |
2014 | 5598 | class = job_class_new (NULL, "test", session); | 5554 | class = job_class_new (NULL, "test", NULL); |
2015 | 5599 | class->instance = "$FOO"; | 5555 | class->instance = "$FOO"; |
2016 | 5600 | job = job_new (class, "foo"); | 5556 | job = job_new (class, "foo"); |
2017 | 5601 | 5557 | ||
2018 | @@ -5612,7 +5568,7 @@ | |||
2019 | 5612 | * value. | 5568 | * value. |
2020 | 5613 | */ | 5569 | */ |
2021 | 5614 | TEST_FEATURE ("with multiple calls"); | 5570 | TEST_FEATURE ("with multiple calls"); |
2023 | 5615 | class = job_class_new (NULL, "test", session); | 5571 | class = job_class_new (NULL, "test", NULL); |
2024 | 5616 | job = job_new (class, ""); | 5572 | job = job_new (class, ""); |
2025 | 5617 | 5573 | ||
2026 | 5618 | ret = job_name (job); | 5574 | ret = job_name (job); |
2027 | @@ -5625,7 +5581,6 @@ | |||
2028 | 5625 | TEST_FREE (name); | 5581 | TEST_FREE (name); |
2029 | 5626 | 5582 | ||
2030 | 5627 | nih_free (class); | 5583 | nih_free (class); |
2031 | 5628 | nih_free (session); | ||
2032 | 5629 | } | 5584 | } |
2033 | 5630 | 5585 | ||
2034 | 5631 | 5586 | ||
2035 | @@ -5883,11 +5838,6 @@ | |||
2036 | 5883 | int ret; | 5838 | int ret; |
2037 | 5884 | NihError *error; | 5839 | NihError *error; |
2038 | 5885 | NihDBusError *dbus_error; | 5840 | NihDBusError *dbus_error; |
2039 | 5886 | Session *session; | ||
2040 | 5887 | |||
2041 | 5888 | session = session_new (NULL, NULL, getuid ()); | ||
2042 | 5889 | TEST_NE_P (session, NULL); | ||
2043 | 5890 | |||
2044 | 5891 | 5841 | ||
2045 | 5892 | TEST_FUNCTION ("job_start"); | 5842 | TEST_FUNCTION ("job_start"); |
2046 | 5893 | nih_error_init (); | 5843 | nih_error_init (); |
2047 | @@ -5904,8 +5854,9 @@ | |||
2048 | 5904 | * the reply will be sent to the sender. | 5854 | * the reply will be sent to the sender. |
2049 | 5905 | */ | 5855 | */ |
2050 | 5906 | TEST_FEATURE ("with stopping job"); | 5856 | TEST_FEATURE ("with stopping job"); |
2052 | 5907 | class = job_class_new (NULL, "test", session); | 5857 | class = job_class_new (NULL, "test", NULL); |
2053 | 5908 | job = job_new (class, ""); | 5858 | job = job_new (class, ""); |
2054 | 5859 | TEST_NE_P (job, NULL); | ||
2055 | 5909 | 5860 | ||
2056 | 5910 | job->goal = JOB_STOP; | 5861 | job->goal = JOB_STOP; |
2057 | 5911 | job->state = JOB_STOPPING; | 5862 | job->state = JOB_STOPPING; |
2058 | @@ -5990,7 +5941,7 @@ | |||
2059 | 5990 | * and no blocking entry created. | 5941 | * and no blocking entry created. |
2060 | 5991 | */ | 5942 | */ |
2061 | 5992 | TEST_FEATURE ("with no wait"); | 5943 | TEST_FEATURE ("with no wait"); |
2063 | 5993 | class = job_class_new (NULL, "test", session); | 5944 | class = job_class_new (NULL, "test", NULL); |
2064 | 5994 | job = job_new (class, ""); | 5945 | job = job_new (class, ""); |
2065 | 5995 | 5946 | ||
2066 | 5996 | job->goal = JOB_STOP; | 5947 | job->goal = JOB_STOP; |
2067 | @@ -6060,7 +6011,7 @@ | |||
2068 | 6060 | * a D-Bus error is raised immediately. | 6011 | * a D-Bus error is raised immediately. |
2069 | 6061 | */ | 6012 | */ |
2070 | 6062 | TEST_FEATURE ("with starting job"); | 6013 | TEST_FEATURE ("with starting job"); |
2072 | 6063 | class = job_class_new (NULL, "test", session); | 6014 | class = job_class_new (NULL, "test", NULL); |
2073 | 6064 | job = job_new (class, ""); | 6015 | job = job_new (class, ""); |
2074 | 6065 | 6016 | ||
2075 | 6066 | job->goal = JOB_START; | 6017 | job->goal = JOB_START; |
2076 | @@ -6107,7 +6058,6 @@ | |||
2077 | 6107 | TEST_EQ (job->state, JOB_STARTING); | 6058 | TEST_EQ (job->state, JOB_STARTING); |
2078 | 6108 | 6059 | ||
2079 | 6109 | nih_free (class); | 6060 | nih_free (class); |
2080 | 6110 | nih_free (session); | ||
2081 | 6111 | 6061 | ||
2082 | 6112 | TEST_DBUS_CLOSE (conn); | 6062 | TEST_DBUS_CLOSE (conn); |
2083 | 6113 | TEST_DBUS_CLOSE (client_conn); | 6063 | TEST_DBUS_CLOSE (client_conn); |
2084 | @@ -6132,10 +6082,6 @@ | |||
2085 | 6132 | int ret; | 6082 | int ret; |
2086 | 6133 | NihError *error; | 6083 | NihError *error; |
2087 | 6134 | NihDBusError *dbus_error; | 6084 | NihDBusError *dbus_error; |
2088 | 6135 | Session *session; | ||
2089 | 6136 | |||
2090 | 6137 | session = session_new (NULL, NULL, getuid ()); | ||
2091 | 6138 | TEST_NE_P (session, NULL); | ||
2092 | 6139 | 6085 | ||
2093 | 6140 | TEST_FUNCTION ("job_stop"); | 6086 | TEST_FUNCTION ("job_stop"); |
2094 | 6141 | nih_error_init (); | 6087 | nih_error_init (); |
2095 | @@ -6152,7 +6098,7 @@ | |||
2096 | 6152 | * the reply will be sent to the sender and the instance deleted. | 6098 | * the reply will be sent to the sender and the instance deleted. |
2097 | 6153 | */ | 6099 | */ |
2098 | 6154 | TEST_FEATURE ("with running job"); | 6100 | TEST_FEATURE ("with running job"); |
2100 | 6155 | class = job_class_new (NULL, "test", session); | 6101 | class = job_class_new (NULL, "test", NULL); |
2101 | 6156 | job = job_new (class, ""); | 6102 | job = job_new (class, ""); |
2102 | 6157 | 6103 | ||
2103 | 6158 | job->goal = JOB_START; | 6104 | job->goal = JOB_START; |
2104 | @@ -6231,7 +6177,7 @@ | |||
2105 | 6231 | * no blocking entry created. | 6177 | * no blocking entry created. |
2106 | 6232 | */ | 6178 | */ |
2107 | 6233 | TEST_FEATURE ("with no wait"); | 6179 | TEST_FEATURE ("with no wait"); |
2109 | 6234 | class = job_class_new (NULL, "test", session); | 6180 | class = job_class_new (NULL, "test", NULL); |
2110 | 6235 | job = job_new (class, ""); | 6181 | job = job_new (class, ""); |
2111 | 6236 | 6182 | ||
2112 | 6237 | job->goal = JOB_START; | 6183 | job->goal = JOB_START; |
2113 | @@ -6297,7 +6243,7 @@ | |||
2114 | 6297 | * a D-Bus error is raised immediately. | 6243 | * a D-Bus error is raised immediately. |
2115 | 6298 | */ | 6244 | */ |
2116 | 6299 | TEST_FEATURE ("with stopping job"); | 6245 | TEST_FEATURE ("with stopping job"); |
2118 | 6300 | class = job_class_new (NULL, "test", session); | 6246 | class = job_class_new (NULL, "test", NULL); |
2119 | 6301 | job = job_new (class, ""); | 6247 | job = job_new (class, ""); |
2120 | 6302 | 6248 | ||
2121 | 6303 | job->goal = JOB_STOP; | 6249 | job->goal = JOB_STOP; |
2122 | @@ -6344,8 +6290,6 @@ | |||
2123 | 6344 | TEST_EQ (job->state, JOB_STOPPING); | 6290 | TEST_EQ (job->state, JOB_STOPPING); |
2124 | 6345 | 6291 | ||
2125 | 6346 | nih_free (class); | 6292 | nih_free (class); |
2126 | 6347 | nih_free (session); | ||
2127 | 6348 | |||
2128 | 6349 | 6293 | ||
2129 | 6350 | TEST_DBUS_CLOSE (conn); | 6294 | TEST_DBUS_CLOSE (conn); |
2130 | 6351 | TEST_DBUS_CLOSE (client_conn); | 6295 | TEST_DBUS_CLOSE (client_conn); |
2131 | @@ -6370,10 +6314,6 @@ | |||
2132 | 6370 | int ret; | 6314 | int ret; |
2133 | 6371 | NihError *error; | 6315 | NihError *error; |
2134 | 6372 | NihDBusError *dbus_error; | 6316 | NihDBusError *dbus_error; |
2135 | 6373 | Session *session; | ||
2136 | 6374 | |||
2137 | 6375 | session = session_new (NULL, NULL, getuid ()); | ||
2138 | 6376 | TEST_NE_P (session, NULL); | ||
2139 | 6377 | 6317 | ||
2140 | 6378 | TEST_FUNCTION ("job_restart"); | 6318 | TEST_FUNCTION ("job_restart"); |
2141 | 6379 | nih_error_init (); | 6319 | nih_error_init (); |
2142 | @@ -6390,7 +6330,7 @@ | |||
2143 | 6390 | * it back through to running, the reply will be sent to the sender. | 6330 | * it back through to running, the reply will be sent to the sender. |
2144 | 6391 | */ | 6331 | */ |
2145 | 6392 | TEST_FEATURE ("with running job"); | 6332 | TEST_FEATURE ("with running job"); |
2147 | 6393 | class = job_class_new (NULL, "test", session); | 6333 | class = job_class_new (NULL, "test", NULL); |
2148 | 6394 | job = job_new (class, ""); | 6334 | job = job_new (class, ""); |
2149 | 6395 | 6335 | ||
2150 | 6396 | job->goal = JOB_START; | 6336 | job->goal = JOB_START; |
2151 | @@ -6479,7 +6419,7 @@ | |||
2152 | 6479 | * and no blocking entry created. | 6419 | * and no blocking entry created. |
2153 | 6480 | */ | 6420 | */ |
2154 | 6481 | TEST_FEATURE ("with no wait"); | 6421 | TEST_FEATURE ("with no wait"); |
2156 | 6482 | class = job_class_new (NULL, "test", session); | 6422 | class = job_class_new (NULL, "test", NULL); |
2157 | 6483 | job = job_new (class, ""); | 6423 | job = job_new (class, ""); |
2158 | 6484 | 6424 | ||
2159 | 6485 | job->goal = JOB_START; | 6425 | job->goal = JOB_START; |
2160 | @@ -6552,7 +6492,7 @@ | |||
2161 | 6552 | * a D-Bus error is raised immediately. | 6492 | * a D-Bus error is raised immediately. |
2162 | 6553 | */ | 6493 | */ |
2163 | 6554 | TEST_FEATURE ("with stopping job"); | 6494 | TEST_FEATURE ("with stopping job"); |
2165 | 6555 | class = job_class_new (NULL, "test", session); | 6495 | class = job_class_new (NULL, "test", NULL); |
2166 | 6556 | job = job_new (class, ""); | 6496 | job = job_new (class, ""); |
2167 | 6557 | 6497 | ||
2168 | 6558 | job->goal = JOB_STOP; | 6498 | job->goal = JOB_STOP; |
2169 | @@ -6599,7 +6539,6 @@ | |||
2170 | 6599 | TEST_EQ (job->state, JOB_STOPPING); | 6539 | TEST_EQ (job->state, JOB_STOPPING); |
2171 | 6600 | 6540 | ||
2172 | 6601 | nih_free (class); | 6541 | nih_free (class); |
2173 | 6602 | nih_free (session); | ||
2174 | 6603 | 6542 | ||
2175 | 6604 | TEST_DBUS_CLOSE (conn); | 6543 | TEST_DBUS_CLOSE (conn); |
2176 | 6605 | TEST_DBUS_CLOSE (client_conn); | 6544 | TEST_DBUS_CLOSE (client_conn); |
2177 | @@ -6620,10 +6559,6 @@ | |||
2178 | 6620 | NihError *error; | 6559 | NihError *error; |
2179 | 6621 | char *name; | 6560 | char *name; |
2180 | 6622 | int ret; | 6561 | int ret; |
2181 | 6623 | Session *session; | ||
2182 | 6624 | |||
2183 | 6625 | session = session_new (NULL, NULL, getuid ()); | ||
2184 | 6626 | TEST_NE_P (session, NULL); | ||
2185 | 6627 | 6562 | ||
2186 | 6628 | TEST_FUNCTION ("job_get_name"); | 6563 | TEST_FUNCTION ("job_get_name"); |
2187 | 6629 | nih_error_init (); | 6564 | nih_error_init (); |
2188 | @@ -6635,7 +6570,7 @@ | |||
2189 | 6635 | TEST_FEATURE ("with instance name"); | 6570 | TEST_FEATURE ("with instance name"); |
2190 | 6636 | TEST_ALLOC_FAIL { | 6571 | TEST_ALLOC_FAIL { |
2191 | 6637 | TEST_ALLOC_SAFE { | 6572 | TEST_ALLOC_SAFE { |
2193 | 6638 | class = job_class_new (NULL, "test", session); | 6573 | class = job_class_new (NULL, "test", NULL); |
2194 | 6639 | job = job_new (class, "instance name"); | 6574 | job = job_new (class, "instance name"); |
2195 | 6640 | 6575 | ||
2196 | 6641 | message = nih_new (NULL, NihDBusMessage); | 6576 | message = nih_new (NULL, NihDBusMessage); |
2197 | @@ -6675,7 +6610,7 @@ | |||
2198 | 6675 | TEST_FEATURE ("with no instance name"); | 6610 | TEST_FEATURE ("with no instance name"); |
2199 | 6676 | TEST_ALLOC_FAIL { | 6611 | TEST_ALLOC_FAIL { |
2200 | 6677 | TEST_ALLOC_SAFE { | 6612 | TEST_ALLOC_SAFE { |
2202 | 6678 | class = job_class_new (NULL, "test", session); | 6613 | class = job_class_new (NULL, "test", NULL); |
2203 | 6679 | job = job_new (class, ""); | 6614 | job = job_new (class, ""); |
2204 | 6680 | 6615 | ||
2205 | 6681 | message = nih_new (NULL, NihDBusMessage); | 6616 | message = nih_new (NULL, NihDBusMessage); |
2206 | @@ -6707,7 +6642,6 @@ | |||
2207 | 6707 | nih_free (message); | 6642 | nih_free (message); |
2208 | 6708 | nih_free (class); | 6643 | nih_free (class); |
2209 | 6709 | } | 6644 | } |
2210 | 6710 | nih_free (session); | ||
2211 | 6711 | } | 6645 | } |
2212 | 6712 | 6646 | ||
2213 | 6713 | void | 6647 | void |
2214 | @@ -6719,10 +6653,6 @@ | |||
2215 | 6719 | NihError *error; | 6653 | NihError *error; |
2216 | 6720 | char *goal; | 6654 | char *goal; |
2217 | 6721 | int ret; | 6655 | int ret; |
2218 | 6722 | Session *session; | ||
2219 | 6723 | |||
2220 | 6724 | session = session_new (NULL, NULL, getuid ()); | ||
2221 | 6725 | TEST_NE_P (session, NULL); | ||
2222 | 6726 | 6656 | ||
2223 | 6727 | /* Check that the goal of the instance is returned a newly allocated | 6657 | /* Check that the goal of the instance is returned a newly allocated |
2224 | 6728 | * string, as a child of the message. | 6658 | * string, as a child of the message. |
2225 | @@ -6733,7 +6663,7 @@ | |||
2226 | 6733 | 6663 | ||
2227 | 6734 | TEST_ALLOC_FAIL { | 6664 | TEST_ALLOC_FAIL { |
2228 | 6735 | TEST_ALLOC_SAFE { | 6665 | TEST_ALLOC_SAFE { |
2230 | 6736 | class = job_class_new (NULL, "test", session); | 6666 | class = job_class_new (NULL, "test", NULL); |
2231 | 6737 | job = job_new (class, ""); | 6667 | job = job_new (class, ""); |
2232 | 6738 | job->goal = JOB_START; | 6668 | job->goal = JOB_START; |
2233 | 6739 | 6669 | ||
2234 | @@ -6766,7 +6696,6 @@ | |||
2235 | 6766 | nih_free (message); | 6696 | nih_free (message); |
2236 | 6767 | nih_free (class); | 6697 | nih_free (class); |
2237 | 6768 | } | 6698 | } |
2238 | 6769 | nih_free (session); | ||
2239 | 6770 | } | 6699 | } |
2240 | 6771 | 6700 | ||
2241 | 6772 | void | 6701 | void |
2242 | @@ -6778,10 +6707,6 @@ | |||
2243 | 6778 | NihError *error; | 6707 | NihError *error; |
2244 | 6779 | char *state; | 6708 | char *state; |
2245 | 6780 | int ret; | 6709 | int ret; |
2246 | 6781 | Session *session; | ||
2247 | 6782 | |||
2248 | 6783 | session = session_new (NULL, NULL, getuid ()); | ||
2249 | 6784 | TEST_NE_P (session, NULL); | ||
2250 | 6785 | 6710 | ||
2251 | 6786 | /* Check that the state of the instance is returned a newly allocated | 6711 | /* Check that the state of the instance is returned a newly allocated |
2252 | 6787 | * string, as a child of the message. | 6712 | * string, as a child of the message. |
2253 | @@ -6792,7 +6717,7 @@ | |||
2254 | 6792 | 6717 | ||
2255 | 6793 | TEST_ALLOC_FAIL { | 6718 | TEST_ALLOC_FAIL { |
2256 | 6794 | TEST_ALLOC_SAFE { | 6719 | TEST_ALLOC_SAFE { |
2258 | 6795 | class = job_class_new (NULL, "test", session); | 6720 | class = job_class_new (NULL, "test", NULL); |
2259 | 6796 | job = job_new (class, ""); | 6721 | job = job_new (class, ""); |
2260 | 6797 | job->goal = JOB_START; | 6722 | job->goal = JOB_START; |
2261 | 6798 | job->state = JOB_RUNNING; | 6723 | job->state = JOB_RUNNING; |
2262 | @@ -6826,7 +6751,6 @@ | |||
2263 | 6826 | nih_free (message); | 6751 | nih_free (message); |
2264 | 6827 | nih_free (class); | 6752 | nih_free (class); |
2265 | 6828 | } | 6753 | } |
2266 | 6829 | nih_free (session); | ||
2267 | 6830 | } | 6754 | } |
2268 | 6831 | 6755 | ||
2269 | 6832 | 6756 | ||
2270 | @@ -6839,10 +6763,6 @@ | |||
2271 | 6839 | JobProcessesElement **processes; | 6763 | JobProcessesElement **processes; |
2272 | 6840 | NihError * error; | 6764 | NihError * error; |
2273 | 6841 | int ret; | 6765 | int ret; |
2274 | 6842 | Session *session; | ||
2275 | 6843 | |||
2276 | 6844 | session = session_new (NULL, NULL, getuid ()); | ||
2277 | 6845 | TEST_NE_P (session, NULL); | ||
2278 | 6846 | 6766 | ||
2279 | 6847 | TEST_FUNCTION ("job_get_processes"); | 6767 | TEST_FUNCTION ("job_get_processes"); |
2280 | 6848 | nih_error_init (); | 6768 | nih_error_init (); |
2281 | @@ -6855,7 +6775,7 @@ | |||
2282 | 6855 | TEST_FEATURE ("with no processes"); | 6775 | TEST_FEATURE ("with no processes"); |
2283 | 6856 | TEST_ALLOC_FAIL { | 6776 | TEST_ALLOC_FAIL { |
2284 | 6857 | TEST_ALLOC_SAFE { | 6777 | TEST_ALLOC_SAFE { |
2286 | 6858 | class = job_class_new (NULL, "test", session); | 6778 | class = job_class_new (NULL, "test", NULL); |
2287 | 6859 | job = job_new (class, ""); | 6779 | job = job_new (class, ""); |
2288 | 6860 | job->goal = JOB_START; | 6780 | job->goal = JOB_START; |
2289 | 6861 | job->state = JOB_STARTING; | 6781 | job->state = JOB_STARTING; |
2290 | @@ -6899,7 +6819,7 @@ | |||
2291 | 6899 | TEST_FEATURE ("with pre-start process"); | 6819 | TEST_FEATURE ("with pre-start process"); |
2292 | 6900 | TEST_ALLOC_FAIL { | 6820 | TEST_ALLOC_FAIL { |
2293 | 6901 | TEST_ALLOC_SAFE { | 6821 | TEST_ALLOC_SAFE { |
2295 | 6902 | class = job_class_new (NULL, "test", session); | 6822 | class = job_class_new (NULL, "test", NULL); |
2296 | 6903 | class->process[PROCESS_PRE_START] = process_new (class); | 6823 | class->process[PROCESS_PRE_START] = process_new (class); |
2297 | 6904 | class->process[PROCESS_PRE_START]->command = "echo"; | 6824 | class->process[PROCESS_PRE_START]->command = "echo"; |
2298 | 6905 | 6825 | ||
2299 | @@ -6954,7 +6874,7 @@ | |||
2300 | 6954 | TEST_FEATURE ("with post-start process and no main process"); | 6874 | TEST_FEATURE ("with post-start process and no main process"); |
2301 | 6955 | TEST_ALLOC_FAIL { | 6875 | TEST_ALLOC_FAIL { |
2302 | 6956 | TEST_ALLOC_SAFE { | 6876 | TEST_ALLOC_SAFE { |
2304 | 6957 | class = job_class_new (NULL, "test", session); | 6877 | class = job_class_new (NULL, "test", NULL); |
2305 | 6958 | class->process[PROCESS_POST_START] = process_new (class); | 6878 | class->process[PROCESS_POST_START] = process_new (class); |
2306 | 6959 | class->process[PROCESS_POST_START]->command = "echo"; | 6879 | class->process[PROCESS_POST_START]->command = "echo"; |
2307 | 6960 | 6880 | ||
2308 | @@ -7008,7 +6928,7 @@ | |||
2309 | 7008 | TEST_FEATURE ("with main process"); | 6928 | TEST_FEATURE ("with main process"); |
2310 | 7009 | TEST_ALLOC_FAIL { | 6929 | TEST_ALLOC_FAIL { |
2311 | 7010 | TEST_ALLOC_SAFE { | 6930 | TEST_ALLOC_SAFE { |
2313 | 7011 | class = job_class_new (NULL, "test", session); | 6931 | class = job_class_new (NULL, "test", NULL); |
2314 | 7012 | class->process[PROCESS_MAIN] = process_new (class); | 6932 | class->process[PROCESS_MAIN] = process_new (class); |
2315 | 7013 | class->process[PROCESS_MAIN]->command = "echo"; | 6933 | class->process[PROCESS_MAIN]->command = "echo"; |
2316 | 7014 | 6934 | ||
2317 | @@ -7063,7 +6983,7 @@ | |||
2318 | 7063 | TEST_FEATURE ("with main process and post-start process"); | 6983 | TEST_FEATURE ("with main process and post-start process"); |
2319 | 7064 | TEST_ALLOC_FAIL { | 6984 | TEST_ALLOC_FAIL { |
2320 | 7065 | TEST_ALLOC_SAFE { | 6985 | TEST_ALLOC_SAFE { |
2322 | 7066 | class = job_class_new (NULL, "test", session); | 6986 | class = job_class_new (NULL, "test", NULL); |
2323 | 7067 | class->process[PROCESS_POST_START] = process_new (class); | 6987 | class->process[PROCESS_POST_START] = process_new (class); |
2324 | 7068 | class->process[PROCESS_POST_START]->command = "echo"; | 6988 | class->process[PROCESS_POST_START]->command = "echo"; |
2325 | 7069 | class->process[PROCESS_MAIN] = process_new (class); | 6989 | class->process[PROCESS_MAIN] = process_new (class); |
2326 | @@ -7127,7 +7047,7 @@ | |||
2327 | 7127 | TEST_FEATURE ("with main process and pre-stop process"); | 7047 | TEST_FEATURE ("with main process and pre-stop process"); |
2328 | 7128 | TEST_ALLOC_FAIL { | 7048 | TEST_ALLOC_FAIL { |
2329 | 7129 | TEST_ALLOC_SAFE { | 7049 | TEST_ALLOC_SAFE { |
2331 | 7130 | class = job_class_new (NULL, "test", session); | 7050 | class = job_class_new (NULL, "test", NULL); |
2332 | 7131 | class->process[PROCESS_MAIN] = process_new (class); | 7051 | class->process[PROCESS_MAIN] = process_new (class); |
2333 | 7132 | class->process[PROCESS_MAIN]->command = "echo"; | 7052 | class->process[PROCESS_MAIN]->command = "echo"; |
2334 | 7133 | class->process[PROCESS_PRE_STOP] = process_new (class); | 7053 | class->process[PROCESS_PRE_STOP] = process_new (class); |
2335 | @@ -7191,7 +7111,7 @@ | |||
2336 | 7191 | TEST_FEATURE ("with pre-stop process and no main process"); | 7111 | TEST_FEATURE ("with pre-stop process and no main process"); |
2337 | 7192 | TEST_ALLOC_FAIL { | 7112 | TEST_ALLOC_FAIL { |
2338 | 7193 | TEST_ALLOC_SAFE { | 7113 | TEST_ALLOC_SAFE { |
2340 | 7194 | class = job_class_new (NULL, "test", session); | 7114 | class = job_class_new (NULL, "test", NULL); |
2341 | 7195 | class->process[PROCESS_PRE_STOP] = process_new (class); | 7115 | class->process[PROCESS_PRE_STOP] = process_new (class); |
2342 | 7196 | class->process[PROCESS_PRE_STOP]->command = "echo"; | 7116 | class->process[PROCESS_PRE_STOP]->command = "echo"; |
2343 | 7197 | 7117 | ||
2344 | @@ -7245,7 +7165,7 @@ | |||
2345 | 7245 | TEST_FEATURE ("with post-stop process"); | 7165 | TEST_FEATURE ("with post-stop process"); |
2346 | 7246 | TEST_ALLOC_FAIL { | 7166 | TEST_ALLOC_FAIL { |
2347 | 7247 | TEST_ALLOC_SAFE { | 7167 | TEST_ALLOC_SAFE { |
2349 | 7248 | class = job_class_new (NULL, "test", session); | 7168 | class = job_class_new (NULL, "test", NULL); |
2350 | 7249 | class->process[PROCESS_POST_STOP] = process_new (class); | 7169 | class->process[PROCESS_POST_STOP] = process_new (class); |
2351 | 7250 | class->process[PROCESS_POST_STOP]->command = "echo"; | 7170 | class->process[PROCESS_POST_STOP]->command = "echo"; |
2352 | 7251 | 7171 | ||
2353 | @@ -7291,7 +7211,6 @@ | |||
2354 | 7291 | nih_free (message); | 7211 | nih_free (message); |
2355 | 7292 | nih_free (class); | 7212 | nih_free (class); |
2356 | 7293 | } | 7213 | } |
2357 | 7294 | nih_free (session); | ||
2358 | 7295 | } | 7214 | } |
2359 | 7296 | 7215 | ||
2360 | 7297 | 7216 | ||
2361 | @@ -7299,6 +7218,9 @@ | |||
2362 | 7299 | main (int argc, | 7218 | main (int argc, |
2363 | 7300 | char *argv[]) | 7219 | char *argv[]) |
2364 | 7301 | { | 7220 | { |
2365 | 7221 | /* run tests in legacy (pre-session support) mode */ | ||
2366 | 7222 | setenv ("UPSTART_NO_SESSIONS", "1", 1); | ||
2367 | 7223 | |||
2368 | 7302 | test_new (); | 7224 | test_new (); |
2369 | 7303 | test_register (); | 7225 | test_register (); |
2370 | 7304 | test_change_goal (); | 7226 | test_change_goal (); |
2371 | 7305 | 7227 | ||
2372 | === modified file 'init/tests/test_job_class.c' | |||
2373 | --- init/tests/test_job_class.c 2011-02-23 13:50:30 +0000 | |||
2374 | +++ init/tests/test_job_class.c 2011-04-19 09:27:29 +0000 | |||
2375 | @@ -160,10 +160,6 @@ | |||
2376 | 160 | Job *job; | 160 | Job *job; |
2377 | 161 | char *path; | 161 | char *path; |
2378 | 162 | int ret; | 162 | int ret; |
2379 | 163 | Session *session; | ||
2380 | 164 | |||
2381 | 165 | session = session_new (NULL, NULL, getuid ()); | ||
2382 | 166 | TEST_NE_P (session, NULL); | ||
2383 | 167 | 163 | ||
2384 | 168 | TEST_FUNCTION ("job_class_consider"); | 164 | TEST_FUNCTION ("job_class_consider"); |
2385 | 169 | dbus_error_init (&dbus_error); | 165 | dbus_error_init (&dbus_error); |
2386 | @@ -181,15 +177,15 @@ | |||
2387 | 181 | source2 = conf_source_new (NULL, "/tmp/bar", CONF_JOB_DIR); | 177 | source2 = conf_source_new (NULL, "/tmp/bar", CONF_JOB_DIR); |
2388 | 182 | 178 | ||
2389 | 183 | file1 = conf_file_new (source2, "/tmp/bar/frodo"); | 179 | file1 = conf_file_new (source2, "/tmp/bar/frodo"); |
2391 | 184 | class1 = file1->job = job_class_new (NULL, "frodo", session); | 180 | class1 = file1->job = job_class_new (NULL, "frodo", NULL); |
2392 | 185 | 181 | ||
2393 | 186 | file2 = conf_file_new (source2, "/tmp/bar/bilbo"); | 182 | file2 = conf_file_new (source2, "/tmp/bar/bilbo"); |
2395 | 187 | class2 = file2->job = job_class_new (NULL, "bilbo", session); | 183 | class2 = file2->job = job_class_new (NULL, "bilbo", NULL); |
2396 | 188 | 184 | ||
2397 | 189 | source3 = conf_source_new (NULL, "/tmp/baz", CONF_JOB_DIR); | 185 | source3 = conf_source_new (NULL, "/tmp/baz", CONF_JOB_DIR); |
2398 | 190 | 186 | ||
2399 | 191 | file3 = conf_file_new (source3, "/tmp/baz/frodo"); | 187 | file3 = conf_file_new (source3, "/tmp/baz/frodo"); |
2401 | 192 | class3 = file3->job = job_class_new (NULL, "frodo", session); | 188 | class3 = file3->job = job_class_new (NULL, "frodo", NULL); |
2402 | 193 | 189 | ||
2403 | 194 | 190 | ||
2404 | 195 | control_init (); | 191 | control_init (); |
2405 | @@ -382,7 +378,7 @@ | |||
2406 | 382 | * becomes the hash table member. | 378 | * becomes the hash table member. |
2407 | 383 | */ | 379 | */ |
2408 | 384 | TEST_FEATURE ("with replacable registered class and not best class"); | 380 | TEST_FEATURE ("with replacable registered class and not best class"); |
2410 | 385 | class4 = job_class_new (NULL, "frodo", session); | 381 | class4 = job_class_new (NULL, "frodo", NULL); |
2411 | 386 | nih_hash_add (job_classes, &class4->entry); | 382 | nih_hash_add (job_classes, &class4->entry); |
2412 | 387 | job_class_register (class4, conn, FALSE); | 383 | job_class_register (class4, conn, FALSE); |
2413 | 388 | 384 | ||
2414 | @@ -440,7 +436,6 @@ | |||
2415 | 440 | 436 | ||
2416 | 441 | 437 | ||
2417 | 442 | nih_free (entry); | 438 | nih_free (entry); |
2418 | 443 | nih_free (session); | ||
2419 | 444 | 439 | ||
2420 | 445 | TEST_DBUS_CLOSE (conn); | 440 | TEST_DBUS_CLOSE (conn); |
2421 | 446 | TEST_DBUS_CLOSE (client_conn); | 441 | TEST_DBUS_CLOSE (client_conn); |
2422 | @@ -464,10 +459,6 @@ | |||
2423 | 464 | Job *job; | 459 | Job *job; |
2424 | 465 | char *path; | 460 | char *path; |
2425 | 466 | int ret; | 461 | int ret; |
2426 | 467 | Session *session; | ||
2427 | 468 | |||
2428 | 469 | session = session_new (NULL, NULL, getuid ()); | ||
2429 | 470 | TEST_NE_P (session, NULL); | ||
2430 | 471 | 462 | ||
2431 | 472 | TEST_FUNCTION ("job_class_reconsider"); | 463 | TEST_FUNCTION ("job_class_reconsider"); |
2432 | 473 | dbus_error_init (&dbus_error); | 464 | dbus_error_init (&dbus_error); |
2433 | @@ -485,15 +476,15 @@ | |||
2434 | 485 | source2 = conf_source_new (NULL, "/tmp/bar", CONF_JOB_DIR); | 476 | source2 = conf_source_new (NULL, "/tmp/bar", CONF_JOB_DIR); |
2435 | 486 | 477 | ||
2436 | 487 | file1 = conf_file_new (source2, "/tmp/bar/frodo"); | 478 | file1 = conf_file_new (source2, "/tmp/bar/frodo"); |
2438 | 488 | class1 = file1->job = job_class_new (NULL, "frodo", session); | 479 | class1 = file1->job = job_class_new (NULL, "frodo", NULL); |
2439 | 489 | 480 | ||
2440 | 490 | file2 = conf_file_new (source2, "/tmp/bar/bilbo"); | 481 | file2 = conf_file_new (source2, "/tmp/bar/bilbo"); |
2442 | 491 | class2 = file2->job = job_class_new (NULL, "bilbo", session); | 482 | class2 = file2->job = job_class_new (NULL, "bilbo", NULL); |
2443 | 492 | 483 | ||
2444 | 493 | source3 = conf_source_new (NULL, "/tmp/baz", CONF_JOB_DIR); | 484 | source3 = conf_source_new (NULL, "/tmp/baz", CONF_JOB_DIR); |
2445 | 494 | 485 | ||
2446 | 495 | file3 = conf_file_new (source3, "/tmp/baz/frodo"); | 486 | file3 = conf_file_new (source3, "/tmp/baz/frodo"); |
2448 | 496 | class3 = file3->job = job_class_new (NULL, "frodo", session); | 487 | class3 = file3->job = job_class_new (NULL, "frodo", NULL); |
2449 | 497 | 488 | ||
2450 | 498 | 489 | ||
2451 | 499 | control_init (); | 490 | control_init (); |
2452 | @@ -726,7 +717,7 @@ | |||
2453 | 726 | nih_free (source2); | 717 | nih_free (source2); |
2454 | 727 | nih_free (source1); | 718 | nih_free (source1); |
2455 | 728 | 719 | ||
2457 | 729 | class4 = job_class_new (NULL, "frodo", session); | 720 | class4 = job_class_new (NULL, "frodo", NULL); |
2458 | 730 | nih_hash_add (job_classes, &class4->entry); | 721 | nih_hash_add (job_classes, &class4->entry); |
2459 | 731 | job_class_register (class4, conn, FALSE); | 722 | job_class_register (class4, conn, FALSE); |
2460 | 732 | 723 | ||
2461 | @@ -759,7 +750,6 @@ | |||
2462 | 759 | 750 | ||
2463 | 760 | 751 | ||
2464 | 761 | nih_free (entry); | 752 | nih_free (entry); |
2465 | 762 | nih_free (session); | ||
2466 | 763 | 753 | ||
2467 | 764 | TEST_DBUS_CLOSE (conn); | 754 | TEST_DBUS_CLOSE (conn); |
2468 | 765 | TEST_DBUS_CLOSE (client_conn); | 755 | TEST_DBUS_CLOSE (client_conn); |
2469 | @@ -779,10 +769,6 @@ | |||
2470 | 779 | JobClass *class; | 769 | JobClass *class; |
2471 | 780 | NihDBusObject *object; | 770 | NihDBusObject *object; |
2472 | 781 | char *path; | 771 | char *path; |
2473 | 782 | Session *session; | ||
2474 | 783 | |||
2475 | 784 | session = session_new (NULL, NULL, getuid ()); | ||
2476 | 785 | TEST_NE_P (session, NULL); | ||
2477 | 786 | 772 | ||
2478 | 787 | TEST_FUNCTION ("job_class_register"); | 773 | TEST_FUNCTION ("job_class_register"); |
2479 | 788 | dbus_error_init (&dbus_error); | 774 | dbus_error_init (&dbus_error); |
2480 | @@ -800,7 +786,7 @@ | |||
2481 | 800 | * announce it. | 786 | * announce it. |
2482 | 801 | */ | 787 | */ |
2483 | 802 | TEST_FEATURE ("with signal emission"); | 788 | TEST_FEATURE ("with signal emission"); |
2485 | 803 | class = job_class_new (NULL, "test", session); | 789 | class = job_class_new (NULL, "test", NULL); |
2486 | 804 | 790 | ||
2487 | 805 | assert (dbus_connection_get_object_path_data (conn, class->path, | 791 | assert (dbus_connection_get_object_path_data (conn, class->path, |
2488 | 806 | (void **)&object)); | 792 | (void **)&object)); |
2489 | @@ -837,7 +823,7 @@ | |||
2490 | 837 | * by emitting a signal immediately afterwards. | 823 | * by emitting a signal immediately afterwards. |
2491 | 838 | */ | 824 | */ |
2492 | 839 | TEST_FEATURE ("without signal emission"); | 825 | TEST_FEATURE ("without signal emission"); |
2494 | 840 | class = job_class_new (NULL, "test", session); | 826 | class = job_class_new (NULL, "test", NULL); |
2495 | 841 | 827 | ||
2496 | 842 | assert (dbus_connection_get_object_path_data (conn, class->path, | 828 | assert (dbus_connection_get_object_path_data (conn, class->path, |
2497 | 843 | (void **)&object)); | 829 | (void **)&object)); |
2498 | @@ -870,7 +856,6 @@ | |||
2499 | 870 | dbus_message_unref (message); | 856 | dbus_message_unref (message); |
2500 | 871 | 857 | ||
2501 | 872 | nih_free (class); | 858 | nih_free (class); |
2502 | 873 | nih_free (session); | ||
2503 | 874 | 859 | ||
2504 | 875 | TEST_DBUS_CLOSE (conn); | 860 | TEST_DBUS_CLOSE (conn); |
2505 | 876 | TEST_DBUS_CLOSE (client_conn); | 861 | TEST_DBUS_CLOSE (client_conn); |
2506 | @@ -889,10 +874,6 @@ | |||
2507 | 889 | JobClass *class; | 874 | JobClass *class; |
2508 | 890 | NihDBusObject *object; | 875 | NihDBusObject *object; |
2509 | 891 | char *path; | 876 | char *path; |
2510 | 892 | Session *session; | ||
2511 | 893 | |||
2512 | 894 | session = session_new (NULL, NULL, getuid ()); | ||
2513 | 895 | TEST_NE_P (session, NULL); | ||
2514 | 896 | 877 | ||
2515 | 897 | /* Check that we can unregister an object for a job class from | 878 | /* Check that we can unregister an object for a job class from |
2516 | 898 | * the bus and that the JobRemoved signal is emitted as a result. | 879 | * the bus and that the JobRemoved signal is emitted as a result. |
2517 | @@ -910,7 +891,7 @@ | |||
2518 | 910 | assert (! dbus_error_is_set (&dbus_error)); | 891 | assert (! dbus_error_is_set (&dbus_error)); |
2519 | 911 | 892 | ||
2520 | 912 | 893 | ||
2522 | 913 | class = job_class_new (NULL, "test", session); | 894 | class = job_class_new (NULL, "test", NULL); |
2523 | 914 | 895 | ||
2524 | 915 | assert (dbus_connection_get_object_path_data (conn, class->path, | 896 | assert (dbus_connection_get_object_path_data (conn, class->path, |
2525 | 916 | (void **)&object)); | 897 | (void **)&object)); |
2526 | @@ -945,7 +926,6 @@ | |||
2527 | 945 | dbus_message_unref (message); | 926 | dbus_message_unref (message); |
2528 | 946 | 927 | ||
2529 | 947 | nih_free (class); | 928 | nih_free (class); |
2530 | 948 | nih_free (session); | ||
2531 | 949 | 929 | ||
2532 | 950 | TEST_DBUS_CLOSE (conn); | 930 | TEST_DBUS_CLOSE (conn); |
2533 | 951 | TEST_DBUS_CLOSE (client_conn); | 931 | TEST_DBUS_CLOSE (client_conn); |
2534 | @@ -961,10 +941,6 @@ | |||
2535 | 961 | JobClass *class; | 941 | JobClass *class; |
2536 | 962 | char **env; | 942 | char **env; |
2537 | 963 | size_t len; | 943 | size_t len; |
2538 | 964 | Session *session; | ||
2539 | 965 | |||
2540 | 966 | session = session_new (NULL, NULL, getuid ()); | ||
2541 | 967 | TEST_NE_P (session, NULL); | ||
2542 | 968 | 944 | ||
2543 | 969 | TEST_FUNCTION ("job_class_environment"); | 945 | TEST_FUNCTION ("job_class_environment"); |
2544 | 970 | 946 | ||
2545 | @@ -972,7 +948,7 @@ | |||
2546 | 972 | * just have the built-ins in the returned environment. | 948 | * just have the built-ins in the returned environment. |
2547 | 973 | */ | 949 | */ |
2548 | 974 | TEST_FEATURE ("with no configured environment"); | 950 | TEST_FEATURE ("with no configured environment"); |
2550 | 975 | class = job_class_new (NULL, "test", session); | 951 | class = job_class_new (NULL, "test", NULL); |
2551 | 976 | 952 | ||
2552 | 977 | TEST_ALLOC_FAIL { | 953 | TEST_ALLOC_FAIL { |
2553 | 978 | env = job_class_environment (NULL, class, &len); | 954 | env = job_class_environment (NULL, class, &len); |
2554 | @@ -1002,7 +978,7 @@ | |||
2555 | 1002 | * will have those appended to the environment as well as the builtins. | 978 | * will have those appended to the environment as well as the builtins. |
2556 | 1003 | */ | 979 | */ |
2557 | 1004 | TEST_FEATURE ("with configured environment"); | 980 | TEST_FEATURE ("with configured environment"); |
2559 | 1005 | class = job_class_new (NULL, "test", session); | 981 | class = job_class_new (NULL, "test", NULL); |
2560 | 1006 | 982 | ||
2561 | 1007 | class->env = nih_str_array_new (class); | 983 | class->env = nih_str_array_new (class); |
2562 | 1008 | assert (nih_str_array_add (&(class->env), class, NULL, "FOO=BAR")); | 984 | assert (nih_str_array_add (&(class->env), class, NULL, "FOO=BAR")); |
2563 | @@ -1039,7 +1015,7 @@ | |||
2564 | 1039 | /* Check that configured environment override built-ins. | 1015 | /* Check that configured environment override built-ins. |
2565 | 1040 | */ | 1016 | */ |
2566 | 1041 | TEST_FEATURE ("with configuration overriding built-ins"); | 1017 | TEST_FEATURE ("with configuration overriding built-ins"); |
2568 | 1042 | class = job_class_new (NULL, "test", session); | 1018 | class = job_class_new (NULL, "test", NULL); |
2569 | 1043 | 1019 | ||
2570 | 1044 | class->env = nih_str_array_new (class); | 1020 | class->env = nih_str_array_new (class); |
2571 | 1045 | assert (nih_str_array_add (&(class->env), class, NULL, "FOO=BAR")); | 1021 | assert (nih_str_array_add (&(class->env), class, NULL, "FOO=BAR")); |
2572 | @@ -1072,7 +1048,6 @@ | |||
2573 | 1072 | } | 1048 | } |
2574 | 1073 | 1049 | ||
2575 | 1074 | nih_free (class); | 1050 | nih_free (class); |
2576 | 1075 | nih_free (session); | ||
2577 | 1076 | } | 1051 | } |
2578 | 1077 | 1052 | ||
2579 | 1078 | 1053 | ||
2580 | @@ -1087,11 +1062,6 @@ | |||
2581 | 1087 | int ret; | 1062 | int ret; |
2582 | 1088 | NihError *error; | 1063 | NihError *error; |
2583 | 1089 | NihDBusError *dbus_error; | 1064 | NihDBusError *dbus_error; |
2584 | 1090 | Session *session; | ||
2585 | 1091 | |||
2586 | 1092 | session = session_new (NULL, NULL, getuid ()); | ||
2587 | 1093 | TEST_NE_P (session, NULL); | ||
2588 | 1094 | |||
2589 | 1095 | 1065 | ||
2590 | 1096 | TEST_FUNCTION ("job_class_get_instance"); | 1066 | TEST_FUNCTION ("job_class_get_instance"); |
2591 | 1097 | nih_error_init (); | 1067 | nih_error_init (); |
2592 | @@ -1103,7 +1073,7 @@ | |||
2593 | 1103 | TEST_FEATURE ("with running job"); | 1073 | TEST_FEATURE ("with running job"); |
2594 | 1104 | TEST_ALLOC_FAIL { | 1074 | TEST_ALLOC_FAIL { |
2595 | 1105 | TEST_ALLOC_SAFE { | 1075 | TEST_ALLOC_SAFE { |
2597 | 1106 | class = job_class_new (NULL, "test", session); | 1076 | class = job_class_new (NULL, "test", NULL); |
2598 | 1107 | job = job_new (class, ""); | 1077 | job = job_new (class, ""); |
2599 | 1108 | 1078 | ||
2600 | 1109 | message = nih_new (NULL, NihDBusMessage); | 1079 | message = nih_new (NULL, NihDBusMessage); |
2601 | @@ -1140,7 +1110,7 @@ | |||
2602 | 1140 | /* Check that if there's no such instance, a D-Bus error is raised. | 1110 | /* Check that if there's no such instance, a D-Bus error is raised. |
2603 | 1141 | */ | 1111 | */ |
2604 | 1142 | TEST_FEATURE ("with unknown job"); | 1112 | TEST_FEATURE ("with unknown job"); |
2606 | 1143 | class = job_class_new (NULL, "test", session); | 1113 | class = job_class_new (NULL, "test", NULL); |
2607 | 1144 | 1114 | ||
2608 | 1145 | message = nih_new (NULL, NihDBusMessage); | 1115 | message = nih_new (NULL, NihDBusMessage); |
2609 | 1146 | message->connection = NULL; | 1116 | message->connection = NULL; |
2610 | @@ -1171,7 +1141,7 @@ | |||
2611 | 1171 | TEST_FEATURE ("with environment"); | 1141 | TEST_FEATURE ("with environment"); |
2612 | 1172 | TEST_ALLOC_FAIL { | 1142 | TEST_ALLOC_FAIL { |
2613 | 1173 | TEST_ALLOC_SAFE { | 1143 | TEST_ALLOC_SAFE { |
2615 | 1174 | class = job_class_new (NULL, "test", session); | 1144 | class = job_class_new (NULL, "test", NULL); |
2616 | 1175 | class->instance = "$FOO"; | 1145 | class->instance = "$FOO"; |
2617 | 1176 | 1146 | ||
2618 | 1177 | job = job_new (class, "wibble"); | 1147 | job = job_new (class, "wibble"); |
2619 | @@ -1215,7 +1185,7 @@ | |||
2620 | 1215 | * is returned. | 1185 | * is returned. |
2621 | 1216 | */ | 1186 | */ |
2622 | 1217 | TEST_FEATURE ("with invalid environment"); | 1187 | TEST_FEATURE ("with invalid environment"); |
2624 | 1218 | class = job_class_new (NULL, "test", session); | 1188 | class = job_class_new (NULL, "test", NULL); |
2625 | 1219 | class->instance = "$FOO"; | 1189 | class->instance = "$FOO"; |
2626 | 1220 | 1190 | ||
2627 | 1221 | job = job_new (class, "wibble"); | 1191 | job = job_new (class, "wibble"); |
2628 | @@ -1242,7 +1212,6 @@ | |||
2629 | 1242 | 1212 | ||
2630 | 1243 | nih_free (message); | 1213 | nih_free (message); |
2631 | 1244 | nih_free (class); | 1214 | nih_free (class); |
2632 | 1245 | nih_free (session); | ||
2633 | 1246 | } | 1215 | } |
2634 | 1247 | 1216 | ||
2635 | 1248 | void | 1217 | void |
2636 | @@ -1255,15 +1224,11 @@ | |||
2637 | 1255 | NihError *error; | 1224 | NihError *error; |
2638 | 1256 | NihDBusError *dbus_error; | 1225 | NihDBusError *dbus_error; |
2639 | 1257 | int ret; | 1226 | int ret; |
2640 | 1258 | Session *session; | ||
2641 | 1259 | |||
2642 | 1260 | session = session_new (NULL, NULL, getuid ()); | ||
2643 | 1261 | TEST_NE_P (session, NULL); | ||
2644 | 1262 | 1227 | ||
2645 | 1263 | TEST_FUNCTION ("job_class_get_instance_by_name"); | 1228 | TEST_FUNCTION ("job_class_get_instance_by_name"); |
2646 | 1264 | nih_error_init (); | 1229 | nih_error_init (); |
2647 | 1265 | 1230 | ||
2649 | 1266 | class = job_class_new (NULL, "test", session); | 1231 | class = job_class_new (NULL, "test", NULL); |
2650 | 1267 | 1232 | ||
2651 | 1268 | 1233 | ||
2652 | 1269 | /* Check that when given a known instance name, the path to that | 1234 | /* Check that when given a known instance name, the path to that |
2653 | @@ -1377,7 +1342,6 @@ | |||
2654 | 1377 | 1342 | ||
2655 | 1378 | 1343 | ||
2656 | 1379 | nih_free (class); | 1344 | nih_free (class); |
2657 | 1380 | nih_free (session); | ||
2658 | 1381 | } | 1345 | } |
2659 | 1382 | 1346 | ||
2660 | 1383 | void | 1347 | void |
2661 | @@ -1389,16 +1353,12 @@ | |||
2662 | 1389 | NihError *error; | 1353 | NihError *error; |
2663 | 1390 | char **paths; | 1354 | char **paths; |
2664 | 1391 | int ret; | 1355 | int ret; |
2665 | 1392 | Session *session; | ||
2666 | 1393 | |||
2667 | 1394 | session = session_new (NULL, NULL, getuid ()); | ||
2668 | 1395 | TEST_NE_P (session, NULL); | ||
2669 | 1396 | 1356 | ||
2670 | 1397 | TEST_FUNCTION ("job_class_get_all_instances"); | 1357 | TEST_FUNCTION ("job_class_get_all_instances"); |
2671 | 1398 | nih_error_init (); | 1358 | nih_error_init (); |
2672 | 1399 | job_class_init (); | 1359 | job_class_init (); |
2673 | 1400 | 1360 | ||
2675 | 1401 | class = job_class_new (NULL, "test", session); | 1361 | class = job_class_new (NULL, "test", NULL); |
2676 | 1402 | 1362 | ||
2677 | 1403 | 1363 | ||
2678 | 1404 | /* Check that paths for each of the active instances are returned | 1364 | /* Check that paths for each of the active instances are returned |
2679 | @@ -1496,7 +1456,6 @@ | |||
2680 | 1496 | } | 1456 | } |
2681 | 1497 | 1457 | ||
2682 | 1498 | nih_free (class); | 1458 | nih_free (class); |
2683 | 1499 | nih_free (session); | ||
2684 | 1500 | } | 1459 | } |
2685 | 1501 | 1460 | ||
2686 | 1502 | 1461 | ||
2687 | @@ -1516,10 +1475,6 @@ | |||
2688 | 1516 | int ret; | 1475 | int ret; |
2689 | 1517 | NihError *error; | 1476 | NihError *error; |
2690 | 1518 | NihDBusError *dbus_error; | 1477 | NihDBusError *dbus_error; |
2691 | 1519 | Session *session; | ||
2692 | 1520 | |||
2693 | 1521 | session = session_new (NULL, NULL, getuid ()); | ||
2694 | 1522 | TEST_NE_P (session, NULL); | ||
2695 | 1523 | 1478 | ||
2696 | 1524 | TEST_FUNCTION ("job_class_start"); | 1479 | TEST_FUNCTION ("job_class_start"); |
2697 | 1525 | nih_error_init (); | 1480 | nih_error_init (); |
2698 | @@ -1536,7 +1491,7 @@ | |||
2699 | 1536 | * the reply will be sent to the sender. | 1491 | * the reply will be sent to the sender. |
2700 | 1537 | */ | 1492 | */ |
2701 | 1538 | TEST_FEATURE ("with new job"); | 1493 | TEST_FEATURE ("with new job"); |
2703 | 1539 | class = job_class_new (NULL, "test", session); | 1494 | class = job_class_new (NULL, "test", NULL); |
2704 | 1540 | 1495 | ||
2705 | 1541 | method = dbus_message_new_method_call ( | 1496 | method = dbus_message_new_method_call ( |
2706 | 1542 | dbus_bus_get_unique_name (conn), | 1497 | dbus_bus_get_unique_name (conn), |
2707 | @@ -1627,7 +1582,7 @@ | |||
2708 | 1627 | * immediately and the job not blocked. | 1582 | * immediately and the job not blocked. |
2709 | 1628 | */ | 1583 | */ |
2710 | 1629 | TEST_FEATURE ("with no wait"); | 1584 | TEST_FEATURE ("with no wait"); |
2712 | 1630 | class = job_class_new (NULL, "test", session); | 1585 | class = job_class_new (NULL, "test", NULL); |
2713 | 1631 | 1586 | ||
2714 | 1632 | method = dbus_message_new_method_call ( | 1587 | method = dbus_message_new_method_call ( |
2715 | 1633 | dbus_bus_get_unique_name (conn), | 1588 | dbus_bus_get_unique_name (conn), |
2716 | @@ -1707,7 +1662,7 @@ | |||
2717 | 1707 | * it through to running, the reply will be sent to the sender. | 1662 | * it through to running, the reply will be sent to the sender. |
2718 | 1708 | */ | 1663 | */ |
2719 | 1709 | TEST_FEATURE ("with stopping job"); | 1664 | TEST_FEATURE ("with stopping job"); |
2721 | 1710 | class = job_class_new (NULL, "test", session); | 1665 | class = job_class_new (NULL, "test", NULL); |
2722 | 1711 | job = job_new (class, ""); | 1666 | job = job_new (class, ""); |
2723 | 1712 | 1667 | ||
2724 | 1713 | job->goal = JOB_STOP; | 1668 | job->goal = JOB_STOP; |
2725 | @@ -1808,7 +1763,7 @@ | |||
2726 | 1808 | * a D-Bus error is raised immediately. | 1763 | * a D-Bus error is raised immediately. |
2727 | 1809 | */ | 1764 | */ |
2728 | 1810 | TEST_FEATURE ("with starting job"); | 1765 | TEST_FEATURE ("with starting job"); |
2730 | 1811 | class = job_class_new (NULL, "test", session); | 1766 | class = job_class_new (NULL, "test", NULL); |
2731 | 1812 | job = job_new (class, ""); | 1767 | job = job_new (class, ""); |
2732 | 1813 | 1768 | ||
2733 | 1814 | job->goal = JOB_START; | 1769 | job->goal = JOB_START; |
2734 | @@ -1864,7 +1819,7 @@ | |||
2735 | 1864 | * when it's starting. | 1819 | * when it's starting. |
2736 | 1865 | */ | 1820 | */ |
2737 | 1866 | TEST_FEATURE ("with environment"); | 1821 | TEST_FEATURE ("with environment"); |
2739 | 1867 | class = job_class_new (NULL, "test", session); | 1822 | class = job_class_new (NULL, "test", NULL); |
2740 | 1868 | class->instance = "$FOO"; | 1823 | class->instance = "$FOO"; |
2741 | 1869 | 1824 | ||
2742 | 1870 | method = dbus_message_new_method_call ( | 1825 | method = dbus_message_new_method_call ( |
2743 | @@ -1965,7 +1920,7 @@ | |||
2744 | 1965 | * is returned. | 1920 | * is returned. |
2745 | 1966 | */ | 1921 | */ |
2746 | 1967 | TEST_FEATURE ("with invalid environment"); | 1922 | TEST_FEATURE ("with invalid environment"); |
2748 | 1968 | class = job_class_new (NULL, "test", session); | 1923 | class = job_class_new (NULL, "test", NULL); |
2749 | 1969 | 1924 | ||
2750 | 1970 | method = dbus_message_new_method_call ( | 1925 | method = dbus_message_new_method_call ( |
2751 | 1971 | dbus_bus_get_unique_name (conn), | 1926 | dbus_bus_get_unique_name (conn), |
2752 | @@ -2010,8 +1965,6 @@ | |||
2753 | 2010 | TEST_HASH_EMPTY (class->instances); | 1965 | TEST_HASH_EMPTY (class->instances); |
2754 | 2011 | 1966 | ||
2755 | 2012 | nih_free (class); | 1967 | nih_free (class); |
2756 | 2013 | nih_free (session); | ||
2757 | 2014 | |||
2758 | 2015 | 1968 | ||
2759 | 2016 | TEST_DBUS_CLOSE (conn); | 1969 | TEST_DBUS_CLOSE (conn); |
2760 | 2017 | TEST_DBUS_CLOSE (client_conn); | 1970 | TEST_DBUS_CLOSE (client_conn); |
2761 | @@ -2037,11 +1990,6 @@ | |||
2762 | 2037 | int ret; | 1990 | int ret; |
2763 | 2038 | NihError *error; | 1991 | NihError *error; |
2764 | 2039 | NihDBusError *dbus_error; | 1992 | NihDBusError *dbus_error; |
2765 | 2040 | Session *session; | ||
2766 | 2041 | |||
2767 | 2042 | session = session_new (NULL, NULL, getuid ()); | ||
2768 | 2043 | TEST_NE_P (session, NULL); | ||
2769 | 2044 | |||
2770 | 2045 | 1993 | ||
2771 | 2046 | TEST_FUNCTION ("job_class_stop"); | 1994 | TEST_FUNCTION ("job_class_stop"); |
2772 | 2047 | nih_error_init (); | 1995 | nih_error_init (); |
2773 | @@ -2058,7 +2006,7 @@ | |||
2774 | 2058 | * will be sent to the sender. | 2006 | * will be sent to the sender. |
2775 | 2059 | */ | 2007 | */ |
2776 | 2060 | TEST_FEATURE ("with running job"); | 2008 | TEST_FEATURE ("with running job"); |
2778 | 2061 | class = job_class_new (NULL, "test", session); | 2009 | class = job_class_new (NULL, "test", NULL); |
2779 | 2062 | job = job_new (class, ""); | 2010 | job = job_new (class, ""); |
2780 | 2063 | 2011 | ||
2781 | 2064 | job->goal = JOB_START; | 2012 | job->goal = JOB_START; |
2782 | @@ -2141,7 +2089,7 @@ | |||
2783 | 2141 | * and no blocking entry created. | 2089 | * and no blocking entry created. |
2784 | 2142 | */ | 2090 | */ |
2785 | 2143 | TEST_FEATURE ("with no wait"); | 2091 | TEST_FEATURE ("with no wait"); |
2787 | 2144 | class = job_class_new (NULL, "test", session); | 2092 | class = job_class_new (NULL, "test", NULL); |
2788 | 2145 | job = job_new (class, ""); | 2093 | job = job_new (class, ""); |
2789 | 2146 | 2094 | ||
2790 | 2147 | job->goal = JOB_START; | 2095 | job->goal = JOB_START; |
2791 | @@ -2211,7 +2159,7 @@ | |||
2792 | 2211 | * a D-Bus error is raised immediately. | 2159 | * a D-Bus error is raised immediately. |
2793 | 2212 | */ | 2160 | */ |
2794 | 2213 | TEST_FEATURE ("with stopping job"); | 2161 | TEST_FEATURE ("with stopping job"); |
2796 | 2214 | class = job_class_new (NULL, "test", session); | 2162 | class = job_class_new (NULL, "test", NULL); |
2797 | 2215 | job = job_new (class, ""); | 2163 | job = job_new (class, ""); |
2798 | 2216 | 2164 | ||
2799 | 2217 | job->goal = JOB_STOP; | 2165 | job->goal = JOB_STOP; |
2800 | @@ -2266,7 +2214,7 @@ | |||
2801 | 2266 | * immediately. | 2214 | * immediately. |
2802 | 2267 | */ | 2215 | */ |
2803 | 2268 | TEST_FEATURE ("with unknown job"); | 2216 | TEST_FEATURE ("with unknown job"); |
2805 | 2269 | class = job_class_new (NULL, "test", session); | 2217 | class = job_class_new (NULL, "test", NULL); |
2806 | 2270 | 2218 | ||
2807 | 2271 | method = dbus_message_new_method_call ( | 2219 | method = dbus_message_new_method_call ( |
2808 | 2272 | dbus_bus_get_unique_name (conn), | 2220 | dbus_bus_get_unique_name (conn), |
2809 | @@ -2315,7 +2263,7 @@ | |||
2810 | 2315 | * for the pre-stop script. | 2263 | * for the pre-stop script. |
2811 | 2316 | */ | 2264 | */ |
2812 | 2317 | TEST_FEATURE ("with environment"); | 2265 | TEST_FEATURE ("with environment"); |
2814 | 2318 | class = job_class_new (NULL, "test", session); | 2266 | class = job_class_new (NULL, "test", NULL); |
2815 | 2319 | class->instance = "$FOO"; | 2267 | class->instance = "$FOO"; |
2816 | 2320 | 2268 | ||
2817 | 2321 | job = job_new (class, "wibble"); | 2269 | job = job_new (class, "wibble"); |
2818 | @@ -2404,7 +2352,7 @@ | |||
2819 | 2404 | * is returned. | 2352 | * is returned. |
2820 | 2405 | */ | 2353 | */ |
2821 | 2406 | TEST_FEATURE ("with invalid environment"); | 2354 | TEST_FEATURE ("with invalid environment"); |
2823 | 2407 | class = job_class_new (NULL, "test", session); | 2355 | class = job_class_new (NULL, "test", NULL); |
2824 | 2408 | job = job_new (class, ""); | 2356 | job = job_new (class, ""); |
2825 | 2409 | 2357 | ||
2826 | 2410 | job->goal = JOB_START; | 2358 | job->goal = JOB_START; |
2827 | @@ -2451,7 +2399,6 @@ | |||
2828 | 2451 | nih_free (dbus_error); | 2399 | nih_free (dbus_error); |
2829 | 2452 | 2400 | ||
2830 | 2453 | nih_free (class); | 2401 | nih_free (class); |
2831 | 2454 | nih_free (session); | ||
2832 | 2455 | 2402 | ||
2833 | 2456 | TEST_DBUS_CLOSE (conn); | 2403 | TEST_DBUS_CLOSE (conn); |
2834 | 2457 | TEST_DBUS_CLOSE (client_conn); | 2404 | TEST_DBUS_CLOSE (client_conn); |
2835 | @@ -2478,11 +2425,6 @@ | |||
2836 | 2478 | int ret; | 2425 | int ret; |
2837 | 2479 | NihError *error; | 2426 | NihError *error; |
2838 | 2480 | NihDBusError *dbus_error; | 2427 | NihDBusError *dbus_error; |
2839 | 2481 | Session *session; | ||
2840 | 2482 | |||
2841 | 2483 | session = session_new (NULL, NULL, getuid ()); | ||
2842 | 2484 | TEST_NE_P (session, NULL); | ||
2843 | 2485 | |||
2844 | 2486 | 2428 | ||
2845 | 2487 | TEST_FUNCTION ("job_class_restart"); | 2429 | TEST_FUNCTION ("job_class_restart"); |
2846 | 2488 | nih_error_init (); | 2430 | nih_error_init (); |
2847 | @@ -2499,7 +2441,7 @@ | |||
2848 | 2499 | * through to waiting, the reply will be sent to the sender. | 2441 | * through to waiting, the reply will be sent to the sender. |
2849 | 2500 | */ | 2442 | */ |
2850 | 2501 | TEST_FEATURE ("with running job"); | 2443 | TEST_FEATURE ("with running job"); |
2852 | 2502 | class = job_class_new (NULL, "test", session); | 2444 | class = job_class_new (NULL, "test", NULL); |
2853 | 2503 | job = job_new (class, ""); | 2445 | job = job_new (class, ""); |
2854 | 2504 | 2446 | ||
2855 | 2505 | job->goal = JOB_START; | 2447 | job->goal = JOB_START; |
2856 | @@ -2596,7 +2538,7 @@ | |||
2857 | 2596 | * entry created. | 2538 | * entry created. |
2858 | 2597 | */ | 2539 | */ |
2859 | 2598 | TEST_FEATURE ("with no wait"); | 2540 | TEST_FEATURE ("with no wait"); |
2861 | 2599 | class = job_class_new (NULL, "test", session); | 2541 | class = job_class_new (NULL, "test", NULL); |
2862 | 2600 | job = job_new (class, ""); | 2542 | job = job_new (class, ""); |
2863 | 2601 | 2543 | ||
2864 | 2602 | job->goal = JOB_START; | 2544 | job->goal = JOB_START; |
2865 | @@ -2677,7 +2619,7 @@ | |||
2866 | 2677 | * a D-Bus error is raised immediately. | 2619 | * a D-Bus error is raised immediately. |
2867 | 2678 | */ | 2620 | */ |
2868 | 2679 | TEST_FEATURE ("with stopping job"); | 2621 | TEST_FEATURE ("with stopping job"); |
2870 | 2680 | class = job_class_new (NULL, "test", session); | 2622 | class = job_class_new (NULL, "test", NULL); |
2871 | 2681 | job = job_new (class, ""); | 2623 | job = job_new (class, ""); |
2872 | 2682 | 2624 | ||
2873 | 2683 | job->goal = JOB_STOP; | 2625 | job->goal = JOB_STOP; |
2874 | @@ -2732,7 +2674,7 @@ | |||
2875 | 2732 | * immediately. | 2674 | * immediately. |
2876 | 2733 | */ | 2675 | */ |
2877 | 2734 | TEST_FEATURE ("with unknown job"); | 2676 | TEST_FEATURE ("with unknown job"); |
2879 | 2735 | class = job_class_new (NULL, "test", session); | 2677 | class = job_class_new (NULL, "test", NULL); |
2880 | 2736 | 2678 | ||
2881 | 2737 | method = dbus_message_new_method_call ( | 2679 | method = dbus_message_new_method_call ( |
2882 | 2738 | dbus_bus_get_unique_name (conn), | 2680 | dbus_bus_get_unique_name (conn), |
2883 | @@ -2781,7 +2723,7 @@ | |||
2884 | 2781 | * when it's starting again. | 2723 | * when it's starting again. |
2885 | 2782 | */ | 2724 | */ |
2886 | 2783 | TEST_FEATURE ("with environment"); | 2725 | TEST_FEATURE ("with environment"); |
2888 | 2784 | class = job_class_new (NULL, "test", session); | 2726 | class = job_class_new (NULL, "test", NULL); |
2889 | 2785 | class->instance = "$FOO"; | 2727 | class->instance = "$FOO"; |
2890 | 2786 | 2728 | ||
2891 | 2787 | job = job_new (class, "wibble"); | 2729 | job = job_new (class, "wibble"); |
2892 | @@ -2894,7 +2836,7 @@ | |||
2893 | 2894 | * is returned. | 2836 | * is returned. |
2894 | 2895 | */ | 2837 | */ |
2895 | 2896 | TEST_FEATURE ("with invalid environment"); | 2838 | TEST_FEATURE ("with invalid environment"); |
2897 | 2897 | class = job_class_new (NULL, "test", session); | 2839 | class = job_class_new (NULL, "test", NULL); |
2898 | 2898 | job = job_new (class, ""); | 2840 | job = job_new (class, ""); |
2899 | 2899 | 2841 | ||
2900 | 2900 | job->goal = JOB_START; | 2842 | job->goal = JOB_START; |
2901 | @@ -2941,7 +2883,6 @@ | |||
2902 | 2941 | nih_free (dbus_error); | 2883 | nih_free (dbus_error); |
2903 | 2942 | 2884 | ||
2904 | 2943 | nih_free (class); | 2885 | nih_free (class); |
2905 | 2944 | nih_free (session); | ||
2906 | 2945 | 2886 | ||
2907 | 2946 | TEST_DBUS_CLOSE (conn); | 2887 | TEST_DBUS_CLOSE (conn); |
2908 | 2947 | TEST_DBUS_CLOSE (client_conn); | 2888 | TEST_DBUS_CLOSE (client_conn); |
2909 | @@ -2961,10 +2902,6 @@ | |||
2910 | 2961 | NihError *error; | 2902 | NihError *error; |
2911 | 2962 | char *name; | 2903 | char *name; |
2912 | 2963 | int ret; | 2904 | int ret; |
2913 | 2964 | Session *session; | ||
2914 | 2965 | |||
2915 | 2966 | session = session_new (NULL, NULL, getuid ()); | ||
2916 | 2967 | TEST_NE_P (session, NULL); | ||
2917 | 2968 | 2905 | ||
2918 | 2969 | /* Check that the name of the job class is returned from the | 2906 | /* Check that the name of the job class is returned from the |
2919 | 2970 | * property, as a child of the message. | 2907 | * property, as a child of the message. |
2920 | @@ -2975,7 +2912,7 @@ | |||
2921 | 2975 | 2912 | ||
2922 | 2976 | TEST_ALLOC_FAIL { | 2913 | TEST_ALLOC_FAIL { |
2923 | 2977 | TEST_ALLOC_SAFE { | 2914 | TEST_ALLOC_SAFE { |
2925 | 2978 | class = job_class_new (NULL, "test", session); | 2915 | class = job_class_new (NULL, "test", NULL); |
2926 | 2979 | 2916 | ||
2927 | 2980 | message = nih_new (NULL, NihDBusMessage); | 2917 | message = nih_new (NULL, NihDBusMessage); |
2928 | 2981 | message->connection = NULL; | 2918 | message->connection = NULL; |
2929 | @@ -3006,7 +2943,6 @@ | |||
2930 | 3006 | nih_free (message); | 2943 | nih_free (message); |
2931 | 3007 | nih_free (class); | 2944 | nih_free (class); |
2932 | 3008 | } | 2945 | } |
2933 | 3009 | nih_free (session); | ||
2934 | 3010 | } | 2946 | } |
2935 | 3011 | 2947 | ||
2936 | 3012 | void | 2948 | void |
2937 | @@ -3017,10 +2953,6 @@ | |||
2938 | 3017 | NihError *error; | 2953 | NihError *error; |
2939 | 3018 | char *description; | 2954 | char *description; |
2940 | 3019 | int ret; | 2955 | int ret; |
2941 | 3020 | Session *session; | ||
2942 | 3021 | |||
2943 | 3022 | session = session_new (NULL, NULL, getuid ()); | ||
2944 | 3023 | TEST_NE_P (session, NULL); | ||
2945 | 3024 | 2956 | ||
2946 | 3025 | TEST_FUNCTION ("job_class_get_description"); | 2957 | TEST_FUNCTION ("job_class_get_description"); |
2947 | 3026 | nih_error_init (); | 2958 | nih_error_init (); |
2948 | @@ -3032,7 +2964,7 @@ | |||
2949 | 3032 | TEST_FEATURE ("with description"); | 2964 | TEST_FEATURE ("with description"); |
2950 | 3033 | TEST_ALLOC_FAIL { | 2965 | TEST_ALLOC_FAIL { |
2951 | 3034 | TEST_ALLOC_SAFE { | 2966 | TEST_ALLOC_SAFE { |
2953 | 3035 | class = job_class_new (NULL, "test", session); | 2967 | class = job_class_new (NULL, "test", NULL); |
2954 | 3036 | class->description = nih_strdup (class, "a test job"); | 2968 | class->description = nih_strdup (class, "a test job"); |
2955 | 3037 | 2969 | ||
2956 | 3038 | message = nih_new (NULL, NihDBusMessage); | 2970 | message = nih_new (NULL, NihDBusMessage); |
2957 | @@ -3072,7 +3004,7 @@ | |||
2958 | 3072 | TEST_FEATURE ("with no description"); | 3004 | TEST_FEATURE ("with no description"); |
2959 | 3073 | TEST_ALLOC_FAIL { | 3005 | TEST_ALLOC_FAIL { |
2960 | 3074 | TEST_ALLOC_SAFE { | 3006 | TEST_ALLOC_SAFE { |
2962 | 3075 | class = job_class_new (NULL, "test", session); | 3007 | class = job_class_new (NULL, "test", NULL); |
2963 | 3076 | 3008 | ||
2964 | 3077 | message = nih_new (NULL, NihDBusMessage); | 3009 | message = nih_new (NULL, NihDBusMessage); |
2965 | 3078 | message->connection = NULL; | 3010 | message->connection = NULL; |
2966 | @@ -3103,7 +3035,6 @@ | |||
2967 | 3103 | nih_free (message); | 3035 | nih_free (message); |
2968 | 3104 | nih_free (class); | 3036 | nih_free (class); |
2969 | 3105 | } | 3037 | } |
2970 | 3106 | nih_free (session); | ||
2971 | 3107 | } | 3038 | } |
2972 | 3108 | 3039 | ||
2973 | 3109 | void | 3040 | void |
2974 | @@ -3114,10 +3045,6 @@ | |||
2975 | 3114 | NihError *error; | 3045 | NihError *error; |
2976 | 3115 | char *author; | 3046 | char *author; |
2977 | 3116 | int ret; | 3047 | int ret; |
2978 | 3117 | Session *session; | ||
2979 | 3118 | |||
2980 | 3119 | session = session_new (NULL, NULL, getuid ()); | ||
2981 | 3120 | TEST_NE_P (session, NULL); | ||
2982 | 3121 | 3048 | ||
2983 | 3122 | TEST_FUNCTION ("job_class_get_author"); | 3049 | TEST_FUNCTION ("job_class_get_author"); |
2984 | 3123 | nih_error_init (); | 3050 | nih_error_init (); |
2985 | @@ -3129,7 +3056,7 @@ | |||
2986 | 3129 | TEST_FEATURE ("with author"); | 3056 | TEST_FEATURE ("with author"); |
2987 | 3130 | TEST_ALLOC_FAIL { | 3057 | TEST_ALLOC_FAIL { |
2988 | 3131 | TEST_ALLOC_SAFE { | 3058 | TEST_ALLOC_SAFE { |
2990 | 3132 | class = job_class_new (NULL, "test", session); | 3059 | class = job_class_new (NULL, "test", NULL); |
2991 | 3133 | class->author = nih_strdup (class, "a test job"); | 3060 | class->author = nih_strdup (class, "a test job"); |
2992 | 3134 | 3061 | ||
2993 | 3135 | message = nih_new (NULL, NihDBusMessage); | 3062 | message = nih_new (NULL, NihDBusMessage); |
2994 | @@ -3169,7 +3096,7 @@ | |||
2995 | 3169 | TEST_FEATURE ("with no author"); | 3096 | TEST_FEATURE ("with no author"); |
2996 | 3170 | TEST_ALLOC_FAIL { | 3097 | TEST_ALLOC_FAIL { |
2997 | 3171 | TEST_ALLOC_SAFE { | 3098 | TEST_ALLOC_SAFE { |
2999 | 3172 | class = job_class_new (NULL, "test", session); | 3099 | class = job_class_new (NULL, "test", NULL); |
3000 | 3173 | 3100 | ||
3001 | 3174 | message = nih_new (NULL, NihDBusMessage); | 3101 | message = nih_new (NULL, NihDBusMessage); |
3002 | 3175 | message->connection = NULL; | 3102 | message->connection = NULL; |
3003 | @@ -3200,7 +3127,6 @@ | |||
3004 | 3200 | nih_free (message); | 3127 | nih_free (message); |
3005 | 3201 | nih_free (class); | 3128 | nih_free (class); |
3006 | 3202 | } | 3129 | } |
3007 | 3203 | nih_free (session); | ||
3008 | 3204 | } | 3130 | } |
3009 | 3205 | 3131 | ||
3010 | 3206 | void | 3132 | void |
3011 | @@ -3211,10 +3137,6 @@ | |||
3012 | 3211 | NihError *error; | 3137 | NihError *error; |
3013 | 3212 | char *version; | 3138 | char *version; |
3014 | 3213 | int ret; | 3139 | int ret; |
3015 | 3214 | Session *session; | ||
3016 | 3215 | |||
3017 | 3216 | session = session_new (NULL, NULL, getuid ()); | ||
3018 | 3217 | TEST_NE_P (session, NULL); | ||
3019 | 3218 | 3140 | ||
3020 | 3219 | TEST_FUNCTION ("job_class_get_version"); | 3141 | TEST_FUNCTION ("job_class_get_version"); |
3021 | 3220 | nih_error_init (); | 3142 | nih_error_init (); |
3022 | @@ -3226,7 +3148,7 @@ | |||
3023 | 3226 | TEST_FEATURE ("with version"); | 3148 | TEST_FEATURE ("with version"); |
3024 | 3227 | TEST_ALLOC_FAIL { | 3149 | TEST_ALLOC_FAIL { |
3025 | 3228 | TEST_ALLOC_SAFE { | 3150 | TEST_ALLOC_SAFE { |
3027 | 3229 | class = job_class_new (NULL, "test", session); | 3151 | class = job_class_new (NULL, "test", NULL); |
3028 | 3230 | class->version = nih_strdup (class, "a test job"); | 3152 | class->version = nih_strdup (class, "a test job"); |
3029 | 3231 | 3153 | ||
3030 | 3232 | message = nih_new (NULL, NihDBusMessage); | 3154 | message = nih_new (NULL, NihDBusMessage); |
3031 | @@ -3266,7 +3188,7 @@ | |||
3032 | 3266 | TEST_FEATURE ("with no version"); | 3188 | TEST_FEATURE ("with no version"); |
3033 | 3267 | TEST_ALLOC_FAIL { | 3189 | TEST_ALLOC_FAIL { |
3034 | 3268 | TEST_ALLOC_SAFE { | 3190 | TEST_ALLOC_SAFE { |
3036 | 3269 | class = job_class_new (NULL, "test", session); | 3191 | class = job_class_new (NULL, "test", NULL); |
3037 | 3270 | 3192 | ||
3038 | 3271 | message = nih_new (NULL, NihDBusMessage); | 3193 | message = nih_new (NULL, NihDBusMessage); |
3039 | 3272 | message->connection = NULL; | 3194 | message->connection = NULL; |
3040 | @@ -3297,7 +3219,6 @@ | |||
3041 | 3297 | nih_free (message); | 3219 | nih_free (message); |
3042 | 3298 | nih_free (class); | 3220 | nih_free (class); |
3043 | 3299 | } | 3221 | } |
3044 | 3300 | nih_free (session); | ||
3045 | 3301 | } | 3222 | } |
3046 | 3302 | 3223 | ||
3047 | 3303 | void | 3224 | void |
3048 | @@ -3310,10 +3231,6 @@ | |||
3049 | 3310 | NihError *error; | 3231 | NihError *error; |
3050 | 3311 | char ***start_on; | 3232 | char ***start_on; |
3051 | 3312 | int ret; | 3233 | int ret; |
3052 | 3313 | Session *session; | ||
3053 | 3314 | |||
3054 | 3315 | session = session_new (NULL, NULL, getuid ()); | ||
3055 | 3316 | TEST_NE_P (session, NULL); | ||
3056 | 3317 | 3234 | ||
3057 | 3318 | TEST_FUNCTION ("job_class_get_start_on"); | 3235 | TEST_FUNCTION ("job_class_get_start_on"); |
3058 | 3319 | 3236 | ||
3059 | @@ -3326,7 +3243,7 @@ | |||
3060 | 3326 | 3243 | ||
3061 | 3327 | TEST_ALLOC_FAIL { | 3244 | TEST_ALLOC_FAIL { |
3062 | 3328 | TEST_ALLOC_SAFE { | 3245 | TEST_ALLOC_SAFE { |
3064 | 3329 | class = job_class_new (NULL, "test", session); | 3246 | class = job_class_new (NULL, "test", NULL); |
3065 | 3330 | 3247 | ||
3066 | 3331 | class->start_on = event_operator_new ( | 3248 | class->start_on = event_operator_new ( |
3067 | 3332 | class, EVENT_OR, NULL, NULL); | 3249 | class, EVENT_OR, NULL, NULL); |
3068 | @@ -3421,7 +3338,7 @@ | |||
3069 | 3421 | 3338 | ||
3070 | 3422 | TEST_ALLOC_FAIL { | 3339 | TEST_ALLOC_FAIL { |
3071 | 3423 | TEST_ALLOC_SAFE { | 3340 | TEST_ALLOC_SAFE { |
3073 | 3424 | class = job_class_new (NULL, "test", session); | 3341 | class = job_class_new (NULL, "test", NULL); |
3074 | 3425 | 3342 | ||
3075 | 3426 | message = nih_new (NULL, NihDBusMessage); | 3343 | message = nih_new (NULL, NihDBusMessage); |
3076 | 3427 | message->connection = NULL; | 3344 | message->connection = NULL; |
3077 | @@ -3453,7 +3370,6 @@ | |||
3078 | 3453 | nih_free (message); | 3370 | nih_free (message); |
3079 | 3454 | nih_free (class); | 3371 | nih_free (class); |
3080 | 3455 | } | 3372 | } |
3081 | 3456 | nih_free (session); | ||
3082 | 3457 | } | 3373 | } |
3083 | 3458 | 3374 | ||
3084 | 3459 | void | 3375 | void |
3085 | @@ -3466,10 +3382,6 @@ | |||
3086 | 3466 | NihError *error; | 3382 | NihError *error; |
3087 | 3467 | char ***stop_on; | 3383 | char ***stop_on; |
3088 | 3468 | int ret; | 3384 | int ret; |
3089 | 3469 | Session *session; | ||
3090 | 3470 | |||
3091 | 3471 | session = session_new (NULL, NULL, getuid ()); | ||
3092 | 3472 | TEST_NE_P (session, NULL); | ||
3093 | 3473 | 3385 | ||
3094 | 3474 | TEST_FUNCTION ("job_class_get_stop_on"); | 3386 | TEST_FUNCTION ("job_class_get_stop_on"); |
3095 | 3475 | 3387 | ||
3096 | @@ -3482,7 +3394,7 @@ | |||
3097 | 3482 | 3394 | ||
3098 | 3483 | TEST_ALLOC_FAIL { | 3395 | TEST_ALLOC_FAIL { |
3099 | 3484 | TEST_ALLOC_SAFE { | 3396 | TEST_ALLOC_SAFE { |
3101 | 3485 | class = job_class_new (NULL, "test", session); | 3397 | class = job_class_new (NULL, "test", NULL); |
3102 | 3486 | 3398 | ||
3103 | 3487 | class->stop_on = event_operator_new ( | 3399 | class->stop_on = event_operator_new ( |
3104 | 3488 | class, EVENT_OR, NULL, NULL); | 3400 | class, EVENT_OR, NULL, NULL); |
3105 | @@ -3577,7 +3489,7 @@ | |||
3106 | 3577 | 3489 | ||
3107 | 3578 | TEST_ALLOC_FAIL { | 3490 | TEST_ALLOC_FAIL { |
3108 | 3579 | TEST_ALLOC_SAFE { | 3491 | TEST_ALLOC_SAFE { |
3110 | 3580 | class = job_class_new (NULL, "test", session); | 3492 | class = job_class_new (NULL, "test", NULL); |
3111 | 3581 | 3493 | ||
3112 | 3582 | message = nih_new (NULL, NihDBusMessage); | 3494 | message = nih_new (NULL, NihDBusMessage); |
3113 | 3583 | message->connection = NULL; | 3495 | message->connection = NULL; |
3114 | @@ -3609,7 +3521,6 @@ | |||
3115 | 3609 | nih_free (message); | 3521 | nih_free (message); |
3116 | 3610 | nih_free (class); | 3522 | nih_free (class); |
3117 | 3611 | } | 3523 | } |
3118 | 3612 | nih_free (session); | ||
3119 | 3613 | } | 3524 | } |
3120 | 3614 | 3525 | ||
3121 | 3615 | void | 3526 | void |
3122 | @@ -3620,10 +3531,6 @@ | |||
3123 | 3620 | NihError *error; | 3531 | NihError *error; |
3124 | 3621 | char **emits; | 3532 | char **emits; |
3125 | 3622 | int ret; | 3533 | int ret; |
3126 | 3623 | Session *session; | ||
3127 | 3624 | |||
3128 | 3625 | session = session_new (NULL, NULL, getuid ()); | ||
3129 | 3626 | TEST_NE_P (session, NULL); | ||
3130 | 3627 | 3534 | ||
3131 | 3628 | TEST_FUNCTION ("job_class_get_emits"); | 3535 | TEST_FUNCTION ("job_class_get_emits"); |
3132 | 3629 | 3536 | ||
3133 | @@ -3637,7 +3544,7 @@ | |||
3134 | 3637 | 3544 | ||
3135 | 3638 | TEST_ALLOC_FAIL { | 3545 | TEST_ALLOC_FAIL { |
3136 | 3639 | TEST_ALLOC_SAFE { | 3546 | TEST_ALLOC_SAFE { |
3138 | 3640 | class = job_class_new (NULL, "test", session); | 3547 | class = job_class_new (NULL, "test", NULL); |
3139 | 3641 | class->emits = nih_str_array_new (class); | 3548 | class->emits = nih_str_array_new (class); |
3140 | 3642 | 3549 | ||
3141 | 3643 | NIH_MUST (nih_str_array_add (&class->emits, class, NULL, "foo")); | 3550 | NIH_MUST (nih_str_array_add (&class->emits, class, NULL, "foo")); |
3142 | @@ -3689,7 +3596,7 @@ | |||
3143 | 3689 | 3596 | ||
3144 | 3690 | TEST_ALLOC_FAIL { | 3597 | TEST_ALLOC_FAIL { |
3145 | 3691 | TEST_ALLOC_SAFE { | 3598 | TEST_ALLOC_SAFE { |
3147 | 3692 | class = job_class_new (NULL, "test", session); | 3599 | class = job_class_new (NULL, "test", NULL); |
3148 | 3693 | 3600 | ||
3149 | 3694 | message = nih_new (NULL, NihDBusMessage); | 3601 | message = nih_new (NULL, NihDBusMessage); |
3150 | 3695 | message->connection = NULL; | 3602 | message->connection = NULL; |
3151 | @@ -3721,7 +3628,6 @@ | |||
3152 | 3721 | nih_free (message); | 3628 | nih_free (message); |
3153 | 3722 | nih_free (class); | 3629 | nih_free (class); |
3154 | 3723 | } | 3630 | } |
3155 | 3724 | nih_free (session); | ||
3156 | 3725 | } | 3631 | } |
3157 | 3726 | 3632 | ||
3158 | 3727 | 3633 | ||
3159 | @@ -3729,6 +3635,9 @@ | |||
3160 | 3729 | main (int argc, | 3635 | main (int argc, |
3161 | 3730 | char *argv[]) | 3636 | char *argv[]) |
3162 | 3731 | { | 3637 | { |
3163 | 3638 | /* run tests in legacy (pre-session support) mode */ | ||
3164 | 3639 | setenv ("UPSTART_NO_SESSIONS", "1", 1); | ||
3165 | 3640 | |||
3166 | 3732 | test_new (); | 3641 | test_new (); |
3167 | 3733 | test_consider (); | 3642 | test_consider (); |
3168 | 3734 | test_reconsider (); | 3643 | test_reconsider (); |
3169 | 3735 | 3644 | ||
3170 | === modified file 'init/tests/test_job_process.c' | |||
3171 | --- init/tests/test_job_process.c 2011-02-24 15:41:04 +0000 | |||
3172 | +++ init/tests/test_job_process.c 2011-04-19 09:27:29 +0000 | |||
3173 | @@ -131,10 +131,6 @@ | |||
3174 | 131 | char filename[PATH_MAX], buf[80]; | 131 | char filename[PATH_MAX], buf[80]; |
3175 | 132 | int ret = -1, status, first; | 132 | int ret = -1, status, first; |
3176 | 133 | siginfo_t info; | 133 | siginfo_t info; |
3177 | 134 | Session *session; | ||
3178 | 135 | |||
3179 | 136 | session = session_new (NULL, NULL, getuid ()); | ||
3180 | 137 | TEST_NE_P (session, NULL); | ||
3181 | 138 | 134 | ||
3182 | 139 | TEST_FUNCTION ("job_process_run"); | 135 | TEST_FUNCTION ("job_process_run"); |
3183 | 140 | job_class_init (); | 136 | job_class_init (); |
3184 | @@ -151,7 +147,7 @@ | |||
3185 | 151 | TEST_FEATURE ("with simple command"); | 147 | TEST_FEATURE ("with simple command"); |
3186 | 152 | TEST_ALLOC_FAIL { | 148 | TEST_ALLOC_FAIL { |
3187 | 153 | TEST_ALLOC_SAFE { | 149 | TEST_ALLOC_SAFE { |
3189 | 154 | class = job_class_new (NULL, "test", session); | 150 | class = job_class_new (NULL, "test", NULL); |
3190 | 155 | class->process[PROCESS_MAIN] = process_new (class); | 151 | class->process[PROCESS_MAIN] = process_new (class); |
3191 | 156 | class->process[PROCESS_MAIN]->command = nih_sprintf ( | 152 | class->process[PROCESS_MAIN]->command = nih_sprintf ( |
3192 | 157 | class->process[PROCESS_MAIN], | 153 | class->process[PROCESS_MAIN], |
3193 | @@ -183,7 +179,7 @@ | |||
3194 | 183 | TEST_FEATURE ("with shell command"); | 179 | TEST_FEATURE ("with shell command"); |
3195 | 184 | TEST_ALLOC_FAIL { | 180 | TEST_ALLOC_FAIL { |
3196 | 185 | TEST_ALLOC_SAFE { | 181 | TEST_ALLOC_SAFE { |
3198 | 186 | class = job_class_new (NULL, "test", session); | 182 | class = job_class_new (NULL, "test", NULL); |
3199 | 187 | class->process[PROCESS_MAIN] = process_new (class); | 183 | class->process[PROCESS_MAIN] = process_new (class); |
3200 | 188 | class->process[PROCESS_MAIN]->command = nih_sprintf ( | 184 | class->process[PROCESS_MAIN]->command = nih_sprintf ( |
3201 | 189 | class->process[PROCESS_MAIN], | 185 | class->process[PROCESS_MAIN], |
3202 | @@ -220,7 +216,7 @@ | |||
3203 | 220 | TEST_FEATURE ("with small script"); | 216 | TEST_FEATURE ("with small script"); |
3204 | 221 | TEST_ALLOC_FAIL { | 217 | TEST_ALLOC_FAIL { |
3205 | 222 | TEST_ALLOC_SAFE { | 218 | TEST_ALLOC_SAFE { |
3207 | 223 | class = job_class_new (NULL, "test", session); | 219 | class = job_class_new (NULL, "test", NULL); |
3208 | 224 | class->process[PROCESS_MAIN] = process_new (class); | 220 | class->process[PROCESS_MAIN] = process_new (class); |
3209 | 225 | class->process[PROCESS_MAIN]->script = TRUE; | 221 | class->process[PROCESS_MAIN]->script = TRUE; |
3210 | 226 | class->process[PROCESS_MAIN]->command = nih_sprintf ( | 222 | class->process[PROCESS_MAIN]->command = nih_sprintf ( |
3211 | @@ -257,7 +253,7 @@ | |||
3212 | 257 | TEST_FEATURE ("with small script and trailing newlines"); | 253 | TEST_FEATURE ("with small script and trailing newlines"); |
3213 | 258 | TEST_ALLOC_FAIL { | 254 | TEST_ALLOC_FAIL { |
3214 | 259 | TEST_ALLOC_SAFE { | 255 | TEST_ALLOC_SAFE { |
3216 | 260 | class = job_class_new (NULL, "test", session); | 256 | class = job_class_new (NULL, "test", NULL); |
3217 | 261 | class->process[PROCESS_MAIN] = process_new (class); | 257 | class->process[PROCESS_MAIN] = process_new (class); |
3218 | 262 | class->process[PROCESS_MAIN]->script = TRUE; | 258 | class->process[PROCESS_MAIN]->script = TRUE; |
3219 | 263 | class->process[PROCESS_MAIN]->command = nih_sprintf ( | 259 | class->process[PROCESS_MAIN]->command = nih_sprintf ( |
3220 | @@ -294,7 +290,7 @@ | |||
3221 | 294 | TEST_FEATURE ("with script that will fail"); | 290 | TEST_FEATURE ("with script that will fail"); |
3222 | 295 | TEST_ALLOC_FAIL { | 291 | TEST_ALLOC_FAIL { |
3223 | 296 | TEST_ALLOC_SAFE { | 292 | TEST_ALLOC_SAFE { |
3225 | 297 | class = job_class_new (NULL, "test", session); | 293 | class = job_class_new (NULL, "test", NULL); |
3226 | 298 | class->process[PROCESS_MAIN] = process_new (class); | 294 | class->process[PROCESS_MAIN] = process_new (class); |
3227 | 299 | class->process[PROCESS_MAIN]->script = TRUE; | 295 | class->process[PROCESS_MAIN]->script = TRUE; |
3228 | 300 | class->process[PROCESS_MAIN]->command = nih_sprintf ( | 296 | class->process[PROCESS_MAIN]->command = nih_sprintf ( |
3229 | @@ -331,7 +327,7 @@ | |||
3230 | 331 | TEST_FEATURE ("with environment of unnamed instance"); | 327 | TEST_FEATURE ("with environment of unnamed instance"); |
3231 | 332 | TEST_ALLOC_FAIL { | 328 | TEST_ALLOC_FAIL { |
3232 | 333 | TEST_ALLOC_SAFE { | 329 | TEST_ALLOC_SAFE { |
3234 | 334 | class = job_class_new (NULL, "test", session); | 330 | class = job_class_new (NULL, "test", NULL); |
3235 | 335 | class->process[PROCESS_MAIN] = process_new (class); | 331 | class->process[PROCESS_MAIN] = process_new (class); |
3236 | 336 | class->process[PROCESS_MAIN]->command = nih_sprintf ( | 332 | class->process[PROCESS_MAIN]->command = nih_sprintf ( |
3237 | 337 | class->process[PROCESS_MAIN], | 333 | class->process[PROCESS_MAIN], |
3238 | @@ -380,7 +376,7 @@ | |||
3239 | 380 | TEST_FEATURE ("with environment of named instance"); | 376 | TEST_FEATURE ("with environment of named instance"); |
3240 | 381 | TEST_ALLOC_FAIL { | 377 | TEST_ALLOC_FAIL { |
3241 | 382 | TEST_ALLOC_SAFE { | 378 | TEST_ALLOC_SAFE { |
3243 | 383 | class = job_class_new (NULL, "test", session); | 379 | class = job_class_new (NULL, "test", NULL); |
3244 | 384 | class->process[PROCESS_MAIN] = process_new (class); | 380 | class->process[PROCESS_MAIN] = process_new (class); |
3245 | 385 | class->process[PROCESS_MAIN]->command = nih_sprintf ( | 381 | class->process[PROCESS_MAIN]->command = nih_sprintf ( |
3246 | 386 | class->process[PROCESS_MAIN], | 382 | class->process[PROCESS_MAIN], |
3247 | @@ -430,7 +426,7 @@ | |||
3248 | 430 | TEST_FEATURE ("with environment for pre-stop"); | 426 | TEST_FEATURE ("with environment for pre-stop"); |
3249 | 431 | TEST_ALLOC_FAIL { | 427 | TEST_ALLOC_FAIL { |
3250 | 432 | TEST_ALLOC_SAFE { | 428 | TEST_ALLOC_SAFE { |
3252 | 433 | class = job_class_new (NULL, "test", session); | 429 | class = job_class_new (NULL, "test", NULL); |
3253 | 434 | class->process[PROCESS_PRE_STOP] = process_new (class); | 430 | class->process[PROCESS_PRE_STOP] = process_new (class); |
3254 | 435 | class->process[PROCESS_PRE_STOP]->command = nih_sprintf ( | 431 | class->process[PROCESS_PRE_STOP]->command = nih_sprintf ( |
3255 | 436 | class->process[PROCESS_PRE_STOP], | 432 | class->process[PROCESS_PRE_STOP], |
3256 | @@ -481,7 +477,7 @@ | |||
3257 | 481 | TEST_FEATURE ("with environment for post-stop"); | 477 | TEST_FEATURE ("with environment for post-stop"); |
3258 | 482 | TEST_ALLOC_FAIL { | 478 | TEST_ALLOC_FAIL { |
3259 | 483 | TEST_ALLOC_SAFE { | 479 | TEST_ALLOC_SAFE { |
3261 | 484 | class = job_class_new (NULL, "test", session); | 480 | class = job_class_new (NULL, "test", NULL); |
3262 | 485 | class->process[PROCESS_POST_STOP] = process_new (class); | 481 | class->process[PROCESS_POST_STOP] = process_new (class); |
3263 | 486 | class->process[PROCESS_POST_STOP]->command = nih_sprintf ( | 482 | class->process[PROCESS_POST_STOP]->command = nih_sprintf ( |
3264 | 487 | class->process[PROCESS_POST_STOP], | 483 | class->process[PROCESS_POST_STOP], |
3265 | @@ -532,7 +528,7 @@ | |||
3266 | 532 | TEST_FEATURE ("with long script"); | 528 | TEST_FEATURE ("with long script"); |
3267 | 533 | TEST_ALLOC_FAIL { | 529 | TEST_ALLOC_FAIL { |
3268 | 534 | TEST_ALLOC_SAFE { | 530 | TEST_ALLOC_SAFE { |
3270 | 535 | class = job_class_new (NULL, "test", session); | 531 | class = job_class_new (NULL, "test", NULL); |
3271 | 536 | class->process[PROCESS_MAIN] = process_new (class); | 532 | class->process[PROCESS_MAIN] = process_new (class); |
3272 | 537 | class->process[PROCESS_MAIN]->script = TRUE; | 533 | class->process[PROCESS_MAIN]->script = TRUE; |
3273 | 538 | class->process[PROCESS_MAIN]->command = nih_alloc ( | 534 | class->process[PROCESS_MAIN]->command = nih_alloc ( |
3274 | @@ -597,7 +593,7 @@ | |||
3275 | 597 | TEST_FEATURE ("with non-daemon job"); | 593 | TEST_FEATURE ("with non-daemon job"); |
3276 | 598 | TEST_ALLOC_FAIL { | 594 | TEST_ALLOC_FAIL { |
3277 | 599 | TEST_ALLOC_SAFE { | 595 | TEST_ALLOC_SAFE { |
3279 | 600 | class = job_class_new (NULL, "test", session); | 596 | class = job_class_new (NULL, "test", NULL); |
3280 | 601 | class->process[PROCESS_MAIN] = process_new (class); | 597 | class->process[PROCESS_MAIN] = process_new (class); |
3281 | 602 | class->process[PROCESS_MAIN]->command = "true"; | 598 | class->process[PROCESS_MAIN]->command = "true"; |
3282 | 603 | 599 | ||
3283 | @@ -633,7 +629,7 @@ | |||
3284 | 633 | TEST_FEATURE ("with script for daemon job"); | 629 | TEST_FEATURE ("with script for daemon job"); |
3285 | 634 | TEST_ALLOC_FAIL { | 630 | TEST_ALLOC_FAIL { |
3286 | 635 | TEST_ALLOC_SAFE { | 631 | TEST_ALLOC_SAFE { |
3288 | 636 | class = job_class_new (NULL, "test", session); | 632 | class = job_class_new (NULL, "test", NULL); |
3289 | 637 | class->process[PROCESS_PRE_START] = process_new (class); | 633 | class->process[PROCESS_PRE_START] = process_new (class); |
3290 | 638 | class->process[PROCESS_PRE_START]->command = "true"; | 634 | class->process[PROCESS_PRE_START]->command = "true"; |
3291 | 639 | 635 | ||
3292 | @@ -670,7 +666,7 @@ | |||
3293 | 670 | TEST_FEATURE ("with daemon job"); | 666 | TEST_FEATURE ("with daemon job"); |
3294 | 671 | TEST_ALLOC_FAIL { | 667 | TEST_ALLOC_FAIL { |
3295 | 672 | TEST_ALLOC_SAFE { | 668 | TEST_ALLOC_SAFE { |
3297 | 673 | class = job_class_new (NULL, "test", session); | 669 | class = job_class_new (NULL, "test", NULL); |
3298 | 674 | class->expect = EXPECT_DAEMON; | 670 | class->expect = EXPECT_DAEMON; |
3299 | 675 | class->process[PROCESS_MAIN] = process_new (class); | 671 | class->process[PROCESS_MAIN] = process_new (class); |
3300 | 676 | class->process[PROCESS_MAIN]->command = "true"; | 672 | class->process[PROCESS_MAIN]->command = "true"; |
3301 | @@ -717,7 +713,7 @@ | |||
3302 | 717 | TEST_FEATURE ("with forking job"); | 713 | TEST_FEATURE ("with forking job"); |
3303 | 718 | TEST_ALLOC_FAIL { | 714 | TEST_ALLOC_FAIL { |
3304 | 719 | TEST_ALLOC_SAFE { | 715 | TEST_ALLOC_SAFE { |
3306 | 720 | class = job_class_new (NULL, "test", session); | 716 | class = job_class_new (NULL, "test", NULL); |
3307 | 721 | class->expect = EXPECT_FORK; | 717 | class->expect = EXPECT_FORK; |
3308 | 722 | class->process[PROCESS_MAIN] = process_new (class); | 718 | class->process[PROCESS_MAIN] = process_new (class); |
3309 | 723 | class->process[PROCESS_MAIN]->command = "true"; | 719 | class->process[PROCESS_MAIN]->command = "true"; |
3310 | @@ -766,7 +762,7 @@ | |||
3311 | 766 | 762 | ||
3312 | 767 | TEST_ALLOC_FAIL { | 763 | TEST_ALLOC_FAIL { |
3313 | 768 | TEST_ALLOC_SAFE { | 764 | TEST_ALLOC_SAFE { |
3315 | 769 | class = job_class_new (NULL, "test", session); | 765 | class = job_class_new (NULL, "test", NULL); |
3316 | 770 | class->process[PROCESS_MAIN] = process_new (class); | 766 | class->process[PROCESS_MAIN] = process_new (class); |
3317 | 771 | class->process[PROCESS_MAIN]->command = filename; | 767 | class->process[PROCESS_MAIN]->command = filename; |
3318 | 772 | 768 | ||
3319 | @@ -791,7 +787,6 @@ | |||
3320 | 791 | 787 | ||
3321 | 792 | nih_free (class); | 788 | nih_free (class); |
3322 | 793 | } | 789 | } |
3323 | 794 | nih_free (session); | ||
3324 | 795 | } | 790 | } |
3325 | 796 | 791 | ||
3326 | 797 | 792 | ||
3327 | @@ -808,10 +803,6 @@ | |||
3328 | 808 | NihError *err; | 803 | NihError *err; |
3329 | 809 | JobProcessError *perr; | 804 | JobProcessError *perr; |
3330 | 810 | int status; | 805 | int status; |
3331 | 811 | Session *session; | ||
3332 | 812 | |||
3333 | 813 | session = session_new (NULL, NULL, getuid ()); | ||
3334 | 814 | TEST_NE_P (session, NULL); | ||
3335 | 815 | 806 | ||
3336 | 816 | TEST_FUNCTION ("job_process_spawn"); | 807 | TEST_FUNCTION ("job_process_spawn"); |
3337 | 817 | TEST_FILENAME (filename); | 808 | TEST_FILENAME (filename); |
3338 | @@ -828,7 +819,7 @@ | |||
3339 | 828 | TEST_FEATURE ("with simple job"); | 819 | TEST_FEATURE ("with simple job"); |
3340 | 829 | sprintf (function, "%d", TEST_PIDS); | 820 | sprintf (function, "%d", TEST_PIDS); |
3341 | 830 | 821 | ||
3343 | 831 | class = job_class_new (NULL, "test", session); | 822 | class = job_class_new (NULL, "test", NULL); |
3344 | 832 | 823 | ||
3345 | 833 | pid = job_process_spawn (class, args, NULL, FALSE); | 824 | pid = job_process_spawn (class, args, NULL, FALSE); |
3346 | 834 | TEST_GT (pid, 0); | 825 | TEST_GT (pid, 0); |
3347 | @@ -865,7 +856,7 @@ | |||
3348 | 865 | TEST_FEATURE ("with no console"); | 856 | TEST_FEATURE ("with no console"); |
3349 | 866 | sprintf (function, "%d", TEST_CONSOLE); | 857 | sprintf (function, "%d", TEST_CONSOLE); |
3350 | 867 | 858 | ||
3352 | 868 | class = job_class_new (NULL, "test", session); | 859 | class = job_class_new (NULL, "test", NULL); |
3353 | 869 | class->console = CONSOLE_NONE; | 860 | class->console = CONSOLE_NONE; |
3354 | 870 | 861 | ||
3355 | 871 | pid = job_process_spawn (class, args, NULL, FALSE); | 862 | pid = job_process_spawn (class, args, NULL, FALSE); |
3356 | @@ -891,7 +882,7 @@ | |||
3357 | 891 | TEST_FEATURE ("with working directory"); | 882 | TEST_FEATURE ("with working directory"); |
3358 | 892 | sprintf (function, "%d", TEST_PWD); | 883 | sprintf (function, "%d", TEST_PWD); |
3359 | 893 | 884 | ||
3361 | 894 | class = job_class_new (NULL, "test", session); | 885 | class = job_class_new (NULL, "test", NULL); |
3362 | 895 | class->chdir = "/tmp"; | 886 | class->chdir = "/tmp"; |
3363 | 896 | 887 | ||
3364 | 897 | pid = job_process_spawn (class, args, NULL, FALSE); | 888 | pid = job_process_spawn (class, args, NULL, FALSE); |
3365 | @@ -920,7 +911,7 @@ | |||
3366 | 920 | env[1] = "FOO=bar"; | 911 | env[1] = "FOO=bar"; |
3367 | 921 | env[2] = NULL; | 912 | env[2] = NULL; |
3368 | 922 | 913 | ||
3370 | 923 | class = job_class_new (NULL, "test", session); | 914 | class = job_class_new (NULL, "test", NULL); |
3371 | 924 | 915 | ||
3372 | 925 | pid = job_process_spawn (class, args, env, FALSE); | 916 | pid = job_process_spawn (class, args, env, FALSE); |
3373 | 926 | TEST_GT (pid, 0); | 917 | TEST_GT (pid, 0); |
3374 | @@ -945,7 +936,7 @@ | |||
3375 | 945 | TEST_FEATURE ("with non-daemon job"); | 936 | TEST_FEATURE ("with non-daemon job"); |
3376 | 946 | sprintf (function, "%d", TEST_SIMPLE); | 937 | sprintf (function, "%d", TEST_SIMPLE); |
3377 | 947 | 938 | ||
3379 | 948 | class = job_class_new (NULL, "test", session); | 939 | class = job_class_new (NULL, "test", NULL); |
3380 | 949 | 940 | ||
3381 | 950 | pid = job_process_spawn (class, args, NULL, FALSE); | 941 | pid = job_process_spawn (class, args, NULL, FALSE); |
3382 | 951 | TEST_GT (pid, 0); | 942 | TEST_GT (pid, 0); |
3383 | @@ -965,7 +956,7 @@ | |||
3384 | 965 | TEST_FEATURE ("with daemon job"); | 956 | TEST_FEATURE ("with daemon job"); |
3385 | 966 | sprintf (function, "%d", TEST_SIMPLE); | 957 | sprintf (function, "%d", TEST_SIMPLE); |
3386 | 967 | 958 | ||
3388 | 968 | class = job_class_new (NULL, "test", session); | 959 | class = job_class_new (NULL, "test", NULL); |
3389 | 969 | 960 | ||
3390 | 970 | pid = job_process_spawn (class, args, NULL, TRUE); | 961 | pid = job_process_spawn (class, args, NULL, TRUE); |
3391 | 971 | TEST_GT (pid, 0); | 962 | TEST_GT (pid, 0); |
3392 | @@ -994,7 +985,7 @@ | |||
3393 | 994 | args[1] = filename; | 985 | args[1] = filename; |
3394 | 995 | args[2] = NULL; | 986 | args[2] = NULL; |
3395 | 996 | 987 | ||
3397 | 997 | class = job_class_new (NULL, "test", session); | 988 | class = job_class_new (NULL, "test", NULL); |
3398 | 998 | 989 | ||
3399 | 999 | pid = job_process_spawn (class, args, NULL, FALSE); | 990 | pid = job_process_spawn (class, args, NULL, FALSE); |
3400 | 1000 | TEST_LT (pid, 0); | 991 | TEST_LT (pid, 0); |
3401 | @@ -1013,7 +1004,7 @@ | |||
3402 | 1013 | */ | 1004 | */ |
3403 | 1014 | TEST_FEATURE ("with debug enabled"); | 1005 | TEST_FEATURE ("with debug enabled"); |
3404 | 1015 | 1006 | ||
3406 | 1016 | class = job_class_new (NULL, "test", session); | 1007 | class = job_class_new (NULL, "test", NULL); |
3407 | 1017 | class->debug = TRUE; | 1008 | class->debug = TRUE; |
3408 | 1018 | 1009 | ||
3409 | 1019 | sprintf (function, "%s", "/bin/true"); | 1010 | sprintf (function, "%s", "/bin/true"); |
3410 | @@ -1042,7 +1033,6 @@ | |||
3411 | 1042 | TEST_EQ (WEXITSTATUS (status), 0); | 1033 | TEST_EQ (WEXITSTATUS (status), 0); |
3412 | 1043 | 1034 | ||
3413 | 1044 | nih_free (class); | 1035 | nih_free (class); |
3414 | 1045 | nih_free (session); | ||
3415 | 1046 | } | 1036 | } |
3416 | 1047 | 1037 | ||
3417 | 1048 | 1038 | ||
3418 | @@ -1055,16 +1045,12 @@ | |||
3419 | 1055 | struct timespec now; | 1045 | struct timespec now; |
3420 | 1056 | pid_t pid; | 1046 | pid_t pid; |
3421 | 1057 | int status; | 1047 | int status; |
3422 | 1058 | Session *session; | ||
3423 | 1059 | |||
3424 | 1060 | session = session_new (NULL, NULL, getuid ()); | ||
3425 | 1061 | TEST_NE_P (session, NULL); | ||
3426 | 1062 | 1048 | ||
3427 | 1063 | TEST_FUNCTION ("job_process_kill"); | 1049 | TEST_FUNCTION ("job_process_kill"); |
3428 | 1064 | nih_timer_init (); | 1050 | nih_timer_init (); |
3429 | 1065 | event_init (); | 1051 | event_init (); |
3430 | 1066 | 1052 | ||
3432 | 1067 | class = job_class_new (NULL, "test", session); | 1053 | class = job_class_new (NULL, "test", NULL); |
3433 | 1068 | class->kill_timeout = 1000; | 1054 | class->kill_timeout = 1000; |
3434 | 1069 | 1055 | ||
3435 | 1070 | class->process[PROCESS_MAIN] = process_new (class); | 1056 | class->process[PROCESS_MAIN] = process_new (class); |
3436 | @@ -1191,7 +1177,6 @@ | |||
3437 | 1191 | } | 1177 | } |
3438 | 1192 | 1178 | ||
3439 | 1193 | nih_free (class); | 1179 | nih_free (class); |
3440 | 1194 | nih_free (session); | ||
3441 | 1195 | } | 1180 | } |
3442 | 1196 | 1181 | ||
3443 | 1197 | 1182 | ||
3444 | @@ -1212,10 +1197,6 @@ | |||
3445 | 1212 | siginfo_t info; | 1197 | siginfo_t info; |
3446 | 1213 | unsigned long data; | 1198 | unsigned long data; |
3447 | 1214 | struct timespec now; | 1199 | struct timespec now; |
3448 | 1215 | Session *session; | ||
3449 | 1216 | |||
3450 | 1217 | session = session_new (NULL, NULL, getuid ()); | ||
3451 | 1218 | TEST_NE_P (session, NULL); | ||
3452 | 1219 | 1200 | ||
3453 | 1220 | TEST_FUNCTION ("job_process_handler"); | 1201 | TEST_FUNCTION ("job_process_handler"); |
3454 | 1221 | program_name = "test"; | 1202 | program_name = "test"; |
3455 | @@ -1223,7 +1204,7 @@ | |||
3456 | 1223 | 1204 | ||
3457 | 1224 | source = conf_source_new (NULL, "/tmp", CONF_JOB_DIR); | 1205 | source = conf_source_new (NULL, "/tmp", CONF_JOB_DIR); |
3458 | 1225 | file = conf_file_new (source, "/tmp/test"); | 1206 | file = conf_file_new (source, "/tmp/test"); |
3460 | 1226 | file->job = class = job_class_new (NULL, "test", session); | 1207 | file->job = class = job_class_new (NULL, "test", NULL); |
3461 | 1227 | class->process[PROCESS_MAIN] = process_new (class); | 1208 | class->process[PROCESS_MAIN] = process_new (class); |
3462 | 1228 | class->process[PROCESS_MAIN]->command = "echo"; | 1209 | class->process[PROCESS_MAIN]->command = "echo"; |
3463 | 1229 | 1210 | ||
3464 | @@ -4387,7 +4368,6 @@ | |||
3465 | 4387 | nih_free (source); | 4368 | nih_free (source); |
3466 | 4388 | 4369 | ||
3467 | 4389 | nih_free (event); | 4370 | nih_free (event); |
3468 | 4390 | nih_free (session); | ||
3469 | 4391 | event_poll (); | 4371 | event_poll (); |
3470 | 4392 | } | 4372 | } |
3471 | 4393 | 4373 | ||
3472 | @@ -4398,26 +4378,22 @@ | |||
3473 | 4398 | JobClass *class1, *class2, *class3; | 4378 | JobClass *class1, *class2, *class3; |
3474 | 4399 | Job *job1, *job2, *job3, *job4, *job5, *ptr; | 4379 | Job *job1, *job2, *job3, *job4, *job5, *ptr; |
3475 | 4400 | ProcessType process; | 4380 | ProcessType process; |
3476 | 4401 | Session *session; | ||
3477 | 4402 | |||
3478 | 4403 | session = session_new (NULL, NULL, getuid ()); | ||
3479 | 4404 | TEST_NE_P (session, NULL); | ||
3480 | 4405 | 4381 | ||
3481 | 4406 | TEST_FUNCTION ("job_process_find"); | 4382 | TEST_FUNCTION ("job_process_find"); |
3483 | 4407 | class1 = job_class_new (NULL, "foo", session); | 4383 | class1 = job_class_new (NULL, "foo", NULL); |
3484 | 4408 | class1->process[PROCESS_MAIN] = process_new (class1); | 4384 | class1->process[PROCESS_MAIN] = process_new (class1); |
3485 | 4409 | class1->process[PROCESS_POST_START] = process_new (class1); | 4385 | class1->process[PROCESS_POST_START] = process_new (class1); |
3486 | 4410 | class1->instance = "$FOO"; | 4386 | class1->instance = "$FOO"; |
3487 | 4411 | nih_hash_add (job_classes, &class1->entry); | 4387 | nih_hash_add (job_classes, &class1->entry); |
3488 | 4412 | 4388 | ||
3490 | 4413 | class2 = job_class_new (NULL, "bar", session); | 4389 | class2 = job_class_new (NULL, "bar", NULL); |
3491 | 4414 | class2->process[PROCESS_PRE_START] = process_new (class2); | 4390 | class2->process[PROCESS_PRE_START] = process_new (class2); |
3492 | 4415 | class2->process[PROCESS_MAIN] = process_new (class2); | 4391 | class2->process[PROCESS_MAIN] = process_new (class2); |
3493 | 4416 | class2->process[PROCESS_PRE_STOP] = process_new (class2); | 4392 | class2->process[PROCESS_PRE_STOP] = process_new (class2); |
3494 | 4417 | class2->instance = "$FOO"; | 4393 | class2->instance = "$FOO"; |
3495 | 4418 | nih_hash_add (job_classes, &class2->entry); | 4394 | nih_hash_add (job_classes, &class2->entry); |
3496 | 4419 | 4395 | ||
3498 | 4420 | class3 = job_class_new (NULL, "baz", session); | 4396 | class3 = job_class_new (NULL, "baz", NULL); |
3499 | 4421 | class3->process[PROCESS_POST_STOP] = process_new (class3); | 4397 | class3->process[PROCESS_POST_STOP] = process_new (class3); |
3500 | 4422 | nih_hash_add (job_classes, &class3->entry); | 4398 | nih_hash_add (job_classes, &class3->entry); |
3501 | 4423 | 4399 | ||
3502 | @@ -4521,7 +4497,6 @@ | |||
3503 | 4521 | nih_free (class1); | 4497 | nih_free (class1); |
3504 | 4522 | nih_free (class2); | 4498 | nih_free (class2); |
3505 | 4523 | nih_free (class3); | 4499 | nih_free (class3); |
3506 | 4524 | nih_free (session); | ||
3507 | 4525 | ptr = job_process_find (20, NULL); | 4500 | ptr = job_process_find (20, NULL); |
3508 | 4526 | 4501 | ||
3509 | 4527 | TEST_EQ_P (ptr, NULL); | 4502 | TEST_EQ_P (ptr, NULL); |
3510 | @@ -4539,15 +4514,11 @@ | |||
3511 | 4539 | char utmpname[PATH_MAX]; | 4514 | char utmpname[PATH_MAX]; |
3512 | 4540 | struct utmpx utmp, *utmptr; | 4515 | struct utmpx utmp, *utmptr; |
3513 | 4541 | struct timeval tv; | 4516 | struct timeval tv; |
3514 | 4542 | Session *session; | ||
3515 | 4543 | |||
3516 | 4544 | session = session_new (NULL, NULL, getuid ()); | ||
3517 | 4545 | TEST_NE_P (session, NULL); | ||
3518 | 4546 | 4517 | ||
3519 | 4547 | TEST_FUNCTION ("job_process_handler"); | 4518 | TEST_FUNCTION ("job_process_handler"); |
3520 | 4548 | program_name = "test"; | 4519 | program_name = "test"; |
3521 | 4549 | 4520 | ||
3523 | 4550 | class = job_class_new (NULL, "test", session); | 4521 | class = job_class_new (NULL, "test", NULL); |
3524 | 4551 | class->process[PROCESS_MAIN] = process_new (class); | 4522 | class->process[PROCESS_MAIN] = process_new (class); |
3525 | 4552 | class->process[PROCESS_MAIN]->command = "echo"; | 4523 | class->process[PROCESS_MAIN]->command = "echo"; |
3526 | 4553 | 4524 | ||
3527 | @@ -4765,7 +4736,6 @@ | |||
3528 | 4765 | 4736 | ||
3529 | 4766 | nih_free (job); | 4737 | nih_free (job); |
3530 | 4767 | } | 4738 | } |
3531 | 4768 | nih_free (session); | ||
3532 | 4769 | } | 4739 | } |
3533 | 4770 | 4740 | ||
3534 | 4771 | 4741 | ||
3535 | @@ -4773,6 +4743,11 @@ | |||
3536 | 4773 | main (int argc, | 4743 | main (int argc, |
3537 | 4774 | char *argv[]) | 4744 | char *argv[]) |
3538 | 4775 | { | 4745 | { |
3539 | 4746 | /* Note we do not set the UPSTART_NO_SESSIONS variable since this | ||
3540 | 4747 | * would cause these tests to fail (as they scrutinize the job | ||
3541 | 4748 | * environment). | ||
3542 | 4749 | */ | ||
3543 | 4750 | |||
3544 | 4776 | /* We re-exec this binary to test various children features. To | 4751 | /* We re-exec this binary to test various children features. To |
3545 | 4777 | * do that, we need to know the full path to the program. | 4752 | * do that, we need to know the full path to the program. |
3546 | 4778 | */ | 4753 | */ |
3547 | 4779 | 4754 | ||
3548 | === modified file 'init/tests/test_parse_conf.c' | |||
3549 | --- init/tests/test_parse_conf.c 2009-06-23 09:29:35 +0000 | |||
3550 | +++ init/tests/test_parse_conf.c 2011-04-19 09:27:29 +0000 | |||
3551 | @@ -77,6 +77,9 @@ | |||
3552 | 77 | main (int argc, | 77 | main (int argc, |
3553 | 78 | char *argv[]) | 78 | char *argv[]) |
3554 | 79 | { | 79 | { |
3555 | 80 | /* run tests in legacy (pre-session support) mode */ | ||
3556 | 81 | setenv ("UPSTART_NO_SESSIONS", "1", 1); | ||
3557 | 82 | |||
3558 | 80 | test_parse_conf (); | 83 | test_parse_conf (); |
3559 | 81 | 84 | ||
3560 | 82 | return 0; | 85 | return 0; |
3561 | 83 | 86 | ||
3562 | === modified file 'init/tests/test_parse_job.c' | |||
3563 | --- init/tests/test_parse_job.c 2011-02-23 11:04:27 +0000 | |||
3564 | +++ init/tests/test_parse_job.c 2011-04-19 09:27:29 +0000 | |||
3565 | @@ -7536,6 +7536,9 @@ | |||
3566 | 7536 | main (int argc, | 7536 | main (int argc, |
3567 | 7537 | char *argv[]) | 7537 | char *argv[]) |
3568 | 7538 | { | 7538 | { |
3569 | 7539 | /* run tests in legacy (pre-session support) mode */ | ||
3570 | 7540 | setenv ("UPSTART_NO_SESSIONS", "1", 1); | ||
3571 | 7541 | |||
3572 | 7539 | test_parse_job (); | 7542 | test_parse_job (); |
3573 | 7540 | 7543 | ||
3574 | 7541 | test_stanza_instance (); | 7544 | test_stanza_instance (); |
3575 | 7542 | 7545 | ||
3576 | === modified file 'init/tests/test_process.c' | |||
3577 | --- init/tests/test_process.c 2009-06-23 09:29:35 +0000 | |||
3578 | +++ init/tests/test_process.c 2011-04-19 09:27:29 +0000 | |||
3579 | @@ -157,6 +157,9 @@ | |||
3580 | 157 | main (int argc, | 157 | main (int argc, |
3581 | 158 | char *argv[]) | 158 | char *argv[]) |
3582 | 159 | { | 159 | { |
3583 | 160 | /* run tests in legacy (pre-session support) mode */ | ||
3584 | 161 | setenv ("UPSTART_NO_SESSIONS", "1", 1); | ||
3585 | 162 | |||
3586 | 160 | test_new (); | 163 | test_new (); |
3587 | 161 | 164 | ||
3588 | 162 | test_name (); | 165 | test_name (); |
3589 | 163 | 166 | ||
3590 | === modified file 'init/tests/test_system.c' | |||
3591 | --- init/tests/test_system.c 2009-06-23 09:29:35 +0000 | |||
3592 | +++ init/tests/test_system.c 2011-04-19 09:27:29 +0000 | |||
3593 | @@ -133,6 +133,9 @@ | |||
3594 | 133 | main (int argc, | 133 | main (int argc, |
3595 | 134 | char *argv[]) | 134 | char *argv[]) |
3596 | 135 | { | 135 | { |
3597 | 136 | /* run tests in legacy (pre-session support) mode */ | ||
3598 | 137 | setenv ("UPSTART_NO_SESSIONS", "1", 1); | ||
3599 | 138 | |||
3600 | 136 | test_kill (); | 139 | test_kill (); |
3601 | 137 | 140 | ||
3602 | 138 | return 0; | 141 | return 0; |
3603 | 139 | 142 | ||
3604 | === modified file 'po/upstart.pot' | |||
3605 | --- po/upstart.pot 2011-03-24 13:11:53 +0000 | |||
3606 | +++ po/upstart.pot 2011-04-19 09:27:29 +0000 | |||
3607 | @@ -6,9 +6,9 @@ | |||
3608 | 6 | #, fuzzy | 6 | #, fuzzy |
3609 | 7 | msgid "" | 7 | msgid "" |
3610 | 8 | msgstr "" | 8 | msgstr "" |
3612 | 9 | "Project-Id-Version: upstart 0.9.4\n" | 9 | "Project-Id-Version: upstart 0.9.5\n" |
3613 | 10 | "Report-Msgid-Bugs-To: new@bugs.launchpad.net\n" | 10 | "Report-Msgid-Bugs-To: new@bugs.launchpad.net\n" |
3615 | 11 | "POT-Creation-Date: 2011-03-24 11:26+0000\n" | 11 | "POT-Creation-Date: 2011-04-15 12:11+0100\n" |
3616 | 12 | "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" | 12 | "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" |
3617 | 13 | "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" | 13 | "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" |
3618 | 14 | "Language-Team: LANGUAGE <LL@li.org>\n" | 14 | "Language-Team: LANGUAGE <LL@li.org>\n" |
3619 | @@ -35,26 +35,26 @@ | |||
3620 | 35 | msgid "Unable to watch configuration file" | 35 | msgid "Unable to watch configuration file" |
3621 | 36 | msgstr "" | 36 | msgstr "" |
3622 | 37 | 37 | ||
3628 | 38 | #: init/conf.c:524 init/conf.c:924 | 38 | #: init/conf.c:598 |
3624 | 39 | msgid "Error while reloading configuration file" | ||
3625 | 40 | msgstr "" | ||
3626 | 41 | |||
3627 | 42 | #: init/conf.c:601 | ||
3629 | 43 | msgid "Unable to watch configuration directory" | 39 | msgid "Unable to watch configuration directory" |
3630 | 44 | msgstr "" | 40 | msgstr "" |
3631 | 45 | 41 | ||
3633 | 46 | #: init/conf.c:772 init/conf.c:904 | 42 | #: init/conf.c:769 init/conf.c:901 |
3634 | 47 | msgid "Error while loading configuration file" | 43 | msgid "Error while loading configuration file" |
3635 | 48 | msgstr "" | 44 | msgstr "" |
3636 | 49 | 45 | ||
3638 | 50 | #: init/conf.c:819 | 46 | #: init/conf.c:816 |
3639 | 51 | msgid "Configuration directory deleted" | 47 | msgid "Configuration directory deleted" |
3640 | 52 | msgstr "" | 48 | msgstr "" |
3641 | 53 | 49 | ||
3643 | 54 | #: init/conf.c:848 | 50 | #: init/conf.c:845 |
3644 | 55 | msgid "Unable to reload configuration after override deletion" | 51 | msgid "Unable to reload configuration after override deletion" |
3645 | 56 | msgstr "" | 52 | msgstr "" |
3646 | 57 | 53 | ||
3647 | 54 | #: init/conf.c:921 | ||
3648 | 55 | msgid "Error while reloading configuration file" | ||
3649 | 56 | msgstr "" | ||
3650 | 57 | |||
3651 | 58 | #: init/control.c:165 | 58 | #: init/control.c:165 |
3652 | 59 | msgid "Connection from private client" | 59 | msgid "Connection from private client" |
3653 | 60 | msgstr "" | 60 | msgstr "" |
3654 | @@ -63,25 +63,25 @@ | |||
3655 | 63 | msgid "Disconnected from system bus" | 63 | msgid "Disconnected from system bus" |
3656 | 64 | msgstr "" | 64 | msgstr "" |
3657 | 65 | 65 | ||
3659 | 66 | #: init/control.c:370 init/main.c:549 | 66 | #: init/control.c:370 init/main.c:557 |
3660 | 67 | msgid "Reloading configuration" | 67 | msgid "Reloading configuration" |
3661 | 68 | msgstr "" | 68 | msgstr "" |
3662 | 69 | 69 | ||
3664 | 70 | #: init/control.c:412 init/control.c:561 | 70 | #: init/control.c:412 init/control.c:565 |
3665 | 71 | msgid "Name may not be empty string" | 71 | msgid "Name may not be empty string" |
3666 | 72 | msgstr "" | 72 | msgstr "" |
3667 | 73 | 73 | ||
3669 | 74 | #: init/control.c:438 | 74 | #: init/control.c:442 |
3670 | 75 | #, c-format | 75 | #, c-format |
3671 | 76 | msgid "Unknown job: %s" | 76 | msgid "Unknown job: %s" |
3672 | 77 | msgstr "" | 77 | msgstr "" |
3673 | 78 | 78 | ||
3676 | 79 | #: init/control.c:569 init/job_class.c:559 init/job_class.c:758 | 79 | #: init/control.c:573 init/job_class.c:579 init/job_class.c:778 |
3677 | 80 | #: init/job_class.c:888 init/job_class.c:1023 | 80 | #: init/job_class.c:908 init/job_class.c:1043 |
3678 | 81 | msgid "Env must be KEY=VALUE pairs" | 81 | msgid "Env must be KEY=VALUE pairs" |
3679 | 82 | msgstr "" | 82 | msgstr "" |
3680 | 83 | 83 | ||
3682 | 84 | #: init/control.c:738 | 84 | #: init/control.c:742 |
3683 | 85 | msgid "The log priority given was not recognised" | 85 | msgid "The log priority given was not recognised" |
3684 | 86 | msgstr "" | 86 | msgstr "" |
3685 | 87 | 87 | ||
3686 | @@ -99,337 +99,341 @@ | |||
3687 | 99 | msgid "Event failed" | 99 | msgid "Event failed" |
3688 | 100 | msgstr "" | 100 | msgstr "" |
3689 | 101 | 101 | ||
3691 | 102 | #: init/job.c:227 | 102 | #: init/job.c:233 |
3692 | 103 | #, c-format | 103 | #, c-format |
3693 | 104 | msgid "%s goal changed from %s to %s" | 104 | msgid "%s goal changed from %s to %s" |
3694 | 105 | msgstr "" | 105 | msgstr "" |
3695 | 106 | 106 | ||
3697 | 107 | #: init/job.c:298 | 107 | #: init/job.c:304 |
3698 | 108 | #, c-format | 108 | #, c-format |
3699 | 109 | msgid "%s state changed from %s to %s" | 109 | msgid "%s state changed from %s to %s" |
3700 | 110 | msgstr "" | 110 | msgstr "" |
3701 | 111 | 111 | ||
3703 | 112 | #: init/job.c:717 init/job.c:755 | 112 | #: init/job.c:723 init/job.c:761 |
3704 | 113 | msgid "Job failed to start" | 113 | msgid "Job failed to start" |
3705 | 114 | msgstr "" | 114 | msgstr "" |
3706 | 115 | 115 | ||
3708 | 116 | #: init/job.c:730 init/job.c:766 | 116 | #: init/job.c:736 init/job.c:772 |
3709 | 117 | msgid "Job failed while stopping" | 117 | msgid "Job failed while stopping" |
3710 | 118 | msgstr "" | 118 | msgstr "" |
3711 | 119 | 119 | ||
3713 | 120 | #: init/job.c:742 init/job.c:777 | 120 | #: init/job.c:748 init/job.c:783 |
3714 | 121 | msgid "Job failed to restart" | 121 | msgid "Job failed to restart" |
3715 | 122 | msgstr "" | 122 | msgstr "" |
3716 | 123 | 123 | ||
3718 | 124 | #: init/job.c:971 | 124 | #: init/job.c:977 |
3719 | 125 | msgid "stop" | 125 | msgid "stop" |
3720 | 126 | msgstr "" | 126 | msgstr "" |
3721 | 127 | 127 | ||
3723 | 128 | #: init/job.c:973 | 128 | #: init/job.c:979 |
3724 | 129 | msgid "start" | 129 | msgid "start" |
3725 | 130 | msgstr "" | 130 | msgstr "" |
3726 | 131 | 131 | ||
3728 | 132 | #: init/job.c:975 | 132 | #: init/job.c:981 |
3729 | 133 | msgid "respawn" | 133 | msgid "respawn" |
3730 | 134 | msgstr "" | 134 | msgstr "" |
3731 | 135 | 135 | ||
3733 | 136 | #: init/job.c:1020 | 136 | #: init/job.c:1026 |
3734 | 137 | msgid "waiting" | 137 | msgid "waiting" |
3735 | 138 | msgstr "" | 138 | msgstr "" |
3736 | 139 | 139 | ||
3738 | 140 | #: init/job.c:1022 | 140 | #: init/job.c:1028 |
3739 | 141 | msgid "starting" | 141 | msgid "starting" |
3740 | 142 | msgstr "" | 142 | msgstr "" |
3741 | 143 | 143 | ||
3743 | 144 | #: init/job.c:1024 init/process.c:80 | 144 | #: init/job.c:1030 init/process.c:80 |
3744 | 145 | msgid "pre-start" | 145 | msgid "pre-start" |
3745 | 146 | msgstr "" | 146 | msgstr "" |
3746 | 147 | 147 | ||
3748 | 148 | #: init/job.c:1026 | 148 | #: init/job.c:1032 |
3749 | 149 | msgid "spawned" | 149 | msgid "spawned" |
3750 | 150 | msgstr "" | 150 | msgstr "" |
3751 | 151 | 151 | ||
3753 | 152 | #: init/job.c:1028 init/process.c:82 | 152 | #: init/job.c:1034 init/process.c:82 |
3754 | 153 | msgid "post-start" | 153 | msgid "post-start" |
3755 | 154 | msgstr "" | 154 | msgstr "" |
3756 | 155 | 155 | ||
3758 | 156 | #: init/job.c:1030 | 156 | #: init/job.c:1036 |
3759 | 157 | msgid "running" | 157 | msgid "running" |
3760 | 158 | msgstr "" | 158 | msgstr "" |
3761 | 159 | 159 | ||
3763 | 160 | #: init/job.c:1032 init/process.c:84 | 160 | #: init/job.c:1038 init/process.c:84 |
3764 | 161 | msgid "pre-stop" | 161 | msgid "pre-stop" |
3765 | 162 | msgstr "" | 162 | msgstr "" |
3766 | 163 | 163 | ||
3768 | 164 | #: init/job.c:1034 | 164 | #: init/job.c:1040 |
3769 | 165 | msgid "stopping" | 165 | msgid "stopping" |
3770 | 166 | msgstr "" | 166 | msgstr "" |
3771 | 167 | 167 | ||
3773 | 168 | #: init/job.c:1036 | 168 | #: init/job.c:1042 |
3774 | 169 | msgid "killed" | 169 | msgid "killed" |
3775 | 170 | msgstr "" | 170 | msgstr "" |
3776 | 171 | 171 | ||
3778 | 172 | #: init/job.c:1038 init/process.c:86 | 172 | #: init/job.c:1044 init/process.c:86 |
3779 | 173 | msgid "post-stop" | 173 | msgid "post-stop" |
3780 | 174 | msgstr "" | 174 | msgstr "" |
3781 | 175 | 175 | ||
3784 | 176 | #: init/job.c:1121 init/job.c:1196 init/job.c:1272 init/job_class.c:750 | 176 | #: init/job.c:1127 init/job.c:1202 init/job.c:1278 init/job_class.c:770 |
3785 | 177 | #: init/job_class.c:880 init/job_class.c:1015 | 177 | #: init/job_class.c:900 init/job_class.c:1035 |
3786 | 178 | #, c-format | 178 | #, c-format |
3787 | 179 | msgid "You do not have permission to modify job: %s" | 179 | msgid "You do not have permission to modify job: %s" |
3788 | 180 | msgstr "" | 180 | msgstr "" |
3789 | 181 | 181 | ||
3791 | 182 | #: init/job.c:1129 init/job_class.c:804 | 182 | #: init/job.c:1135 init/job_class.c:824 |
3792 | 183 | #, c-format | 183 | #, c-format |
3793 | 184 | msgid "Job is already running: %s" | 184 | msgid "Job is already running: %s" |
3794 | 185 | msgstr "" | 185 | msgstr "" |
3795 | 186 | 186 | ||
3797 | 187 | #: init/job.c:1204 init/job.c:1280 init/job_class.c:934 init/job_class.c:1068 | 187 | #: init/job.c:1210 init/job.c:1286 init/job_class.c:954 init/job_class.c:1088 |
3798 | 188 | #, c-format | 188 | #, c-format |
3799 | 189 | msgid "Job has already been stopped: %s" | 189 | msgid "Job has already been stopped: %s" |
3800 | 190 | msgstr "" | 190 | msgstr "" |
3801 | 191 | 191 | ||
3804 | 192 | #: init/job_class.c:596 init/job_class.c:641 init/job_class.c:926 | 192 | #: init/job_class.c:616 init/job_class.c:661 init/job_class.c:946 |
3805 | 193 | #: init/job_class.c:1060 | 193 | #: init/job_class.c:1080 |
3806 | 194 | #, c-format | 194 | #, c-format |
3807 | 195 | msgid "Unknown instance: %s" | 195 | msgid "Unknown instance: %s" |
3808 | 196 | msgstr "" | 196 | msgstr "" |
3809 | 197 | 197 | ||
3811 | 198 | #: init/job_process.c:278 | 198 | #: init/job_process.c:279 |
3812 | 199 | #, c-format | 199 | #, c-format |
3813 | 200 | msgid "Failed to spawn %s %s process: %s" | 200 | msgid "Failed to spawn %s %s process: %s" |
3814 | 201 | msgstr "" | 201 | msgstr "" |
3815 | 202 | 202 | ||
3817 | 203 | #: init/job_process.c:284 | 203 | #: init/job_process.c:285 |
3818 | 204 | msgid "Temporary process spawn error" | 204 | msgid "Temporary process spawn error" |
3819 | 205 | msgstr "" | 205 | msgstr "" |
3820 | 206 | 206 | ||
3822 | 207 | #: init/job_process.c:291 | 207 | #: init/job_process.c:292 |
3823 | 208 | #, c-format | 208 | #, c-format |
3824 | 209 | msgid "%s %s process (%d)" | 209 | msgid "%s %s process (%d)" |
3825 | 210 | msgstr "" | 210 | msgstr "" |
3826 | 211 | 211 | ||
3828 | 212 | #: init/job_process.c:391 | 212 | #: init/job_process.c:392 |
3829 | 213 | #, c-format | 213 | #, c-format |
3830 | 214 | msgid "Pausing %s (%d) [pre-exec] for debug" | 214 | msgid "Pausing %s (%d) [pre-exec] for debug" |
3831 | 215 | msgstr "" | 215 | msgstr "" |
3832 | 216 | 216 | ||
3834 | 217 | #: init/job_process.c:445 | 217 | #: init/job_process.c:446 |
3835 | 218 | #, c-format | 218 | #, c-format |
3836 | 219 | msgid "Failed to open system console: %s" | 219 | msgid "Failed to open system console: %s" |
3837 | 220 | msgstr "" | 220 | msgstr "" |
3838 | 221 | 221 | ||
3840 | 222 | #: init/job_process.c:661 | 222 | #: init/job_process.c:720 |
3841 | 223 | #, c-format | 223 | #, c-format |
3842 | 224 | msgid "unable to open console: %s" | 224 | msgid "unable to open console: %s" |
3843 | 225 | msgstr "" | 225 | msgstr "" |
3844 | 226 | 226 | ||
3846 | 227 | #: init/job_process.c:716 | 227 | #: init/job_process.c:775 |
3847 | 228 | #, c-format | 228 | #, c-format |
3848 | 229 | msgid "unable to set \"%s\" resource limit: %s" | 229 | msgid "unable to set \"%s\" resource limit: %s" |
3849 | 230 | msgstr "" | 230 | msgstr "" |
3850 | 231 | 231 | ||
3852 | 232 | #: init/job_process.c:721 | 232 | #: init/job_process.c:780 |
3853 | 233 | #, c-format | 233 | #, c-format |
3854 | 234 | msgid "unable to set priority: %s" | 234 | msgid "unable to set priority: %s" |
3855 | 235 | msgstr "" | 235 | msgstr "" |
3856 | 236 | 236 | ||
3858 | 237 | #: init/job_process.c:726 | 237 | #: init/job_process.c:785 |
3859 | 238 | #, c-format | 238 | #, c-format |
3860 | 239 | msgid "unable to set oom adjustment: %s" | 239 | msgid "unable to set oom adjustment: %s" |
3861 | 240 | msgstr "" | 240 | msgstr "" |
3862 | 241 | 241 | ||
3864 | 242 | #: init/job_process.c:731 | 242 | #: init/job_process.c:790 |
3865 | 243 | #, c-format | 243 | #, c-format |
3866 | 244 | msgid "unable to change root directory: %s" | 244 | msgid "unable to change root directory: %s" |
3867 | 245 | msgstr "" | 245 | msgstr "" |
3868 | 246 | 246 | ||
3870 | 247 | #: init/job_process.c:736 | 247 | #: init/job_process.c:795 |
3871 | 248 | #, c-format | 248 | #, c-format |
3872 | 249 | msgid "unable to change working directory: %s" | 249 | msgid "unable to change working directory: %s" |
3873 | 250 | msgstr "" | 250 | msgstr "" |
3874 | 251 | 251 | ||
3876 | 252 | #: init/job_process.c:741 | 252 | #: init/job_process.c:800 |
3877 | 253 | #, c-format | 253 | #, c-format |
3878 | 254 | msgid "unable to set trace: %s" | 254 | msgid "unable to set trace: %s" |
3879 | 255 | msgstr "" | 255 | msgstr "" |
3880 | 256 | 256 | ||
3882 | 257 | #: init/job_process.c:746 | 257 | #: init/job_process.c:805 |
3883 | 258 | #, c-format | 258 | #, c-format |
3884 | 259 | msgid "unable to execute: %s" | 259 | msgid "unable to execute: %s" |
3885 | 260 | msgstr "" | 260 | msgstr "" |
3886 | 261 | 261 | ||
3888 | 262 | #: init/job_process.c:777 | 262 | #: init/job_process.c:836 |
3889 | 263 | #, c-format | 263 | #, c-format |
3890 | 264 | msgid "Sending TERM signal to %s %s process (%d)" | 264 | msgid "Sending TERM signal to %s %s process (%d)" |
3891 | 265 | msgstr "" | 265 | msgstr "" |
3892 | 266 | 266 | ||
3894 | 267 | #: init/job_process.c:785 | 267 | #: init/job_process.c:844 |
3895 | 268 | #, c-format | 268 | #, c-format |
3896 | 269 | msgid "Failed to send TERM signal to %s %s process (%d): %s" | 269 | msgid "Failed to send TERM signal to %s %s process (%d): %s" |
3897 | 270 | msgstr "" | 270 | msgstr "" |
3898 | 271 | 271 | ||
3900 | 272 | #: init/job_process.c:825 | 272 | #: init/job_process.c:884 |
3901 | 273 | #, c-format | 273 | #, c-format |
3902 | 274 | msgid "Sending KILL signal to %s %s process (%d)" | 274 | msgid "Sending KILL signal to %s %s process (%d)" |
3903 | 275 | msgstr "" | 275 | msgstr "" |
3904 | 276 | 276 | ||
3906 | 277 | #: init/job_process.c:833 | 277 | #: init/job_process.c:892 |
3907 | 278 | #, c-format | 278 | #, c-format |
3908 | 279 | msgid "Failed to send KILL signal to %s %s process (%d): %s" | 279 | msgid "Failed to send KILL signal to %s %s process (%d): %s" |
3909 | 280 | msgstr "" | 280 | msgstr "" |
3910 | 281 | 281 | ||
3912 | 282 | #: init/job_process.c:882 | 282 | #: init/job_process.c:941 |
3913 | 283 | #, c-format | 283 | #, c-format |
3914 | 284 | msgid "%s %s process (%d) terminated with status %d" | 284 | msgid "%s %s process (%d) terminated with status %d" |
3915 | 285 | msgstr "" | 285 | msgstr "" |
3916 | 286 | 286 | ||
3918 | 287 | #: init/job_process.c:887 | 287 | #: init/job_process.c:946 |
3919 | 288 | #, c-format | 288 | #, c-format |
3920 | 289 | msgid "%s %s process (%d) exited normally" | 289 | msgid "%s %s process (%d) exited normally" |
3921 | 290 | msgstr "" | 290 | msgstr "" |
3922 | 291 | 291 | ||
3924 | 292 | #: init/job_process.c:902 | 292 | #: init/job_process.c:961 |
3925 | 293 | #, c-format | 293 | #, c-format |
3926 | 294 | msgid "%s %s process (%d) killed by %s signal" | 294 | msgid "%s %s process (%d) killed by %s signal" |
3927 | 295 | msgstr "" | 295 | msgstr "" |
3928 | 296 | 296 | ||
3930 | 297 | #: init/job_process.c:906 | 297 | #: init/job_process.c:965 |
3931 | 298 | #, c-format | 298 | #, c-format |
3932 | 299 | msgid "%s %s process (%d) killed by signal %d" | 299 | msgid "%s %s process (%d) killed by signal %d" |
3933 | 300 | msgstr "" | 300 | msgstr "" |
3934 | 301 | 301 | ||
3936 | 302 | #: init/job_process.c:920 | 302 | #: init/job_process.c:979 |
3937 | 303 | #, c-format | 303 | #, c-format |
3938 | 304 | msgid "%s %s process (%d) stopped by %s signal" | 304 | msgid "%s %s process (%d) stopped by %s signal" |
3939 | 305 | msgstr "" | 305 | msgstr "" |
3940 | 306 | 306 | ||
3942 | 307 | #: init/job_process.c:924 | 307 | #: init/job_process.c:983 |
3943 | 308 | #, c-format | 308 | #, c-format |
3944 | 309 | msgid "%s %s process (%d) stopped by signal %d" | 309 | msgid "%s %s process (%d) stopped by signal %d" |
3945 | 310 | msgstr "" | 310 | msgstr "" |
3946 | 311 | 311 | ||
3948 | 312 | #: init/job_process.c:938 | 312 | #: init/job_process.c:997 |
3949 | 313 | #, c-format | 313 | #, c-format |
3950 | 314 | msgid "%s %s process (%d) continued by %s signal" | 314 | msgid "%s %s process (%d) continued by %s signal" |
3951 | 315 | msgstr "" | 315 | msgstr "" |
3952 | 316 | 316 | ||
3954 | 317 | #: init/job_process.c:942 | 317 | #: init/job_process.c:1001 |
3955 | 318 | #, c-format | 318 | #, c-format |
3956 | 319 | msgid "%s %s process (%d) continued by signal %d" | 319 | msgid "%s %s process (%d) continued by signal %d" |
3957 | 320 | msgstr "" | 320 | msgstr "" |
3958 | 321 | 321 | ||
3960 | 322 | #: init/job_process.c:1077 | 322 | #: init/job_process.c:1136 |
3961 | 323 | #, c-format | 323 | #, c-format |
3962 | 324 | msgid "%s respawning too fast, stopped" | 324 | msgid "%s respawning too fast, stopped" |
3963 | 325 | msgstr "" | 325 | msgstr "" |
3964 | 326 | 326 | ||
3966 | 327 | #: init/job_process.c:1083 | 327 | #: init/job_process.c:1142 |
3967 | 328 | #, c-format | 328 | #, c-format |
3968 | 329 | msgid "%s %s process ended, respawning" | 329 | msgid "%s %s process ended, respawning" |
3969 | 330 | msgstr "" | 330 | msgstr "" |
3970 | 331 | 331 | ||
3972 | 332 | #: init/job_process.c:1323 | 332 | #: init/job_process.c:1382 |
3973 | 333 | #, c-format | 333 | #, c-format |
3974 | 334 | msgid "Failed to set ptrace options for %s %s process (%d): %s" | 334 | msgid "Failed to set ptrace options for %s %s process (%d): %s" |
3975 | 335 | msgstr "" | 335 | msgstr "" |
3976 | 336 | 336 | ||
3978 | 337 | #: init/job_process.c:1336 init/job_process.c:1531 | 337 | #: init/job_process.c:1395 init/job_process.c:1590 |
3979 | 338 | #, c-format | 338 | #, c-format |
3980 | 339 | msgid "Failed to continue traced %s %s process (%d): %s" | 339 | msgid "Failed to continue traced %s %s process (%d): %s" |
3981 | 340 | msgstr "" | 340 | msgstr "" |
3982 | 341 | 341 | ||
3984 | 342 | #: init/job_process.c:1376 init/job_process.c:1467 init/job_process.c:1522 | 342 | #: init/job_process.c:1435 init/job_process.c:1526 init/job_process.c:1581 |
3985 | 343 | #, c-format | 343 | #, c-format |
3986 | 344 | msgid "Failed to detach traced %s %s process (%d): %s" | 344 | msgid "Failed to detach traced %s %s process (%d): %s" |
3987 | 345 | msgstr "" | 345 | msgstr "" |
3988 | 346 | 346 | ||
3990 | 347 | #: init/job_process.c:1416 | 347 | #: init/job_process.c:1475 |
3991 | 348 | #, c-format | 348 | #, c-format |
3992 | 349 | msgid "Failed to deliver signal to traced %s %s process (%d): %s" | 349 | msgid "Failed to deliver signal to traced %s %s process (%d): %s" |
3993 | 350 | msgstr "" | 350 | msgstr "" |
3994 | 351 | 351 | ||
3996 | 352 | #: init/job_process.c:1451 | 352 | #: init/job_process.c:1510 |
3997 | 353 | #, c-format | 353 | #, c-format |
3998 | 354 | msgid "Failed to obtain child process id for %s %s process (%d): %s" | 354 | msgid "Failed to obtain child process id for %s %s process (%d): %s" |
3999 | 355 | msgstr "" | 355 | msgstr "" |
4000 | 356 | 356 | ||
4002 | 357 | #: init/job_process.c:1458 | 357 | #: init/job_process.c:1517 |
4003 | 358 | #, c-format | 358 | #, c-format |
4004 | 359 | msgid "%s %s process (%d) became new process (%d)" | 359 | msgid "%s %s process (%d) became new process (%d)" |
4005 | 360 | msgstr "" | 360 | msgstr "" |
4006 | 361 | 361 | ||
4008 | 362 | #: init/job_process.c:1517 | 362 | #: init/job_process.c:1576 |
4009 | 363 | #, c-format | 363 | #, c-format |
4010 | 364 | msgid "%s %s process (%d) executable changed" | 364 | msgid "%s %s process (%d) executable changed" |
4011 | 365 | msgstr "" | 365 | msgstr "" |
4012 | 366 | 366 | ||
4014 | 367 | #: init/main.c:122 | 367 | #: init/main.c:124 |
4015 | 368 | msgid "specify alternative directory to load configuration files from" | 368 | msgid "specify alternative directory to load configuration files from" |
4016 | 369 | msgstr "" | 369 | msgstr "" |
4017 | 370 | 370 | ||
4019 | 371 | #: init/main.c:125 | 371 | #: init/main.c:127 |
4020 | 372 | msgid "specify an alternative initial event (for testing)" | 372 | msgid "specify an alternative initial event (for testing)" |
4021 | 373 | msgstr "" | 373 | msgstr "" |
4022 | 374 | 374 | ||
4024 | 375 | #: init/main.c:128 | 375 | #: init/main.c:130 |
4025 | 376 | msgid "do not emit any startup event (for testing)" | 376 | msgid "do not emit any startup event (for testing)" |
4026 | 377 | msgstr "" | 377 | msgstr "" |
4027 | 378 | 378 | ||
4028 | 379 | #: init/main.c:133 | 379 | #: init/main.c:133 |
4029 | 380 | msgid "Disable user and chroot sessions" | ||
4030 | 381 | msgstr "" | ||
4031 | 382 | |||
4032 | 383 | #: init/main.c:138 | ||
4033 | 380 | msgid "use D-Bus session bus rather than system bus (for testing)" | 384 | msgid "use D-Bus session bus rather than system bus (for testing)" |
4034 | 381 | msgstr "" | 385 | msgstr "" |
4035 | 382 | 386 | ||
4037 | 383 | #: init/main.c:153 | 387 | #: init/main.c:158 |
4038 | 384 | msgid "Process management daemon." | 388 | msgid "Process management daemon." |
4039 | 385 | msgstr "" | 389 | msgstr "" |
4040 | 386 | 390 | ||
4042 | 387 | #: init/main.c:155 | 391 | #: init/main.c:160 |
4043 | 388 | msgid "" | 392 | msgid "" |
4044 | 389 | "This daemon is normally executed by the kernel and given process id 1 to " | 393 | "This daemon is normally executed by the kernel and given process id 1 to " |
4045 | 390 | "denote its special status. When executed by a user process, it will " | 394 | "denote its special status. When executed by a user process, it will " |
4046 | 391 | "actually run /sbin/telinit." | 395 | "actually run /sbin/telinit." |
4047 | 392 | msgstr "" | 396 | msgstr "" |
4048 | 393 | 397 | ||
4050 | 394 | #: init/main.c:171 util/reboot.c:166 util/shutdown.c:363 util/telinit.c:148 | 398 | #: init/main.c:176 util/reboot.c:166 util/shutdown.c:363 util/telinit.c:148 |
4051 | 395 | msgid "Need to be root" | 399 | msgid "Need to be root" |
4052 | 396 | msgstr "" | 400 | msgstr "" |
4053 | 397 | 401 | ||
4055 | 398 | #: init/main.c:180 | 402 | #: init/main.c:185 |
4056 | 399 | msgid "Not being executed as init" | 403 | msgid "Not being executed as init" |
4057 | 400 | msgstr "" | 404 | msgstr "" |
4058 | 401 | 405 | ||
4060 | 402 | #: init/main.c:230 init/main.c:459 | 406 | #: init/main.c:235 init/main.c:467 |
4061 | 403 | msgid "Unable to set root directory" | 407 | msgid "Unable to set root directory" |
4062 | 404 | msgstr "" | 408 | msgstr "" |
4063 | 405 | 409 | ||
4065 | 406 | #: init/main.c:241 | 410 | #: init/main.c:246 |
4066 | 407 | msgid "Unable to mount /proc filesystem" | 411 | msgid "Unable to mount /proc filesystem" |
4067 | 408 | msgstr "" | 412 | msgstr "" |
4068 | 409 | 413 | ||
4070 | 410 | #: init/main.c:250 | 414 | #: init/main.c:255 |
4071 | 411 | msgid "Unable to mount /sys filesystem" | 415 | msgid "Unable to mount /sys filesystem" |
4072 | 412 | msgstr "" | 416 | msgstr "" |
4073 | 413 | 417 | ||
4075 | 414 | #: init/main.c:346 | 418 | #: init/main.c:351 |
4076 | 415 | msgid "Unable to listen for private connections" | 419 | msgid "Unable to listen for private connections" |
4077 | 416 | msgstr "" | 420 | msgstr "" |
4078 | 417 | 421 | ||
4080 | 418 | #: init/main.c:476 | 422 | #: init/main.c:484 |
4081 | 419 | #, c-format | 423 | #, c-format |
4082 | 420 | msgid "Caught %s, core dumped" | 424 | msgid "Caught %s, core dumped" |
4083 | 421 | msgstr "" | 425 | msgstr "" |
4084 | 422 | 426 | ||
4086 | 423 | #: init/main.c:480 | 427 | #: init/main.c:488 |
4087 | 424 | #, c-format | 428 | #, c-format |
4088 | 425 | msgid "Caught %s, unable to dump core" | 429 | msgid "Caught %s, unable to dump core" |
4089 | 426 | msgstr "" | 430 | msgstr "" |
4090 | 427 | 431 | ||
4092 | 428 | #: init/main.c:566 | 432 | #: init/main.c:574 |
4093 | 429 | msgid "Reconnecting to system bus" | 433 | msgid "Reconnecting to system bus" |
4094 | 430 | msgstr "" | 434 | msgstr "" |
4095 | 431 | 435 | ||
4097 | 432 | #: init/main.c:572 | 436 | #: init/main.c:580 |
4098 | 433 | msgid "Unable to connect to the system bus" | 437 | msgid "Unable to connect to the system bus" |
4099 | 434 | msgstr "" | 438 | msgstr "" |
4100 | 435 | 439 | ||
4101 | @@ -437,98 +441,110 @@ | |||
4102 | 437 | msgid "main" | 441 | msgid "main" |
4103 | 438 | msgstr "" | 442 | msgstr "" |
4104 | 439 | 443 | ||
4106 | 440 | #: util/initctl.c:310 | 444 | #: util/initctl.c:318 |
4107 | 441 | msgid "Unable to connect to system bus" | 445 | msgid "Unable to connect to system bus" |
4108 | 442 | msgstr "" | 446 | msgstr "" |
4109 | 443 | 447 | ||
4111 | 444 | #: util/initctl.c:311 | 448 | #: util/initctl.c:319 |
4112 | 445 | msgid "Unable to connect to session bus" | 449 | msgid "Unable to connect to session bus" |
4113 | 446 | msgstr "" | 450 | msgstr "" |
4114 | 447 | 451 | ||
4116 | 448 | #: util/initctl.c:320 | 452 | #: util/initctl.c:328 |
4117 | 449 | #, c-format | 453 | #, c-format |
4118 | 450 | msgid "%s: --dest given without --system\n" | 454 | msgid "%s: --dest given without --system\n" |
4119 | 451 | msgstr "" | 455 | msgstr "" |
4120 | 452 | 456 | ||
4122 | 453 | #: util/initctl.c:328 | 457 | #: util/initctl.c:336 |
4123 | 454 | msgid "Unable to connect to Upstart" | 458 | msgid "Unable to connect to Upstart" |
4124 | 455 | msgstr "" | 459 | msgstr "" |
4125 | 456 | 460 | ||
4128 | 457 | #: util/initctl.c:514 util/initctl.c:649 util/initctl.c:777 util/initctl.c:912 | 461 | #: util/initctl.c:522 util/initctl.c:657 util/initctl.c:785 util/initctl.c:920 |
4129 | 458 | #: util/initctl.c:1017 | 462 | #: util/initctl.c:1025 |
4130 | 459 | #, c-format | 463 | #, c-format |
4131 | 460 | msgid "%s: missing job name\n" | 464 | msgid "%s: missing job name\n" |
4132 | 461 | msgstr "" | 465 | msgstr "" |
4133 | 462 | 466 | ||
4135 | 463 | #: util/initctl.c:963 | 467 | #: util/initctl.c:971 |
4136 | 464 | msgid "Not running" | 468 | msgid "Not running" |
4137 | 465 | msgstr "" | 469 | msgstr "" |
4138 | 466 | 470 | ||
4140 | 467 | #: util/initctl.c:1319 | 471 | #: util/initctl.c:1327 |
4141 | 468 | #, c-format | 472 | #, c-format |
4142 | 469 | msgid "%s: missing event name\n" | 473 | msgid "%s: missing event name\n" |
4143 | 470 | msgstr "" | 474 | msgstr "" |
4144 | 471 | 475 | ||
4146 | 472 | #: util/initctl.c:1517 | 476 | #: util/initctl.c:1525 |
4147 | 473 | msgid "Invalid job class" | 477 | msgid "Invalid job class" |
4148 | 474 | msgstr "" | 478 | msgstr "" |
4149 | 475 | 479 | ||
4151 | 476 | #: util/initctl.c:2218 | 480 | #: util/initctl.c:2122 |
4152 | 481 | msgid "unknown event" | ||
4153 | 482 | msgstr "" | ||
4154 | 483 | |||
4155 | 484 | #: util/initctl.c:2126 | ||
4156 | 485 | msgid "unknown job" | ||
4157 | 486 | msgstr "" | ||
4158 | 487 | |||
4159 | 488 | #: util/initctl.c:2227 | ||
4160 | 477 | msgid "use D-Bus session bus to connect to init daemon (for testing)" | 489 | msgid "use D-Bus session bus to connect to init daemon (for testing)" |
4161 | 478 | msgstr "" | 490 | msgstr "" |
4162 | 479 | 491 | ||
4164 | 480 | #: util/initctl.c:2220 | 492 | #: util/initctl.c:2229 |
4165 | 481 | msgid "use D-Bus system bus to connect to init daemon" | 493 | msgid "use D-Bus system bus to connect to init daemon" |
4166 | 482 | msgstr "" | 494 | msgstr "" |
4167 | 483 | 495 | ||
4169 | 484 | #: util/initctl.c:2222 | 496 | #: util/initctl.c:2231 |
4170 | 485 | msgid "destination well-known name on D-Bus bus" | 497 | msgid "destination well-known name on D-Bus bus" |
4171 | 486 | msgstr "" | 498 | msgstr "" |
4172 | 487 | 499 | ||
4174 | 488 | #: util/initctl.c:2235 | 500 | #: util/initctl.c:2244 |
4175 | 489 | msgid "do not wait for job to start before exiting" | 501 | msgid "do not wait for job to start before exiting" |
4176 | 490 | msgstr "" | 502 | msgstr "" |
4177 | 491 | 503 | ||
4179 | 492 | #: util/initctl.c:2247 | 504 | #: util/initctl.c:2256 |
4180 | 493 | msgid "do not wait for job to stop before exiting" | 505 | msgid "do not wait for job to stop before exiting" |
4181 | 494 | msgstr "" | 506 | msgstr "" |
4182 | 495 | 507 | ||
4184 | 496 | #: util/initctl.c:2259 | 508 | #: util/initctl.c:2268 |
4185 | 497 | msgid "do not wait for job to restart before exiting" | 509 | msgid "do not wait for job to restart before exiting" |
4186 | 498 | msgstr "" | 510 | msgstr "" |
4187 | 499 | 511 | ||
4189 | 500 | #: util/initctl.c:2298 | 512 | #: util/initctl.c:2307 |
4190 | 501 | msgid "do not wait for event to finish before exiting" | 513 | msgid "do not wait for event to finish before exiting" |
4191 | 502 | msgstr "" | 514 | msgstr "" |
4192 | 503 | 515 | ||
4194 | 504 | #: util/initctl.c:2339 | 516 | #: util/initctl.c:2348 |
4195 | 505 | msgid "" | 517 | msgid "" |
4196 | 506 | "enumerate list of events and jobs causing job created from job config to " | 518 | "enumerate list of events and jobs causing job created from job config to " |
4197 | 507 | "start/stop" | 519 | "start/stop" |
4198 | 508 | msgstr "" | 520 | msgstr "" |
4199 | 509 | 521 | ||
4201 | 510 | #: util/initctl.c:2352 | 522 | #: util/initctl.c:2361 |
4202 | 511 | msgid "ignore specified list of events (comma-separated)" | 523 | msgid "ignore specified list of events (comma-separated)" |
4203 | 512 | msgstr "" | 524 | msgstr "" |
4204 | 513 | 525 | ||
4206 | 514 | #: util/initctl.c:2361 | 526 | #: util/initctl.c:2363 |
4207 | 527 | msgid "Generate warning for any unreachable events/jobs" | ||
4208 | 528 | msgstr "" | ||
4209 | 529 | |||
4210 | 530 | #: util/initctl.c:2372 | ||
4211 | 515 | msgid "Job" | 531 | msgid "Job" |
4212 | 516 | msgstr "" | 532 | msgstr "" |
4213 | 517 | 533 | ||
4215 | 518 | #: util/initctl.c:2368 | 534 | #: util/initctl.c:2379 |
4216 | 519 | msgid "Event" | 535 | msgid "Event" |
4217 | 520 | msgstr "" | 536 | msgstr "" |
4218 | 521 | 537 | ||
4221 | 522 | #: util/initctl.c:2376 util/initctl.c:2388 util/initctl.c:2399 | 538 | #: util/initctl.c:2387 util/initctl.c:2399 util/initctl.c:2410 |
4222 | 523 | #: util/initctl.c:2410 util/initctl.c:2417 | 539 | #: util/initctl.c:2421 util/initctl.c:2428 |
4223 | 524 | msgid "JOB [KEY=VALUE]..." | 540 | msgid "JOB [KEY=VALUE]..." |
4224 | 525 | msgstr "" | 541 | msgstr "" |
4225 | 526 | 542 | ||
4227 | 527 | #: util/initctl.c:2377 | 543 | #: util/initctl.c:2388 |
4228 | 528 | msgid "Start job." | 544 | msgid "Start job." |
4229 | 529 | msgstr "" | 545 | msgstr "" |
4230 | 530 | 546 | ||
4232 | 531 | #: util/initctl.c:2378 | 547 | #: util/initctl.c:2389 |
4233 | 532 | msgid "" | 548 | msgid "" |
4234 | 533 | "JOB is the name of the job that is to be started, this may be followed by " | 549 | "JOB is the name of the job that is to be started, this may be followed by " |
4235 | 534 | "zero or more environment variables to be defined in the new job.\n" | 550 | "zero or more environment variables to be defined in the new job.\n" |
4236 | @@ -538,11 +554,11 @@ | |||
4237 | 538 | "an existing instance is already running." | 554 | "an existing instance is already running." |
4238 | 539 | msgstr "" | 555 | msgstr "" |
4239 | 540 | 556 | ||
4241 | 541 | #: util/initctl.c:2389 | 557 | #: util/initctl.c:2400 |
4242 | 542 | msgid "Stop job." | 558 | msgid "Stop job." |
4243 | 543 | msgstr "" | 559 | msgstr "" |
4244 | 544 | 560 | ||
4246 | 545 | #: util/initctl.c:2390 | 561 | #: util/initctl.c:2401 |
4247 | 546 | msgid "" | 562 | msgid "" |
4248 | 547 | "JOB is the name of the job that is to be stopped, this may be followed by " | 563 | "JOB is the name of the job that is to be stopped, this may be followed by " |
4249 | 548 | "zero or more environment variables to be passed to the job's pre-stop and " | 564 | "zero or more environment variables to be passed to the job's pre-stop and " |
4250 | @@ -552,11 +568,11 @@ | |||
4251 | 552 | "decide which of multiple instances will be stopped." | 568 | "decide which of multiple instances will be stopped." |
4252 | 553 | msgstr "" | 569 | msgstr "" |
4253 | 554 | 570 | ||
4255 | 555 | #: util/initctl.c:2400 | 571 | #: util/initctl.c:2411 |
4256 | 556 | msgid "Restart job." | 572 | msgid "Restart job." |
4257 | 557 | msgstr "" | 573 | msgstr "" |
4258 | 558 | 574 | ||
4260 | 559 | #: util/initctl.c:2401 | 575 | #: util/initctl.c:2412 |
4261 | 560 | msgid "" | 576 | msgid "" |
4262 | 561 | "JOB is the name of the job that is to be restarted, this may be followed by " | 577 | "JOB is the name of the job that is to be restarted, this may be followed by " |
4263 | 562 | "zero or more environment variables to be defined in the job after " | 578 | "zero or more environment variables to be defined in the job after " |
4264 | @@ -566,66 +582,66 @@ | |||
4265 | 566 | "decide which of multiple instances will be restarted." | 582 | "decide which of multiple instances will be restarted." |
4266 | 567 | msgstr "" | 583 | msgstr "" |
4267 | 568 | 584 | ||
4269 | 569 | #: util/initctl.c:2411 | 585 | #: util/initctl.c:2422 |
4270 | 570 | msgid "Send HUP signal to job." | 586 | msgid "Send HUP signal to job." |
4271 | 571 | msgstr "" | 587 | msgstr "" |
4272 | 572 | 588 | ||
4274 | 573 | #: util/initctl.c:2412 | 589 | #: util/initctl.c:2423 |
4275 | 574 | msgid "" | 590 | msgid "" |
4276 | 575 | "JOB is the name of the job that is to be sent the signal, this may be " | 591 | "JOB is the name of the job that is to be sent the signal, this may be " |
4277 | 576 | "followed by zero or more environment variables to distinguish between job " | 592 | "followed by zero or more environment variables to distinguish between job " |
4278 | 577 | "instances.\n" | 593 | "instances.\n" |
4279 | 578 | msgstr "" | 594 | msgstr "" |
4280 | 579 | 595 | ||
4282 | 580 | #: util/initctl.c:2418 | 596 | #: util/initctl.c:2429 |
4283 | 581 | msgid "Query status of job." | 597 | msgid "Query status of job." |
4284 | 582 | msgstr "" | 598 | msgstr "" |
4285 | 583 | 599 | ||
4287 | 584 | #: util/initctl.c:2419 | 600 | #: util/initctl.c:2430 |
4288 | 585 | msgid "" | 601 | msgid "" |
4289 | 586 | "JOB is the name of the job that is to be queried, this may be followed by " | 602 | "JOB is the name of the job that is to be queried, this may be followed by " |
4290 | 587 | "zero or more environment variables to distguish between job instances.\n" | 603 | "zero or more environment variables to distguish between job instances.\n" |
4291 | 588 | msgstr "" | 604 | msgstr "" |
4292 | 589 | 605 | ||
4294 | 590 | #: util/initctl.c:2425 | 606 | #: util/initctl.c:2436 |
4295 | 591 | msgid "List known jobs." | 607 | msgid "List known jobs." |
4296 | 592 | msgstr "" | 608 | msgstr "" |
4297 | 593 | 609 | ||
4299 | 594 | #: util/initctl.c:2426 | 610 | #: util/initctl.c:2437 |
4300 | 595 | msgid "The known jobs and their current status will be output." | 611 | msgid "The known jobs and their current status will be output." |
4301 | 596 | msgstr "" | 612 | msgstr "" |
4302 | 597 | 613 | ||
4304 | 598 | #: util/initctl.c:2429 | 614 | #: util/initctl.c:2440 |
4305 | 599 | msgid "EVENT [KEY=VALUE]..." | 615 | msgid "EVENT [KEY=VALUE]..." |
4306 | 600 | msgstr "" | 616 | msgstr "" |
4307 | 601 | 617 | ||
4309 | 602 | #: util/initctl.c:2430 | 618 | #: util/initctl.c:2441 |
4310 | 603 | msgid "Emit an event." | 619 | msgid "Emit an event." |
4311 | 604 | msgstr "" | 620 | msgstr "" |
4312 | 605 | 621 | ||
4314 | 606 | #: util/initctl.c:2431 | 622 | #: util/initctl.c:2442 |
4315 | 607 | msgid "" | 623 | msgid "" |
4316 | 608 | "EVENT is the name of an event the init daemon should emit, this may be " | 624 | "EVENT is the name of an event the init daemon should emit, this may be " |
4317 | 609 | "followed by zero or more environment variables to be included in the event.\n" | 625 | "followed by zero or more environment variables to be included in the event.\n" |
4318 | 610 | msgstr "" | 626 | msgstr "" |
4319 | 611 | 627 | ||
4321 | 612 | #: util/initctl.c:2437 | 628 | #: util/initctl.c:2448 |
4322 | 613 | msgid "Reload the configuration of the init daemon." | 629 | msgid "Reload the configuration of the init daemon." |
4323 | 614 | msgstr "" | 630 | msgstr "" |
4324 | 615 | 631 | ||
4326 | 616 | #: util/initctl.c:2441 | 632 | #: util/initctl.c:2452 |
4327 | 617 | msgid "Request the version of the init daemon." | 633 | msgid "Request the version of the init daemon." |
4328 | 618 | msgstr "" | 634 | msgstr "" |
4329 | 619 | 635 | ||
4331 | 620 | #: util/initctl.c:2444 | 636 | #: util/initctl.c:2455 |
4332 | 621 | msgid "[PRIORITY]" | 637 | msgid "[PRIORITY]" |
4333 | 622 | msgstr "" | 638 | msgstr "" |
4334 | 623 | 639 | ||
4336 | 624 | #: util/initctl.c:2445 | 640 | #: util/initctl.c:2456 |
4337 | 625 | msgid "Change the minimum priority of log messages from the init daemon" | 641 | msgid "Change the minimum priority of log messages from the init daemon" |
4338 | 626 | msgstr "" | 642 | msgstr "" |
4339 | 627 | 643 | ||
4341 | 628 | #: util/initctl.c:2447 | 644 | #: util/initctl.c:2458 |
4342 | 629 | msgid "" | 645 | msgid "" |
4343 | 630 | "PRIORITY may be one of:\n" | 646 | "PRIORITY may be one of:\n" |
4344 | 631 | " `debug' (messages useful for debugging upstart are logged, equivalent to --" | 647 | " `debug' (messages useful for debugging upstart are logged, equivalent to --" |
4345 | @@ -642,25 +658,25 @@ | |||
4346 | 642 | "Without arguments, this outputs the current log priority." | 658 | "Without arguments, this outputs the current log priority." |
4347 | 643 | msgstr "" | 659 | msgstr "" |
4348 | 644 | 660 | ||
4350 | 645 | #: util/initctl.c:2464 util/initctl.c:2470 | 661 | #: util/initctl.c:2475 util/initctl.c:2481 |
4351 | 646 | msgid "[CONF]" | 662 | msgid "[CONF]" |
4352 | 647 | msgstr "" | 663 | msgstr "" |
4353 | 648 | 664 | ||
4355 | 649 | #: util/initctl.c:2465 | 665 | #: util/initctl.c:2476 |
4356 | 650 | msgid "Show emits, start on and stop on details for job configurations." | 666 | msgid "Show emits, start on and stop on details for job configurations." |
4357 | 651 | msgstr "" | 667 | msgstr "" |
4358 | 652 | 668 | ||
4360 | 653 | #: util/initctl.c:2466 | 669 | #: util/initctl.c:2477 |
4361 | 654 | msgid "" | 670 | msgid "" |
4362 | 655 | "If CONF specified, show configuration details for single job configuration, " | 671 | "If CONF specified, show configuration details for single job configuration, " |
4363 | 656 | "else show details for all jobs configurations.\n" | 672 | "else show details for all jobs configurations.\n" |
4364 | 657 | msgstr "" | 673 | msgstr "" |
4365 | 658 | 674 | ||
4367 | 659 | #: util/initctl.c:2471 | 675 | #: util/initctl.c:2482 |
4368 | 660 | msgid "Check for unreachable jobs/event conditions." | 676 | msgid "Check for unreachable jobs/event conditions." |
4369 | 661 | msgstr "" | 677 | msgstr "" |
4370 | 662 | 678 | ||
4372 | 663 | #: util/initctl.c:2472 | 679 | #: util/initctl.c:2483 |
4373 | 664 | msgid "" | 680 | msgid "" |
4374 | 665 | "List all jobs and events which cannot be satisfied by currently available " | 681 | "List all jobs and events which cannot be satisfied by currently available " |
4375 | 666 | "job configuration files" | 682 | "job configuration files" |
4376 | 667 | 683 | ||
4377 | === modified file 'scripts/init-checkconf.sh' | |||
4378 | --- scripts/init-checkconf.sh 2011-03-10 14:06:37 +0000 | |||
4379 | +++ scripts/init-checkconf.sh 2011-04-19 09:27:29 +0000 | |||
4380 | @@ -1,7 +1,11 @@ | |||
4381 | 1 | #!/bin/bash | 1 | #!/bin/bash |
4382 | 2 | #--------------------------------------------------------------------- | 2 | #--------------------------------------------------------------------- |
4385 | 3 | # Script to determine if specified config file is valid or not | 3 | # Script to determine if specified config file is valid or not. |
4386 | 4 | # (whether upstart can parse it successfully). | 4 | # By default, two checks are performed: |
4387 | 5 | # | ||
4388 | 6 | # - Ensure Upstart can parse overall file successfully | ||
4389 | 7 | # - Ensure all script sections are parseable by shell | ||
4390 | 8 | # | ||
4391 | 5 | #--------------------------------------------------------------------- | 9 | #--------------------------------------------------------------------- |
4392 | 6 | # | 10 | # |
4393 | 7 | # Copyright (C) 2011 Canonical Ltd. | 11 | # Copyright (C) 2011 Canonical Ltd. |
4394 | @@ -29,6 +33,7 @@ | |||
4395 | 29 | debug_enabled=n | 33 | debug_enabled=n |
4396 | 30 | file_valid=n | 34 | file_valid=n |
4397 | 31 | running=n | 35 | running=n |
4398 | 36 | check_scripts=y | ||
4399 | 32 | 37 | ||
4400 | 33 | cleanup() | 38 | cleanup() |
4401 | 34 | { | 39 | { |
4402 | @@ -55,6 +60,7 @@ | |||
4403 | 55 | --file=<file> (no default). | 60 | --file=<file> (no default). |
4404 | 56 | -i <path>, : Specify path to initctl binary | 61 | -i <path>, : Specify path to initctl binary |
4405 | 57 | --initctl-path=<path> (default=$initctl_path). | 62 | --initctl-path=<path> (default=$initctl_path). |
4406 | 63 | -s, --noscript : Do not check script sections. | ||
4407 | 58 | -x <path> : Specify path to init daemon binary | 64 | -x <path> : Specify path to init daemon binary |
4408 | 59 | --upstart-path=<path> (default=$upstart_path). | 65 | --upstart-path=<path> (default=$upstart_path). |
4409 | 60 | -h, --help : Show this help. | 66 | -h, --help : Show this help. |
4410 | @@ -85,8 +91,8 @@ | |||
4411 | 85 | args=$(getopt \ | 91 | args=$(getopt \ |
4412 | 86 | -n "$script_name" \ | 92 | -n "$script_name" \ |
4413 | 87 | -a \ | 93 | -a \ |
4416 | 88 | --options="df:hi:x:" \ | 94 | --options="df:hi:sx:" \ |
4417 | 89 | --longoptions="debug file: help initctl-path: upstart-path:" \ | 95 | --longoptions="debug file: help initctl-path: noscript upstart-path:" \ |
4418 | 90 | -- "$@") | 96 | -- "$@") |
4419 | 91 | 97 | ||
4420 | 92 | eval set -- "$args" | 98 | eval set -- "$args" |
4421 | @@ -115,6 +121,10 @@ | |||
4422 | 115 | shift | 121 | shift |
4423 | 116 | ;; | 122 | ;; |
4424 | 117 | 123 | ||
4425 | 124 | -s|--noscript) | ||
4426 | 125 | check_scripts=n | ||
4427 | 126 | ;; | ||
4428 | 127 | |||
4429 | 118 | -x|--upstart-path) | 128 | -x|--upstart-path) |
4430 | 119 | upstart_path="$2" | 129 | upstart_path="$2" |
4431 | 120 | shift | 130 | shift |
4432 | @@ -165,7 +175,7 @@ | |||
4433 | 165 | debug "upstart_out=$upstart_out" | 175 | debug "upstart_out=$upstart_out" |
4434 | 166 | 176 | ||
4435 | 167 | upstart_cmd=$(printf \ | 177 | upstart_cmd=$(printf \ |
4437 | 168 | "%s --session --no-startup-event --verbose --confdir %s" \ | 178 | "%s --session --no-sessions --no-startup-event --verbose --confdir %s" \ |
4438 | 169 | "$upstart_path" \ | 179 | "$upstart_path" \ |
4439 | 170 | "$confdir") | 180 | "$confdir") |
4440 | 171 | debug "upstart_cmd=$upstart_cmd" | 181 | debug "upstart_cmd=$upstart_cmd" |
4441 | @@ -177,7 +187,7 @@ | |||
4442 | 177 | # We handle this ourselves in cleanup(). | 187 | # We handle this ourselves in cleanup(). |
4443 | 178 | disown | 188 | disown |
4444 | 179 | 189 | ||
4446 | 180 | # wait for upstart to initialize | 190 | # wait for Upstart to initialize |
4447 | 181 | for i in $(seq 1 5) | 191 | for i in $(seq 1 5) |
4448 | 182 | do | 192 | do |
4449 | 183 | debug "Waiting for Upstart to reply over D-Bus (attempt $i)" | 193 | debug "Waiting for Upstart to reply over D-Bus (attempt $i)" |
4450 | @@ -193,9 +203,23 @@ | |||
4451 | 193 | sleep 1 | 203 | sleep 1 |
4452 | 194 | done | 204 | done |
4453 | 195 | 205 | ||
4457 | 196 | [ $running = n ] && die "failed to start upstart" | 206 | [ $running = n ] && die "failed to ask Upstart to check conf file" |
4458 | 197 | 207 | ||
4459 | 198 | debug "upstart ($upstart_cmd) running with PID $upstart_pid" | 208 | debug "Secondary Upstart ($upstart_cmd) running with PID $upstart_pid" |
4460 | 209 | |||
4461 | 210 | if [ "$check_scripts" = y ] | ||
4462 | 211 | then | ||
4463 | 212 | for section in pre-start post-start script pre-stop post-stop | ||
4464 | 213 | do | ||
4465 | 214 | if egrep -q "\<${section}\>" "$file" | ||
4466 | 215 | then | ||
4467 | 216 | cmd='sed -n "/^ *${section}/,/^ *end script/p" $file | /bin/sh -n 2>&1' | ||
4468 | 217 | errors=$(eval "$cmd") | ||
4469 | 218 | [ $? -ne 0 ] && \ | ||
4470 | 219 | die "$(printf "File $file: shell syntax invalid in $section section:\n${errors}")" | ||
4471 | 220 | fi | ||
4472 | 221 | done | ||
4473 | 222 | fi | ||
4474 | 199 | 223 | ||
4475 | 200 | if "$initctl_path" --session status "$job" >/dev/null 2>&1 | 224 | if "$initctl_path" --session status "$job" >/dev/null 2>&1 |
4476 | 201 | then | 225 | then |
4477 | @@ -205,4 +229,4 @@ | |||
4478 | 205 | fi | 229 | fi |
4479 | 206 | 230 | ||
4480 | 207 | errors=$(grep "$job" "$upstart_out"|sed "s,${confdir}/,,g") | 231 | errors=$(grep "$job" "$upstart_out"|sed "s,${confdir}/,,g") |
4482 | 208 | error "File $file: syntax invalid ($errors)" | 232 | die "$(printf "File $file: syntax invalid:\n${errors}")" |
4483 | 209 | 233 | ||
4484 | === modified file 'scripts/man/init-checkconf.8' | |||
4485 | --- scripts/man/init-checkconf.8 2011-03-07 15:02:20 +0000 | |||
4486 | +++ scripts/man/init-checkconf.8 2011-04-19 09:27:29 +0000 | |||
4487 | @@ -1,39 +1,49 @@ | |||
4489 | 1 | .TH init-checkconf 8 2011-03-07 "Upstart" | 1 | .TH init\-checkconf 8 2011-04-06 "Upstart" |
4490 | 2 | .\" | 2 | .\" |
4491 | 3 | .SH NAME | 3 | .SH NAME |
4493 | 4 | init-checkconf \- manual page for init-checkconf | 4 | init\-checkconf \- manual page for init-checkconf |
4494 | 5 | .\" | 5 | .\" |
4495 | 6 | .SH SYNOPSIS | 6 | .SH SYNOPSIS |
4497 | 7 | .B init-checkconf | 7 | .B init\-checkconf |
4498 | 8 | .RI [ OPTIONS ] " file " | 8 | .RI [ OPTIONS ] " file " |
4499 | 9 | 9 | ||
4502 | 10 | .B init-checkconf | 10 | .B init\-checkconf |
4503 | 11 | .RI [ OPTIONS ] " " "-f" " file " | 11 | .RI [ OPTIONS ] " " "\-f" " file " |
4504 | 12 | .\" | 12 | .\" |
4505 | 13 | .SH DESCRIPTION | 13 | .SH DESCRIPTION |
4506 | 14 | Determine if specified Upstart | 14 | Determine if specified Upstart |
4507 | 15 | .BR init (8) | 15 | .BR init (8) |
4508 | 16 | job configuration file is valid. | 16 | job configuration file is valid. |
4509 | 17 | .P | ||
4510 | 18 | By default, two checks are performed: | ||
4511 | 19 | .IP \(bu 4 | ||
4512 | 20 | Ensure Upstart can parse overall file successfully | ||
4513 | 21 | .IP \(bu 4 | ||
4514 | 22 | Ensure all script sections are parseable by shell | ||
4515 | 23 | .P | ||
4516 | 17 | .\" | 24 | .\" |
4517 | 18 | .SH OPTIONS | 25 | .SH OPTIONS |
4518 | 19 | .TP | 26 | .TP |
4520 | 20 | .B -d | 27 | .BR \-d " , " \-\-debug |
4521 | 21 | Show some debug output. | 28 | Show some debug output. |
4522 | 22 | .TP | 29 | .TP |
4524 | 23 | .B -f \fIfile\fP | 30 | .BR \-f " \fIfile\fP" " , " \-\-file=\fIfile\fP |
4525 | 24 | Specify job configuration file to check. | 31 | Specify job configuration file to check. |
4526 | 25 | .TP | 32 | .TP |
4528 | 26 | .B -i \fIpath\fP | 33 | .BR \-i " \fIpath\fP" " , " \-\-initctl\-path=\fIpath\fP |
4529 | 27 | Specify path to | 34 | Specify path to |
4530 | 28 | .BR initctl (8) | 35 | .BR initctl (8) |
4531 | 29 | binary. | 36 | binary. |
4532 | 30 | .TP | 37 | .TP |
4534 | 31 | .B -x \fIpath\fP | 38 | .BR \-s " , " \-\-noscript |
4535 | 39 | Do not check script sections. | ||
4536 | 40 | .TP | ||
4537 | 41 | .BR \-x " \fIpath\fP" " , " \-\-upstart\-path=\fIpath\fP | ||
4538 | 32 | Specify path to | 42 | Specify path to |
4539 | 33 | .BR init (8) | 43 | .BR init (8) |
4540 | 34 | binary. | 44 | binary. |
4541 | 35 | .TP | 45 | .TP |
4543 | 36 | .B -h | 46 | .BR \-h " , " \-\-help |
4544 | 37 | Display usage statement. | 47 | Display usage statement. |
4545 | 38 | .\" | 48 | .\" |
4546 | 39 | .SH AUTHOR | 49 | .SH AUTHOR |
4547 | @@ -51,4 +61,6 @@ | |||
4548 | 51 | warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | 61 | warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
4549 | 52 | .\" | 62 | .\" |
4550 | 53 | .SH SEE ALSO | 63 | .SH SEE ALSO |
4551 | 64 | .BR sh (1) | ||
4552 | 65 | .BR init (5) | ||
4553 | 54 | .BR init (8) | 66 | .BR init (8) |
4554 | 55 | 67 | ||
4555 | === modified file 'util/initctl.c' | |||
4556 | --- util/initctl.c 2011-03-15 12:15:28 +0000 | |||
4557 | +++ util/initctl.c 2011-04-19 09:27:29 +0000 | |||
4558 | @@ -194,6 +194,14 @@ | |||
4559 | 194 | int check_config_mode = FALSE; | 194 | int check_config_mode = FALSE; |
4560 | 195 | 195 | ||
4561 | 196 | /** | 196 | /** |
4562 | 197 | * check_config_warn: | ||
4563 | 198 | * | ||
4564 | 199 | * If TRUE, check-config will generate a warning for *any* unreachable | ||
4565 | 200 | * events/jobs. | ||
4566 | 201 | **/ | ||
4567 | 202 | int check_config_warn = FALSE; | ||
4568 | 203 | |||
4569 | 204 | /** | ||
4570 | 197 | * check_config_data: | 205 | * check_config_data: |
4571 | 198 | * | 206 | * |
4572 | 199 | * Used to record details of all known jobs and events. | 207 | * Used to record details of all known jobs and events. |
4573 | @@ -1959,7 +1967,7 @@ | |||
4574 | 1959 | * this node based on children | 1967 | * this node based on children |
4575 | 1960 | * and type of operator. | 1968 | * and type of operator. |
4576 | 1961 | */ | 1969 | */ |
4578 | 1962 | if (IS_OP_AND (expr)) | 1970 | if (IS_OP_AND (expr) || check_config_warn) |
4579 | 1963 | node->value = first->value && second->value; | 1971 | node->value = first->value && second->value; |
4580 | 1964 | else | 1972 | else |
4581 | 1965 | node->value = first->value || second->value; | 1973 | node->value = first->value || second->value; |
4582 | @@ -2110,12 +2118,13 @@ | |||
4583 | 2110 | const char *job = expr->job_in_error; | 2118 | const char *job = expr->job_in_error; |
4584 | 2111 | 2119 | ||
4585 | 2112 | if (event) | 2120 | if (event) |
4587 | 2113 | nih_message (" %s: unknown event %s", condition, event); | 2121 | nih_message (" %s: %s %s", condition, |
4588 | 2122 | _("unknown event"), event); | ||
4589 | 2114 | 2123 | ||
4590 | 2115 | if (job) | 2124 | if (job) |
4592 | 2116 | nih_message (" %s: unknown job %s", condition, job); | 2125 | nih_message (" %s: %s %s", condition, |
4593 | 2126 | _("unknown job"), job); | ||
4594 | 2117 | } | 2127 | } |
4595 | 2118 | |||
4596 | 2119 | } | 2128 | } |
4597 | 2120 | 2129 | ||
4598 | 2121 | 2130 | ||
4599 | @@ -2349,8 +2358,10 @@ | |||
4600 | 2349 | * Command-line options accepted for the check-config command. | 2358 | * Command-line options accepted for the check-config command. |
4601 | 2350 | **/ | 2359 | **/ |
4602 | 2351 | NihOption check_config_options[] = { | 2360 | NihOption check_config_options[] = { |
4604 | 2352 | { 0, "ignore-events", N_("ignore specified list of events (comma-separated)"), | 2361 | { 'i', "ignore-events", N_("ignore specified list of events (comma-separated)"), |
4605 | 2353 | NULL, "EVENT_LIST", NULL, ignored_events_setter }, | 2362 | NULL, "EVENT_LIST", NULL, ignored_events_setter }, |
4606 | 2363 | { 'w', "warn", N_("Generate warning for any unreachable events/jobs"), | ||
4607 | 2364 | NULL, NULL, &check_config_warn, NULL }, | ||
4608 | 2354 | NIH_OPTION_LAST | 2365 | NIH_OPTION_LAST |
4609 | 2355 | }; | 2366 | }; |
4610 | 2356 | /** | 2367 | /** |
4611 | 2357 | 2368 | ||
4612 | === modified file 'util/man/initctl.8' | |||
4613 | --- util/man/initctl.8 2011-03-10 14:06:37 +0000 | |||
4614 | +++ util/man/initctl.8 2011-04-19 09:27:29 +0000 | |||
4615 | @@ -494,7 +494,7 @@ | |||
4616 | 494 | 494 | ||
4617 | 495 | .B OPTIONS | 495 | .B OPTIONS |
4618 | 496 | .RS | 496 | .RS |
4620 | 497 | .IP "\fB\-\-ignore\-events\fP \fI[EVENTS]\fP" | 497 | .IP "\fB-i\fP \fI[EVENTS]\fP, \fB\-\-ignore\-events\fP \fI[EVENTS]\fP" |
4621 | 498 | 498 | ||
4622 | 499 | If specified, the argument should be a list of comma\-separated events to | 499 | If specified, the argument should be a list of comma\-separated events to |
4623 | 500 | ignore when checking the job configuration files. | 500 | ignore when checking the job configuration files. |
4624 | @@ -504,6 +504,8 @@ | |||
4625 | 504 | 504 | ||
4626 | 505 | Note that internal events (such as \fBstartup\fP(7) and | 505 | Note that internal events (such as \fBstartup\fP(7) and |
4627 | 506 | \fBstarting\fP(7)) are automatically ignored. | 506 | \fBstarting\fP(7)) are automatically ignored. |
4628 | 507 | .IP "\fB-w\fP, \fB\-\-warn\fP" | ||
4629 | 508 | If specified, treat \fIany\fP unknown jobs and events as errors. | ||
4630 | 507 | 509 | ||
4631 | 508 | .\" | 510 | .\" |
4632 | 509 | .SH AUTHOR | 511 | .SH AUTHOR |
4633 | 510 | 512 | ||
4634 | === modified file 'util/tests/test_initctl.c' | |||
4635 | --- util/tests/test_initctl.c 2011-03-15 11:32:15 +0000 | |||
4636 | +++ util/tests/test_initctl.c 2011-04-19 09:27:29 +0000 | |||
4637 | @@ -49,6 +49,7 @@ | |||
4638 | 49 | /* remember we run from the 'util' directory */ | 49 | /* remember we run from the 'util' directory */ |
4639 | 50 | #define UPSTART_BINARY "../init/init" | 50 | #define UPSTART_BINARY "../init/init" |
4640 | 51 | #define INITCTL_BINARY "./initctl --session" | 51 | #define INITCTL_BINARY "./initctl --session" |
4641 | 52 | |||
4642 | 52 | #define BUFFER_SIZE 1024 | 53 | #define BUFFER_SIZE 1024 |
4643 | 53 | 54 | ||
4644 | 54 | /** | 55 | /** |
4645 | @@ -74,7 +75,9 @@ | |||
4646 | 74 | \ | 75 | \ |
4647 | 75 | if (pid == 0) \ | 76 | if (pid == 0) \ |
4648 | 76 | execlp (UPSTART_BINARY, UPSTART_BINARY, \ | 77 | execlp (UPSTART_BINARY, UPSTART_BINARY, \ |
4650 | 77 | "--session", "--no-startup-event", \ | 78 | "--session", \ |
4651 | 79 | "--no-startup-event", \ | ||
4652 | 80 | "--no-sessions", \ | ||
4653 | 78 | NULL); \ | 81 | NULL); \ |
4654 | 79 | \ | 82 | \ |
4655 | 80 | while (attempts) { \ | 83 | while (attempts) { \ |
4656 | @@ -138,11 +141,11 @@ | |||
4657 | 138 | * @len: size_t pointer which will be set to length of @result. | 141 | * @len: size_t pointer which will be set to length of @result. |
4658 | 139 | * | 142 | * |
4659 | 140 | * Run a command and return its standard output. It is the callers | 143 | * Run a command and return its standard output. It is the callers |
4661 | 141 | * responsibility to free @result. | 144 | * responsibility to free @result. Errors from running @cmd are fatal. |
4662 | 142 | **/ | 145 | **/ |
4663 | 143 | #define RUN_COMMAND(parent, cmd, result, len) \ | 146 | #define RUN_COMMAND(parent, cmd, result, len) \ |
4664 | 144 | { \ | 147 | { \ |
4666 | 145 | FILE *initctl; \ | 148 | FILE *f; \ |
4667 | 146 | char buffer[BUFFER_SIZE]; \ | 149 | char buffer[BUFFER_SIZE]; \ |
4668 | 147 | char **ret; \ | 150 | char **ret; \ |
4669 | 148 | \ | 151 | \ |
4670 | @@ -152,20 +155,20 @@ | |||
4671 | 152 | TEST_NE_P (*result, NULL); \ | 155 | TEST_NE_P (*result, NULL); \ |
4672 | 153 | *(len) = 0; \ | 156 | *(len) = 0; \ |
4673 | 154 | \ | 157 | \ |
4676 | 155 | initctl = popen (cmd, "r"); \ | 158 | f = popen (cmd, "r"); \ |
4677 | 156 | TEST_NE_P (initctl, NULL); \ | 159 | TEST_NE_P (f, NULL); \ |
4678 | 157 | \ | 160 | \ |
4681 | 158 | while (fgets (buffer, BUFFER_SIZE, initctl)) { \ | 161 | while (fgets (buffer, BUFFER_SIZE, f)) { \ |
4682 | 159 | size_t l = strlen(buffer)-1; \ | 162 | size_t l = strlen (buffer)-1; \ |
4683 | 160 | \ | 163 | \ |
4684 | 161 | if ( buffer[l] == '\n') \ | 164 | if ( buffer[l] == '\n') \ |
4685 | 162 | buffer[l] = '\0'; \ | 165 | buffer[l] = '\0'; \ |
4686 | 163 | ret = nih_str_array_add (result, parent, len, \ | 166 | ret = nih_str_array_add (result, parent, len, \ |
4688 | 164 | buffer); \ | 167 | buffer); \ |
4689 | 165 | TEST_NE_P (ret, NULL); \ | 168 | TEST_NE_P (ret, NULL); \ |
4690 | 166 | } \ | 169 | } \ |
4693 | 167 | \ | 170 | \ |
4694 | 168 | TEST_NE (pclose(initctl), -1); \ | 171 | TEST_NE ( pclose (f), -1); \ |
4695 | 169 | } | 172 | } |
4696 | 170 | 173 | ||
4697 | 171 | /** | 174 | /** |
4698 | @@ -10946,7 +10949,6 @@ | |||
4699 | 10946 | "author \"foo\"\n" | 10949 | "author \"foo\"\n" |
4700 | 10947 | "description \"wibble\""); | 10950 | "description \"wibble\""); |
4701 | 10948 | 10951 | ||
4702 | 10949 | |||
4703 | 10950 | cmd = nih_sprintf (NULL, "%s show-config foo 2>&1", INITCTL_BINARY); | 10952 | cmd = nih_sprintf (NULL, "%s show-config foo 2>&1", INITCTL_BINARY); |
4704 | 10951 | TEST_NE_P (cmd, NULL); | 10953 | TEST_NE_P (cmd, NULL); |
4705 | 10952 | RUN_COMMAND (NULL, cmd, &output, &lines); | 10954 | RUN_COMMAND (NULL, cmd, &output, &lines); |
4706 | @@ -11790,6 +11792,47 @@ | |||
4707 | 11790 | 11792 | ||
4708 | 11791 | /*******************************************************************/ | 11793 | /*******************************************************************/ |
4709 | 11792 | 11794 | ||
4710 | 11795 | TEST_FEATURE ( | ||
4711 | 11796 | "satisfiable complex start on, satisfiable complex stop on with warnings"); | ||
4712 | 11797 | |||
4713 | 11798 | CREATE_FILE (dirname, "plymouth.conf", | ||
4714 | 11799 | "start on (starting mountall\n" | ||
4715 | 11800 | " or (hello\n" | ||
4716 | 11801 | " and (stopped gdm\n" | ||
4717 | 11802 | " or (stopped kdm\n" | ||
4718 | 11803 | " or (stopped xdm\n" | ||
4719 | 11804 | " or stopped lxdm)))))\n" | ||
4720 | 11805 | "stop on (stopping portmap\n" | ||
4721 | 11806 | " or (wibble or starting beano))\n"); | ||
4722 | 11807 | |||
4723 | 11808 | CREATE_FILE (dirname, "mountall.conf", "exec true\n"); | ||
4724 | 11809 | CREATE_FILE (dirname, "portmap.conf", | ||
4725 | 11810 | "exec true\n" | ||
4726 | 11811 | "emits hello"); | ||
4727 | 11812 | CREATE_FILE (dirname, "lxdm.conf", "exec true"); | ||
4728 | 11813 | CREATE_FILE (dirname, "wibble.conf", "emits wibble"); | ||
4729 | 11814 | CREATE_FILE (dirname, "beano.conf", "exec true"); | ||
4730 | 11815 | |||
4731 | 11816 | cmd = nih_sprintf (NULL, "%s check-config --warn 2>&1", | ||
4732 | 11817 | INITCTL_BINARY); | ||
4733 | 11818 | TEST_NE_P (cmd, NULL); | ||
4734 | 11819 | RUN_COMMAND (NULL, cmd, &output, &lines); | ||
4735 | 11820 | |||
4736 | 11821 | TEST_EQ_STR (output[0], "plymouth"); | ||
4737 | 11822 | TEST_EQ_STR (output[1], " start on: unknown job xdm"); | ||
4738 | 11823 | TEST_EQ_STR (output[2], " start on: unknown job kdm"); | ||
4739 | 11824 | TEST_EQ_STR (output[3], " start on: unknown job gdm"); | ||
4740 | 11825 | TEST_EQ (lines, 4); | ||
4741 | 11826 | |||
4742 | 11827 | DELETE_FILE (dirname, "plymouth.conf"); | ||
4743 | 11828 | DELETE_FILE (dirname, "mountall.conf"); | ||
4744 | 11829 | DELETE_FILE (dirname, "portmap.conf"); | ||
4745 | 11830 | DELETE_FILE (dirname, "lxdm.conf"); | ||
4746 | 11831 | DELETE_FILE (dirname, "beano.conf"); | ||
4747 | 11832 | DELETE_FILE (dirname, "wibble.conf"); | ||
4748 | 11833 | |||
4749 | 11834 | /*******************************************************************/ | ||
4750 | 11835 | |||
4751 | 11793 | STOP_UPSTART (upstart_pid); | 11836 | STOP_UPSTART (upstart_pid); |
4752 | 11794 | TEST_EQ (unsetenv ("UPSTART_CONFDIR"), 0); | 11837 | TEST_EQ (unsetenv ("UPSTART_CONFDIR"), 0); |
4753 | 11795 | } | 11838 | } |
I've been testing this for over a week on two natty machines kept up to date on a daily basis. I've seen no breakage, and this fixes a critical bug. The change to upstart-job is a bit late, and could be removed, but at this point I feel its better having the package as it has been tested by some of us uploaded rather than something with only half the fixes.
Approved, and uploading to natty for release team approval.