Merge lp:~jamesodhunt/upstart/override-support into lp:~canonical-scott/upstart/trunk
- override-support
- Merge into trunk
Status: | Superseded |
---|---|
Proposed branch: | lp:~jamesodhunt/upstart/override-support |
Merge into: | lp:~canonical-scott/upstart/trunk |
Diff against target: |
4846 lines (+2341/-335) 12 files modified
init/conf.c (+492/-52) init/conf.h (+40/-0) init/job_class.c (+1/-1) init/man/init.5 (+144/-23) init/man/init.8 (+2/-1) init/parse_conf.c (+6/-0) init/parse_job.c (+18/-6) init/parse_job.h (+3/-3) init/paths.h (+50/-0) init/tests/test_conf.c (+1295/-2) init/tests/test_parse_job.c (+282/-243) util/man/initctl.8 (+8/-4) |
To merge this branch: | bzr merge lp:~jamesodhunt/upstart/override-support |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Scott James Remnant | Pending | ||
Review via email: mp+45956@code.launchpad.net |
This proposal has been superseded by a proposal from 2011-01-17.
Commit message
Description of the change
Implemented override feature on blueprint:
https:/
Details:
* Generic
- fixed typos.
- addition of debug functions useful for gdb sessions (available
only in DEBUG build).
* init/conf.c:
- (toggle_conf_name): New function which convert a conf file
name to an override name and vice versa.
- (conf_reload): Removed ENOENT check to ensure error thrown if
conf files/dirs do not exist.
- (conf_reload_path): Now takes an extra override_path parameter.
- (is_conf_
functions to determine type of given file path.
- majority of remaining functions updated to handle override
files.
* init/man/init.5: Updated to document override file support.
* init/man/init.8: Added reference to control-
* init/parse_conf.c: Added assertion to remind us forcibly to add
override-
'init.conf'.
* init/parse_job.c (parse_job): Additional parameter 'update' to
allow override files to replace existing Job details.
* init/test_conf.c
- test_override(): New function.
- test_toggle_
* init/test_
- Updated for extra parse_job() parameter
- added a test feature to test_parse_job() to exercise new
parameter to parse_job().
* util/man/initctl.8: Clarified what it means to restart a job.
To test:
make check
Scott James Remnant (scott) wrote : | # |
- 1260. By James Hunt
-
* Generic
- fixed typos.
- addition of debug functions useful for gdb sessions (available
only in DEBUG build).
* init/conf.c:
- (conf_reload): Removed ENOENT check to ensure error thrown if
conf files/dirs do not exist.
- (conf_reload_path): Now takes an extra override_path parameter.
- (is_conf_file/is_ conf_file_ std/is_ conf_file_ override) : New
functions to determine type of given file path.
- (toggle_conf_name): New function which convert a conf file
name to an override name and vice versa.
- majority of remaining functions updated to handle override
files.
* init/man/init.5: Updated to document override file support.
* init/man/init.8: Added reference to control-alt-delete( 7) man page.
* init/paths.h: New macros CONF_EXT_OVERRIDE, CONF_EXT_STD,
IS_CONF_FILE_OVERRIDE and IS_CONF_FILE_STD.
* init/parse_conf.c: Added assertion to remind us forcibly to add
override-handling code for directories if we ever allow content in
'init.conf'.
* init/parse_job.c (parse_job): Additional parameter 'update' to
allow override files to replace existing Job details.
* init/test_conf.c
- New macros TEST_ENSURE_CLEAN_ENV( ) and
TEST_FORCE_WATCH_ UPDATE( ).
- test_override(): New function.
- test_toggle_conf_name( ): New function.
* init/test_parse_job. c:
- Updated for extra parse_job() parameter
- added a test feature to test_parse_job() to exercise new
parameter to parse_job().
* util/man/initctl.8: Clarified what it means to restart a job. - 1261. By James Hunt
-
* (debug_
count_list_ entries) : Fixed debug function which always counted
conf_sources list, rather than that specified.
Philipp Schlesinger (philipp-sadleder) wrote : | # |
Hello!
New message, please read <http://
<email address hidden>
Philipp Schlesinger (philipp-sadleder) wrote : | # |
Hey, Don't miss up this new stuff, you're going to be delighted, read more here <http://
Best, <email address hidden>
Philipp Schlesinger (philipp-sadleder) wrote : | # |
Hello friend,
Look what I've found on the web, it is something new and really cool, you'lllove it. More info here <http://
Sincerely yours, philipp
Philipp Schlesinger (philipp-sadleder) wrote : | # |
Yo!
Have you read this new book already? I'm so delighted with it, please read it here http://
Hugs, philipp
Philipp Schlesinger (philipp-sadleder) wrote : | # |
Hey,
I'd like to show you a nice gift a friend of mine gave me recently, it's something really cool)) Please take a look http://
Hope this helps, philipp
Philipp Schlesinger (philipp-sadleder) wrote : | # |
Hello,
I know you're interested in stuff like that, that is something really cool, just take a look http://
Hope this helps, philipp
Philipp Schlesinger (philipp-sadleder) wrote : | # |
Dear,
I was amazed by that shocking article I've recently read, please read it and tell me your opinion http://
Warmest regards, philipp
Philipp Schlesinger (philipp-sadleder) wrote : | # |
Hello friend,
I've recently came across that amazing stuff, it looks nice I think, take a look http://
Yours sincerely, philipp
Philipp Schlesinger (philipp-sadleder) wrote : | # |
Yo!
I've recently seen some nice stuff that might be useful for you, just take a look http://
My Best, philipp
Unmerged revisions
- 1261. By James Hunt
-
* (debug_
count_list_ entries) : Fixed debug function which always counted
conf_sources list, rather than that specified. - 1260. By James Hunt
-
* Generic
- fixed typos.
- addition of debug functions useful for gdb sessions (available
only in DEBUG build).
* init/conf.c:
- (conf_reload): Removed ENOENT check to ensure error thrown if
conf files/dirs do not exist.
- (conf_reload_path): Now takes an extra override_path parameter.
- (is_conf_file/is_ conf_file_ std/is_ conf_file_ override) : New
functions to determine type of given file path.
- (toggle_conf_name): New function which convert a conf file
name to an override name and vice versa.
- majority of remaining functions updated to handle override
files.
* init/man/init.5: Updated to document override file support.
* init/man/init.8: Added reference to control-alt-delete( 7) man page.
* init/paths.h: New macros CONF_EXT_OVERRIDE, CONF_EXT_STD,
IS_CONF_FILE_OVERRIDE and IS_CONF_FILE_STD.
* init/parse_conf.c: Added assertion to remind us forcibly to add
override-handling code for directories if we ever allow content in
'init.conf'.
* init/parse_job.c (parse_job): Additional parameter 'update' to
allow override files to replace existing Job details.
* init/test_conf.c
- New macros TEST_ENSURE_CLEAN_ENV( ) and
TEST_FORCE_WATCH_ UPDATE( ).
- test_override(): New function.
- test_toggle_conf_name( ): New function.
* init/test_parse_job. c:
- Updated for extra parse_job() parameter
- added a test feature to test_parse_job() to exercise new
parameter to parse_job().
* util/man/initctl.8: Clarified what it means to restart a job.
Preview Diff
1 | === modified file 'init/conf.c' |
2 | --- init/conf.c 2009-07-08 21:05:59 +0000 |
3 | +++ init/conf.c 2011-01-17 15:53:13 +0000 |
4 | @@ -48,7 +48,7 @@ |
5 | #include "parse_conf.h" |
6 | #include "conf.h" |
7 | #include "errors.h" |
8 | - |
9 | +#include "paths.h" |
10 | |
11 | /* Prototypes for static functions */ |
12 | static int conf_source_reload_file (ConfSource *source) |
13 | @@ -70,9 +70,19 @@ |
14 | struct stat *statbuf) |
15 | __attribute__ ((warn_unused_result)); |
16 | |
17 | -static int conf_reload_path (ConfSource *source, const char *path) |
18 | - __attribute__ ((warn_unused_result)); |
19 | - |
20 | +static int conf_reload_path (ConfSource *source, const char *path, |
21 | + const char *override_path) |
22 | + __attribute__ ((warn_unused_result)); |
23 | + |
24 | +static inline int is_conf_file (const char *path) |
25 | + __attribute__ ((warn_unused_result)); |
26 | + |
27 | +static inline int is_conf_file_std (const char *path) |
28 | + __attribute__ ((warn_unused_result)); |
29 | + |
30 | +static inline int |
31 | +is_conf_file_override (const char *path) |
32 | + __attribute__ ((warn_unused_result)); |
33 | |
34 | /** |
35 | * conf_sources: |
36 | @@ -85,6 +95,115 @@ |
37 | |
38 | |
39 | /** |
40 | + * is_conf_file_std: |
41 | + * @path: path to check. |
42 | + * |
43 | + * Determine if specified path contains a legitimate |
44 | + * configuration file name. |
45 | + * |
46 | + * Returns: TRUE if @path contains a valid configuration file name, |
47 | + * else FALSE. |
48 | + * |
49 | + **/ |
50 | +static inline int |
51 | +is_conf_file_std (const char *path) |
52 | +{ |
53 | + char *ptr = strrchr (path, '.'); |
54 | + |
55 | + if (ptr && IS_CONF_EXT_STD (ptr)) |
56 | + return TRUE; |
57 | + |
58 | + return FALSE; |
59 | +} |
60 | + |
61 | +/** |
62 | + * is_conf_file_override: |
63 | + * @path: path to check. |
64 | + * |
65 | + * Determine if specified path contains a legitimate |
66 | + * override file name. |
67 | + * |
68 | + * Returns: TRUE if @path contains a valid override file name, |
69 | + * else FALSE. |
70 | + * |
71 | + **/ |
72 | +static inline int |
73 | +is_conf_file_override (const char *path) |
74 | +{ |
75 | + char *ptr = strrchr (path, '.'); |
76 | + |
77 | + if (ptr && IS_CONF_EXT_OVERRIDE (ptr)) |
78 | + return TRUE; |
79 | + |
80 | + return FALSE; |
81 | +} |
82 | + |
83 | +/** |
84 | + * is_conf_file: |
85 | + * @path: path to check. |
86 | + * |
87 | + * Determine if specified path contains a legitimate |
88 | + * configuration file or override file name. |
89 | + * |
90 | + * Returns: TRUE if @path contains a valid configuration |
91 | + * file or override file name, else FALSE. |
92 | + * |
93 | + **/ |
94 | +static inline int |
95 | +is_conf_file (const char *path) |
96 | +{ |
97 | + char *ptr = strrchr (path, '.'); |
98 | + |
99 | + if (ptr && IS_CONF_EXT (ptr)) |
100 | + return TRUE; |
101 | + |
102 | + return FALSE; |
103 | +} |
104 | + |
105 | +/** |
106 | + * Convert a configuration file name to an override file name and vice |
107 | + * versa. |
108 | + * |
109 | + * For example, if @path is "foo.conf", this function will return |
110 | + * "foo.override", whereas if @path is "foo.override", it will return |
111 | + * "foo.conf". |
112 | + * |
113 | + * Note that this function should be static, but isn't to allow the |
114 | + * tests to access it. |
115 | + * |
116 | + * @parent: parent of returned path, |
117 | + * @path: path to a configuration file. |
118 | + * |
119 | + * Returns: newly allocated toggled path, or NULL on error. |
120 | + **/ |
121 | +char * |
122 | +toggle_conf_name (const void *parent, |
123 | + const char *path) |
124 | +{ |
125 | + char *new_path; |
126 | + char *ext; |
127 | + char *new_ext; |
128 | + size_t len; |
129 | + |
130 | + ext = strrchr (path, '.'); |
131 | + if (!ext) |
132 | + return NULL; |
133 | + |
134 | + new_ext = IS_CONF_EXT_STD (ext) |
135 | + ? CONF_EXT_OVERRIDE |
136 | + : CONF_EXT_STD; |
137 | + |
138 | + len = strlen (new_ext); |
139 | + |
140 | + new_path = NIH_MUST (nih_strndup (parent, path, (ext - path) + len)); |
141 | + |
142 | + memcpy (new_path + (ext - path), new_ext, len); |
143 | + |
144 | + return new_path; |
145 | +} |
146 | + |
147 | + |
148 | +/** |
149 | * conf_init: |
150 | * |
151 | * Initialise the conf_sources list. |
152 | @@ -232,10 +351,9 @@ |
153 | NihError *err; |
154 | |
155 | err = nih_error_get (); |
156 | - if (err->number != ENOENT) |
157 | - nih_error ("%s: %s: %s", source->path, |
158 | - _("Unable to load configuration"), |
159 | - err->message); |
160 | + nih_error ("%s: %s: %s", source->path, |
161 | + _("Unable to load configuration"), |
162 | + err->message); |
163 | nih_free (err); |
164 | } |
165 | } |
166 | @@ -328,10 +446,16 @@ |
167 | conf_source_reload_file (ConfSource *source) |
168 | { |
169 | NihError *err = NULL; |
170 | + nih_local char *override_path = NULL; |
171 | + |
172 | + struct stat statbuf; |
173 | |
174 | nih_assert (source != NULL); |
175 | nih_assert (source->type == CONF_FILE); |
176 | |
177 | + /* this function should only be called for standard |
178 | + * configuration files. |
179 | + */ |
180 | if (! source->watch) { |
181 | nih_local char *dpath = NULL; |
182 | char *dname; |
183 | @@ -360,7 +484,7 @@ |
184 | /* Parse the file itself. If this fails, then we can discard the |
185 | * inotify error, since this one will be better. |
186 | */ |
187 | - if (conf_reload_path (source, source->path) < 0) { |
188 | + if (conf_reload_path (source, source->path, NULL) < 0) { |
189 | if (err) |
190 | nih_free (err); |
191 | |
192 | @@ -381,6 +505,26 @@ |
193 | nih_free (err); |
194 | } |
195 | |
196 | + if (! is_conf_file_std (source->path)) |
197 | + return 0; |
198 | + |
199 | + override_path = toggle_conf_name (NULL, source->path); |
200 | + |
201 | + if (stat (override_path, &statbuf) != 0) |
202 | + return 0; |
203 | + |
204 | + nih_debug ("Updating configuration for %s from %s", |
205 | + source->path, override_path); |
206 | + if (conf_reload_path (source, source->path, override_path) < 0) { |
207 | + NihError *err; |
208 | + |
209 | + err = nih_error_get (); |
210 | + nih_error ("%s: %s: %s", override_path, |
211 | + _("Error while reloading configuration file"), |
212 | + err->message); |
213 | + nih_free (err); |
214 | + } |
215 | + |
216 | return 0; |
217 | } |
218 | |
219 | @@ -500,19 +644,18 @@ |
220 | * @is_dir: TRUE of @path is a directory. |
221 | * |
222 | * This is the file filter used for the jobs directory, we only care |
223 | - * about paths with the ".conf" extension. Directories that |
224 | - * match the nih_file_ignore() function are also ignored. |
225 | - * |
226 | - * Returns: FALSE if @path ends in ".conf", or is the original source, |
227 | - * TRUE otherwise. |
228 | + * about paths with particular extensions (see IS_CONF_EXT). |
229 | + * |
230 | + * Directories that match the nih_file_ignore() function are also ignored. |
231 | + * |
232 | + * Returns: FALSE if @path ends in ".conf" or ".override", |
233 | + * or is the original source, TRUE otherwise. |
234 | **/ |
235 | static int |
236 | conf_dir_filter (ConfSource *source, |
237 | const char *path, |
238 | int is_dir) |
239 | { |
240 | - char *ptr; |
241 | - |
242 | nih_assert (source != NULL); |
243 | nih_assert (path != NULL); |
244 | |
245 | @@ -522,8 +665,7 @@ |
246 | if (is_dir) |
247 | return nih_file_ignore (NULL, path); |
248 | |
249 | - ptr = strrchr (path, '.'); |
250 | - if (ptr && (! strcmp (ptr, ".conf"))) |
251 | + if (is_conf_file (path)) |
252 | return FALSE; |
253 | |
254 | return TRUE; |
255 | @@ -545,29 +687,92 @@ |
256 | * After checking that it was a regular file that was changed, we reload it; |
257 | * we expect this to fail sometimes since the file may be only partially |
258 | * written. |
259 | - **/ |
260 | + **/ |
261 | static void |
262 | conf_create_modify_handler (ConfSource *source, |
263 | NihWatch *watch, |
264 | const char *path, |
265 | struct stat *statbuf) |
266 | { |
267 | + ConfFile *file = NULL; |
268 | + const char *error_path = path; |
269 | + nih_local char *new_path = NULL; |
270 | + int ret; |
271 | + |
272 | nih_assert (source != NULL); |
273 | nih_assert (watch != NULL); |
274 | nih_assert (path != NULL); |
275 | nih_assert (statbuf != NULL); |
276 | |
277 | + /* note that symbolic links are ignored */ |
278 | if (! S_ISREG (statbuf->st_mode)) |
279 | return; |
280 | |
281 | - if (conf_reload_path (source, path) < 0) { |
282 | + new_path = toggle_conf_name (NULL, path); |
283 | + file = (ConfFile *)nih_hash_lookup (source->files, new_path); |
284 | + |
285 | + if (is_conf_file_override (path)) { |
286 | + if (! file) { |
287 | + /* override file has no corresponding conf file */ |
288 | + nih_debug ("Ignoring orphan override file %s", path); |
289 | + return; |
290 | + } |
291 | + |
292 | + /* reload conf file */ |
293 | + nih_debug ("Loading configuration file %s", new_path); |
294 | + ret = conf_reload_path (source, new_path, NULL); |
295 | + if (ret < 0) { |
296 | + error_path = new_path; |
297 | + goto error; |
298 | + } |
299 | + |
300 | + /* overlay override settings */ |
301 | + nih_debug ("Loading override file %s for %s", path, new_path); |
302 | + ret = conf_reload_path (source, new_path, path); |
303 | + if (ret < 0) { |
304 | + error_path = path; |
305 | + goto error; |
306 | + } |
307 | + } else { |
308 | + nih_debug ("Loading configuration and override files for %s", path); |
309 | + |
310 | + /* load conf file */ |
311 | + nih_debug ("Loading configuration file %s", path); |
312 | + ret = conf_reload_path (source, path, NULL); |
313 | + if (ret < 0) { |
314 | + error_path = path; |
315 | + goto error; |
316 | + } |
317 | + |
318 | + /* ensure we ignore directory changes (which won't have overrides. */ |
319 | + if (is_conf_file_std (path)) { |
320 | + struct stat st; |
321 | + if (stat (new_path, &st) == 0) { |
322 | + /* overlay override settings */ |
323 | + nih_debug ("Loading override file %s for %s", new_path, path); |
324 | + ret = conf_reload_path (source, path, new_path); |
325 | + if (ret < 0) { |
326 | + error_path = new_path; |
327 | + goto error; |
328 | + } |
329 | + } |
330 | + |
331 | + } |
332 | + } |
333 | + |
334 | + return; |
335 | + |
336 | +error: |
337 | + { |
338 | NihError *err; |
339 | |
340 | err = nih_error_get (); |
341 | - nih_error ("%s: %s: %s", path, |
342 | - _("Error while loading configuration file"), |
343 | - err->message); |
344 | + nih_error ("%s: %s: %s", error_path, |
345 | + _("Error while loading configuration file"), |
346 | + err->message); |
347 | nih_free (err); |
348 | + if (file) |
349 | + nih_unref (file, source); |
350 | } |
351 | } |
352 | |
353 | @@ -584,13 +789,14 @@ |
354 | * |
355 | * We lookup the file in our hash table, and if we can find it, perform |
356 | * the usual deletion of it. |
357 | - **/ |
358 | + **/ |
359 | static void |
360 | conf_delete_handler (ConfSource *source, |
361 | NihWatch *watch, |
362 | const char *path) |
363 | { |
364 | ConfFile *file; |
365 | + nih_local char *new_path = NULL; |
366 | |
367 | nih_assert (source != NULL); |
368 | nih_assert (watch != NULL); |
369 | @@ -602,7 +808,11 @@ |
370 | * it's probably a directory or something, so just ignore it. |
371 | */ |
372 | file = (ConfFile *)nih_hash_lookup (source->files, path); |
373 | - if (! file) { |
374 | + /* Note we have to be careful to consider deletion of directories too. |
375 | + * This is handled implicitly by the override check which will return |
376 | + * false if passed a directory in this case. |
377 | + */ |
378 | + if (! file && ! is_conf_file_override (path)) { |
379 | if (! strcmp (watch->path, path)) { |
380 | nih_warn ("%s: %s", source->path, |
381 | _("Configuration directory deleted")); |
382 | @@ -613,7 +823,30 @@ |
383 | return; |
384 | } |
385 | |
386 | - nih_unref (file, source); |
387 | + /* non-override files (and directories) are the simple case, so handle |
388 | + * them and leave. |
389 | + */ |
390 | + if (! is_conf_file_override (path)) { |
391 | + nih_unref (file, source); |
392 | + return; |
393 | + } |
394 | + |
395 | + /* if an override file is deleted for which there is a corresponding |
396 | + * conf file, reload the conf file to remove any modifications |
397 | + * introduced by the override file. |
398 | + */ |
399 | + new_path = toggle_conf_name (NULL, path); |
400 | + file = (ConfFile *)nih_hash_lookup (source->files, new_path); |
401 | + |
402 | + if (file) { |
403 | + nih_debug ("Reloading configuration for %s on deletion of overide (%s)", |
404 | + new_path, path); |
405 | + |
406 | + if ( conf_reload_path (source, new_path, NULL) < 0 ) { |
407 | + nih_warn ("%s: %s", new_path, |
408 | + _("Unable to reload configuration after override deletion")); |
409 | + } |
410 | + } |
411 | } |
412 | |
413 | /** |
414 | @@ -636,22 +869,61 @@ |
415 | const char *path, |
416 | struct stat *statbuf) |
417 | { |
418 | + ConfFile *file = NULL; |
419 | + nih_local char *new_path = NULL; |
420 | + |
421 | nih_assert (source != NULL); |
422 | nih_assert (dirname != NULL); |
423 | nih_assert (path != NULL); |
424 | nih_assert (statbuf != NULL); |
425 | |
426 | + /* We assume that CONF_EXT_STD files are visited before |
427 | + * CONF_EXT_OVERRIDE files. Happily, this assumption is currently |
428 | + * valid since CONF_EXT_STD comes before CONF_EXT_OVERRIDE if ordered |
429 | + * alphabetically. |
430 | + * |
431 | + * If this were ever to change (for example if we decided to |
432 | + * rename the CONF_EXT_OVERRIDE files to end in ".abc", say), the logic |
433 | + * in this function would be erroneous since it would never be possible when |
434 | + * visiting an override file (before a conf file) to lookup a conf file |
435 | + * in the hash, since the conf file would not yet have been seen and thus would |
436 | + * not exist in the hash (yet). |
437 | + */ |
438 | + nih_assert (CONF_EXT_STD[1] < CONF_EXT_OVERRIDE[1]); |
439 | + |
440 | if (! S_ISREG (statbuf->st_mode)) |
441 | return 0; |
442 | |
443 | - if (conf_reload_path (source, path) < 0) { |
444 | - NihError *err; |
445 | - |
446 | - err = nih_error_get (); |
447 | - nih_error ("%s: %s: %s", path, |
448 | - _("Error while loading configuration file"), |
449 | - err->message); |
450 | - nih_free (err); |
451 | + if (is_conf_file_std (path)) { |
452 | + if (conf_reload_path (source, path, NULL) < 0) { |
453 | + NihError *err; |
454 | + |
455 | + err = nih_error_get (); |
456 | + nih_error ("%s: %s: %s", path, |
457 | + _("Error while loading configuration file"), |
458 | + err->message); |
459 | + nih_free (err); |
460 | + } |
461 | + return 0; |
462 | + } |
463 | + |
464 | + new_path = toggle_conf_name (NULL, path); |
465 | + file = (ConfFile *)nih_hash_lookup (source->files, new_path); |
466 | + |
467 | + if (file) { |
468 | + /* we're visiting an override file with an associated conf file that |
469 | + * has already been loaded, so just overlay the override file. If |
470 | + * there is no corresponding conf file, we ignore the override file. |
471 | + */ |
472 | + if (conf_reload_path (source, new_path, path) < 0) { |
473 | + NihError *err; |
474 | + |
475 | + err = nih_error_get (); |
476 | + nih_error ("%s: %s: %s", new_path, |
477 | + _("Error while reloading configuration file"), |
478 | + err->message); |
479 | + nih_free (err); |
480 | + } |
481 | } |
482 | |
483 | return 0; |
484 | @@ -661,12 +933,15 @@ |
485 | /** |
486 | * conf_reload_path: |
487 | * @source: configuration source, |
488 | - * @path: path of file to be reloaded. |
489 | + * @path: path of conf file to be reloaded. |
490 | + * @override_path: if TRUE and @path refers to a path associated with @source, |
491 | + * overlay the contents of @path into the existing @source entry for |
492 | + * @path. If FALSE, discard any existing knowledge of @path. |
493 | * |
494 | - * This function is used to parse the file at @path in the context of the |
495 | - * given configuration @source. Necessary ConfFile structures are allocated |
496 | - * and attached to @source as appropriate. CONF_FILE sources always have |
497 | - * a single ConfFile when the file exists. |
498 | + * This function is used to parse the file at @path (or @override_path) in the |
499 | + * context of the given configuration @source. Necessary ConfFile structures |
500 | + * are allocated and attached to @source as appropriate. CONF_FILE sources |
501 | + * always have a single ConfFile when the file exists. |
502 | * |
503 | * If the file has been parsed before, then the existing item is deleted and |
504 | * freed if the file fails to load, or after the new item has been parsed. |
505 | @@ -678,36 +953,43 @@ |
506 | **/ |
507 | static int |
508 | conf_reload_path (ConfSource *source, |
509 | - const char *path) |
510 | + const char *path, |
511 | + const char *override_path) |
512 | { |
513 | - ConfFile *file; |
514 | + ConfFile *file = NULL; |
515 | nih_local char *buf = NULL; |
516 | const char *start, *end; |
517 | nih_local char *name = NULL; |
518 | size_t len, pos, lineno; |
519 | NihError *err = NULL; |
520 | + const char *path_to_load; |
521 | |
522 | nih_assert (source != NULL); |
523 | nih_assert (path != NULL); |
524 | |
525 | - /* Look up the old file in memory, and then free it. In cases |
526 | - * of failure, we discard it anyway, so there's no particular reason |
527 | + path_to_load = ( override_path ? override_path : path); |
528 | + |
529 | + /* If there is no corresponding override file, look up the old |
530 | + * conf file in memory, and then free it. In cases of failure, |
531 | + * we discard it anyway, so there's no particular reason |
532 | * to keep it around anymore. |
533 | */ |
534 | file = (ConfFile *)nih_hash_lookup (source->files, path); |
535 | - if (file) |
536 | + if (! override_path && file) |
537 | nih_unref (file, source); |
538 | |
539 | /* Read the file into memory for parsing, if this fails we don't |
540 | * bother creating a new ConfFile structure for it and bail out |
541 | * now. |
542 | */ |
543 | - buf = nih_file_read (NULL, path, &len); |
544 | + buf = nih_file_read (NULL, path_to_load, &len); |
545 | if (! buf) |
546 | return -1; |
547 | |
548 | - /* Parse the file, storing the item in a new ConfFile structure. */ |
549 | - file = NIH_MUST (conf_file_new (source, path)); |
550 | + /* Create a new ConfFile structure (if no override_path was specified) */ |
551 | + file = (ConfFile *)nih_hash_lookup (source->files, path); |
552 | + if (! file) |
553 | + file = NIH_MUST (conf_file_new (source, path)); |
554 | |
555 | pos = 0; |
556 | lineno = 1; |
557 | @@ -716,7 +998,14 @@ |
558 | case CONF_FILE: |
559 | case CONF_DIR: |
560 | /* Simple file of options; usually no item attached to it. */ |
561 | - nih_debug ("Loading configuration from %s", path); |
562 | + if (override_path) { |
563 | + nih_debug ("Updating configuration for %s from %s", |
564 | + path, override_path); |
565 | + } else { |
566 | + nih_debug ("Loading configuration from %s %s", |
567 | + (source->type == CONF_DIR ? "directory" : "file"), path); |
568 | + } |
569 | + |
570 | if (parse_conf (file, buf, len, &pos, &lineno) < 0) |
571 | err = nih_error_get (); |
572 | |
573 | @@ -734,7 +1023,7 @@ |
574 | start++; |
575 | |
576 | end = strrchr (start, '.'); |
577 | - if (end && (! strcmp (end, ".conf"))) { |
578 | + if (end && IS_CONF_EXT (end)) { |
579 | name = NIH_MUST (nih_strndup (NULL, start, end - start)); |
580 | } else { |
581 | name = NIH_MUST (nih_strdup (NULL, start)); |
582 | @@ -743,8 +1032,13 @@ |
583 | /* Create a new job item and parse the buffer to produce |
584 | * the job definition. |
585 | */ |
586 | - nih_debug ("Loading %s from %s", name, path); |
587 | - file->job = parse_job (NULL, name, buf, len, &pos, &lineno); |
588 | + if (override_path) { |
589 | + nih_debug ("Updating %s (%s) with %s", |
590 | + name, path, override_path); |
591 | + } else { |
592 | + nih_debug ("Loading %s from %s", name, path); |
593 | + } |
594 | + file->job = parse_job (NULL, file->job, name, buf, len, &pos, &lineno); |
595 | if (file->job) { |
596 | job_class_consider (file->job); |
597 | } else { |
598 | @@ -778,7 +1072,7 @@ |
599 | case PARSE_EXPECTED_OPERATOR: |
600 | case PARSE_EXPECTED_VARIABLE: |
601 | case PARSE_MISMATCHED_PARENS: |
602 | - nih_error ("%s:%zi: %s", path, lineno, err->message); |
603 | + nih_error ("%s:%zi: %s", path_to_load, lineno, err->message); |
604 | nih_free (err); |
605 | err = NULL; |
606 | break; |
607 | @@ -881,3 +1175,149 @@ |
608 | |
609 | return NULL; |
610 | } |
611 | + |
612 | +#ifdef DEBUG |
613 | + |
614 | +size_t |
615 | +debug_count_list_entries (const NihList *list) |
616 | +{ |
617 | + size_t i = 0; |
618 | + NIH_LIST_FOREACH (conf_sources, iter) { |
619 | + i++; |
620 | + } |
621 | + return i; |
622 | +} |
623 | + |
624 | +size_t |
625 | +debug_count_hash_entries (const NihHash *hash) |
626 | +{ |
627 | + size_t i = 0; |
628 | + NIH_HASH_FOREACH_SAFE (hash, iter) { |
629 | + i++; |
630 | + } |
631 | + return i; |
632 | +} |
633 | + |
634 | +void |
635 | +debug_show_job_class (const JobClass *job) |
636 | +{ |
637 | + int i; |
638 | + char **env = (char **)job->env; |
639 | + char **export = (char **)job->export; |
640 | + |
641 | + nih_assert (job); |
642 | + |
643 | + nih_debug ("JobClass %p: name='%s', path='%s', task=%d, " |
644 | + "respawn=%d, console=%x, deleted=%d, debug=%d", |
645 | + job, job->name, job->path, job->task, |
646 | + job->respawn, job->console, job->deleted, job->debug); |
647 | + |
648 | + nih_debug ("\tstart_on=%p, stop_on=%p, emits=%p, process=%p", |
649 | + job->start_on, job->stop_on, job->emits, job->process); |
650 | + |
651 | + nih_debug ("\tauthor='%s', description='%s'", |
652 | + job->author, job->description); |
653 | + |
654 | + if (env && *env) { |
655 | + nih_debug ("\tenv:"); |
656 | + i = 0; |
657 | + while ( *env ) { |
658 | + nih_debug ("\t\tenv[%d]='%s' (len=%u+1)", |
659 | + i, *env, strlen (*env)); |
660 | + env++; |
661 | + ++i; |
662 | + } |
663 | + } else { |
664 | + nih_debug ("\tenv: none."); |
665 | + } |
666 | + |
667 | + |
668 | + if (export && *export) { |
669 | + nih_debug ("\texport:"); |
670 | + i = 0; |
671 | + while ( *export ) { |
672 | + nih_debug ("\t\tenv[%d]='%s' (len=%u+1)", |
673 | + i, *export, strlen (*export)); |
674 | + export++; |
675 | + ++i; |
676 | + } |
677 | + } |
678 | + else { |
679 | + nih_debug ("\texport: none"); |
680 | + } |
681 | +} |
682 | + |
683 | +void |
684 | +debug_show_job_classes (void) |
685 | +{ |
686 | + nih_debug ("job_classes:"); |
687 | + |
688 | + NIH_HASH_FOREACH_SAFE (job_classes, iter) { |
689 | + JobClass *job = (JobClass *)iter; |
690 | + debug_show_job_class (job); |
691 | + } |
692 | +} |
693 | + |
694 | +void |
695 | +debug_show_event (const Event *event) |
696 | +{ |
697 | + nih_assert (event); |
698 | + |
699 | + nih_debug ("Event %p: name='%s', progress=%x, failed=%d, " |
700 | + "blockers=%d, blocking=%p", |
701 | + event, event->name, event->progress, event->failed, |
702 | + event->blockers, (void *)&event->blocking); |
703 | +} |
704 | + |
705 | +void |
706 | +debug_show_conf_file (const ConfFile *file) |
707 | +{ |
708 | + nih_assert (file); |
709 | + |
710 | + nih_debug ("ConfFile %p: path='%s', source=%p, flag=%x, job=%p", |
711 | + file, file->path, file->source, file->flag, file->job); |
712 | + |
713 | + /* Some ConfFile objects won't have any JobClass details, for example, |
714 | + * the ConfFile object associated with "/etc/init.conf". |
715 | + */ |
716 | + if (! file->job) { |
717 | + nih_debug ("ConfFile %p: job: no JobClass object.", file); |
718 | + return; |
719 | + } |
720 | + |
721 | + nih_debug ("ConfFile %p: job:", file); |
722 | + debug_show_job_class (file->job); |
723 | +} |
724 | + |
725 | +void |
726 | +debug_show_conf_source (const ConfSource *source) |
727 | +{ |
728 | + nih_assert (source); |
729 | + |
730 | + nih_debug ("ConfSource %p: path='%s', type=%x, flag=%x", |
731 | + source, source->path, source->type, source->flag); |
732 | + |
733 | + nih_debug ("ConfSource %p files (%d):", source, |
734 | + debug_count_hash_entries (source->files)); |
735 | + |
736 | + NIH_HASH_FOREACH (source->files, file_iter) { |
737 | + ConfFile *file = (ConfFile *)file_iter; |
738 | + debug_show_conf_file (file); |
739 | + } |
740 | +} |
741 | + |
742 | +void |
743 | +debug_show_conf_sources (void) |
744 | +{ |
745 | + nih_assert (conf_sources); |
746 | + |
747 | + nih_debug ("conf_sources:"); |
748 | + |
749 | + NIH_LIST_FOREACH (conf_sources, iter) { |
750 | + ConfSource *source = (ConfSource *)iter; |
751 | + debug_show_conf_source (source); |
752 | + } |
753 | +} |
754 | + |
755 | +#endif /* DEBUG */ |
756 | + |
757 | |
758 | === modified file 'init/conf.h' |
759 | --- init/conf.h 2009-07-09 08:36:52 +0000 |
760 | +++ init/conf.h 2011-01-17 15:53:13 +0000 |
761 | @@ -124,6 +124,46 @@ |
762 | |
763 | JobClass * conf_select_job (const char *name); |
764 | |
765 | +char *toggle_conf_name (const void *parent, const char *path) |
766 | + __attribute__ ((warn_unused_result, malloc)); |
767 | + |
768 | +#ifdef DEBUG |
769 | + |
770 | +/* used for debugging only */ |
771 | + |
772 | +size_t |
773 | +debug_count_hash_entries (const NihHash *hash); |
774 | + |
775 | +size_t |
776 | +debug_count_list_entries (const NihList *list) |
777 | + __attribute__ ((unused)); |
778 | + |
779 | +void |
780 | +debug_show_job_class (const JobClass *job) |
781 | + __attribute__ ((unused)); |
782 | + |
783 | +void |
784 | +debug_show_job_classes (void) |
785 | + __attribute__ ((unused)); |
786 | + |
787 | +void |
788 | +debug_show_event (const Event *event) |
789 | + __attribute__ ((unused)); |
790 | + |
791 | +void |
792 | +debug_show_conf_file(const ConfFile *file) |
793 | + __attribute__ ((unused)); |
794 | + |
795 | +void |
796 | +debug_show_conf_source(const ConfSource *source) |
797 | + __attribute__ ((unused)); |
798 | + |
799 | +void |
800 | +debug_show_conf_sources(void) |
801 | + __attribute__ ((unused)); |
802 | + |
803 | +#endif |
804 | + |
805 | NIH_END_EXTERN |
806 | |
807 | #endif /* INIT_CONF_H */ |
808 | |
809 | === modified file 'init/job_class.c' |
810 | --- init/job_class.c 2010-12-14 15:30:06 +0000 |
811 | +++ init/job_class.c 2011-01-17 15:53:13 +0000 |
812 | @@ -220,7 +220,7 @@ |
813 | class->chdir = NULL; |
814 | |
815 | class->deleted = FALSE; |
816 | - class->debug = FALSE; |
817 | + class->debug = FALSE; |
818 | |
819 | return class; |
820 | |
821 | |
822 | === modified file 'init/man/init.5' |
823 | --- init/man/init.5 2010-12-14 16:20:38 +0000 |
824 | +++ init/man/init.5 2011-01-17 15:53:13 +0000 |
825 | @@ -1,42 +1,79 @@ |
826 | -.TH init 5 2010-12-14 "Upstart" |
827 | +.TH init 5 2011-01-12 "Upstart" |
828 | .\" |
829 | .SH NAME |
830 | init \- Upstart init daemon job configuration |
831 | .\" |
832 | .SH SYNOPSIS |
833 | -.B /etc/init |
834 | +.B /etc/init/ |
835 | .\" |
836 | .SH DESCRIPTION |
837 | On startup, the Upstart |
838 | .BR init (8) |
839 | -daemon reads its job configuration from the |
840 | -.I /etc/init |
841 | -directory, and watches for future changes using |
842 | +daemon reads its job configuration from files in the |
843 | +.I /etc/init/ |
844 | +directory, and watches for future changes to these files using |
845 | .BR inotify (7). |
846 | |
847 | -Files in this directory must end in |
848 | +To be considered by Upstart, files in this directory must have a |
849 | +recognized suffix and may also be present in sub-directories. There are |
850 | +two recognized suffixes: |
851 | + |
852 | +.IP \(bu 4 |
853 | +Files ending in |
854 | .I .conf |
855 | -and may also be present in sub-directories. |
856 | - |
857 | -Each file defines a single service or task, with the name taken from its |
858 | -relative path within the directory without the extension. For example a |
859 | -job defined in |
860 | +are called configuration files, or simply "conf files" for short. |
861 | +These are the primary vehicle for specifying a job. |
862 | +.IP \(bu 4 |
863 | +Files ending in |
864 | +.I .override |
865 | +are called override files. If an override file is present, the stanzas |
866 | +it contains take precedence over those equivalently named stanzas in the |
867 | +corresponding configuration file contents for a particular job. |
868 | +The main use for override files is to modify how a job will run without |
869 | +having to modify its configuration file directly. See the section |
870 | +\fBOverride File Handling\fP below for further details. |
871 | +.P |
872 | +A job can thus be defined by either: |
873 | +.IP \[bu] 2 |
874 | +A single configuration file. |
875 | +.IP \[bu] |
876 | +A single configuration file \fBand\fP a single override file. |
877 | +.P |
878 | +Unless explicitly stated otherwise, any reference to a jobs |
879 | +configuration can refer both to a configuration file or an override |
880 | +file. |
881 | + |
882 | +Each configuration file defines the template for a single \fIservice\fP |
883 | +(long-running process or daemon) or \fItask\fP (short-lived process). |
884 | + |
885 | +Note that a configuration file is not itself a job: it is a description |
886 | +of an environmenta job could be run in. A job is the runtime embodiment |
887 | +of a configuration file. |
888 | + |
889 | +The configuration file name as displayed by Upstart and associated |
890 | +tooling is taken from its relative path within the directory without the |
891 | +extension. For example a configuration file |
892 | .I /etc/init/rc-sysinit.conf |
893 | is named |
894 | .IR rc-sysinit , |
895 | -while a job defined in |
896 | +while a configuration file |
897 | .I /etc/init/net/apache.conf |
898 | is named |
899 | .IR net/apache . |
900 | +Since override files only modify the way a configuration file is |
901 | +interpreted, they are not named. |
902 | |
903 | -These files are plain text and should not be executable. |
904 | +Configuration files are plain text and should not be executable. |
905 | .\" |
906 | -.SS Format |
907 | +.SS Configuration File Format |
908 | Each line begins with a configuration stanza and continues until either |
909 | the end of the line or a line containing a closing stanza. Line breaks |
910 | within a stanza are permitted within single or double quotes, or if |
911 | preceeded by a blackslash. |
912 | |
913 | +If a stanza is duplicated, the last occurence will be used. Unrecognized |
914 | +stanzas will generate parse errors, which will stop a job from running. |
915 | + |
916 | Stanzas and their arguments are delimited by whitespace, which consists |
917 | of one or more space or tab characters which are otherwise ignored unless |
918 | placed within single or double quotes. |
919 | @@ -144,10 +181,10 @@ |
920 | such as removing temporary directories. |
921 | |
922 | .PP |
923 | -All of these processes, including the main process, are optional. Services |
924 | -without a main process will appear to be running until they are stopped, |
925 | -this is commonly used to define states such as runlevels. It's quite |
926 | -permissable to have no main process, but to have |
927 | +All of these processes, including the main process, are optional. |
928 | +Services without a main process will appear to be running until they are |
929 | +stopped: this is commonly used to define states such as runlevels. It |
930 | +is permissable to have no main process, but to have |
931 | .B pre-start |
932 | and |
933 | .B post-stop |
934 | @@ -249,7 +286,7 @@ |
935 | .B stop on |
936 | stanza defines the set of events that will cause the job to be automatically |
937 | stopped. It has the same syntax as |
938 | -.B start on |
939 | +\fBstart on\fP. |
940 | |
941 | .I VALUE |
942 | may additionally expand the value of any variable that came from the |
943 | @@ -306,7 +343,8 @@ |
944 | .B env \fIKEY\fR[=\fIVALUE\fR] |
945 | Defines a default environment variable, the value of which may be overriden |
946 | by the event or command that starts the job. |
947 | -If no value is given, then the value is taken from the |
948 | +If \'KEY=VALUE\' is specified, the variable KEY is given the value VALUE. |
949 | +If only \'KEY\' is given, then the value is taken from the |
950 | .BR init (8) |
951 | daemon's own environment. |
952 | .\" |
953 | @@ -366,7 +404,7 @@ |
954 | times in |
955 | .I INTERVAL |
956 | seconds, it will be considered to be having deeper problems and will |
957 | -be stopped. |
958 | +be stopped. Default COUNT is 10. Default INTERVAL is 5 seconds. |
959 | |
960 | This only applies to automatic respawns and not the |
961 | .BR restart (8) |
962 | @@ -385,7 +423,8 @@ |
963 | .SS Instances |
964 | By default, only one instance of any job is permitted to exist at one |
965 | time. Attempting to start a job when it's already starting or running |
966 | -results in an error. |
967 | +results in an error. Note that a job is considered to be running if its |
968 | +pre-start process is running. |
969 | |
970 | Multiple instances may be permitted by defining the names of those |
971 | instances. If an instance with the same name is not already starting |
972 | @@ -561,6 +600,46 @@ |
973 | .B unlimited |
974 | may be specified for either. |
975 | .\" |
976 | +.SS Override File Handling |
977 | +Override files allow a jobs environment to be changed without modifying |
978 | +the jobs configuration file. Rules governing override files: |
979 | + |
980 | +.IP \[bu] 2 |
981 | +If a job is embodied with only a configuration file, the contents of |
982 | +this file define the job. |
983 | +.IP \[bu] |
984 | +If an override files exists where there is no existing cofiguration |
985 | +file, the override file is ignored. |
986 | +.IP \[bu] |
987 | +If both a configuration file \fBand\fP an override file exist for a job |
988 | +and both files are syntactically correct: |
989 | +.RS |
990 | +.IP \[bu] 2 |
991 | +stanzas in the override file will take precedence over stanzas present |
992 | +in the corresponding configuration file. |
993 | +.IP \[bu] |
994 | +stanzas in the override file which are not present in the corresponding |
995 | +configuration file will be honoured when the job runs. |
996 | +.RE |
997 | +.IP \[bu] |
998 | +If both a configuration file and an override file exist for a job and |
999 | +subsequently the override file is deleted, the configuration file is |
1000 | +automatically reloaded with the effect that any changes introduced by |
1001 | +the override file are undone and the configuration file alone now defines |
1002 | +the job. |
1003 | +.IP \[bu] |
1004 | +If both a configuration file and an override file exist for a job and |
1005 | +subsequently the configuration file is deleted, a new instance of the |
1006 | +job can no longer be started (since without a corresponding |
1007 | +configuration file an override file is ignored). |
1008 | +.IP \[bu] |
1009 | +If both a configuration file and an override file exist for a job and |
1010 | +any of the contents of the override file are invalid, the override file |
1011 | +is ignored and only the contents of the configuration file are |
1012 | +considered. |
1013 | +.P |
1014 | + |
1015 | +.\" |
1016 | .SS Miscellaneous |
1017 | .TP |
1018 | .B kill timeout \fIINTERVAL |
1019 | @@ -568,7 +647,7 @@ |
1020 | .I SIGTERM |
1021 | and |
1022 | .I SIGKILL |
1023 | -signals when stopping the running job. |
1024 | +signals when stopping the running job. Default is 5 seconds. |
1025 | .\" |
1026 | .TP |
1027 | .B expect stop |
1028 | @@ -609,6 +688,48 @@ |
1029 | is unable to supervise forking processes and will believe them to have |
1030 | stopped as soon as they fork on startup. |
1031 | .\" |
1032 | +.SH BUGS |
1033 | +The |
1034 | +.B and |
1035 | +and |
1036 | +.B or |
1037 | +operators allowed with |
1038 | +.B start on |
1039 | +and |
1040 | +.B stop on |
1041 | +do not work intuitively: operands to the right of either operator are |
1042 | +only evaluated once and state information is then discarded. This can |
1043 | +lead to jobs with complex \fBstart on\fP or \fPstop on\fP conditions |
1044 | +not behaving as expected \fIwhen restarted\fP. For example, if a job |
1045 | +encodes the following condition: |
1046 | +.ti +4 |
1047 | +.sp 1 |
1048 | +.nf |
1049 | +start on A and (B or C) |
1050 | +.fi |
1051 | + |
1052 | +When 'A' and 'B' become true, the condition is satisfied so the job will |
1053 | +be run. However, if the job ends and subsequently 'A' and 'C' become true, |
1054 | +the job will \fInot\fP be re-run even though the condtion is satisfied. |
1055 | +Avoid using complex conditions with jobs which need to be restarted. |
1056 | +.\" |
1057 | +.SH AUTHOR |
1058 | +Manual page written by Scott James Remnant |
1059 | +.RB < scott@netsplit.com > |
1060 | +and James Hunt |
1061 | +.RB < james.hunt@canonical.com > . |
1062 | +.\" |
1063 | +.SH REPORTING BUGS |
1064 | +Report bugs at |
1065 | +.RB < https://launchpad.net/upstart/+bugs > |
1066 | +.\" |
1067 | +.SH COPYRIGHT |
1068 | +Copyright \(co 2010 Canonical Ltd. |
1069 | +.br |
1070 | +This is free software; see the source for copying conditions. There is NO |
1071 | +warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
1072 | + |
1073 | +.\" |
1074 | .SH SEE ALSO |
1075 | .BR init (8) |
1076 | .BR sh (1) |
1077 | |
1078 | === modified file 'init/man/init.8' |
1079 | --- init/man/init.8 2010-02-04 19:26:17 +0000 |
1080 | +++ init/man/init.8 2011-01-17 15:53:13 +0000 |
1081 | @@ -96,12 +96,13 @@ |
1082 | warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
1083 | .\" |
1084 | .SH SEE ALSO |
1085 | +.BR control-alt-delete (7) |
1086 | .BR init (5) |
1087 | .BR initctl (8) |
1088 | -.BR telinit (8) |
1089 | .BR runlevel (7) |
1090 | .BR startup (7) |
1091 | .BR starting (7) |
1092 | .BR started (7) |
1093 | .BR stopping (7) |
1094 | .BR stopped (7) |
1095 | +.BR telinit (8) |
1096 | |
1097 | === modified file 'init/parse_conf.c' |
1098 | --- init/parse_conf.c 2009-06-23 09:29:35 +0000 |
1099 | +++ init/parse_conf.c 2011-01-17 15:53:13 +0000 |
1100 | @@ -74,6 +74,12 @@ |
1101 | nih_assert (file != NULL); |
1102 | nih_assert (pos != NULL); |
1103 | |
1104 | + /* If we update 'stanzas' to allow content in init.conf, this |
1105 | + * function must be updated in a similar manner to parse_job() |
1106 | + * to handle overrides files. |
1107 | + */ |
1108 | + nih_assert (sizeof(stanzas) / sizeof(stanzas[0]) == 1); |
1109 | + |
1110 | if (nih_config_parse_file (file, len, pos, lineno, |
1111 | stanzas, conffile) < 0) |
1112 | return -1; |
1113 | |
1114 | === modified file 'init/parse_job.c' |
1115 | --- init/parse_job.c 2010-12-14 16:37:15 +0000 |
1116 | +++ init/parse_job.c 2011-01-17 15:53:13 +0000 |
1117 | @@ -263,6 +263,7 @@ |
1118 | /** |
1119 | * parse_job: |
1120 | * @parent: parent object for new job, |
1121 | + * @update: If not NULL, update the existing specified JobClass, |
1122 | * @name: name of new job, |
1123 | * @file: file or string to parse, |
1124 | * @len: length of @file, |
1125 | @@ -278,10 +279,12 @@ |
1126 | * of the returned job are freed, the returned job will also be |
1127 | * freed. |
1128 | * |
1129 | - * Returns: new JobClass structure on success, NULL on raised error. |
1130 | + * Returns: if @update is NULL, returns new JobClass structure on success, NULL on raised error. |
1131 | + * If @update is not NULL, returns @update or NULL on error. |
1132 | **/ |
1133 | JobClass * |
1134 | parse_job (const void *parent, |
1135 | + JobClass *update, |
1136 | const char *name, |
1137 | const char *file, |
1138 | size_t len, |
1139 | @@ -294,13 +297,22 @@ |
1140 | nih_assert (file != NULL); |
1141 | nih_assert (pos != NULL); |
1142 | |
1143 | - class = job_class_new (parent, name); |
1144 | - if (! class) |
1145 | - nih_return_system_error (NULL); |
1146 | + if (update) { |
1147 | + class = update; |
1148 | + nih_debug ("Reusing JobClass %s (%s)", |
1149 | + class->name, class->path); |
1150 | + } else { |
1151 | + nih_debug ("Creating new JobClass %s", |
1152 | + name); |
1153 | + class = job_class_new (parent, name); |
1154 | + if (! class) |
1155 | + nih_return_system_error (NULL); |
1156 | + } |
1157 | |
1158 | if (nih_config_parse_file (file, len, pos, lineno, |
1159 | - stanzas, class) < 0) { |
1160 | - nih_free (class); |
1161 | + stanzas, class) < 0) { |
1162 | + if (!update) |
1163 | + nih_free (class); |
1164 | return NULL; |
1165 | } |
1166 | |
1167 | |
1168 | === modified file 'init/parse_job.h' |
1169 | --- init/parse_job.h 2009-06-23 09:29:35 +0000 |
1170 | +++ init/parse_job.h 2011-01-17 15:53:13 +0000 |
1171 | @@ -27,9 +27,9 @@ |
1172 | |
1173 | NIH_BEGIN_EXTERN |
1174 | |
1175 | -JobClass *parse_job (const void *parent, const char *name, |
1176 | - const char *file, size_t len, |
1177 | - size_t *pos, size_t *lineno) |
1178 | +JobClass *parse_job (const void *parent, JobClass *update, |
1179 | + const char *name, const char *file, |
1180 | + size_t len, size_t *pos, size_t *lineno) |
1181 | __attribute__ ((warn_unused_result, malloc)); |
1182 | |
1183 | NIH_END_EXTERN |
1184 | |
1185 | === modified file 'init/paths.h' |
1186 | --- init/paths.h 2010-02-26 15:27:14 +0000 |
1187 | +++ init/paths.h 2011-01-17 15:53:13 +0000 |
1188 | @@ -103,5 +103,55 @@ |
1189 | #define TELINIT SBINDIR "/telinit" |
1190 | #endif |
1191 | |
1192 | +/** |
1193 | + * File extension for standard configuration files. |
1194 | + **/ |
1195 | +#define CONF_EXT_STD ".conf" |
1196 | + |
1197 | +/** |
1198 | + * File extension for override files. |
1199 | + * |
1200 | + * Note that override files are not stored in the ConfSource 'files' hash: |
1201 | + * all JobClass information from override files is added to the JobClass for |
1202 | + * the corresponding (CONF_EXT_STD) object. |
1203 | + **/ |
1204 | +#define CONF_EXT_OVERRIDE ".override" |
1205 | + |
1206 | +/** |
1207 | + * Determine if specified path extension representes a standard |
1208 | + * configuration file. |
1209 | + * |
1210 | + * @period: pointer to last period in path to check. |
1211 | + * |
1212 | + * Returns 1 if specified path extension matches that for a |
1213 | + * standard configuration file, else return 0. |
1214 | + **/ |
1215 | +#define IS_CONF_EXT_STD(period) \ |
1216 | + (!strcmp (period, CONF_EXT_STD)) |
1217 | + |
1218 | +/** |
1219 | + * Determine if specified path extension representes an |
1220 | + * override file. |
1221 | + * |
1222 | + * @period: pointer to last period in path to check. |
1223 | + * |
1224 | + * Returns 1 if specified path extension matches that for |
1225 | + * an override file, else return 0. |
1226 | + **/ |
1227 | +#define IS_CONF_EXT_OVERRIDE(period) \ |
1228 | + (!strcmp (period, CONF_EXT_OVERRIDE)) |
1229 | + |
1230 | +/** |
1231 | + * Determine if specified filename has a valid configuration |
1232 | + * file name extension. |
1233 | + * |
1234 | + * @period: pointer to last period in filename. |
1235 | + * |
1236 | + * Returns: TRUE if extension beyond @period is one of the |
1237 | + * recognized types, else FALSE. |
1238 | + **/ |
1239 | +#define IS_CONF_EXT(period) \ |
1240 | + (IS_CONF_EXT_STD(period) || \ |
1241 | + IS_CONF_EXT_OVERRIDE(period)) |
1242 | |
1243 | #endif /* INIT_PATHS_H */ |
1244 | |
1245 | === modified file 'init/tests/test_conf.c' |
1246 | --- init/tests/test_conf.c 2009-07-08 21:05:59 +0000 |
1247 | +++ init/tests/test_conf.c 2011-01-17 15:53:13 +0000 |
1248 | @@ -46,6 +46,50 @@ |
1249 | #include "job.h" |
1250 | #include "conf.h" |
1251 | |
1252 | +/* macro to try and ensure the environment is as pristine as possible |
1253 | + * (to avoid follow-on errors caused by not freeing objects in a |
1254 | + * previous test, say) |
1255 | + */ |
1256 | +#define TEST_ENSURE_CLEAN_ENV() \ |
1257 | +{ \ |
1258 | + setvbuf(stdout, NULL, _IONBF, 0); \ |
1259 | + \ |
1260 | + if (job_classes) { \ |
1261 | + TEST_HASH_EMPTY (job_classes); \ |
1262 | + } \ |
1263 | + \ |
1264 | + if (conf_sources) { \ |
1265 | + TEST_LIST_EMPTY (conf_sources); \ |
1266 | + } \ |
1267 | + \ |
1268 | + if (nih_io_watches) { \ |
1269 | + TEST_LIST_EMPTY (nih_io_watches); \ |
1270 | + } \ |
1271 | + \ |
1272 | + if (nih_timers) { \ |
1273 | + TEST_LIST_EMPTY (nih_timers); \ |
1274 | + } \ |
1275 | + \ |
1276 | + if (events) { \ |
1277 | + TEST_LIST_EMPTY (events); \ |
1278 | + } \ |
1279 | +} |
1280 | + |
1281 | +/* Force an inotify watch update */ |
1282 | +#define TEST_FORCE_WATCH_UPDATE() \ |
1283 | +{ \ |
1284 | + int nfds = 0; \ |
1285 | + fd_set readfds, writefds, exceptfds; \ |
1286 | + \ |
1287 | + FD_ZERO (&readfds); \ |
1288 | + FD_ZERO (&writefds); \ |
1289 | + FD_ZERO (&exceptfds); \ |
1290 | + \ |
1291 | + nih_debug("calling nih_io_select_fds"); \ |
1292 | + nih_io_select_fds (&nfds, &readfds, &writefds, &exceptfds); \ |
1293 | + nih_debug("calling nih_io_handle_fds"); \ |
1294 | + nih_io_handle_fds (&readfds, &writefds, &exceptfds); \ |
1295 | +} |
1296 | |
1297 | void |
1298 | test_source_new (void) |
1299 | @@ -2270,6 +2314,1255 @@ |
1300 | } |
1301 | } |
1302 | |
1303 | +void |
1304 | +test_toggle_conf_name (void) |
1305 | +{ |
1306 | + char override_ext[] = ".override"; |
1307 | + char dirname[PATH_MAX]; |
1308 | + char filename[PATH_MAX]; |
1309 | + JobClass *job; |
1310 | + char *f; |
1311 | + char *p; |
1312 | + |
1313 | + TEST_FUNCTION_FEATURE ("toggle_conf_name", |
1314 | + "changing conf to override"); |
1315 | + |
1316 | + TEST_FILENAME (dirname); |
1317 | + strcpy (filename, dirname); |
1318 | + strcat (filename, "/foo.conf"); |
1319 | + f = toggle_conf_name (NULL, filename); |
1320 | + TEST_NE_P (f, NULL); |
1321 | + |
1322 | + p = strstr (f, ".override"); |
1323 | + TEST_NE_P (p, NULL); |
1324 | + TEST_EQ_P (p, f+strlen (f) - strlen (override_ext)); |
1325 | + nih_free (f); |
1326 | + |
1327 | + TEST_FEATURE ("changing override to conf"); |
1328 | + strcpy (filename, dirname); |
1329 | + strcat (filename, "/bar.override"); |
1330 | + f = toggle_conf_name (NULL, filename); |
1331 | + TEST_NE_P (f, NULL); |
1332 | + |
1333 | + p = strstr (f, ".conf"); |
1334 | + TEST_NE_P (p, NULL); |
1335 | + TEST_EQ_P (p, f+strlen (f) - strlen (".conf")); |
1336 | + nih_free (f); |
1337 | + |
1338 | + /* test parent param */ |
1339 | + job = job_class_new (NULL, "foo"); |
1340 | + TEST_NE_P (job, NULL); |
1341 | + |
1342 | + f = toggle_conf_name (job, filename); |
1343 | + TEST_NE_P (f, NULL); |
1344 | + |
1345 | + TEST_EQ (TRUE, nih_alloc_parent (f, job)); |
1346 | + |
1347 | + nih_free (job); |
1348 | +} |
1349 | + |
1350 | +void |
1351 | +test_override (void) |
1352 | +{ |
1353 | + ConfSource *source; |
1354 | + ConfFile *file; |
1355 | + FILE *f; |
1356 | + int ret, fd[4096], i = 0; |
1357 | + char dirname[PATH_MAX]; |
1358 | + char filename[PATH_MAX], override[PATH_MAX]; |
1359 | + JobClass *job; |
1360 | + NihError *err; |
1361 | + |
1362 | + program_name = "test"; |
1363 | + nih_log_set_priority (NIH_LOG_FATAL); |
1364 | + |
1365 | + TEST_ENSURE_CLEAN_ENV (); |
1366 | + TEST_GROUP ("override files"); |
1367 | + |
1368 | + /* Make sure that we have inotify before performing some tests... */ |
1369 | + if ((fd[0] = inotify_init ()) < 0) { |
1370 | + printf ("SKIP: inotify not available\n"); |
1371 | + goto no_inotify; |
1372 | + } |
1373 | + close (fd[0]); |
1374 | + |
1375 | + |
1376 | + /* Explicit test of behaviour prior to introduction of override files. |
1377 | + * |
1378 | + * conf with no override before watch: |
1379 | + * create conf |
1380 | + * create watch |
1381 | + * ensure conf loaded |
1382 | + * update conf |
1383 | + * ensure conf updated |
1384 | + * delete conf |
1385 | + * ensure conf deleted |
1386 | + */ |
1387 | + TEST_FEATURE ("with pre-override environment (conf with no override before watch)"); |
1388 | + TEST_ENSURE_CLEAN_ENV (); |
1389 | + TEST_FILENAME (dirname); |
1390 | + TEST_EQ (mkdir (dirname, 0755), 0); |
1391 | + |
1392 | + /* create conf */ |
1393 | + strcpy (filename, dirname); |
1394 | + strcat (filename, "/foo.conf"); |
1395 | + f = fopen (filename, "w"); |
1396 | + TEST_NE_P (f, NULL); |
1397 | + fprintf (f, "start on started\n"); |
1398 | + fprintf (f, "emits hello\n"); |
1399 | + fclose (f); |
1400 | + |
1401 | + /* create watch */ |
1402 | + source = conf_source_new (NULL, dirname, CONF_JOB_DIR); |
1403 | + TEST_NE_P (source, NULL); |
1404 | + ret = conf_source_reload (source); |
1405 | + TEST_EQ (ret, 0); |
1406 | + |
1407 | + /* ensure conf loaded */ |
1408 | + file = (ConfFile *)nih_hash_lookup (source->files, filename); |
1409 | + TEST_NE_P (file, NULL); |
1410 | + job = (JobClass *)nih_hash_lookup (job_classes, "foo"); |
1411 | + TEST_NE_P (job, NULL); |
1412 | + TEST_EQ_P (file->job, job); |
1413 | + TEST_EQ_STR ((job->emits)[0], "hello"); |
1414 | + TEST_NE_P (job->start_on, NULL); |
1415 | + |
1416 | + /* update conf */ |
1417 | + f = fopen (filename, "a"); |
1418 | + TEST_NE_P (f, NULL); |
1419 | + fprintf (f, "manual\n"); |
1420 | + fclose (f); |
1421 | + |
1422 | + TEST_FORCE_WATCH_UPDATE(); |
1423 | + |
1424 | + /* ensure conf updated */ |
1425 | + file = (ConfFile *)nih_hash_lookup (source->files, filename); |
1426 | + TEST_NE_P (file, NULL); |
1427 | + job = (JobClass *)nih_hash_lookup (job_classes, "foo"); |
1428 | + TEST_NE_P (job, NULL); |
1429 | + TEST_EQ_P (job->start_on, NULL); |
1430 | + |
1431 | + /* delete conf */ |
1432 | + unlink (filename); |
1433 | + |
1434 | + TEST_FORCE_WATCH_UPDATE(); |
1435 | + |
1436 | + job = (JobClass *)nih_hash_lookup (job_classes, "foo"); |
1437 | + TEST_EQ_P (job, NULL); |
1438 | + TEST_HASH_EMPTY (job_classes); |
1439 | + TEST_HASH_EMPTY (source->files); |
1440 | + |
1441 | + TEST_FORCE_WATCH_UPDATE(); |
1442 | + |
1443 | + /* ensure conf deleted */ |
1444 | + file = (ConfFile *)nih_hash_lookup (source->files, filename); |
1445 | + TEST_EQ_P (file, NULL); |
1446 | + |
1447 | + nih_free (source); |
1448 | + TEST_EQ (rmdir (dirname), 0); |
1449 | + |
1450 | + |
1451 | + /* Explicit test of behaviour prior to introduction of override files. |
1452 | + * |
1453 | + * conf with no override after watch: |
1454 | + * create watch |
1455 | + * create conf |
1456 | + * ensure conf loaded |
1457 | + * update conf |
1458 | + * ensure conf updated |
1459 | + * delete conf |
1460 | + * ensure conf deleted |
1461 | + */ |
1462 | + TEST_ENSURE_CLEAN_ENV (); |
1463 | + TEST_FEATURE ("with pre-override environment (conf with no override after watch)"); |
1464 | + TEST_FILENAME (dirname); |
1465 | + TEST_EQ (mkdir (dirname, 0755), 0); |
1466 | + |
1467 | + /* create watch */ |
1468 | + source = conf_source_new (NULL, dirname, CONF_JOB_DIR); |
1469 | + TEST_NE_P (source, NULL); |
1470 | + ret = conf_source_reload (source); |
1471 | + TEST_EQ (ret, 0); |
1472 | + |
1473 | + /* create conf */ |
1474 | + strcpy (filename, dirname); |
1475 | + strcat (filename, "/foo.conf"); |
1476 | + f = fopen (filename, "w"); |
1477 | + TEST_NE_P (f, NULL); |
1478 | + fprintf (f, "start on started\n"); |
1479 | + fprintf (f, "emits hello\n"); |
1480 | + fclose (f); |
1481 | + |
1482 | + TEST_FORCE_WATCH_UPDATE(); |
1483 | + |
1484 | + /* ensure conf loaded */ |
1485 | + file = (ConfFile *)nih_hash_lookup (source->files, filename); |
1486 | + TEST_NE_P (file, NULL); |
1487 | + job = (JobClass *)nih_hash_lookup (job_classes, "foo"); |
1488 | + TEST_NE_P (job, NULL); |
1489 | + TEST_EQ_P (file->job, job); |
1490 | + TEST_EQ_STR ((job->emits)[0], "hello"); |
1491 | + |
1492 | + /* update conf */ |
1493 | + f = fopen (filename, "a"); |
1494 | + TEST_NE_P (f, NULL); |
1495 | + fprintf (f, "manual\n"); |
1496 | + fclose (f); |
1497 | + |
1498 | + TEST_FORCE_WATCH_UPDATE(); |
1499 | + |
1500 | + /* ensure conf updated */ |
1501 | + job = (JobClass *)nih_hash_lookup (job_classes, "foo"); |
1502 | + TEST_NE_P (job, NULL); |
1503 | + TEST_EQ_P (job->start_on, NULL); |
1504 | + |
1505 | + /* delete conf */ |
1506 | + unlink (filename); |
1507 | + |
1508 | + TEST_FORCE_WATCH_UPDATE(); |
1509 | + |
1510 | + /* ensure conf deleted */ |
1511 | + file = (ConfFile *)nih_hash_lookup (source->files, filename); |
1512 | + TEST_EQ_P (file, NULL); |
1513 | + nih_free (source); |
1514 | + TEST_EQ (rmdir (dirname), 0); |
1515 | + |
1516 | + |
1517 | + TEST_FEATURE ("ensure lone override ignored before watch"); |
1518 | + TEST_ENSURE_CLEAN_ENV (); |
1519 | + TEST_FILENAME (dirname); |
1520 | + TEST_EQ (mkdir (dirname, 0755), 0); |
1521 | + |
1522 | + /* create override */ |
1523 | + strcpy (filename, dirname); |
1524 | + strcat (filename, "/foo.override"); |
1525 | + f = fopen (filename, "w"); |
1526 | + TEST_NE_P (f, NULL); |
1527 | + fprintf (f, "manual\n"); |
1528 | + fclose (f); |
1529 | + |
1530 | + /* create watch */ |
1531 | + source = conf_source_new (NULL, dirname, CONF_JOB_DIR); |
1532 | + TEST_NE_P (source, NULL); |
1533 | + ret = conf_source_reload (source); |
1534 | + TEST_EQ (ret, 0); |
1535 | + |
1536 | + TEST_FORCE_WATCH_UPDATE(); |
1537 | + |
1538 | + /* ensure no conf object created */ |
1539 | + TEST_HASH_EMPTY (source->files); |
1540 | + file = (ConfFile *)nih_hash_lookup (source->files, filename); |
1541 | + TEST_EQ_P (file, NULL); |
1542 | + job = (JobClass *)nih_hash_lookup (job_classes, "foo"); |
1543 | + TEST_EQ_P (job, NULL); |
1544 | + |
1545 | + /* update override */ |
1546 | + f = fopen (filename, "a"); |
1547 | + TEST_NE_P (f, NULL); |
1548 | + fprintf (f, "author \"me\"\n"); |
1549 | + fclose (f); |
1550 | + |
1551 | + TEST_FORCE_WATCH_UPDATE(); |
1552 | + |
1553 | + /* ensure no conf object created */ |
1554 | + TEST_HASH_EMPTY (source->files); |
1555 | + file = (ConfFile *)nih_hash_lookup (source->files, filename); |
1556 | + TEST_EQ_P (file, NULL); |
1557 | + job = (JobClass *)nih_hash_lookup (job_classes, "foo"); |
1558 | + TEST_EQ_P (job, NULL); |
1559 | + |
1560 | + /* delete override */ |
1561 | + unlink (filename); |
1562 | + nih_free (source); |
1563 | + TEST_EQ (rmdir (dirname), 0); |
1564 | + |
1565 | + |
1566 | + TEST_FEATURE ("ensure lone override ignored after watch"); |
1567 | + TEST_ENSURE_CLEAN_ENV (); |
1568 | + TEST_FILENAME (dirname); |
1569 | + TEST_EQ (mkdir (dirname, 0755), 0); |
1570 | + |
1571 | + /* create watch */ |
1572 | + source = conf_source_new (NULL, dirname, CONF_JOB_DIR); |
1573 | + TEST_NE_P (source, NULL); |
1574 | + ret = conf_source_reload (source); |
1575 | + TEST_EQ (ret, 0); |
1576 | + |
1577 | + strcpy (filename, dirname); |
1578 | + strcat (filename, "/bar.override"); |
1579 | + f = fopen (filename, "w"); |
1580 | + TEST_NE_P (f, NULL); |
1581 | + fprintf (f, "manual\n"); |
1582 | + fclose (f); |
1583 | + |
1584 | + TEST_FORCE_WATCH_UPDATE(); |
1585 | + |
1586 | + /* ensure no conf object created */ |
1587 | + file = (ConfFile *)nih_hash_lookup (source->files, filename); |
1588 | + TEST_EQ_P (file, NULL); |
1589 | + job = (JobClass *)nih_hash_lookup (job_classes, "bar"); |
1590 | + TEST_EQ_P (job, NULL); |
1591 | + |
1592 | + /* delete override */ |
1593 | + unlink (filename); |
1594 | + |
1595 | + TEST_FORCE_WATCH_UPDATE(); |
1596 | + |
1597 | + /* ensure override still not present */ |
1598 | + file = (ConfFile *)nih_hash_lookup (source->files, filename); |
1599 | + TEST_EQ_P (file, NULL); |
1600 | + job = (JobClass *)nih_hash_lookup (job_classes, "bar"); |
1601 | + TEST_EQ_P (job, NULL); |
1602 | + |
1603 | + nih_free (source); |
1604 | + TEST_EQ (rmdir (dirname), 0); |
1605 | + |
1606 | + |
1607 | + TEST_FEATURE ("create conf, watch, then create/modify/delete override"); |
1608 | + TEST_ENSURE_CLEAN_ENV (); |
1609 | + TEST_FILENAME (dirname); |
1610 | + TEST_EQ (mkdir (dirname, 0755), 0); |
1611 | + |
1612 | + /* create conf */ |
1613 | + strcpy (filename, dirname); |
1614 | + strcat (filename, "/foo.conf"); |
1615 | + f = fopen (filename, "w"); |
1616 | + TEST_NE_P (f, NULL); |
1617 | + fprintf (f, "start on started\n"); |
1618 | + fprintf (f, "emits hello\n"); |
1619 | + fclose (f); |
1620 | + |
1621 | + /* create watch */ |
1622 | + source = conf_source_new (NULL, dirname, CONF_JOB_DIR); |
1623 | + TEST_NE_P (source, NULL); |
1624 | + ret = conf_source_reload (source); |
1625 | + TEST_EQ (ret, 0); |
1626 | + |
1627 | + /* ensure conf loaded */ |
1628 | + TEST_HASH_NOT_EMPTY (source->files); |
1629 | + file = (ConfFile *)nih_hash_lookup (source->files, filename); |
1630 | + TEST_NE_P (file, NULL); |
1631 | + job = (JobClass *)nih_hash_lookup (job_classes, "foo"); |
1632 | + TEST_NE_P (job, NULL); |
1633 | + TEST_EQ_P (file->job, job); |
1634 | + TEST_EQ_STR ((job->emits)[0], "hello"); |
1635 | + TEST_EQ_P ((job->emits)[1], NULL); |
1636 | + TEST_NE_P (job->start_on, NULL); |
1637 | + |
1638 | + /* create override */ |
1639 | + strcpy (override, dirname); |
1640 | + strcat (override, "/foo.override"); |
1641 | + f = fopen (override, "w"); |
1642 | + TEST_NE_P (f, NULL); |
1643 | + fprintf (f, "manual\n"); |
1644 | + fclose (f); |
1645 | + |
1646 | + TEST_HASH_NOT_EMPTY (source->files); |
1647 | + TEST_FORCE_WATCH_UPDATE(); |
1648 | + |
1649 | + /* ensure conf updated */ |
1650 | + TEST_HASH_NOT_EMPTY (source->files); |
1651 | + file = (ConfFile *)nih_hash_lookup (source->files, filename); |
1652 | + TEST_NE_P (file, NULL); |
1653 | + job = (JobClass *)nih_hash_lookup (job_classes, "foo"); |
1654 | + TEST_NE_P (job, NULL); |
1655 | + TEST_EQ_P (job->start_on, NULL); |
1656 | + |
1657 | + /* ensure no override in hash */ |
1658 | + file = (ConfFile *)nih_hash_lookup (source->files, override); |
1659 | + TEST_EQ_P (file, NULL); |
1660 | + |
1661 | + /* modify override */ |
1662 | + f = fopen (override, "a"); |
1663 | + TEST_NE_P (f, NULL); |
1664 | + fprintf (f, "emits world\n"); |
1665 | + fclose (f); |
1666 | + |
1667 | + TEST_FORCE_WATCH_UPDATE(); |
1668 | + |
1669 | + /* ensure conf updated */ |
1670 | + file = (ConfFile *)nih_hash_lookup (source->files, filename); |
1671 | + TEST_NE_P (file, NULL); |
1672 | + job = (JobClass *)nih_hash_lookup (job_classes, "foo"); |
1673 | + TEST_NE_P (job, NULL); |
1674 | + TEST_EQ_P (job->start_on, NULL); |
1675 | + TEST_EQ_STR ((job->emits)[0], "hello"); |
1676 | + TEST_EQ_STR ((job->emits)[1], "world"); |
1677 | + |
1678 | + /* delete override */ |
1679 | + unlink (override); |
1680 | + |
1681 | + TEST_FORCE_WATCH_UPDATE(); |
1682 | + |
1683 | + /* ensure conf reverted */ |
1684 | + file = (ConfFile *)nih_hash_lookup (source->files, filename); |
1685 | + TEST_NE_P (file, NULL); |
1686 | + job = (JobClass *)nih_hash_lookup (job_classes, "foo"); |
1687 | + TEST_NE_P (job, NULL); |
1688 | + TEST_NE_P (job->start_on, NULL); |
1689 | + TEST_EQ_STR ((job->emits)[0], "hello"); |
1690 | + TEST_EQ_P ((job->emits)[1], NULL); |
1691 | + |
1692 | + nih_free (source); |
1693 | + unlink (filename); |
1694 | + TEST_EQ (rmdir (dirname), 0); |
1695 | + |
1696 | + |
1697 | + TEST_FEATURE ("create watch, conf, then create/modify/delete override"); |
1698 | + TEST_ENSURE_CLEAN_ENV (); |
1699 | + TEST_FILENAME (dirname); |
1700 | + TEST_EQ (mkdir (dirname, 0755), 0); |
1701 | + |
1702 | + /* create watch */ |
1703 | + source = conf_source_new (NULL, dirname, CONF_JOB_DIR); |
1704 | + TEST_NE_P (source, NULL); |
1705 | + ret = conf_source_reload (source); |
1706 | + TEST_EQ (ret, 0); |
1707 | + |
1708 | + /* create conf */ |
1709 | + strcpy (filename, dirname); |
1710 | + strcat (filename, "/foo.conf"); |
1711 | + f = fopen (filename, "w"); |
1712 | + TEST_NE_P (f, NULL); |
1713 | + fprintf (f, "start on started\n"); |
1714 | + fprintf (f, "emits hello\n"); |
1715 | + fclose (f); |
1716 | + |
1717 | + TEST_FORCE_WATCH_UPDATE(); |
1718 | + |
1719 | + /* ensure conf loaded */ |
1720 | + TEST_HASH_NOT_EMPTY (source->files); |
1721 | + file = (ConfFile *)nih_hash_lookup (source->files, filename); |
1722 | + TEST_NE_P (file, NULL); |
1723 | + job = (JobClass *)nih_hash_lookup (job_classes, "foo"); |
1724 | + TEST_NE_P (job, NULL); |
1725 | + TEST_EQ_P (file->job, job); |
1726 | + TEST_EQ_STR ((job->emits)[0], "hello"); |
1727 | + TEST_EQ_P ((job->emits)[1], NULL); |
1728 | + TEST_NE_P (job->start_on, NULL); |
1729 | + |
1730 | + /* create override */ |
1731 | + strcpy (override, dirname); |
1732 | + strcat (override, "/foo.override"); |
1733 | + f = fopen (override, "w"); |
1734 | + TEST_NE_P (f, NULL); |
1735 | + fprintf (f, "manual\n"); |
1736 | + fclose (f); |
1737 | + |
1738 | + TEST_HASH_NOT_EMPTY (source->files); |
1739 | + TEST_FORCE_WATCH_UPDATE(); |
1740 | + |
1741 | + /* ensure conf updated */ |
1742 | + TEST_HASH_NOT_EMPTY (source->files); |
1743 | + file = (ConfFile *)nih_hash_lookup (source->files, filename); |
1744 | + TEST_NE_P (file, NULL); |
1745 | + job = (JobClass *)nih_hash_lookup (job_classes, "foo"); |
1746 | + TEST_NE_P (job, NULL); |
1747 | + TEST_EQ_P (job->start_on, NULL); |
1748 | + |
1749 | + /* ensure no override in hash */ |
1750 | + file = (ConfFile *)nih_hash_lookup (source->files, override); |
1751 | + TEST_EQ_P (file, NULL); |
1752 | + |
1753 | + /* modify override */ |
1754 | + f = fopen (override, "a"); |
1755 | + TEST_NE_P (f, NULL); |
1756 | + fprintf (f, "emits world\n"); |
1757 | + fclose (f); |
1758 | + |
1759 | + TEST_FORCE_WATCH_UPDATE(); |
1760 | + |
1761 | + /* ensure conf updated */ |
1762 | + file = (ConfFile *)nih_hash_lookup (source->files, filename); |
1763 | + TEST_NE_P (file, NULL); |
1764 | + job = (JobClass *)nih_hash_lookup (job_classes, "foo"); |
1765 | + TEST_NE_P (job, NULL); |
1766 | + TEST_EQ_P (job->start_on, NULL); |
1767 | + TEST_EQ_STR ((job->emits)[0], "hello"); |
1768 | + TEST_EQ_STR ((job->emits)[1], "world"); |
1769 | + |
1770 | + /* delete override */ |
1771 | + unlink (override); |
1772 | + |
1773 | + TEST_FORCE_WATCH_UPDATE(); |
1774 | + |
1775 | + /* ensure conf reverted */ |
1776 | + file = (ConfFile *)nih_hash_lookup (source->files, filename); |
1777 | + TEST_NE_P (file, NULL); |
1778 | + job = (JobClass *)nih_hash_lookup (job_classes, "foo"); |
1779 | + TEST_NE_P (job, NULL); |
1780 | + TEST_NE_P (job->start_on, NULL); |
1781 | + TEST_EQ_STR ((job->emits)[0], "hello"); |
1782 | + TEST_EQ_P ((job->emits)[1], NULL); |
1783 | + |
1784 | + nih_free (source); |
1785 | + unlink (filename); |
1786 | + TEST_EQ (rmdir (dirname), 0); |
1787 | + |
1788 | + |
1789 | + TEST_FEATURE ("create override, watch, then create/modify/delete conf"); |
1790 | + TEST_ENSURE_CLEAN_ENV (); |
1791 | + TEST_FILENAME (dirname); |
1792 | + TEST_EQ (mkdir (dirname, 0755), 0); |
1793 | + |
1794 | + strcpy (filename, dirname); |
1795 | + strcat (filename, "/foo.conf"); |
1796 | + strcpy (override, dirname); |
1797 | + strcat (override, "/foo.override"); |
1798 | + |
1799 | + /* create override */ |
1800 | + f = fopen (override, "w"); |
1801 | + TEST_NE_P (f, NULL); |
1802 | + fprintf (f, "manual\n"); |
1803 | + fprintf (f, "author \"bar\"\n"); |
1804 | + fclose (f); |
1805 | + |
1806 | + /* create watch */ |
1807 | + source = conf_source_new (NULL, dirname, CONF_JOB_DIR); |
1808 | + TEST_NE_P (source, NULL); |
1809 | + ret = conf_source_reload (source); |
1810 | + TEST_EQ (ret, 0); |
1811 | + |
1812 | + TEST_FORCE_WATCH_UPDATE(); |
1813 | + |
1814 | + /* ensure no conf object created */ |
1815 | + TEST_HASH_EMPTY (source->files); |
1816 | + file = (ConfFile *)nih_hash_lookup (source->files, filename); |
1817 | + TEST_EQ_P (file, NULL); |
1818 | + job = (JobClass *)nih_hash_lookup (job_classes, "foo"); |
1819 | + TEST_EQ_P (job, NULL); |
1820 | + |
1821 | + /* create conf */ |
1822 | + f = fopen (filename, "w"); |
1823 | + TEST_NE_P (f, NULL); |
1824 | + fprintf (f, "start on started\n"); |
1825 | + fprintf (f, "emits hello\n"); |
1826 | + fprintf (f, "author \"foo\"\n"); |
1827 | + fclose (f); |
1828 | + |
1829 | + TEST_FORCE_WATCH_UPDATE(); |
1830 | + |
1831 | + /* ensure conf loaded */ |
1832 | + file = (ConfFile *)nih_hash_lookup (source->files, filename); |
1833 | + TEST_NE_P (file, NULL); |
1834 | + job = (JobClass *)nih_hash_lookup (job_classes, "foo"); |
1835 | + TEST_NE_P (job, NULL); |
1836 | + TEST_EQ_P (file->job, job); |
1837 | + TEST_EQ_STR ((job->emits)[0], "hello"); |
1838 | + |
1839 | + /* should pick up override, *NOT* conf */ |
1840 | + TEST_EQ_P (job->start_on, NULL); |
1841 | + TEST_EQ_STR (job->author, "bar"); |
1842 | + |
1843 | + /* modify conf */ |
1844 | + f = fopen (filename, "w"); |
1845 | + TEST_NE_P (f, NULL); |
1846 | + fprintf (f, "start on wibble\n"); |
1847 | + fprintf (f, "emits moo\n"); |
1848 | + fclose (f); |
1849 | + |
1850 | + TEST_FORCE_WATCH_UPDATE(); |
1851 | + |
1852 | + /* ensure conf reloaded and updated with override */ |
1853 | + file = (ConfFile *)nih_hash_lookup (source->files, filename); |
1854 | + TEST_NE_P (file, NULL); |
1855 | + job = (JobClass *)nih_hash_lookup (job_classes, "foo"); |
1856 | + TEST_NE_P (job, NULL); |
1857 | + TEST_EQ_P (file->job, job); |
1858 | + TEST_EQ_STR ((job->emits)[0], "moo"); |
1859 | + |
1860 | + /* should pick up override, *NOT* conf */ |
1861 | + TEST_EQ_P (job->start_on, NULL); |
1862 | + TEST_EQ_STR (job->author, "bar"); |
1863 | + |
1864 | + /* delete conf */ |
1865 | + unlink (filename); |
1866 | + |
1867 | + TEST_FORCE_WATCH_UPDATE(); |
1868 | + |
1869 | + /* ensure conf object deleted */ |
1870 | + file = (ConfFile *)nih_hash_lookup (source->files, filename); |
1871 | + TEST_EQ_P (file, NULL); |
1872 | + TEST_HASH_EMPTY (source->files); |
1873 | + job = (JobClass *)nih_hash_lookup (job_classes, "foo"); |
1874 | + TEST_EQ_P (job, NULL); |
1875 | + file = (ConfFile *)nih_hash_lookup (source->files, override); |
1876 | + TEST_EQ_P (file, NULL); |
1877 | + |
1878 | + unlink (override); |
1879 | + |
1880 | + /* ensure no conf object still */ |
1881 | + file = (ConfFile *)nih_hash_lookup (source->files, filename); |
1882 | + TEST_EQ_P (file, NULL); |
1883 | + TEST_HASH_EMPTY (source->files); |
1884 | + job = (JobClass *)nih_hash_lookup (job_classes, "foo"); |
1885 | + TEST_EQ_P (job, NULL); |
1886 | + file = (ConfFile *)nih_hash_lookup (source->files, override); |
1887 | + TEST_EQ_P (file, NULL); |
1888 | + |
1889 | + nih_free (source); |
1890 | + TEST_EQ (rmdir (dirname), 0); |
1891 | + |
1892 | + |
1893 | + TEST_FEATURE ("create watch, override, then create/modify/delete conf"); |
1894 | + TEST_ENSURE_CLEAN_ENV (); |
1895 | + TEST_FILENAME (dirname); |
1896 | + TEST_EQ (mkdir (dirname, 0755), 0); |
1897 | + |
1898 | + /* create watch */ |
1899 | + source = conf_source_new (NULL, dirname, CONF_JOB_DIR); |
1900 | + TEST_NE_P (source, NULL); |
1901 | + ret = conf_source_reload (source); |
1902 | + TEST_EQ (ret, 0); |
1903 | + |
1904 | + strcpy (filename, dirname); |
1905 | + strcat (filename, "/foo.conf"); |
1906 | + strcpy (override, dirname); |
1907 | + strcat (override, "/foo.override"); |
1908 | + |
1909 | + /* create override */ |
1910 | + f = fopen (override, "w"); |
1911 | + TEST_NE_P (f, NULL); |
1912 | + fprintf (f, "manual\n"); |
1913 | + fprintf (f, "author \"bar\"\n"); |
1914 | + fclose (f); |
1915 | + |
1916 | + TEST_FORCE_WATCH_UPDATE(); |
1917 | + |
1918 | + /* ensure no conf object created */ |
1919 | + TEST_HASH_EMPTY (source->files); |
1920 | + file = (ConfFile *)nih_hash_lookup (source->files, filename); |
1921 | + TEST_EQ_P (file, NULL); |
1922 | + job = (JobClass *)nih_hash_lookup (job_classes, "foo"); |
1923 | + TEST_EQ_P (job, NULL); |
1924 | + |
1925 | + /* create conf */ |
1926 | + f = fopen (filename, "w"); |
1927 | + TEST_NE_P (f, NULL); |
1928 | + fprintf (f, "start on started\n"); |
1929 | + fprintf (f, "emits hello\n"); |
1930 | + fprintf (f, "author \"foo\"\n"); |
1931 | + fclose (f); |
1932 | + |
1933 | + TEST_FORCE_WATCH_UPDATE(); |
1934 | + |
1935 | + /* ensure conf loaded */ |
1936 | + file = (ConfFile *)nih_hash_lookup (source->files, filename); |
1937 | + TEST_NE_P (file, NULL); |
1938 | + job = (JobClass *)nih_hash_lookup (job_classes, "foo"); |
1939 | + TEST_NE_P (job, NULL); |
1940 | + TEST_EQ_P (file->job, job); |
1941 | + TEST_EQ_STR ((job->emits)[0], "hello"); |
1942 | + |
1943 | + /* should pick up override, *NOT* conf */ |
1944 | + TEST_EQ_P (job->start_on, NULL); |
1945 | + TEST_EQ_STR (job->author, "bar"); |
1946 | + |
1947 | + /* modify conf */ |
1948 | + f = fopen (filename, "w"); |
1949 | + TEST_NE_P (f, NULL); |
1950 | + fprintf (f, "start on wibble\n"); |
1951 | + fprintf (f, "emits moo\n"); |
1952 | + fclose (f); |
1953 | + |
1954 | + TEST_FORCE_WATCH_UPDATE(); |
1955 | + |
1956 | + /* ensure conf reloaded and updated with override */ |
1957 | + file = (ConfFile *)nih_hash_lookup (source->files, filename); |
1958 | + TEST_NE_P (file, NULL); |
1959 | + job = (JobClass *)nih_hash_lookup (job_classes, "foo"); |
1960 | + TEST_NE_P (job, NULL); |
1961 | + TEST_EQ_P (file->job, job); |
1962 | + TEST_EQ_STR ((job->emits)[0], "moo"); |
1963 | + |
1964 | + /* should pick up override, *NOT* conf */ |
1965 | + TEST_EQ_P (job->start_on, NULL); |
1966 | + TEST_EQ_STR (job->author, "bar"); |
1967 | + |
1968 | + /* delete conf */ |
1969 | + unlink (filename); |
1970 | + |
1971 | + TEST_FORCE_WATCH_UPDATE(); |
1972 | + |
1973 | + /* ensure conf object deleted */ |
1974 | + file = (ConfFile *)nih_hash_lookup (source->files, filename); |
1975 | + TEST_EQ_P (file, NULL); |
1976 | + TEST_HASH_EMPTY (source->files); |
1977 | + job = (JobClass *)nih_hash_lookup (job_classes, "foo"); |
1978 | + TEST_EQ_P (job, NULL); |
1979 | + file = (ConfFile *)nih_hash_lookup (source->files, override); |
1980 | + TEST_EQ_P (file, NULL); |
1981 | + |
1982 | + unlink (override); |
1983 | + |
1984 | + /* ensure no conf object still */ |
1985 | + file = (ConfFile *)nih_hash_lookup (source->files, filename); |
1986 | + TEST_EQ_P (file, NULL); |
1987 | + TEST_HASH_EMPTY (source->files); |
1988 | + job = (JobClass *)nih_hash_lookup (job_classes, "foo"); |
1989 | + TEST_EQ_P (job, NULL); |
1990 | + file = (ConfFile *)nih_hash_lookup (source->files, override); |
1991 | + TEST_EQ_P (file, NULL); |
1992 | + |
1993 | + nih_free (source); |
1994 | + TEST_EQ (rmdir (dirname), 0); |
1995 | + |
1996 | + |
1997 | + TEST_FEATURE ("create override, watch, conf, then modify/delete override"); |
1998 | + TEST_ENSURE_CLEAN_ENV (); |
1999 | + TEST_FILENAME (dirname); |
2000 | + TEST_EQ (mkdir (dirname, 0755), 0); |
2001 | + |
2002 | + strcpy (filename, dirname); |
2003 | + strcat (filename, "/foo.conf"); |
2004 | + strcpy (override, dirname); |
2005 | + strcat (override, "/foo.override"); |
2006 | + |
2007 | + /* create override */ |
2008 | + f = fopen (override, "w"); |
2009 | + TEST_NE_P (f, NULL); |
2010 | + fprintf (f, "manual\n"); |
2011 | + fprintf (f, "author \"bar\"\n"); |
2012 | + fclose (f); |
2013 | + |
2014 | + /* create watch */ |
2015 | + source = conf_source_new (NULL, dirname, CONF_JOB_DIR); |
2016 | + TEST_NE_P (source, NULL); |
2017 | + ret = conf_source_reload (source); |
2018 | + TEST_EQ (ret, 0); |
2019 | + |
2020 | + TEST_FORCE_WATCH_UPDATE(); |
2021 | + |
2022 | + /* ensure no conf object created */ |
2023 | + TEST_HASH_EMPTY (source->files); |
2024 | + file = (ConfFile *)nih_hash_lookup (source->files, filename); |
2025 | + TEST_EQ_P (file, NULL); |
2026 | + job = (JobClass *)nih_hash_lookup (job_classes, "foo"); |
2027 | + TEST_EQ_P (job, NULL); |
2028 | + |
2029 | + /* create conf */ |
2030 | + f = fopen (filename, "w"); |
2031 | + TEST_NE_P (f, NULL); |
2032 | + fprintf (f, "start on started\n"); |
2033 | + fprintf (f, "emits hello\n"); |
2034 | + fprintf (f, "author \"foo\"\n"); |
2035 | + fclose (f); |
2036 | + |
2037 | + /* FIXME: crashes here */ |
2038 | + TEST_FORCE_WATCH_UPDATE(); |
2039 | + |
2040 | + /* ensure conf loaded */ |
2041 | + file = (ConfFile *)nih_hash_lookup (source->files, filename); |
2042 | + TEST_NE_P (file, NULL); |
2043 | + job = (JobClass *)nih_hash_lookup (job_classes, "foo"); |
2044 | + TEST_NE_P (job, NULL); |
2045 | + TEST_EQ_P (file->job, job); |
2046 | + TEST_EQ_STR ((job->emits)[0], "hello"); |
2047 | + |
2048 | + /* should pick up override, *NOT* conf */ |
2049 | + TEST_EQ_P (job->start_on, NULL); |
2050 | + TEST_EQ_STR (job->author, "bar"); |
2051 | + |
2052 | + /* modify override */ |
2053 | + f = fopen (override, "w"); |
2054 | + TEST_NE_P (f, NULL); |
2055 | + fprintf (f, "author \"meh\"\n"); |
2056 | + fprintf (f, "env wibble=wobble\n"); |
2057 | + fprintf (f, "manual\n"); |
2058 | + fclose (f); |
2059 | + |
2060 | + TEST_FORCE_WATCH_UPDATE(); |
2061 | + |
2062 | + /* ensure conf reloaded and updated with override */ |
2063 | + file = (ConfFile *)nih_hash_lookup (source->files, filename); |
2064 | + TEST_NE_P (file, NULL); |
2065 | + job = (JobClass *)nih_hash_lookup (job_classes, "foo"); |
2066 | + TEST_NE_P (job, NULL); |
2067 | + TEST_EQ_P (file->job, job); |
2068 | + TEST_EQ_STR ((job->emits)[0], "hello"); |
2069 | + |
2070 | + /* should pick up override, *NOT* conf */ |
2071 | + TEST_EQ_P (job->start_on, NULL); |
2072 | + TEST_EQ_STR (job->author, "meh"); |
2073 | + TEST_EQ_STR ((job->env)[0], "wibble=wobble"); |
2074 | + |
2075 | + /* delete override */ |
2076 | + unlink (override); |
2077 | + |
2078 | + TEST_FORCE_WATCH_UPDATE(); |
2079 | + |
2080 | + /* ensure conf object reverted */ |
2081 | + file = (ConfFile *)nih_hash_lookup (source->files, filename); |
2082 | + TEST_NE_P (file, NULL); |
2083 | + job = (JobClass *)nih_hash_lookup (job_classes, "foo"); |
2084 | + TEST_NE_P (job, NULL); |
2085 | + TEST_NE_P (job->start_on, NULL); |
2086 | + TEST_EQ_STR (job->author, "foo"); |
2087 | + TEST_EQ_P (job->env, NULL); |
2088 | + TEST_EQ_STR ((job->emits)[0], "hello"); |
2089 | + |
2090 | + unlink (filename); |
2091 | + nih_free (source); |
2092 | + TEST_EQ (rmdir (dirname), 0); |
2093 | + |
2094 | + |
2095 | + TEST_FEATURE ("create watch, override, conf, then modify/delete override"); |
2096 | + TEST_ENSURE_CLEAN_ENV (); |
2097 | + TEST_FILENAME (dirname); |
2098 | + TEST_EQ (mkdir (dirname, 0755), 0); |
2099 | + |
2100 | + strcpy (filename, dirname); |
2101 | + strcat (filename, "/foo.conf"); |
2102 | + strcpy (override, dirname); |
2103 | + strcat (override, "/foo.override"); |
2104 | + |
2105 | + /* create watch */ |
2106 | + source = conf_source_new (NULL, dirname, CONF_JOB_DIR); |
2107 | + TEST_NE_P (source, NULL); |
2108 | + ret = conf_source_reload (source); |
2109 | + TEST_EQ (ret, 0); |
2110 | + |
2111 | + TEST_FORCE_WATCH_UPDATE(); |
2112 | + |
2113 | + /* create override */ |
2114 | + f = fopen (override, "w"); |
2115 | + TEST_NE_P (f, NULL); |
2116 | + fprintf (f, "manual\n"); |
2117 | + fprintf (f, "author \"bar\"\n"); |
2118 | + fclose (f); |
2119 | + |
2120 | + TEST_FORCE_WATCH_UPDATE(); |
2121 | + |
2122 | + /* create conf */ |
2123 | + f = fopen (filename, "w"); |
2124 | + TEST_NE_P (f, NULL); |
2125 | + fprintf (f, "start on started\n"); |
2126 | + fprintf (f, "emits hello\n"); |
2127 | + fprintf (f, "author \"foo\"\n"); |
2128 | + fclose (f); |
2129 | + |
2130 | + TEST_FORCE_WATCH_UPDATE(); |
2131 | + |
2132 | + /* ensure conf loaded */ |
2133 | + file = (ConfFile *)nih_hash_lookup (source->files, filename); |
2134 | + TEST_NE_P (file, NULL); |
2135 | + job = (JobClass *)nih_hash_lookup (job_classes, "foo"); |
2136 | + TEST_NE_P (job, NULL); |
2137 | + TEST_EQ_P (file->job, job); |
2138 | + TEST_EQ_STR ((job->emits)[0], "hello"); |
2139 | + |
2140 | + /* should pick up override, *NOT* conf */ |
2141 | + TEST_EQ_P (job->start_on, NULL); |
2142 | + TEST_EQ_STR (job->author, "bar"); |
2143 | + |
2144 | + /* update override */ |
2145 | + f = fopen (override, "a"); |
2146 | + TEST_NE_P (f, NULL); |
2147 | + fprintf (f, "author \"me\"\n"); |
2148 | + fprintf (f, "env wibble=wobble\n"); |
2149 | + fclose (f); |
2150 | + |
2151 | + TEST_FORCE_WATCH_UPDATE(); |
2152 | + |
2153 | + /* ensure conf reloaded and updated with override */ |
2154 | + file = (ConfFile *)nih_hash_lookup (source->files, filename); |
2155 | + TEST_NE_P (file, NULL); |
2156 | + job = (JobClass *)nih_hash_lookup (job_classes, "foo"); |
2157 | + TEST_NE_P (job, NULL); |
2158 | + TEST_EQ_P (file->job, job); |
2159 | + TEST_EQ_STR ((job->emits)[0], "hello"); |
2160 | + |
2161 | + /* should pick up override, *NOT* conf */ |
2162 | + TEST_EQ_P (job->start_on, NULL); |
2163 | + TEST_EQ_STR (job->author, "me"); |
2164 | + TEST_EQ_STR ((job->env)[0], "wibble=wobble"); |
2165 | + |
2166 | + TEST_FORCE_WATCH_UPDATE(); |
2167 | + |
2168 | + /* delete override */ |
2169 | + unlink (override); |
2170 | + |
2171 | + TEST_FORCE_WATCH_UPDATE(); |
2172 | + |
2173 | + /* ensure conf loaded */ |
2174 | + file = (ConfFile *)nih_hash_lookup (source->files, filename); |
2175 | + TEST_NE_P (file, NULL); |
2176 | + job = (JobClass *)nih_hash_lookup (job_classes, "foo"); |
2177 | + TEST_NE_P (job, NULL); |
2178 | + TEST_EQ_P (file->job, job); |
2179 | + TEST_EQ_STR (job->author, "foo"); |
2180 | + TEST_EQ_STR ((job->emits)[0], "hello"); |
2181 | + TEST_NE_P (job->start_on, NULL); |
2182 | + TEST_EQ_P (job->env, NULL); |
2183 | + |
2184 | + unlink (filename); |
2185 | + nih_free (source); |
2186 | + TEST_EQ (rmdir (dirname), 0); |
2187 | + |
2188 | + |
2189 | + TEST_FEATURE ("create both conf+override files, watch, then modify/delete conf"); |
2190 | + TEST_ENSURE_CLEAN_ENV (); |
2191 | + TEST_FILENAME (dirname); |
2192 | + TEST_EQ (mkdir (dirname, 0755), 0); |
2193 | + |
2194 | + /* create conf */ |
2195 | + strcpy (filename, dirname); |
2196 | + strcat (filename, "/foo.conf"); |
2197 | + f = fopen (filename, "w"); |
2198 | + TEST_NE_P (f, NULL); |
2199 | + fprintf (f, "start on started\n"); |
2200 | + fprintf (f, "author \"me\"\n"); |
2201 | + fprintf (f, "env foo=bar\n"); |
2202 | + fprintf (f, "emits hello\n"); |
2203 | + fclose (f); |
2204 | + |
2205 | + /* create override */ |
2206 | + strcpy (override, dirname); |
2207 | + strcat (override, "/foo.override"); |
2208 | + f = fopen (override, "w"); |
2209 | + TEST_NE_P (f, NULL); |
2210 | + fprintf (f, "manual\n"); |
2211 | + fprintf (f, "author \"you\"\n"); |
2212 | + fclose (f); |
2213 | + |
2214 | + /* create watch */ |
2215 | + source = conf_source_new (NULL, dirname, CONF_JOB_DIR); |
2216 | + TEST_NE_P (source, NULL); |
2217 | + ret = conf_source_reload (source); |
2218 | + TEST_EQ (ret, 0); |
2219 | + |
2220 | + TEST_FORCE_WATCH_UPDATE(); |
2221 | + |
2222 | + /* ensure conf loaded */ |
2223 | + TEST_HASH_NOT_EMPTY (source->files); |
2224 | + file = (ConfFile *)nih_hash_lookup (source->files, filename); |
2225 | + TEST_NE_P (file, NULL); |
2226 | + job = (JobClass *)nih_hash_lookup (job_classes, "foo"); |
2227 | + TEST_NE_P (job, NULL); |
2228 | + TEST_EQ_P (file->job, job); |
2229 | + TEST_EQ_STR ((job->emits)[0], "hello"); |
2230 | + TEST_EQ_STR (job->author, "you"); |
2231 | + TEST_EQ_P (job->start_on, NULL); |
2232 | + TEST_EQ_STR ((job->env)[0], "foo=bar"); |
2233 | + TEST_EQ_P (job->export, NULL); |
2234 | + |
2235 | + /* modify conf */ |
2236 | + f = fopen (filename, "a"); |
2237 | + TEST_NE_P (f, NULL); |
2238 | + fprintf (f, "export foo\n"); |
2239 | + fclose (f); |
2240 | + |
2241 | + TEST_FORCE_WATCH_UPDATE(); |
2242 | + |
2243 | + /* ensure conf updated */ |
2244 | + TEST_HASH_NOT_EMPTY (source->files); |
2245 | + file = (ConfFile *)nih_hash_lookup (source->files, filename); |
2246 | + TEST_NE_P (file, NULL); |
2247 | + job = (JobClass *)nih_hash_lookup (job_classes, "foo"); |
2248 | + TEST_NE_P (job, NULL); |
2249 | + TEST_EQ_STR ((job->env)[0], "foo=bar"); |
2250 | + TEST_NE_P (job->export, NULL); |
2251 | + TEST_EQ_STR ((job->export)[0], "foo"); |
2252 | + |
2253 | + /* delete conf */ |
2254 | + unlink (filename); |
2255 | + |
2256 | + TEST_FORCE_WATCH_UPDATE(); |
2257 | + |
2258 | + /* ensure conf object deleted */ |
2259 | + file = (ConfFile *)nih_hash_lookup (source->files, filename); |
2260 | + TEST_EQ_P (file, NULL); |
2261 | + TEST_HASH_EMPTY (source->files); |
2262 | + job = (JobClass *)nih_hash_lookup (job_classes, "foo"); |
2263 | + TEST_EQ_P (job, NULL); |
2264 | + file = (ConfFile *)nih_hash_lookup (source->files, override); |
2265 | + TEST_EQ_P (file, NULL); |
2266 | + |
2267 | + unlink (override); |
2268 | + nih_free (source); |
2269 | + TEST_EQ (rmdir (dirname), 0); |
2270 | + |
2271 | + TEST_FEATURE ("create both conf+override files, watch, then modify/delete override"); |
2272 | + TEST_ENSURE_CLEAN_ENV (); |
2273 | + TEST_FILENAME (dirname); |
2274 | + TEST_EQ (mkdir (dirname, 0755), 0); |
2275 | + |
2276 | + /* create conf */ |
2277 | + strcpy (filename, dirname); |
2278 | + strcat (filename, "/foo.conf"); |
2279 | + f = fopen (filename, "w"); |
2280 | + TEST_NE_P (f, NULL); |
2281 | + fprintf (f, "start on started\n"); |
2282 | + fprintf (f, "author \"me\"\n"); |
2283 | + fprintf (f, "env foo=bar\n"); |
2284 | + fprintf (f, "emits hello\n"); |
2285 | + fclose (f); |
2286 | + |
2287 | + /* create override */ |
2288 | + strcpy (override, dirname); |
2289 | + strcat (override, "/foo.override"); |
2290 | + f = fopen (override, "w"); |
2291 | + TEST_NE_P (f, NULL); |
2292 | + fprintf (f, "manual\n"); |
2293 | + fprintf (f, "author \"you\"\n"); |
2294 | + fclose (f); |
2295 | + |
2296 | + /* create watch */ |
2297 | + source = conf_source_new (NULL, dirname, CONF_JOB_DIR); |
2298 | + TEST_NE_P (source, NULL); |
2299 | + ret = conf_source_reload (source); |
2300 | + TEST_EQ (ret, 0); |
2301 | + |
2302 | + TEST_FORCE_WATCH_UPDATE(); |
2303 | + |
2304 | + /* ensure conf loaded */ |
2305 | + TEST_HASH_NOT_EMPTY (source->files); |
2306 | + file = (ConfFile *)nih_hash_lookup (source->files, filename); |
2307 | + TEST_NE_P (file, NULL); |
2308 | + job = (JobClass *)nih_hash_lookup (job_classes, "foo"); |
2309 | + TEST_NE_P (job, NULL); |
2310 | + TEST_EQ_P (file->job, job); |
2311 | + TEST_EQ_STR ((job->emits)[0], "hello"); |
2312 | + TEST_EQ_STR (job->author, "you"); |
2313 | + TEST_EQ_P (job->start_on, NULL); |
2314 | + TEST_EQ_STR ((job->env)[0], "foo=bar"); |
2315 | + TEST_EQ_P (job->export, NULL); |
2316 | + |
2317 | + /* modify override */ |
2318 | + f = fopen (override, "w"); |
2319 | + TEST_NE_P (f, NULL); |
2320 | + fprintf (f, "description \"hello world\"\n"); |
2321 | + fprintf (f, "author \"ubuntu\"\n"); |
2322 | + fclose (f); |
2323 | + |
2324 | + TEST_FORCE_WATCH_UPDATE(); |
2325 | + |
2326 | + /* ensure conf updated */ |
2327 | + file = (ConfFile *)nih_hash_lookup (source->files, filename); |
2328 | + TEST_NE_P (file, NULL); |
2329 | + job = (JobClass *)nih_hash_lookup (job_classes, "foo"); |
2330 | + TEST_NE_P (job, NULL); |
2331 | + TEST_EQ_P (file->job, job); |
2332 | + TEST_EQ_STR (job->author, "ubuntu"); |
2333 | + TEST_NE_P (job->description, NULL); |
2334 | + TEST_EQ_STR (job->description, "hello world"); |
2335 | + TEST_EQ_STR ((job->emits)[0], "hello"); |
2336 | + TEST_NE_P (job->start_on, NULL); |
2337 | + |
2338 | + /* delete override */ |
2339 | + unlink (override); |
2340 | + |
2341 | + TEST_FORCE_WATCH_UPDATE(); |
2342 | + |
2343 | + /* ensure conf updated */ |
2344 | + file = (ConfFile *)nih_hash_lookup (source->files, filename); |
2345 | + TEST_NE_P (file, NULL); |
2346 | + job = (JobClass *)nih_hash_lookup (job_classes, "foo"); |
2347 | + TEST_NE_P (job, NULL); |
2348 | + TEST_EQ_P (file->job, job); |
2349 | + TEST_NE_P (job->start_on, NULL); |
2350 | + TEST_EQ_STR ((job->env)[0], "foo=bar"); |
2351 | + TEST_EQ_STR ((job->emits)[0], "hello"); |
2352 | + TEST_EQ_STR (job->author, "me"); |
2353 | + TEST_EQ_P (job->description, NULL); |
2354 | + |
2355 | + nih_free (source); |
2356 | + unlink (filename); |
2357 | + TEST_EQ (rmdir (dirname), 0); |
2358 | + |
2359 | + |
2360 | + TEST_FEATURE ("create conf, watch, then create invalid override, delete override"); |
2361 | + TEST_ENSURE_CLEAN_ENV (); |
2362 | + TEST_FILENAME (dirname); |
2363 | + TEST_EQ (mkdir (dirname, 0755), 0); |
2364 | + |
2365 | + /* create conf */ |
2366 | + strcpy (filename, dirname); |
2367 | + strcat (filename, "/foo.conf"); |
2368 | + f = fopen (filename, "w"); |
2369 | + TEST_NE_P (f, NULL); |
2370 | + fprintf (f, "start on started\n"); |
2371 | + fprintf (f, "author \"wibble\"\n"); |
2372 | + fprintf (f, "emits hello\n"); |
2373 | + fclose (f); |
2374 | + |
2375 | + /* create watch */ |
2376 | + source = conf_source_new (NULL, dirname, CONF_JOB_DIR); |
2377 | + TEST_NE_P (source, NULL); |
2378 | + ret = conf_source_reload (source); |
2379 | + TEST_EQ (ret, 0); |
2380 | + |
2381 | + TEST_FORCE_WATCH_UPDATE(); |
2382 | + |
2383 | + /* ensure conf loaded */ |
2384 | + TEST_HASH_NOT_EMPTY (source->files); |
2385 | + file = (ConfFile *)nih_hash_lookup (source->files, filename); |
2386 | + TEST_NE_P (file, NULL); |
2387 | + job = (JobClass *)nih_hash_lookup (job_classes, "foo"); |
2388 | + TEST_NE_P (job, NULL); |
2389 | + TEST_EQ_P (file->job, job); |
2390 | + TEST_EQ_STR ((job->emits)[0], "hello"); |
2391 | + TEST_NE_P (job->start_on, NULL); |
2392 | + |
2393 | + /* create (partially) invalid override (which should be |
2394 | + * fully ignored) |
2395 | + */ |
2396 | + strcpy (override, dirname); |
2397 | + strcat (override, "/foo.override"); |
2398 | + f = fopen (override, "w"); |
2399 | + TEST_NE_P (f, NULL); |
2400 | + fprintf (f, "manual\n"); |
2401 | + fprintf (f, "bleaugh!\n"); |
2402 | + fprintf (f, "wha...?\n"); |
2403 | + fprintf (f, "author \"moo\"\n"); |
2404 | + fclose (f); |
2405 | + |
2406 | + TEST_FORCE_WATCH_UPDATE(); |
2407 | + |
2408 | + unlink (override); |
2409 | + |
2410 | + TEST_FORCE_WATCH_UPDATE(); |
2411 | + |
2412 | + /* ensure conf still loaded */ |
2413 | + TEST_HASH_NOT_EMPTY (source->files); |
2414 | + file = (ConfFile *)nih_hash_lookup (source->files, filename); |
2415 | + TEST_NE_P (file, NULL); |
2416 | + job = (JobClass *)nih_hash_lookup (job_classes, "foo"); |
2417 | + TEST_NE_P (job, NULL); |
2418 | + TEST_EQ_P (file->job, job); |
2419 | + TEST_EQ_STR ((job->emits)[0], "hello"); |
2420 | + TEST_NE_P (job->start_on, NULL); |
2421 | + TEST_EQ_STR (job->author, "wibble"); |
2422 | + |
2423 | + nih_free (source); |
2424 | + unlink (filename); |
2425 | + TEST_EQ (rmdir (dirname), 0); |
2426 | + |
2427 | + TEST_FEATURE ("ensure override ignored for CONF_FILE"); |
2428 | + TEST_ENSURE_CLEAN_ENV (); |
2429 | + TEST_FILENAME (dirname); |
2430 | + TEST_EQ (mkdir (dirname, 0755), 0); |
2431 | + |
2432 | + /* create empty conf */ |
2433 | + strcpy (filename, dirname); |
2434 | + strcat (filename, "/init.conf"); |
2435 | + f = fopen (filename, "w"); |
2436 | + TEST_NE_P (f, NULL); |
2437 | + fclose (f); |
2438 | + |
2439 | + /* create watch */ |
2440 | + source = conf_source_new (NULL, dirname, CONF_FILE); |
2441 | + TEST_NE_P (source, NULL); |
2442 | + ret = conf_source_reload (source); |
2443 | + |
2444 | + /* We expect conf_source_reload to fail in this situation since |
2445 | + * although "init.conf" is a supported config file, it is not |
2446 | + * allowed to contain any stanzas, implying that it can only |
2447 | + * contain comments. In fact, if the file exists but is zero |
2448 | + * size that is currently an error since upstart blindly calls |
2449 | + * nih_file_read(), which will fail since there are no bytes to |
2450 | + * read. |
2451 | + */ |
2452 | + TEST_NE (ret, 0); |
2453 | + err = nih_error_steal (); |
2454 | + TEST_EQ (err->number, EILSEQ); |
2455 | + nih_free (err); |
2456 | + |
2457 | + TEST_FORCE_WATCH_UPDATE(); |
2458 | + |
2459 | + /* ensure conf NOT loaded */ |
2460 | + TEST_HASH_EMPTY (source->files); |
2461 | + |
2462 | + /* create override */ |
2463 | + strcpy (override, dirname); |
2464 | + strcat (override, "/init.override"); |
2465 | + f = fopen (override, "w"); |
2466 | + TEST_NE_P (f, NULL); |
2467 | + fprintf (f, "manual\n"); |
2468 | + fclose (f); |
2469 | + |
2470 | + TEST_FORCE_WATCH_UPDATE(); |
2471 | + |
2472 | + /* ensure conf still NOT loaded */ |
2473 | + TEST_HASH_EMPTY (source->files); |
2474 | + |
2475 | + nih_free (source); |
2476 | + unlink (filename); |
2477 | + unlink (override); |
2478 | + TEST_EQ (rmdir (dirname), 0); |
2479 | + |
2480 | + /* Consume all available inotify instances so that the following |
2481 | + * tests run without inotify. |
2482 | + */ |
2483 | + for (i = 0; i < 4096; i++) |
2484 | + if ((fd[i] = inotify_init ()) < 0) |
2485 | + break; |
2486 | + |
2487 | +no_inotify: |
2488 | + /* If you don't have inotify, any override file must exist |
2489 | + * before the system boots. |
2490 | + */ |
2491 | + |
2492 | + TEST_FEATURE ("both conf+override files with no inotify support"); |
2493 | + TEST_ENSURE_CLEAN_ENV (); |
2494 | + TEST_FILENAME (dirname); |
2495 | + TEST_EQ (mkdir (dirname, 0755), 0); |
2496 | + |
2497 | + /* create conf */ |
2498 | + strcpy (filename, dirname); |
2499 | + strcat (filename, "/foo.conf"); |
2500 | + f = fopen (filename, "w"); |
2501 | + TEST_NE_P (f, NULL); |
2502 | + fprintf (f, "start on started\n"); |
2503 | + fprintf (f, "author \"me\"\n"); |
2504 | + fprintf (f, "env foo=bar\n"); |
2505 | + fprintf (f, "emits hello\n"); |
2506 | + fclose (f); |
2507 | + |
2508 | + /* create override */ |
2509 | + strcpy (override, dirname); |
2510 | + strcat (override, "/foo.override"); |
2511 | + f = fopen (override, "w"); |
2512 | + TEST_NE_P (f, NULL); |
2513 | + fprintf (f, "manual\n"); |
2514 | + fprintf (f, "author \"you\"\n"); |
2515 | + fclose (f); |
2516 | + |
2517 | + /* create watch */ |
2518 | + source = conf_source_new (NULL, dirname, CONF_JOB_DIR); |
2519 | + TEST_NE_P (source, NULL); |
2520 | + ret = conf_source_reload (source); |
2521 | + TEST_EQ (ret, 0); |
2522 | + |
2523 | + /* ensure conf loaded */ |
2524 | + TEST_HASH_NOT_EMPTY (source->files); |
2525 | + file = (ConfFile *)nih_hash_lookup (source->files, filename); |
2526 | + TEST_NE_P (file, NULL); |
2527 | + job = (JobClass *)nih_hash_lookup (job_classes, "foo"); |
2528 | + TEST_NE_P (job, NULL); |
2529 | + TEST_EQ_P (file->job, job); |
2530 | + TEST_EQ_STR ((job->emits)[0], "hello"); |
2531 | + TEST_EQ_STR (job->author, "you"); |
2532 | + TEST_EQ_P (job->start_on, NULL); |
2533 | + TEST_EQ_STR ((job->env)[0], "foo=bar"); |
2534 | + TEST_EQ_P (job->export, NULL); |
2535 | + |
2536 | + nih_free (source); |
2537 | + unlink (filename); |
2538 | + unlink (override); |
2539 | + TEST_EQ (rmdir (dirname), 0); |
2540 | + |
2541 | + |
2542 | + nih_log_set_priority (NIH_LOG_MESSAGE); |
2543 | + |
2544 | + /* Release consumed instances */ |
2545 | + for (i = 0; i < 4096; i++) { |
2546 | + if (fd[i] < 0) |
2547 | + break; |
2548 | + |
2549 | + close (fd[i]); |
2550 | + } |
2551 | +} |
2552 | |
2553 | void |
2554 | test_source_reload_file (void) |
2555 | @@ -2822,8 +4115,6 @@ |
2556 | TEST_HASH_EMPTY (source->files); |
2557 | |
2558 | nih_free (source); |
2559 | - |
2560 | - |
2561 | /* Consume all available inotify instances so that the following |
2562 | * tests run without inotify. |
2563 | */ |
2564 | @@ -3309,6 +4600,8 @@ |
2565 | test_source_reload_conf_dir (); |
2566 | test_source_reload_file (); |
2567 | test_source_reload (); |
2568 | + test_toggle_conf_name (); |
2569 | + test_override (); |
2570 | test_file_destroy (); |
2571 | test_select_job (); |
2572 | |
2573 | |
2574 | === modified file 'init/tests/test_parse_job.c' |
2575 | --- init/tests/test_parse_job.c 2010-12-14 16:20:38 +0000 |
2576 | +++ init/tests/test_parse_job.c 2011-01-17 15:53:13 +0000 |
2577 | @@ -64,7 +64,7 @@ |
2578 | TEST_ALLOC_FAIL { |
2579 | pos = 0; |
2580 | lineno = 1; |
2581 | - job = parse_job (NULL, "test", buf, strlen (buf), |
2582 | + job = parse_job (NULL, NULL, "test", buf, strlen (buf), |
2583 | &pos, &lineno); |
2584 | |
2585 | if (test_alloc_failed) { |
2586 | @@ -110,7 +110,7 @@ |
2587 | TEST_ALLOC_FAIL { |
2588 | pos = 0; |
2589 | lineno = 1; |
2590 | - job = parse_job (NULL, "test", buf, strlen (buf), |
2591 | + job = parse_job (NULL, NULL, "test", buf, strlen (buf), |
2592 | &pos, &lineno); |
2593 | |
2594 | if (test_alloc_failed) { |
2595 | @@ -131,6 +131,45 @@ |
2596 | |
2597 | nih_free (job); |
2598 | } |
2599 | + |
2600 | + TEST_FEATURE ("with non-NULL update parameter (override)"); |
2601 | + { |
2602 | + JobClass *tmp = NULL; |
2603 | + |
2604 | + strcpy (buf, "start on starting\n"); |
2605 | + strcat (buf, "author \"me\"\n"); |
2606 | + |
2607 | + pos = 0; |
2608 | + lineno = 1; |
2609 | + job = parse_job (NULL, NULL, "test", buf, strlen (buf), |
2610 | + &pos, &lineno); |
2611 | + |
2612 | + TEST_NE_P (job, NULL); |
2613 | + TEST_EQ_STR (job->author, "me"); |
2614 | + TEST_NE_P (job->start_on, NULL); |
2615 | + |
2616 | + strcat (buf, "author \"you\"\n"); |
2617 | + strcat (buf, "manual\n"); |
2618 | + strcat (buf, "description \"my description\"\n"); |
2619 | + |
2620 | + pos = 0; |
2621 | + lineno = 1; |
2622 | + tmp = parse_job (NULL, job, "test", buf, strlen (buf), |
2623 | + &pos, &lineno); |
2624 | + TEST_NE_P (tmp, NULL); |
2625 | + |
2626 | + /* if passed a job, the same object should be returned. |
2627 | + */ |
2628 | + TEST_EQ_P (tmp, job); |
2629 | + |
2630 | + TEST_EQ_STR (tmp->author, "you"); |
2631 | + TEST_EQ_P (tmp->start_on, NULL); |
2632 | + TEST_NE_P (tmp->description, NULL); |
2633 | + |
2634 | + TEST_EQ_STR (tmp->description, "my description"); |
2635 | + |
2636 | + nih_free (job); |
2637 | + } |
2638 | } |
2639 | |
2640 | void |
2641 | @@ -153,7 +192,7 @@ |
2642 | TEST_ALLOC_FAIL { |
2643 | pos = 0; |
2644 | lineno = 1; |
2645 | - job = parse_job (NULL, "test", buf, strlen (buf), |
2646 | + job = parse_job (NULL, NULL, "test", buf, strlen (buf), |
2647 | &pos, &lineno); |
2648 | |
2649 | if (test_alloc_failed) { |
2650 | @@ -190,7 +229,7 @@ |
2651 | TEST_ALLOC_FAIL { |
2652 | pos = 0; |
2653 | lineno = 1; |
2654 | - job = parse_job (NULL, "test", buf, strlen (buf), |
2655 | + job = parse_job (NULL, NULL, "test", buf, strlen (buf), |
2656 | &pos, &lineno); |
2657 | |
2658 | if (test_alloc_failed) { |
2659 | @@ -229,7 +268,7 @@ |
2660 | TEST_ALLOC_FAIL { |
2661 | pos = 0; |
2662 | lineno = 1; |
2663 | - job = parse_job (NULL, "test", buf, strlen (buf), |
2664 | + job = parse_job (NULL, NULL, "test", buf, strlen (buf), |
2665 | &pos, &lineno); |
2666 | |
2667 | if (test_alloc_failed) { |
2668 | @@ -266,7 +305,7 @@ |
2669 | |
2670 | pos = 0; |
2671 | lineno = 1; |
2672 | - job = parse_job (NULL, "test", buf, strlen (buf), &pos, &lineno); |
2673 | + job = parse_job (NULL, NULL, "test", buf, strlen (buf), &pos, &lineno); |
2674 | |
2675 | TEST_EQ_P (job, NULL); |
2676 | |
2677 | @@ -299,7 +338,7 @@ |
2678 | TEST_ALLOC_FAIL { |
2679 | pos = 0; |
2680 | lineno = 1; |
2681 | - job = parse_job (NULL, "test", buf, strlen (buf), |
2682 | + job = parse_job (NULL, NULL, "test", buf, strlen (buf), |
2683 | &pos, &lineno); |
2684 | |
2685 | if (test_alloc_failed) { |
2686 | @@ -340,7 +379,7 @@ |
2687 | TEST_ALLOC_FAIL { |
2688 | pos = 0; |
2689 | lineno = 1; |
2690 | - job = parse_job (NULL, "test", buf, strlen (buf), |
2691 | + job = parse_job (NULL, NULL, "test", buf, strlen (buf), |
2692 | &pos, &lineno); |
2693 | |
2694 | if (test_alloc_failed) { |
2695 | @@ -379,7 +418,7 @@ |
2696 | TEST_ALLOC_FAIL { |
2697 | pos = 0; |
2698 | lineno = 1; |
2699 | - job = parse_job (NULL, "test", buf, strlen (buf), |
2700 | + job = parse_job (NULL, NULL, "test", buf, strlen (buf), |
2701 | &pos, &lineno); |
2702 | |
2703 | if (test_alloc_failed) { |
2704 | @@ -416,7 +455,7 @@ |
2705 | |
2706 | pos = 0; |
2707 | lineno = 1; |
2708 | - job = parse_job (NULL, "test", buf, strlen (buf), &pos, &lineno); |
2709 | + job = parse_job (NULL, NULL, "test", buf, strlen (buf), &pos, &lineno); |
2710 | |
2711 | TEST_EQ_P (job, NULL); |
2712 | |
2713 | @@ -447,7 +486,7 @@ |
2714 | TEST_ALLOC_FAIL { |
2715 | pos = 0; |
2716 | lineno = 1; |
2717 | - job = parse_job (NULL, "test", buf, strlen (buf), |
2718 | + job = parse_job (NULL, NULL, "test", buf, strlen (buf), |
2719 | &pos, &lineno); |
2720 | |
2721 | if (test_alloc_failed) { |
2722 | @@ -484,7 +523,7 @@ |
2723 | TEST_ALLOC_FAIL { |
2724 | pos = 0; |
2725 | lineno = 1; |
2726 | - job = parse_job (NULL, "test", buf, strlen (buf), |
2727 | + job = parse_job (NULL, NULL, "test", buf, strlen (buf), |
2728 | &pos, &lineno); |
2729 | |
2730 | if (test_alloc_failed) { |
2731 | @@ -524,7 +563,7 @@ |
2732 | TEST_ALLOC_FAIL { |
2733 | pos = 0; |
2734 | lineno = 1; |
2735 | - job = parse_job (NULL, "test", buf, strlen (buf), |
2736 | + job = parse_job (NULL, NULL, "test", buf, strlen (buf), |
2737 | &pos, &lineno); |
2738 | |
2739 | if (test_alloc_failed) { |
2740 | @@ -565,7 +604,7 @@ |
2741 | TEST_ALLOC_FAIL { |
2742 | pos = 0; |
2743 | lineno = 1; |
2744 | - job = parse_job (NULL, "test", buf, strlen (buf), |
2745 | + job = parse_job (NULL, NULL, "test", buf, strlen (buf), |
2746 | &pos, &lineno); |
2747 | |
2748 | if (test_alloc_failed) { |
2749 | @@ -604,7 +643,7 @@ |
2750 | TEST_ALLOC_FAIL { |
2751 | pos = 0; |
2752 | lineno = 1; |
2753 | - job = parse_job (NULL, "test", buf, strlen (buf), |
2754 | + job = parse_job (NULL, NULL, "test", buf, strlen (buf), |
2755 | &pos, &lineno); |
2756 | |
2757 | if (test_alloc_failed) { |
2758 | @@ -643,7 +682,7 @@ |
2759 | TEST_ALLOC_FAIL { |
2760 | pos = 0; |
2761 | lineno = 1; |
2762 | - job = parse_job (NULL, "test", buf, strlen (buf), |
2763 | + job = parse_job (NULL, NULL, "test", buf, strlen (buf), |
2764 | &pos, &lineno); |
2765 | |
2766 | if (test_alloc_failed) { |
2767 | @@ -680,7 +719,7 @@ |
2768 | |
2769 | pos = 0; |
2770 | lineno = 1; |
2771 | - job = parse_job (NULL, "test", buf, strlen (buf), &pos, &lineno); |
2772 | + job = parse_job (NULL, NULL, "test", buf, strlen (buf), &pos, &lineno); |
2773 | |
2774 | TEST_EQ_P (job, NULL); |
2775 | |
2776 | @@ -699,7 +738,7 @@ |
2777 | |
2778 | pos = 0; |
2779 | lineno = 1; |
2780 | - job = parse_job (NULL, "test", buf, strlen (buf), &pos, &lineno); |
2781 | + job = parse_job (NULL, NULL, "test", buf, strlen (buf), &pos, &lineno); |
2782 | |
2783 | TEST_EQ_P (job, NULL); |
2784 | |
2785 | @@ -718,7 +757,7 @@ |
2786 | |
2787 | pos = 0; |
2788 | lineno = 1; |
2789 | - job = parse_job (NULL, "test", buf, strlen (buf), &pos, &lineno); |
2790 | + job = parse_job (NULL, NULL, "test", buf, strlen (buf), &pos, &lineno); |
2791 | |
2792 | TEST_EQ_P (job, NULL); |
2793 | |
2794 | @@ -737,7 +776,7 @@ |
2795 | |
2796 | pos = 0; |
2797 | lineno = 1; |
2798 | - job = parse_job (NULL, "test", buf, strlen (buf), &pos, &lineno); |
2799 | + job = parse_job (NULL, NULL, "test", buf, strlen (buf), &pos, &lineno); |
2800 | |
2801 | TEST_EQ_P (job, NULL); |
2802 | |
2803 | @@ -768,7 +807,7 @@ |
2804 | TEST_ALLOC_FAIL { |
2805 | pos = 0; |
2806 | lineno = 1; |
2807 | - job = parse_job (NULL, "test", buf, strlen (buf), |
2808 | + job = parse_job (NULL, NULL, "test", buf, strlen (buf), |
2809 | &pos, &lineno); |
2810 | |
2811 | if (test_alloc_failed) { |
2812 | @@ -805,7 +844,7 @@ |
2813 | TEST_ALLOC_FAIL { |
2814 | pos = 0; |
2815 | lineno = 1; |
2816 | - job = parse_job (NULL, "test", buf, strlen (buf), |
2817 | + job = parse_job (NULL, NULL, "test", buf, strlen (buf), |
2818 | &pos, &lineno); |
2819 | |
2820 | if (test_alloc_failed) { |
2821 | @@ -845,7 +884,7 @@ |
2822 | TEST_ALLOC_FAIL { |
2823 | pos = 0; |
2824 | lineno = 1; |
2825 | - job = parse_job (NULL, "test", buf, strlen (buf), |
2826 | + job = parse_job (NULL, NULL, "test", buf, strlen (buf), |
2827 | &pos, &lineno); |
2828 | |
2829 | if (test_alloc_failed) { |
2830 | @@ -886,7 +925,7 @@ |
2831 | TEST_ALLOC_FAIL { |
2832 | pos = 0; |
2833 | lineno = 1; |
2834 | - job = parse_job (NULL, "test", buf, strlen (buf), |
2835 | + job = parse_job (NULL, NULL, "test", buf, strlen (buf), |
2836 | &pos, &lineno); |
2837 | |
2838 | if (test_alloc_failed) { |
2839 | @@ -925,7 +964,7 @@ |
2840 | TEST_ALLOC_FAIL { |
2841 | pos = 0; |
2842 | lineno = 1; |
2843 | - job = parse_job (NULL, "test", buf, strlen (buf), |
2844 | + job = parse_job (NULL, NULL, "test", buf, strlen (buf), |
2845 | &pos, &lineno); |
2846 | |
2847 | if (test_alloc_failed) { |
2848 | @@ -964,7 +1003,7 @@ |
2849 | TEST_ALLOC_FAIL { |
2850 | pos = 0; |
2851 | lineno = 1; |
2852 | - job = parse_job (NULL, "test", buf, strlen (buf), |
2853 | + job = parse_job (NULL, NULL, "test", buf, strlen (buf), |
2854 | &pos, &lineno); |
2855 | |
2856 | if (test_alloc_failed) { |
2857 | @@ -1001,7 +1040,7 @@ |
2858 | |
2859 | pos = 0; |
2860 | lineno = 1; |
2861 | - job = parse_job (NULL, "test", buf, strlen (buf), &pos, &lineno); |
2862 | + job = parse_job (NULL, NULL, "test", buf, strlen (buf), &pos, &lineno); |
2863 | |
2864 | TEST_EQ_P (job, NULL); |
2865 | |
2866 | @@ -1020,7 +1059,7 @@ |
2867 | |
2868 | pos = 0; |
2869 | lineno = 1; |
2870 | - job = parse_job (NULL, "test", buf, strlen (buf), &pos, &lineno); |
2871 | + job = parse_job (NULL, NULL, "test", buf, strlen (buf), &pos, &lineno); |
2872 | |
2873 | TEST_EQ_P (job, NULL); |
2874 | |
2875 | @@ -1039,7 +1078,7 @@ |
2876 | |
2877 | pos = 0; |
2878 | lineno = 1; |
2879 | - job = parse_job (NULL, "test", buf, strlen (buf), &pos, &lineno); |
2880 | + job = parse_job (NULL, NULL, "test", buf, strlen (buf), &pos, &lineno); |
2881 | |
2882 | TEST_EQ_P (job, NULL); |
2883 | |
2884 | @@ -1058,7 +1097,7 @@ |
2885 | |
2886 | pos = 0; |
2887 | lineno = 1; |
2888 | - job = parse_job (NULL, "test", buf, strlen (buf), &pos, &lineno); |
2889 | + job = parse_job (NULL, NULL, "test", buf, strlen (buf), &pos, &lineno); |
2890 | |
2891 | TEST_EQ_P (job, NULL); |
2892 | |
2893 | @@ -1089,7 +1128,7 @@ |
2894 | TEST_ALLOC_FAIL { |
2895 | pos = 0; |
2896 | lineno = 1; |
2897 | - job = parse_job (NULL, "test", buf, strlen (buf), |
2898 | + job = parse_job (NULL, NULL, "test", buf, strlen (buf), |
2899 | &pos, &lineno); |
2900 | |
2901 | if (test_alloc_failed) { |
2902 | @@ -1126,7 +1165,7 @@ |
2903 | TEST_ALLOC_FAIL { |
2904 | pos = 0; |
2905 | lineno = 1; |
2906 | - job = parse_job (NULL, "test", buf, strlen (buf), |
2907 | + job = parse_job (NULL, NULL, "test", buf, strlen (buf), |
2908 | &pos, &lineno); |
2909 | |
2910 | if (test_alloc_failed) { |
2911 | @@ -1166,7 +1205,7 @@ |
2912 | TEST_ALLOC_FAIL { |
2913 | pos = 0; |
2914 | lineno = 1; |
2915 | - job = parse_job (NULL, "test", buf, strlen (buf), |
2916 | + job = parse_job (NULL, NULL, "test", buf, strlen (buf), |
2917 | &pos, &lineno); |
2918 | |
2919 | if (test_alloc_failed) { |
2920 | @@ -1207,7 +1246,7 @@ |
2921 | TEST_ALLOC_FAIL { |
2922 | pos = 0; |
2923 | lineno = 1; |
2924 | - job = parse_job (NULL, "test", buf, strlen (buf), |
2925 | + job = parse_job (NULL, NULL, "test", buf, strlen (buf), |
2926 | &pos, &lineno); |
2927 | |
2928 | if (test_alloc_failed) { |
2929 | @@ -1246,7 +1285,7 @@ |
2930 | TEST_ALLOC_FAIL { |
2931 | pos = 0; |
2932 | lineno = 1; |
2933 | - job = parse_job (NULL, "test", buf, strlen (buf), |
2934 | + job = parse_job (NULL, NULL, "test", buf, strlen (buf), |
2935 | &pos, &lineno); |
2936 | |
2937 | if (test_alloc_failed) { |
2938 | @@ -1285,7 +1324,7 @@ |
2939 | TEST_ALLOC_FAIL { |
2940 | pos = 0; |
2941 | lineno = 1; |
2942 | - job = parse_job (NULL, "test", buf, strlen (buf), |
2943 | + job = parse_job (NULL, NULL, "test", buf, strlen (buf), |
2944 | &pos, &lineno); |
2945 | |
2946 | if (test_alloc_failed) { |
2947 | @@ -1322,7 +1361,7 @@ |
2948 | |
2949 | pos = 0; |
2950 | lineno = 1; |
2951 | - job = parse_job (NULL, "test", buf, strlen (buf), &pos, &lineno); |
2952 | + job = parse_job (NULL, NULL, "test", buf, strlen (buf), &pos, &lineno); |
2953 | |
2954 | TEST_EQ_P (job, NULL); |
2955 | |
2956 | @@ -1341,7 +1380,7 @@ |
2957 | |
2958 | pos = 0; |
2959 | lineno = 1; |
2960 | - job = parse_job (NULL, "test", buf, strlen (buf), &pos, &lineno); |
2961 | + job = parse_job (NULL, NULL, "test", buf, strlen (buf), &pos, &lineno); |
2962 | |
2963 | TEST_EQ_P (job, NULL); |
2964 | |
2965 | @@ -1360,7 +1399,7 @@ |
2966 | |
2967 | pos = 0; |
2968 | lineno = 1; |
2969 | - job = parse_job (NULL, "test", buf, strlen (buf), &pos, &lineno); |
2970 | + job = parse_job (NULL, NULL, "test", buf, strlen (buf), &pos, &lineno); |
2971 | |
2972 | TEST_EQ_P (job, NULL); |
2973 | |
2974 | @@ -1379,7 +1418,7 @@ |
2975 | |
2976 | pos = 0; |
2977 | lineno = 1; |
2978 | - job = parse_job (NULL, "test", buf, strlen (buf), &pos, &lineno); |
2979 | + job = parse_job (NULL, NULL, "test", buf, strlen (buf), &pos, &lineno); |
2980 | |
2981 | TEST_EQ_P (job, NULL); |
2982 | |
2983 | @@ -1410,7 +1449,7 @@ |
2984 | TEST_ALLOC_FAIL { |
2985 | pos = 0; |
2986 | lineno = 1; |
2987 | - job = parse_job (NULL, "test", buf, strlen (buf), |
2988 | + job = parse_job (NULL, NULL, "test", buf, strlen (buf), |
2989 | &pos, &lineno); |
2990 | |
2991 | if (test_alloc_failed) { |
2992 | @@ -1447,7 +1486,7 @@ |
2993 | TEST_ALLOC_FAIL { |
2994 | pos = 0; |
2995 | lineno = 1; |
2996 | - job = parse_job (NULL, "test", buf, strlen (buf), |
2997 | + job = parse_job (NULL, NULL, "test", buf, strlen (buf), |
2998 | &pos, &lineno); |
2999 | |
3000 | if (test_alloc_failed) { |
3001 | @@ -1487,7 +1526,7 @@ |
3002 | TEST_ALLOC_FAIL { |
3003 | pos = 0; |
3004 | lineno = 1; |
3005 | - job = parse_job (NULL, "test", buf, strlen (buf), |
3006 | + job = parse_job (NULL, NULL, "test", buf, strlen (buf), |
3007 | &pos, &lineno); |
3008 | |
3009 | if (test_alloc_failed) { |
3010 | @@ -1528,7 +1567,7 @@ |
3011 | TEST_ALLOC_FAIL { |
3012 | pos = 0; |
3013 | lineno = 1; |
3014 | - job = parse_job (NULL, "test", buf, strlen (buf), |
3015 | + job = parse_job (NULL, NULL, "test", buf, strlen (buf), |
3016 | &pos, &lineno); |
3017 | |
3018 | if (test_alloc_failed) { |
3019 | @@ -1567,7 +1606,7 @@ |
3020 | TEST_ALLOC_FAIL { |
3021 | pos = 0; |
3022 | lineno = 1; |
3023 | - job = parse_job (NULL, "test", buf, strlen (buf), |
3024 | + job = parse_job (NULL, NULL, "test", buf, strlen (buf), |
3025 | &pos, &lineno); |
3026 | |
3027 | if (test_alloc_failed) { |
3028 | @@ -1606,7 +1645,7 @@ |
3029 | TEST_ALLOC_FAIL { |
3030 | pos = 0; |
3031 | lineno = 1; |
3032 | - job = parse_job (NULL, "test", buf, strlen (buf), |
3033 | + job = parse_job (NULL, NULL, "test", buf, strlen (buf), |
3034 | &pos, &lineno); |
3035 | |
3036 | if (test_alloc_failed) { |
3037 | @@ -1643,7 +1682,7 @@ |
3038 | |
3039 | pos = 0; |
3040 | lineno = 1; |
3041 | - job = parse_job (NULL, "test", buf, strlen (buf), &pos, &lineno); |
3042 | + job = parse_job (NULL, NULL, "test", buf, strlen (buf), &pos, &lineno); |
3043 | |
3044 | TEST_EQ_P (job, NULL); |
3045 | |
3046 | @@ -1662,7 +1701,7 @@ |
3047 | |
3048 | pos = 0; |
3049 | lineno = 1; |
3050 | - job = parse_job (NULL, "test", buf, strlen (buf), &pos, &lineno); |
3051 | + job = parse_job (NULL, NULL, "test", buf, strlen (buf), &pos, &lineno); |
3052 | |
3053 | TEST_EQ_P (job, NULL); |
3054 | |
3055 | @@ -1681,7 +1720,7 @@ |
3056 | |
3057 | pos = 0; |
3058 | lineno = 1; |
3059 | - job = parse_job (NULL, "test", buf, strlen (buf), &pos, &lineno); |
3060 | + job = parse_job (NULL, NULL, "test", buf, strlen (buf), &pos, &lineno); |
3061 | |
3062 | TEST_EQ_P (job, NULL); |
3063 | |
3064 | @@ -1700,7 +1739,7 @@ |
3065 | |
3066 | pos = 0; |
3067 | lineno = 1; |
3068 | - job = parse_job (NULL, "test", buf, strlen (buf), &pos, &lineno); |
3069 | + job = parse_job (NULL, NULL, "test", buf, strlen (buf), &pos, &lineno); |
3070 | |
3071 | TEST_EQ_P (job, NULL); |
3072 | |
3073 | @@ -1731,7 +1770,7 @@ |
3074 | TEST_ALLOC_FAIL { |
3075 | pos = 0; |
3076 | lineno = 1; |
3077 | - job = parse_job (NULL, "test", buf, strlen (buf), |
3078 | + job = parse_job (NULL, NULL, "test", buf, strlen (buf), |
3079 | &pos, &lineno); |
3080 | |
3081 | if (test_alloc_failed) { |
3082 | @@ -1776,7 +1815,7 @@ |
3083 | TEST_ALLOC_FAIL { |
3084 | pos = 0; |
3085 | lineno = 1; |
3086 | - job = parse_job (NULL, "test", buf, strlen (buf), |
3087 | + job = parse_job (NULL, NULL, "test", buf, strlen (buf), |
3088 | &pos, &lineno); |
3089 | |
3090 | if (test_alloc_failed) { |
3091 | @@ -1828,7 +1867,7 @@ |
3092 | TEST_ALLOC_FAIL { |
3093 | pos = 0; |
3094 | lineno = 1; |
3095 | - job = parse_job (NULL, "test", buf, strlen (buf), |
3096 | + job = parse_job (NULL, NULL, "test", buf, strlen (buf), |
3097 | &pos, &lineno); |
3098 | |
3099 | if (test_alloc_failed) { |
3100 | @@ -1879,7 +1918,7 @@ |
3101 | TEST_ALLOC_FAIL { |
3102 | pos = 0; |
3103 | lineno = 1; |
3104 | - job = parse_job (NULL, "test", buf, strlen (buf), |
3105 | + job = parse_job (NULL, NULL, "test", buf, strlen (buf), |
3106 | &pos, &lineno); |
3107 | |
3108 | if (test_alloc_failed) { |
3109 | @@ -1942,7 +1981,7 @@ |
3110 | TEST_ALLOC_FAIL { |
3111 | pos = 0; |
3112 | lineno = 1; |
3113 | - job = parse_job (NULL, "test", buf, strlen (buf), |
3114 | + job = parse_job (NULL, NULL, "test", buf, strlen (buf), |
3115 | &pos, &lineno); |
3116 | |
3117 | if (test_alloc_failed) { |
3118 | @@ -2012,7 +2051,7 @@ |
3119 | TEST_ALLOC_FAIL { |
3120 | pos = 0; |
3121 | lineno = 1; |
3122 | - job = parse_job (NULL, "test", buf, strlen (buf), |
3123 | + job = parse_job (NULL, NULL, "test", buf, strlen (buf), |
3124 | &pos, &lineno); |
3125 | |
3126 | if (test_alloc_failed) { |
3127 | @@ -2090,7 +2129,7 @@ |
3128 | TEST_ALLOC_FAIL { |
3129 | pos = 0; |
3130 | lineno = 1; |
3131 | - job = parse_job (NULL, "test", buf, strlen (buf), |
3132 | + job = parse_job (NULL, NULL, "test", buf, strlen (buf), |
3133 | &pos, &lineno); |
3134 | |
3135 | if (test_alloc_failed) { |
3136 | @@ -2170,7 +2209,7 @@ |
3137 | TEST_ALLOC_FAIL { |
3138 | pos = 0; |
3139 | lineno = 1; |
3140 | - job = parse_job (NULL, "test", buf, strlen (buf), |
3141 | + job = parse_job (NULL, NULL, "test", buf, strlen (buf), |
3142 | &pos, &lineno); |
3143 | |
3144 | if (test_alloc_failed) { |
3145 | @@ -2249,7 +2288,7 @@ |
3146 | TEST_ALLOC_FAIL { |
3147 | pos = 0; |
3148 | lineno = 1; |
3149 | - job = parse_job (NULL, "test", buf, strlen (buf), |
3150 | + job = parse_job (NULL, NULL, "test", buf, strlen (buf), |
3151 | &pos, &lineno); |
3152 | |
3153 | if (test_alloc_failed) { |
3154 | @@ -2291,7 +2330,7 @@ |
3155 | |
3156 | pos = 0; |
3157 | lineno = 1; |
3158 | - job = parse_job (NULL, "test", buf, strlen (buf), &pos, &lineno); |
3159 | + job = parse_job (NULL, NULL, "test", buf, strlen (buf), &pos, &lineno); |
3160 | |
3161 | TEST_EQ_P (job, NULL); |
3162 | |
3163 | @@ -2310,7 +2349,7 @@ |
3164 | |
3165 | pos = 0; |
3166 | lineno = 1; |
3167 | - job = parse_job (NULL, "test", buf, strlen (buf), &pos, &lineno); |
3168 | + job = parse_job (NULL, NULL, "test", buf, strlen (buf), &pos, &lineno); |
3169 | |
3170 | TEST_EQ_P (job, NULL); |
3171 | |
3172 | @@ -2329,7 +2368,7 @@ |
3173 | |
3174 | pos = 0; |
3175 | lineno = 1; |
3176 | - job = parse_job (NULL, "test", buf, strlen (buf), &pos, &lineno); |
3177 | + job = parse_job (NULL, NULL, "test", buf, strlen (buf), &pos, &lineno); |
3178 | |
3179 | TEST_EQ_P (job, NULL); |
3180 | |
3181 | @@ -2348,7 +2387,7 @@ |
3182 | |
3183 | pos = 0; |
3184 | lineno = 1; |
3185 | - job = parse_job (NULL, "test", buf, strlen (buf), &pos, &lineno); |
3186 | + job = parse_job (NULL, NULL, "test", buf, strlen (buf), &pos, &lineno); |
3187 | |
3188 | TEST_EQ_P (job, NULL); |
3189 | |
3190 | @@ -2367,7 +2406,7 @@ |
3191 | |
3192 | pos = 0; |
3193 | lineno = 1; |
3194 | - job = parse_job (NULL, "test", buf, strlen (buf), &pos, &lineno); |
3195 | + job = parse_job (NULL, NULL, "test", buf, strlen (buf), &pos, &lineno); |
3196 | |
3197 | TEST_EQ_P (job, NULL); |
3198 | |
3199 | @@ -2384,7 +2423,7 @@ |
3200 | |
3201 | pos = 0; |
3202 | lineno = 1; |
3203 | - job = parse_job (NULL, "test", buf, strlen (buf), &pos, &lineno); |
3204 | + job = parse_job (NULL, NULL, "test", buf, strlen (buf), &pos, &lineno); |
3205 | |
3206 | TEST_EQ_P (job, NULL); |
3207 | |
3208 | @@ -2403,7 +2442,7 @@ |
3209 | |
3210 | pos = 0; |
3211 | lineno = 1; |
3212 | - job = parse_job (NULL, "test", buf, strlen (buf), &pos, &lineno); |
3213 | + job = parse_job (NULL, NULL, "test", buf, strlen (buf), &pos, &lineno); |
3214 | |
3215 | TEST_EQ_P (job, NULL); |
3216 | |
3217 | @@ -2422,7 +2461,7 @@ |
3218 | |
3219 | pos = 0; |
3220 | lineno = 1; |
3221 | - job = parse_job (NULL, "test", buf, strlen (buf), &pos, &lineno); |
3222 | + job = parse_job (NULL, NULL, "test", buf, strlen (buf), &pos, &lineno); |
3223 | |
3224 | TEST_EQ_P (job, NULL); |
3225 | |
3226 | @@ -2441,7 +2480,7 @@ |
3227 | |
3228 | pos = 0; |
3229 | lineno = 1; |
3230 | - job = parse_job (NULL, "test", buf, strlen (buf), &pos, &lineno); |
3231 | + job = parse_job (NULL, NULL, "test", buf, strlen (buf), &pos, &lineno); |
3232 | |
3233 | TEST_EQ_P (job, NULL); |
3234 | |
3235 | @@ -2460,7 +2499,7 @@ |
3236 | |
3237 | pos = 0; |
3238 | lineno = 1; |
3239 | - job = parse_job (NULL, "test", buf, strlen (buf), &pos, &lineno); |
3240 | + job = parse_job (NULL, NULL, "test", buf, strlen (buf), &pos, &lineno); |
3241 | |
3242 | TEST_EQ_P (job, NULL); |
3243 | |
3244 | @@ -2479,7 +2518,7 @@ |
3245 | |
3246 | pos = 0; |
3247 | lineno = 1; |
3248 | - job = parse_job (NULL, "test", buf, strlen (buf), &pos, &lineno); |
3249 | + job = parse_job (NULL, NULL, "test", buf, strlen (buf), &pos, &lineno); |
3250 | |
3251 | TEST_EQ_P (job, NULL); |
3252 | |
3253 | @@ -2498,7 +2537,7 @@ |
3254 | |
3255 | pos = 0; |
3256 | lineno = 1; |
3257 | - job = parse_job (NULL, "test", buf, strlen (buf), &pos, &lineno); |
3258 | + job = parse_job (NULL, NULL, "test", buf, strlen (buf), &pos, &lineno); |
3259 | |
3260 | TEST_EQ_P (job, NULL); |
3261 | |
3262 | @@ -2517,7 +2556,7 @@ |
3263 | |
3264 | pos = 0; |
3265 | lineno = 1; |
3266 | - job = parse_job (NULL, "test", buf, strlen (buf), &pos, &lineno); |
3267 | + job = parse_job (NULL, NULL, "test", buf, strlen (buf), &pos, &lineno); |
3268 | |
3269 | TEST_EQ_P (job, NULL); |
3270 | |
3271 | @@ -2551,7 +2590,7 @@ |
3272 | TEST_ALLOC_FAIL { |
3273 | pos = 0; |
3274 | lineno = 1; |
3275 | - job = parse_job (NULL, "test", buf, strlen (buf), |
3276 | + job = parse_job (NULL, NULL, "test", buf, strlen (buf), |
3277 | &pos, &lineno); |
3278 | |
3279 | if (test_alloc_failed) { |
3280 | @@ -2586,7 +2625,7 @@ |
3281 | TEST_FEATURE ("manual stanza after start on"); |
3282 | strcpy (buf, "start on wibble\nmanual\n"); |
3283 | |
3284 | - job = parse_job (NULL, "test", buf, strlen (buf), |
3285 | + job = parse_job (NULL, NULL, "test", buf, strlen (buf), |
3286 | &pos, &lineno); |
3287 | |
3288 | TEST_NE_P (job, NULL); |
3289 | @@ -2616,7 +2655,7 @@ |
3290 | TEST_ALLOC_FAIL { |
3291 | pos = 0; |
3292 | lineno = 1; |
3293 | - job = parse_job (NULL, "test", buf, strlen (buf), |
3294 | + job = parse_job (NULL, NULL, "test", buf, strlen (buf), |
3295 | &pos, &lineno); |
3296 | |
3297 | if (test_alloc_failed) { |
3298 | @@ -2661,7 +2700,7 @@ |
3299 | TEST_ALLOC_FAIL { |
3300 | pos = 0; |
3301 | lineno = 1; |
3302 | - job = parse_job (NULL, "test", buf, strlen (buf), |
3303 | + job = parse_job (NULL, NULL, "test", buf, strlen (buf), |
3304 | &pos, &lineno); |
3305 | |
3306 | if (test_alloc_failed) { |
3307 | @@ -2713,7 +2752,7 @@ |
3308 | TEST_ALLOC_FAIL { |
3309 | pos = 0; |
3310 | lineno = 1; |
3311 | - job = parse_job (NULL, "test", buf, strlen (buf), |
3312 | + job = parse_job (NULL, NULL, "test", buf, strlen (buf), |
3313 | &pos, &lineno); |
3314 | |
3315 | if (test_alloc_failed) { |
3316 | @@ -2764,7 +2803,7 @@ |
3317 | TEST_ALLOC_FAIL { |
3318 | pos = 0; |
3319 | lineno = 1; |
3320 | - job = parse_job (NULL, "test", buf, strlen (buf), |
3321 | + job = parse_job (NULL, NULL, "test", buf, strlen (buf), |
3322 | &pos, &lineno); |
3323 | |
3324 | if (test_alloc_failed) { |
3325 | @@ -2827,7 +2866,7 @@ |
3326 | TEST_ALLOC_FAIL { |
3327 | pos = 0; |
3328 | lineno = 1; |
3329 | - job = parse_job (NULL, "test", buf, strlen (buf), |
3330 | + job = parse_job (NULL, NULL, "test", buf, strlen (buf), |
3331 | &pos, &lineno); |
3332 | |
3333 | if (test_alloc_failed) { |
3334 | @@ -2897,7 +2936,7 @@ |
3335 | TEST_ALLOC_FAIL { |
3336 | pos = 0; |
3337 | lineno = 1; |
3338 | - job = parse_job (NULL, "test", buf, strlen (buf), |
3339 | + job = parse_job (NULL, NULL, "test", buf, strlen (buf), |
3340 | &pos, &lineno); |
3341 | |
3342 | if (test_alloc_failed) { |
3343 | @@ -2975,7 +3014,7 @@ |
3344 | TEST_ALLOC_FAIL { |
3345 | pos = 0; |
3346 | lineno = 1; |
3347 | - job = parse_job (NULL, "test", buf, strlen (buf), |
3348 | + job = parse_job (NULL, NULL, "test", buf, strlen (buf), |
3349 | &pos, &lineno); |
3350 | |
3351 | if (test_alloc_failed) { |
3352 | @@ -3055,7 +3094,7 @@ |
3353 | TEST_ALLOC_FAIL { |
3354 | pos = 0; |
3355 | lineno = 1; |
3356 | - job = parse_job (NULL, "test", buf, strlen (buf), |
3357 | + job = parse_job (NULL, NULL, "test", buf, strlen (buf), |
3358 | &pos, &lineno); |
3359 | |
3360 | if (test_alloc_failed) { |
3361 | @@ -3134,7 +3173,7 @@ |
3362 | TEST_ALLOC_FAIL { |
3363 | pos = 0; |
3364 | lineno = 1; |
3365 | - job = parse_job (NULL, "test", buf, strlen (buf), |
3366 | + job = parse_job (NULL, NULL, "test", buf, strlen (buf), |
3367 | &pos, &lineno); |
3368 | |
3369 | if (test_alloc_failed) { |
3370 | @@ -3176,7 +3215,7 @@ |
3371 | |
3372 | pos = 0; |
3373 | lineno = 1; |
3374 | - job = parse_job (NULL, "test", buf, strlen (buf), &pos, &lineno); |
3375 | + job = parse_job (NULL, NULL, "test", buf, strlen (buf), &pos, &lineno); |
3376 | |
3377 | TEST_EQ_P (job, NULL); |
3378 | |
3379 | @@ -3195,7 +3234,7 @@ |
3380 | |
3381 | pos = 0; |
3382 | lineno = 1; |
3383 | - job = parse_job (NULL, "test", buf, strlen (buf), &pos, &lineno); |
3384 | + job = parse_job (NULL, NULL, "test", buf, strlen (buf), &pos, &lineno); |
3385 | |
3386 | TEST_EQ_P (job, NULL); |
3387 | |
3388 | @@ -3214,7 +3253,7 @@ |
3389 | |
3390 | pos = 0; |
3391 | lineno = 1; |
3392 | - job = parse_job (NULL, "test", buf, strlen (buf), &pos, &lineno); |
3393 | + job = parse_job (NULL, NULL, "test", buf, strlen (buf), &pos, &lineno); |
3394 | |
3395 | TEST_EQ_P (job, NULL); |
3396 | |
3397 | @@ -3233,7 +3272,7 @@ |
3398 | |
3399 | pos = 0; |
3400 | lineno = 1; |
3401 | - job = parse_job (NULL, "test", buf, strlen (buf), &pos, &lineno); |
3402 | + job = parse_job (NULL, NULL, "test", buf, strlen (buf), &pos, &lineno); |
3403 | |
3404 | TEST_EQ_P (job, NULL); |
3405 | |
3406 | @@ -3252,7 +3291,7 @@ |
3407 | |
3408 | pos = 0; |
3409 | lineno = 1; |
3410 | - job = parse_job (NULL, "test", buf, strlen (buf), &pos, &lineno); |
3411 | + job = parse_job (NULL, NULL, "test", buf, strlen (buf), &pos, &lineno); |
3412 | |
3413 | TEST_EQ_P (job, NULL); |
3414 | |
3415 | @@ -3269,7 +3308,7 @@ |
3416 | |
3417 | pos = 0; |
3418 | lineno = 1; |
3419 | - job = parse_job (NULL, "test", buf, strlen (buf), &pos, &lineno); |
3420 | + job = parse_job (NULL, NULL, "test", buf, strlen (buf), &pos, &lineno); |
3421 | |
3422 | TEST_EQ_P (job, NULL); |
3423 | |
3424 | @@ -3288,7 +3327,7 @@ |
3425 | |
3426 | pos = 0; |
3427 | lineno = 1; |
3428 | - job = parse_job (NULL, "test", buf, strlen (buf), &pos, &lineno); |
3429 | + job = parse_job (NULL, NULL, "test", buf, strlen (buf), &pos, &lineno); |
3430 | |
3431 | TEST_EQ_P (job, NULL); |
3432 | |
3433 | @@ -3307,7 +3346,7 @@ |
3434 | |
3435 | pos = 0; |
3436 | lineno = 1; |
3437 | - job = parse_job (NULL, "test", buf, strlen (buf), &pos, &lineno); |
3438 | + job = parse_job (NULL, NULL, "test", buf, strlen (buf), &pos, &lineno); |
3439 | |
3440 | TEST_EQ_P (job, NULL); |
3441 | |
3442 | @@ -3326,7 +3365,7 @@ |
3443 | |
3444 | pos = 0; |
3445 | lineno = 1; |
3446 | - job = parse_job (NULL, "test", buf, strlen (buf), &pos, &lineno); |
3447 | + job = parse_job (NULL, NULL, "test", buf, strlen (buf), &pos, &lineno); |
3448 | |
3449 | TEST_EQ_P (job, NULL); |
3450 | |
3451 | @@ -3345,7 +3384,7 @@ |
3452 | |
3453 | pos = 0; |
3454 | lineno = 1; |
3455 | - job = parse_job (NULL, "test", buf, strlen (buf), &pos, &lineno); |
3456 | + job = parse_job (NULL, NULL, "test", buf, strlen (buf), &pos, &lineno); |
3457 | |
3458 | TEST_EQ_P (job, NULL); |
3459 | |
3460 | @@ -3364,7 +3403,7 @@ |
3461 | |
3462 | pos = 0; |
3463 | lineno = 1; |
3464 | - job = parse_job (NULL, "test", buf, strlen (buf), &pos, &lineno); |
3465 | + job = parse_job (NULL, NULL, "test", buf, strlen (buf), &pos, &lineno); |
3466 | |
3467 | TEST_EQ_P (job, NULL); |
3468 | |
3469 | @@ -3383,7 +3422,7 @@ |
3470 | |
3471 | pos = 0; |
3472 | lineno = 1; |
3473 | - job = parse_job (NULL, "test", buf, strlen (buf), &pos, &lineno); |
3474 | + job = parse_job (NULL, NULL, "test", buf, strlen (buf), &pos, &lineno); |
3475 | |
3476 | TEST_EQ_P (job, NULL); |
3477 | |
3478 | @@ -3402,7 +3441,7 @@ |
3479 | |
3480 | pos = 0; |
3481 | lineno = 1; |
3482 | - job = parse_job (NULL, "test", buf, strlen (buf), &pos, &lineno); |
3483 | + job = parse_job (NULL, NULL, "test", buf, strlen (buf), &pos, &lineno); |
3484 | |
3485 | TEST_EQ_P (job, NULL); |
3486 | |
3487 | @@ -3432,7 +3471,7 @@ |
3488 | TEST_ALLOC_FAIL { |
3489 | pos = 0; |
3490 | lineno = 1; |
3491 | - job = parse_job (NULL, "test", buf, strlen (buf), |
3492 | + job = parse_job (NULL, NULL, "test", buf, strlen (buf), |
3493 | &pos, &lineno); |
3494 | |
3495 | if (test_alloc_failed) { |
3496 | @@ -3465,7 +3504,7 @@ |
3497 | TEST_ALLOC_FAIL { |
3498 | pos = 0; |
3499 | lineno = 1; |
3500 | - job = parse_job (NULL, "test", buf, strlen (buf), |
3501 | + job = parse_job (NULL, NULL, "test", buf, strlen (buf), |
3502 | &pos, &lineno); |
3503 | |
3504 | if (test_alloc_failed) { |
3505 | @@ -3498,7 +3537,7 @@ |
3506 | |
3507 | pos = 0; |
3508 | lineno = 1; |
3509 | - job = parse_job (NULL, "test", buf, strlen (buf), &pos, &lineno); |
3510 | + job = parse_job (NULL, NULL, "test", buf, strlen (buf), &pos, &lineno); |
3511 | |
3512 | TEST_EQ_P (job, NULL); |
3513 | |
3514 | @@ -3517,7 +3556,7 @@ |
3515 | |
3516 | pos = 0; |
3517 | lineno = 1; |
3518 | - job = parse_job (NULL, "test", buf, strlen (buf), &pos, &lineno); |
3519 | + job = parse_job (NULL, NULL, "test", buf, strlen (buf), &pos, &lineno); |
3520 | |
3521 | TEST_EQ_P (job, NULL); |
3522 | |
3523 | @@ -3547,7 +3586,7 @@ |
3524 | TEST_ALLOC_FAIL { |
3525 | pos = 0; |
3526 | lineno = 1; |
3527 | - job = parse_job (NULL, "test", buf, strlen (buf), |
3528 | + job = parse_job (NULL, NULL, "test", buf, strlen (buf), |
3529 | &pos, &lineno); |
3530 | |
3531 | if (test_alloc_failed) { |
3532 | @@ -3580,7 +3619,7 @@ |
3533 | TEST_ALLOC_FAIL { |
3534 | pos = 0; |
3535 | lineno = 1; |
3536 | - job = parse_job (NULL, "test", buf, strlen (buf), |
3537 | + job = parse_job (NULL, NULL, "test", buf, strlen (buf), |
3538 | &pos, &lineno); |
3539 | |
3540 | if (test_alloc_failed) { |
3541 | @@ -3613,7 +3652,7 @@ |
3542 | |
3543 | pos = 0; |
3544 | lineno = 1; |
3545 | - job = parse_job (NULL, "test", buf, strlen (buf), &pos, &lineno); |
3546 | + job = parse_job (NULL, NULL, "test", buf, strlen (buf), &pos, &lineno); |
3547 | |
3548 | TEST_EQ_P (job, NULL); |
3549 | |
3550 | @@ -3632,7 +3671,7 @@ |
3551 | |
3552 | pos = 0; |
3553 | lineno = 1; |
3554 | - job = parse_job (NULL, "test", buf, strlen (buf), &pos, &lineno); |
3555 | + job = parse_job (NULL, NULL, "test", buf, strlen (buf), &pos, &lineno); |
3556 | |
3557 | TEST_EQ_P (job, NULL); |
3558 | |
3559 | @@ -3662,7 +3701,7 @@ |
3560 | TEST_ALLOC_FAIL { |
3561 | pos = 0; |
3562 | lineno = 1; |
3563 | - job = parse_job (NULL, "test", buf, strlen (buf), |
3564 | + job = parse_job (NULL, NULL, "test", buf, strlen (buf), |
3565 | &pos, &lineno); |
3566 | |
3567 | if (test_alloc_failed) { |
3568 | @@ -3695,7 +3734,7 @@ |
3569 | TEST_ALLOC_FAIL { |
3570 | pos = 0; |
3571 | lineno = 1; |
3572 | - job = parse_job (NULL, "test", buf, strlen (buf), |
3573 | + job = parse_job (NULL, NULL, "test", buf, strlen (buf), |
3574 | &pos, &lineno); |
3575 | |
3576 | if (test_alloc_failed) { |
3577 | @@ -3728,7 +3767,7 @@ |
3578 | |
3579 | pos = 0; |
3580 | lineno = 1; |
3581 | - job = parse_job (NULL, "test", buf, strlen (buf), &pos, &lineno); |
3582 | + job = parse_job (NULL, NULL, "test", buf, strlen (buf), &pos, &lineno); |
3583 | |
3584 | TEST_EQ_P (job, NULL); |
3585 | |
3586 | @@ -3747,7 +3786,7 @@ |
3587 | |
3588 | pos = 0; |
3589 | lineno = 1; |
3590 | - job = parse_job (NULL, "test", buf, strlen (buf), &pos, &lineno); |
3591 | + job = parse_job (NULL, NULL, "test", buf, strlen (buf), &pos, &lineno); |
3592 | |
3593 | TEST_EQ_P (job, NULL); |
3594 | |
3595 | @@ -3777,7 +3816,7 @@ |
3596 | TEST_ALLOC_FAIL { |
3597 | pos = 0; |
3598 | lineno = 1; |
3599 | - job = parse_job (NULL, "test", buf, strlen (buf), |
3600 | + job = parse_job (NULL, NULL, "test", buf, strlen (buf), |
3601 | &pos, &lineno); |
3602 | |
3603 | if (test_alloc_failed) { |
3604 | @@ -3814,7 +3853,7 @@ |
3605 | TEST_ALLOC_FAIL { |
3606 | pos = 0; |
3607 | lineno = 1; |
3608 | - job = parse_job (NULL, "test", buf, strlen (buf), |
3609 | + job = parse_job (NULL, NULL, "test", buf, strlen (buf), |
3610 | &pos, &lineno); |
3611 | |
3612 | if (test_alloc_failed) { |
3613 | @@ -3857,7 +3896,7 @@ |
3614 | TEST_ALLOC_FAIL { |
3615 | pos = 0; |
3616 | lineno = 1; |
3617 | - job = parse_job (NULL, "test", buf, strlen (buf), |
3618 | + job = parse_job (NULL, NULL, "test", buf, strlen (buf), |
3619 | &pos, &lineno); |
3620 | |
3621 | if (test_alloc_failed) { |
3622 | @@ -3899,7 +3938,7 @@ |
3623 | |
3624 | pos = 0; |
3625 | lineno = 1; |
3626 | - job = parse_job (NULL, "test", buf, strlen (buf), &pos, &lineno); |
3627 | + job = parse_job (NULL, NULL, "test", buf, strlen (buf), &pos, &lineno); |
3628 | |
3629 | TEST_EQ_P (job, NULL); |
3630 | |
3631 | @@ -3929,7 +3968,7 @@ |
3632 | TEST_ALLOC_FAIL { |
3633 | pos = 0; |
3634 | lineno = 1; |
3635 | - job = parse_job (NULL, "test", buf, strlen (buf), |
3636 | + job = parse_job (NULL, NULL, "test", buf, strlen (buf), |
3637 | &pos, &lineno); |
3638 | |
3639 | if (test_alloc_failed) { |
3640 | @@ -3962,7 +4001,7 @@ |
3641 | TEST_ALLOC_FAIL { |
3642 | pos = 0; |
3643 | lineno = 1; |
3644 | - job = parse_job (NULL, "test", buf, strlen (buf), |
3645 | + job = parse_job (NULL, NULL, "test", buf, strlen (buf), |
3646 | &pos, &lineno); |
3647 | |
3648 | if (test_alloc_failed) { |
3649 | @@ -3995,7 +4034,7 @@ |
3650 | TEST_ALLOC_FAIL { |
3651 | pos = 0; |
3652 | lineno = 1; |
3653 | - job = parse_job (NULL, "test", buf, strlen (buf), |
3654 | + job = parse_job (NULL, NULL, "test", buf, strlen (buf), |
3655 | &pos, &lineno); |
3656 | |
3657 | if (test_alloc_failed) { |
3658 | @@ -4028,7 +4067,7 @@ |
3659 | TEST_ALLOC_FAIL { |
3660 | pos = 0; |
3661 | lineno = 1; |
3662 | - job = parse_job (NULL, "test", buf, strlen (buf), |
3663 | + job = parse_job (NULL, NULL, "test", buf, strlen (buf), |
3664 | &pos, &lineno); |
3665 | |
3666 | if (test_alloc_failed) { |
3667 | @@ -4061,7 +4100,7 @@ |
3668 | TEST_ALLOC_FAIL { |
3669 | pos = 0; |
3670 | lineno = 1; |
3671 | - job = parse_job (NULL, "test", buf, strlen (buf), |
3672 | + job = parse_job (NULL, NULL, "test", buf, strlen (buf), |
3673 | &pos, &lineno); |
3674 | |
3675 | if (test_alloc_failed) { |
3676 | @@ -4093,7 +4132,7 @@ |
3677 | |
3678 | pos = 0; |
3679 | lineno = 1; |
3680 | - job = parse_job (NULL, "test", buf, strlen (buf), &pos, &lineno); |
3681 | + job = parse_job (NULL, NULL, "test", buf, strlen (buf), &pos, &lineno); |
3682 | |
3683 | TEST_EQ_P (job, NULL); |
3684 | |
3685 | @@ -4112,7 +4151,7 @@ |
3686 | |
3687 | pos = 0; |
3688 | lineno = 1; |
3689 | - job = parse_job (NULL, "test", buf, strlen (buf), &pos, &lineno); |
3690 | + job = parse_job (NULL, NULL, "test", buf, strlen (buf), &pos, &lineno); |
3691 | |
3692 | TEST_EQ_P (job, NULL); |
3693 | |
3694 | @@ -4131,7 +4170,7 @@ |
3695 | |
3696 | pos = 0; |
3697 | lineno = 1; |
3698 | - job = parse_job (NULL, "test", buf, strlen (buf), &pos, &lineno); |
3699 | + job = parse_job (NULL, NULL, "test", buf, strlen (buf), &pos, &lineno); |
3700 | |
3701 | TEST_EQ_P (job, NULL); |
3702 | |
3703 | @@ -4159,7 +4198,7 @@ |
3704 | TEST_ALLOC_FAIL { |
3705 | pos = 0; |
3706 | lineno = 1; |
3707 | - job = parse_job (NULL, "test", buf, strlen (buf), |
3708 | + job = parse_job (NULL, NULL, "test", buf, strlen (buf), |
3709 | &pos, &lineno); |
3710 | |
3711 | if (test_alloc_failed) { |
3712 | @@ -4193,7 +4232,7 @@ |
3713 | TEST_ALLOC_FAIL { |
3714 | pos = 0; |
3715 | lineno = 1; |
3716 | - job = parse_job (NULL, "test", buf, strlen (buf), |
3717 | + job = parse_job (NULL, NULL, "test", buf, strlen (buf), |
3718 | &pos, &lineno); |
3719 | |
3720 | if (test_alloc_failed) { |
3721 | @@ -4226,7 +4265,7 @@ |
3722 | TEST_ALLOC_FAIL { |
3723 | pos = 0; |
3724 | lineno = 1; |
3725 | - job = parse_job (NULL, "test", buf, strlen (buf), |
3726 | + job = parse_job (NULL, NULL, "test", buf, strlen (buf), |
3727 | &pos, &lineno); |
3728 | |
3729 | if (test_alloc_failed) { |
3730 | @@ -4260,7 +4299,7 @@ |
3731 | TEST_ALLOC_FAIL { |
3732 | pos = 0; |
3733 | lineno = 1; |
3734 | - job = parse_job (NULL, "test", buf, strlen (buf), |
3735 | + job = parse_job (NULL, NULL, "test", buf, strlen (buf), |
3736 | &pos, &lineno); |
3737 | |
3738 | if (test_alloc_failed) { |
3739 | @@ -4293,7 +4332,7 @@ |
3740 | TEST_ALLOC_FAIL { |
3741 | pos = 0; |
3742 | lineno = 1; |
3743 | - job = parse_job (NULL, "test", buf, strlen (buf), |
3744 | + job = parse_job (NULL, NULL, "test", buf, strlen (buf), |
3745 | &pos, &lineno); |
3746 | |
3747 | if (test_alloc_failed) { |
3748 | @@ -4326,7 +4365,7 @@ |
3749 | |
3750 | pos = 0; |
3751 | lineno = 1; |
3752 | - job = parse_job (NULL, "test", buf, strlen (buf), &pos, &lineno); |
3753 | + job = parse_job (NULL, NULL, "test", buf, strlen (buf), &pos, &lineno); |
3754 | |
3755 | TEST_EQ_P (job, NULL); |
3756 | |
3757 | @@ -4345,7 +4384,7 @@ |
3758 | |
3759 | pos = 0; |
3760 | lineno = 1; |
3761 | - job = parse_job (NULL, "test", buf, strlen (buf), &pos, &lineno); |
3762 | + job = parse_job (NULL, NULL, "test", buf, strlen (buf), &pos, &lineno); |
3763 | |
3764 | TEST_EQ_P (job, NULL); |
3765 | |
3766 | @@ -4364,7 +4403,7 @@ |
3767 | |
3768 | pos = 0; |
3769 | lineno = 1; |
3770 | - job = parse_job (NULL, "test", buf, strlen (buf), &pos, &lineno); |
3771 | + job = parse_job (NULL, NULL, "test", buf, strlen (buf), &pos, &lineno); |
3772 | |
3773 | TEST_EQ_P (job, NULL); |
3774 | |
3775 | @@ -4383,7 +4422,7 @@ |
3776 | |
3777 | pos = 0; |
3778 | lineno = 1; |
3779 | - job = parse_job (NULL, "test", buf, strlen (buf), &pos, &lineno); |
3780 | + job = parse_job (NULL, NULL, "test", buf, strlen (buf), &pos, &lineno); |
3781 | |
3782 | TEST_EQ_P (job, NULL); |
3783 | |
3784 | @@ -4402,7 +4441,7 @@ |
3785 | |
3786 | pos = 0; |
3787 | lineno = 1; |
3788 | - job = parse_job (NULL, "test", buf, strlen (buf), &pos, &lineno); |
3789 | + job = parse_job (NULL, NULL, "test", buf, strlen (buf), &pos, &lineno); |
3790 | |
3791 | TEST_EQ_P (job, NULL); |
3792 | |
3793 | @@ -4421,7 +4460,7 @@ |
3794 | |
3795 | pos = 0; |
3796 | lineno = 1; |
3797 | - job = parse_job (NULL, "test", buf, strlen (buf), &pos, &lineno); |
3798 | + job = parse_job (NULL, NULL, "test", buf, strlen (buf), &pos, &lineno); |
3799 | |
3800 | TEST_EQ_P (job, NULL); |
3801 | |
3802 | @@ -4440,7 +4479,7 @@ |
3803 | |
3804 | pos = 0; |
3805 | lineno = 1; |
3806 | - job = parse_job (NULL, "test", buf, strlen (buf), &pos, &lineno); |
3807 | + job = parse_job (NULL, NULL, "test", buf, strlen (buf), &pos, &lineno); |
3808 | |
3809 | TEST_EQ_P (job, NULL); |
3810 | |
3811 | @@ -4459,7 +4498,7 @@ |
3812 | |
3813 | pos = 0; |
3814 | lineno = 1; |
3815 | - job = parse_job (NULL, "test", buf, strlen (buf), &pos, &lineno); |
3816 | + job = parse_job (NULL, NULL, "test", buf, strlen (buf), &pos, &lineno); |
3817 | |
3818 | TEST_EQ_P (job, NULL); |
3819 | |
3820 | @@ -4478,7 +4517,7 @@ |
3821 | |
3822 | pos = 0; |
3823 | lineno = 1; |
3824 | - job = parse_job (NULL, "test", buf, strlen (buf), &pos, &lineno); |
3825 | + job = parse_job (NULL, NULL, "test", buf, strlen (buf), &pos, &lineno); |
3826 | |
3827 | TEST_EQ_P (job, NULL); |
3828 | |
3829 | @@ -4497,7 +4536,7 @@ |
3830 | |
3831 | pos = 0; |
3832 | lineno = 1; |
3833 | - job = parse_job (NULL, "test", buf, strlen (buf), &pos, &lineno); |
3834 | + job = parse_job (NULL, NULL, "test", buf, strlen (buf), &pos, &lineno); |
3835 | |
3836 | TEST_EQ_P (job, NULL); |
3837 | |
3838 | @@ -4516,7 +4555,7 @@ |
3839 | |
3840 | pos = 0; |
3841 | lineno = 1; |
3842 | - job = parse_job (NULL, "test", buf, strlen (buf), &pos, &lineno); |
3843 | + job = parse_job (NULL, NULL, "test", buf, strlen (buf), &pos, &lineno); |
3844 | |
3845 | TEST_EQ_P (job, NULL); |
3846 | |
3847 | @@ -4535,7 +4574,7 @@ |
3848 | |
3849 | pos = 0; |
3850 | lineno = 1; |
3851 | - job = parse_job (NULL, "test", buf, strlen (buf), &pos, &lineno); |
3852 | + job = parse_job (NULL, NULL, "test", buf, strlen (buf), &pos, &lineno); |
3853 | |
3854 | TEST_EQ_P (job, NULL); |
3855 | |
3856 | @@ -4565,7 +4604,7 @@ |
3857 | TEST_ALLOC_FAIL { |
3858 | pos = 0; |
3859 | lineno = 1; |
3860 | - job = parse_job (NULL, "test", buf, strlen (buf), |
3861 | + job = parse_job (NULL, NULL, "test", buf, strlen (buf), |
3862 | &pos, &lineno); |
3863 | |
3864 | if (test_alloc_failed) { |
3865 | @@ -4597,7 +4636,7 @@ |
3866 | TEST_ALLOC_FAIL { |
3867 | pos = 0; |
3868 | lineno = 1; |
3869 | - job = parse_job (NULL, "test", buf, strlen (buf), |
3870 | + job = parse_job (NULL, NULL, "test", buf, strlen (buf), |
3871 | &pos, &lineno); |
3872 | |
3873 | if (test_alloc_failed) { |
3874 | @@ -4629,7 +4668,7 @@ |
3875 | |
3876 | pos = 0; |
3877 | lineno = 1; |
3878 | - job = parse_job (NULL, "test", buf, strlen (buf), &pos, &lineno); |
3879 | + job = parse_job (NULL, NULL, "test", buf, strlen (buf), &pos, &lineno); |
3880 | |
3881 | TEST_EQ_P (job, NULL); |
3882 | |
3883 | @@ -4659,7 +4698,7 @@ |
3884 | TEST_ALLOC_FAIL { |
3885 | pos = 0; |
3886 | lineno = 1; |
3887 | - job = parse_job (NULL, "test", buf, strlen (buf), |
3888 | + job = parse_job (NULL, NULL, "test", buf, strlen (buf), |
3889 | &pos, &lineno); |
3890 | |
3891 | if (test_alloc_failed) { |
3892 | @@ -4693,7 +4732,7 @@ |
3893 | TEST_ALLOC_FAIL { |
3894 | pos = 0; |
3895 | lineno = 1; |
3896 | - job = parse_job (NULL, "test", buf, strlen (buf), |
3897 | + job = parse_job (NULL, NULL, "test", buf, strlen (buf), |
3898 | &pos, &lineno); |
3899 | |
3900 | if (test_alloc_failed) { |
3901 | @@ -4726,7 +4765,7 @@ |
3902 | |
3903 | pos = 0; |
3904 | lineno = 1; |
3905 | - job = parse_job (NULL, "test", buf, strlen (buf), &pos, &lineno); |
3906 | + job = parse_job (NULL, NULL, "test", buf, strlen (buf), &pos, &lineno); |
3907 | |
3908 | TEST_EQ_P (job, NULL); |
3909 | |
3910 | @@ -4745,7 +4784,7 @@ |
3911 | |
3912 | pos = 0; |
3913 | lineno = 1; |
3914 | - job = parse_job (NULL, "test", buf, strlen (buf), &pos, &lineno); |
3915 | + job = parse_job (NULL, NULL, "test", buf, strlen (buf), &pos, &lineno); |
3916 | |
3917 | TEST_EQ_P (job, NULL); |
3918 | |
3919 | @@ -4775,7 +4814,7 @@ |
3920 | TEST_ALLOC_FAIL { |
3921 | pos = 0; |
3922 | lineno = 1; |
3923 | - job = parse_job (NULL, "test", buf, strlen (buf), |
3924 | + job = parse_job (NULL, NULL, "test", buf, strlen (buf), |
3925 | &pos, &lineno); |
3926 | |
3927 | if (test_alloc_failed) { |
3928 | @@ -4808,7 +4847,7 @@ |
3929 | TEST_ALLOC_FAIL { |
3930 | pos = 0; |
3931 | lineno = 1; |
3932 | - job = parse_job (NULL, "test", buf, strlen (buf), |
3933 | + job = parse_job (NULL, NULL, "test", buf, strlen (buf), |
3934 | &pos, &lineno); |
3935 | |
3936 | if (test_alloc_failed) { |
3937 | @@ -4840,7 +4879,7 @@ |
3938 | |
3939 | pos = 0; |
3940 | lineno = 1; |
3941 | - job = parse_job (NULL, "test", buf, strlen (buf), &pos, &lineno); |
3942 | + job = parse_job (NULL, NULL, "test", buf, strlen (buf), &pos, &lineno); |
3943 | |
3944 | TEST_EQ_P (job, NULL); |
3945 | |
3946 | @@ -4859,7 +4898,7 @@ |
3947 | |
3948 | pos = 0; |
3949 | lineno = 1; |
3950 | - job = parse_job (NULL, "test", buf, strlen (buf), &pos, &lineno); |
3951 | + job = parse_job (NULL, NULL, "test", buf, strlen (buf), &pos, &lineno); |
3952 | |
3953 | TEST_EQ_P (job, NULL); |
3954 | |
3955 | @@ -4878,7 +4917,7 @@ |
3956 | |
3957 | pos = 0; |
3958 | lineno = 1; |
3959 | - job = parse_job (NULL, "test", buf, strlen (buf), &pos, &lineno); |
3960 | + job = parse_job (NULL, NULL, "test", buf, strlen (buf), &pos, &lineno); |
3961 | |
3962 | TEST_EQ_P (job, NULL); |
3963 | |
3964 | @@ -4897,7 +4936,7 @@ |
3965 | |
3966 | pos = 0; |
3967 | lineno = 1; |
3968 | - job = parse_job (NULL, "test", buf, strlen (buf), &pos, &lineno); |
3969 | + job = parse_job (NULL, NULL, "test", buf, strlen (buf), &pos, &lineno); |
3970 | |
3971 | TEST_EQ_P (job, NULL); |
3972 | |
3973 | @@ -4916,7 +4955,7 @@ |
3974 | |
3975 | pos = 0; |
3976 | lineno = 1; |
3977 | - job = parse_job (NULL, "test", buf, strlen (buf), &pos, &lineno); |
3978 | + job = parse_job (NULL, NULL, "test", buf, strlen (buf), &pos, &lineno); |
3979 | |
3980 | TEST_EQ_P (job, NULL); |
3981 | |
3982 | @@ -4935,7 +4974,7 @@ |
3983 | |
3984 | pos = 0; |
3985 | lineno = 1; |
3986 | - job = parse_job (NULL, "test", buf, strlen (buf), &pos, &lineno); |
3987 | + job = parse_job (NULL, NULL, "test", buf, strlen (buf), &pos, &lineno); |
3988 | |
3989 | TEST_EQ_P (job, NULL); |
3990 | |
3991 | @@ -4954,7 +4993,7 @@ |
3992 | |
3993 | pos = 0; |
3994 | lineno = 1; |
3995 | - job = parse_job (NULL, "test", buf, strlen (buf), &pos, &lineno); |
3996 | + job = parse_job (NULL, NULL, "test", buf, strlen (buf), &pos, &lineno); |
3997 | |
3998 | TEST_EQ_P (job, NULL); |
3999 | |
4000 | @@ -4974,7 +5013,7 @@ |
4001 | |
4002 | pos = 0; |
4003 | lineno = 1; |
4004 | - job = parse_job (NULL, "test", buf, strlen (buf), &pos, &lineno); |
4005 | + job = parse_job (NULL, NULL, "test", buf, strlen (buf), &pos, &lineno); |
4006 | |
4007 | TEST_EQ_P (job, NULL); |
4008 | |
4009 | @@ -5005,7 +5044,7 @@ |
4010 | TEST_ALLOC_FAIL { |
4011 | pos = 0; |
4012 | lineno = 1; |
4013 | - job = parse_job (NULL, "test", buf, strlen (buf), |
4014 | + job = parse_job (NULL, NULL, "test", buf, strlen (buf), |
4015 | &pos, &lineno); |
4016 | |
4017 | if (test_alloc_failed) { |
4018 | @@ -5044,7 +5083,7 @@ |
4019 | TEST_ALLOC_FAIL { |
4020 | pos = 0; |
4021 | lineno = 1; |
4022 | - job = parse_job (NULL, "test", buf, strlen (buf), |
4023 | + job = parse_job (NULL, NULL, "test", buf, strlen (buf), |
4024 | &pos, &lineno); |
4025 | |
4026 | if (test_alloc_failed) { |
4027 | @@ -5083,7 +5122,7 @@ |
4028 | TEST_ALLOC_FAIL { |
4029 | pos = 0; |
4030 | lineno = 1; |
4031 | - job = parse_job (NULL, "test", buf, strlen (buf), |
4032 | + job = parse_job (NULL, NULL, "test", buf, strlen (buf), |
4033 | &pos, &lineno); |
4034 | |
4035 | if (test_alloc_failed) { |
4036 | @@ -5127,7 +5166,7 @@ |
4037 | TEST_ALLOC_FAIL { |
4038 | pos = 0; |
4039 | lineno = 1; |
4040 | - job = parse_job (NULL, "test", buf, strlen (buf), |
4041 | + job = parse_job (NULL, NULL, "test", buf, strlen (buf), |
4042 | &pos, &lineno); |
4043 | |
4044 | if (test_alloc_failed) { |
4045 | @@ -5168,7 +5207,7 @@ |
4046 | |
4047 | pos = 0; |
4048 | lineno = 1; |
4049 | - job = parse_job (NULL, "test", buf, strlen (buf), &pos, &lineno); |
4050 | + job = parse_job (NULL, NULL, "test", buf, strlen (buf), &pos, &lineno); |
4051 | |
4052 | TEST_EQ_P (job, NULL); |
4053 | |
4054 | @@ -5187,7 +5226,7 @@ |
4055 | |
4056 | pos = 0; |
4057 | lineno = 1; |
4058 | - job = parse_job (NULL, "test", buf, strlen (buf), &pos, &lineno); |
4059 | + job = parse_job (NULL, NULL, "test", buf, strlen (buf), &pos, &lineno); |
4060 | |
4061 | TEST_EQ_P (job, NULL); |
4062 | |
4063 | @@ -5206,7 +5245,7 @@ |
4064 | |
4065 | pos = 0; |
4066 | lineno = 1; |
4067 | - job = parse_job (NULL, "test", buf, strlen (buf), &pos, &lineno); |
4068 | + job = parse_job (NULL, NULL, "test", buf, strlen (buf), &pos, &lineno); |
4069 | |
4070 | TEST_EQ_P (job, NULL); |
4071 | |
4072 | @@ -5225,7 +5264,7 @@ |
4073 | |
4074 | pos = 0; |
4075 | lineno = 1; |
4076 | - job = parse_job (NULL, "test", buf, strlen (buf), &pos, &lineno); |
4077 | + job = parse_job (NULL, NULL, "test", buf, strlen (buf), &pos, &lineno); |
4078 | |
4079 | TEST_EQ_P (job, NULL); |
4080 | |
4081 | @@ -5244,7 +5283,7 @@ |
4082 | |
4083 | pos = 0; |
4084 | lineno = 1; |
4085 | - job = parse_job (NULL, "test", buf, strlen (buf), &pos, &lineno); |
4086 | + job = parse_job (NULL, NULL, "test", buf, strlen (buf), &pos, &lineno); |
4087 | |
4088 | TEST_EQ_P (job, NULL); |
4089 | |
4090 | @@ -5263,7 +5302,7 @@ |
4091 | |
4092 | pos = 0; |
4093 | lineno = 1; |
4094 | - job = parse_job (NULL, "test", buf, strlen (buf), &pos, &lineno); |
4095 | + job = parse_job (NULL, NULL, "test", buf, strlen (buf), &pos, &lineno); |
4096 | |
4097 | TEST_EQ_P (job, NULL); |
4098 | |
4099 | @@ -5293,7 +5332,7 @@ |
4100 | TEST_ALLOC_FAIL { |
4101 | pos = 0; |
4102 | lineno = 1; |
4103 | - job = parse_job (NULL, "test", buf, strlen (buf), |
4104 | + job = parse_job (NULL, NULL, "test", buf, strlen (buf), |
4105 | &pos, &lineno); |
4106 | |
4107 | if (test_alloc_failed) { |
4108 | @@ -5326,7 +5365,7 @@ |
4109 | TEST_ALLOC_FAIL { |
4110 | pos = 0; |
4111 | lineno = 1; |
4112 | - job = parse_job (NULL, "test", buf, strlen (buf), |
4113 | + job = parse_job (NULL, NULL, "test", buf, strlen (buf), |
4114 | &pos, &lineno); |
4115 | |
4116 | if (test_alloc_failed) { |
4117 | @@ -5359,7 +5398,7 @@ |
4118 | TEST_ALLOC_FAIL { |
4119 | pos = 0; |
4120 | lineno = 1; |
4121 | - job = parse_job (NULL, "test", buf, strlen (buf), |
4122 | + job = parse_job (NULL, NULL, "test", buf, strlen (buf), |
4123 | &pos, &lineno); |
4124 | |
4125 | if (test_alloc_failed) { |
4126 | @@ -5392,7 +5431,7 @@ |
4127 | TEST_ALLOC_FAIL { |
4128 | pos = 0; |
4129 | lineno = 1; |
4130 | - job = parse_job (NULL, "test", buf, strlen (buf), |
4131 | + job = parse_job (NULL, NULL, "test", buf, strlen (buf), |
4132 | &pos, &lineno); |
4133 | |
4134 | if (test_alloc_failed) { |
4135 | @@ -5423,7 +5462,7 @@ |
4136 | |
4137 | pos = 0; |
4138 | lineno = 1; |
4139 | - job = parse_job (NULL, "test", buf, strlen (buf), &pos, &lineno); |
4140 | + job = parse_job (NULL, NULL, "test", buf, strlen (buf), &pos, &lineno); |
4141 | |
4142 | TEST_EQ_P (job, NULL); |
4143 | |
4144 | @@ -5442,7 +5481,7 @@ |
4145 | |
4146 | pos = 0; |
4147 | lineno = 1; |
4148 | - job = parse_job (NULL, "test", buf, strlen (buf), &pos, &lineno); |
4149 | + job = parse_job (NULL, NULL, "test", buf, strlen (buf), &pos, &lineno); |
4150 | |
4151 | TEST_EQ_P (job, NULL); |
4152 | |
4153 | @@ -5460,7 +5499,7 @@ |
4154 | |
4155 | pos = 0; |
4156 | lineno = 1; |
4157 | - job = parse_job (NULL, "test", buf, strlen (buf), &pos, &lineno); |
4158 | + job = parse_job (NULL, NULL, "test", buf, strlen (buf), &pos, &lineno); |
4159 | |
4160 | TEST_EQ_P (job, NULL); |
4161 | |
4162 | @@ -5490,7 +5529,7 @@ |
4163 | TEST_ALLOC_FAIL { |
4164 | pos = 0; |
4165 | lineno = 1; |
4166 | - job = parse_job (NULL, "test", buf, strlen (buf), |
4167 | + job = parse_job (NULL, NULL, "test", buf, strlen (buf), |
4168 | &pos, &lineno); |
4169 | |
4170 | if (test_alloc_failed) { |
4171 | @@ -5528,7 +5567,7 @@ |
4172 | TEST_ALLOC_FAIL { |
4173 | pos = 0; |
4174 | lineno = 1; |
4175 | - job = parse_job (NULL, "test", buf, strlen (buf), |
4176 | + job = parse_job (NULL, NULL, "test", buf, strlen (buf), |
4177 | &pos, &lineno); |
4178 | |
4179 | if (test_alloc_failed) { |
4180 | @@ -5565,7 +5604,7 @@ |
4181 | |
4182 | pos = 0; |
4183 | lineno = 1; |
4184 | - job = parse_job (NULL, "test", buf, strlen (buf), &pos, &lineno); |
4185 | + job = parse_job (NULL, NULL, "test", buf, strlen (buf), &pos, &lineno); |
4186 | |
4187 | TEST_EQ_P (job, NULL); |
4188 | |
4189 | @@ -5584,7 +5623,7 @@ |
4190 | |
4191 | pos = 0; |
4192 | lineno = 1; |
4193 | - job = parse_job (NULL, "test", buf, strlen (buf), &pos, &lineno); |
4194 | + job = parse_job (NULL, NULL, "test", buf, strlen (buf), &pos, &lineno); |
4195 | |
4196 | TEST_EQ_P (job, NULL); |
4197 | |
4198 | @@ -5614,7 +5653,7 @@ |
4199 | TEST_ALLOC_FAIL { |
4200 | pos = 0; |
4201 | lineno = 1; |
4202 | - job = parse_job (NULL, "test", buf, strlen (buf), |
4203 | + job = parse_job (NULL, NULL, "test", buf, strlen (buf), |
4204 | &pos, &lineno); |
4205 | |
4206 | if (test_alloc_failed) { |
4207 | @@ -5651,7 +5690,7 @@ |
4208 | TEST_ALLOC_FAIL { |
4209 | pos = 0; |
4210 | lineno = 1; |
4211 | - job = parse_job (NULL, "test", buf, strlen (buf), |
4212 | + job = parse_job (NULL, NULL, "test", buf, strlen (buf), |
4213 | &pos, &lineno); |
4214 | |
4215 | if (test_alloc_failed) { |
4216 | @@ -5694,7 +5733,7 @@ |
4217 | TEST_ALLOC_FAIL { |
4218 | pos = 0; |
4219 | lineno = 1; |
4220 | - job = parse_job (NULL, "test", buf, strlen (buf), |
4221 | + job = parse_job (NULL, NULL, "test", buf, strlen (buf), |
4222 | &pos, &lineno); |
4223 | |
4224 | if (test_alloc_failed) { |
4225 | @@ -5736,7 +5775,7 @@ |
4226 | |
4227 | pos = 0; |
4228 | lineno = 1; |
4229 | - job = parse_job (NULL, "test", buf, strlen (buf), &pos, &lineno); |
4230 | + job = parse_job (NULL, NULL, "test", buf, strlen (buf), &pos, &lineno); |
4231 | |
4232 | TEST_EQ_P (job, NULL); |
4233 | |
4234 | @@ -5766,7 +5805,7 @@ |
4235 | TEST_ALLOC_FAIL { |
4236 | pos = 0; |
4237 | lineno = 1; |
4238 | - job = parse_job (NULL, "test", buf, strlen (buf), |
4239 | + job = parse_job (NULL, NULL, "test", buf, strlen (buf), |
4240 | &pos, &lineno); |
4241 | |
4242 | if (test_alloc_failed) { |
4243 | @@ -5799,7 +5838,7 @@ |
4244 | TEST_ALLOC_FAIL { |
4245 | pos = 0; |
4246 | lineno = 1; |
4247 | - job = parse_job (NULL, "test", buf, strlen (buf), |
4248 | + job = parse_job (NULL, NULL, "test", buf, strlen (buf), |
4249 | &pos, &lineno); |
4250 | |
4251 | if (test_alloc_failed) { |
4252 | @@ -5831,7 +5870,7 @@ |
4253 | |
4254 | pos = 0; |
4255 | lineno = 1; |
4256 | - job = parse_job (NULL, "test", buf, strlen (buf), &pos, &lineno); |
4257 | + job = parse_job (NULL, NULL, "test", buf, strlen (buf), &pos, &lineno); |
4258 | |
4259 | TEST_EQ_P (job, NULL); |
4260 | |
4261 | @@ -5850,7 +5889,7 @@ |
4262 | |
4263 | pos = 0; |
4264 | lineno = 1; |
4265 | - job = parse_job (NULL, "test", buf, strlen (buf), &pos, &lineno); |
4266 | + job = parse_job (NULL, NULL, "test", buf, strlen (buf), &pos, &lineno); |
4267 | |
4268 | TEST_EQ_P (job, NULL); |
4269 | |
4270 | @@ -5869,7 +5908,7 @@ |
4271 | |
4272 | pos = 0; |
4273 | lineno = 1; |
4274 | - job = parse_job (NULL, "test", buf, strlen (buf), &pos, &lineno); |
4275 | + job = parse_job (NULL, NULL, "test", buf, strlen (buf), &pos, &lineno); |
4276 | |
4277 | TEST_EQ_P (job, NULL); |
4278 | |
4279 | @@ -5888,7 +5927,7 @@ |
4280 | |
4281 | pos = 0; |
4282 | lineno = 1; |
4283 | - job = parse_job (NULL, "test", buf, strlen (buf), &pos, &lineno); |
4284 | + job = parse_job (NULL, NULL, "test", buf, strlen (buf), &pos, &lineno); |
4285 | |
4286 | TEST_EQ_P (job, NULL); |
4287 | |
4288 | @@ -5907,7 +5946,7 @@ |
4289 | |
4290 | pos = 0; |
4291 | lineno = 1; |
4292 | - job = parse_job (NULL, "test", buf, strlen (buf), &pos, &lineno); |
4293 | + job = parse_job (NULL, NULL, "test", buf, strlen (buf), &pos, &lineno); |
4294 | |
4295 | TEST_EQ_P (job, NULL); |
4296 | |
4297 | @@ -5927,7 +5966,7 @@ |
4298 | |
4299 | pos = 0; |
4300 | lineno = 1; |
4301 | - job = parse_job (NULL, "test", buf, strlen (buf), &pos, &lineno); |
4302 | + job = parse_job (NULL, NULL, "test", buf, strlen (buf), &pos, &lineno); |
4303 | |
4304 | TEST_EQ_P (job, NULL); |
4305 | |
4306 | @@ -5957,7 +5996,7 @@ |
4307 | TEST_ALLOC_FAIL { |
4308 | pos = 0; |
4309 | lineno = 1; |
4310 | - job = parse_job (NULL, "test", buf, strlen (buf), |
4311 | + job = parse_job (NULL, NULL, "test", buf, strlen (buf), |
4312 | &pos, &lineno); |
4313 | |
4314 | if (test_alloc_failed) { |
4315 | @@ -5990,7 +6029,7 @@ |
4316 | TEST_ALLOC_FAIL { |
4317 | pos = 0; |
4318 | lineno = 1; |
4319 | - job = parse_job (NULL, "test", buf, strlen (buf), |
4320 | + job = parse_job (NULL, NULL, "test", buf, strlen (buf), |
4321 | &pos, &lineno); |
4322 | |
4323 | if (test_alloc_failed) { |
4324 | @@ -6023,7 +6062,7 @@ |
4325 | TEST_ALLOC_FAIL { |
4326 | pos = 0; |
4327 | lineno = 1; |
4328 | - job = parse_job (NULL, "test", buf, strlen (buf), |
4329 | + job = parse_job (NULL, NULL, "test", buf, strlen (buf), |
4330 | &pos, &lineno); |
4331 | |
4332 | if (test_alloc_failed) { |
4333 | @@ -6055,7 +6094,7 @@ |
4334 | |
4335 | pos = 0; |
4336 | lineno = 1; |
4337 | - job = parse_job (NULL, "test", buf, strlen (buf), &pos, &lineno); |
4338 | + job = parse_job (NULL, NULL, "test", buf, strlen (buf), &pos, &lineno); |
4339 | |
4340 | TEST_EQ_P (job, NULL); |
4341 | |
4342 | @@ -6074,7 +6113,7 @@ |
4343 | |
4344 | pos = 0; |
4345 | lineno = 1; |
4346 | - job = parse_job (NULL, "test", buf, strlen (buf), &pos, &lineno); |
4347 | + job = parse_job (NULL, NULL, "test", buf, strlen (buf), &pos, &lineno); |
4348 | |
4349 | TEST_EQ_P (job, NULL); |
4350 | |
4351 | @@ -6093,7 +6132,7 @@ |
4352 | |
4353 | pos = 0; |
4354 | lineno = 1; |
4355 | - job = parse_job (NULL, "test", buf, strlen (buf), &pos, &lineno); |
4356 | + job = parse_job (NULL, NULL, "test", buf, strlen (buf), &pos, &lineno); |
4357 | |
4358 | TEST_EQ_P (job, NULL); |
4359 | |
4360 | @@ -6112,7 +6151,7 @@ |
4361 | |
4362 | pos = 0; |
4363 | lineno = 1; |
4364 | - job = parse_job (NULL, "test", buf, strlen (buf), &pos, &lineno); |
4365 | + job = parse_job (NULL, NULL, "test", buf, strlen (buf), &pos, &lineno); |
4366 | |
4367 | TEST_EQ_P (job, NULL); |
4368 | |
4369 | @@ -6131,7 +6170,7 @@ |
4370 | |
4371 | pos = 0; |
4372 | lineno = 1; |
4373 | - job = parse_job (NULL, "test", buf, strlen (buf), &pos, &lineno); |
4374 | + job = parse_job (NULL, NULL, "test", buf, strlen (buf), &pos, &lineno); |
4375 | |
4376 | TEST_EQ_P (job, NULL); |
4377 | |
4378 | @@ -6150,7 +6189,7 @@ |
4379 | |
4380 | pos = 0; |
4381 | lineno = 1; |
4382 | - job = parse_job (NULL, "test", buf, strlen (buf), &pos, &lineno); |
4383 | + job = parse_job (NULL, NULL, "test", buf, strlen (buf), &pos, &lineno); |
4384 | |
4385 | TEST_EQ_P (job, NULL); |
4386 | |
4387 | @@ -6180,7 +6219,7 @@ |
4388 | TEST_ALLOC_FAIL { |
4389 | pos = 0; |
4390 | lineno = 1; |
4391 | - job = parse_job (NULL, "test", buf, strlen (buf), |
4392 | + job = parse_job (NULL, NULL, "test", buf, strlen (buf), |
4393 | &pos, &lineno); |
4394 | |
4395 | if (test_alloc_failed) { |
4396 | @@ -6213,7 +6252,7 @@ |
4397 | TEST_ALLOC_FAIL { |
4398 | pos = 0; |
4399 | lineno = 1; |
4400 | - job = parse_job (NULL, "test", buf, strlen (buf), |
4401 | + job = parse_job (NULL, NULL, "test", buf, strlen (buf), |
4402 | &pos, &lineno); |
4403 | |
4404 | if (test_alloc_failed) { |
4405 | @@ -6246,7 +6285,7 @@ |
4406 | TEST_ALLOC_FAIL { |
4407 | pos = 0; |
4408 | lineno = 1; |
4409 | - job = parse_job (NULL, "test", buf, strlen (buf), |
4410 | + job = parse_job (NULL, NULL, "test", buf, strlen (buf), |
4411 | &pos, &lineno); |
4412 | |
4413 | if (test_alloc_failed) { |
4414 | @@ -6279,7 +6318,7 @@ |
4415 | TEST_ALLOC_FAIL { |
4416 | pos = 0; |
4417 | lineno = 1; |
4418 | - job = parse_job (NULL, "test", buf, strlen (buf), |
4419 | + job = parse_job (NULL, NULL, "test", buf, strlen (buf), |
4420 | &pos, &lineno); |
4421 | |
4422 | if (test_alloc_failed) { |
4423 | @@ -6311,7 +6350,7 @@ |
4424 | |
4425 | pos = 0; |
4426 | lineno = 1; |
4427 | - job = parse_job (NULL, "test", buf, strlen (buf), &pos, &lineno); |
4428 | + job = parse_job (NULL, NULL, "test", buf, strlen (buf), &pos, &lineno); |
4429 | |
4430 | TEST_EQ_P (job, NULL); |
4431 | |
4432 | @@ -6330,7 +6369,7 @@ |
4433 | |
4434 | pos = 0; |
4435 | lineno = 1; |
4436 | - job = parse_job (NULL, "test", buf, strlen (buf), &pos, &lineno); |
4437 | + job = parse_job (NULL, NULL, "test", buf, strlen (buf), &pos, &lineno); |
4438 | |
4439 | TEST_EQ_P (job, NULL); |
4440 | |
4441 | @@ -6349,7 +6388,7 @@ |
4442 | |
4443 | pos = 0; |
4444 | lineno = 1; |
4445 | - job = parse_job (NULL, "test", buf, strlen (buf), &pos, &lineno); |
4446 | + job = parse_job (NULL, NULL, "test", buf, strlen (buf), &pos, &lineno); |
4447 | |
4448 | TEST_EQ_P (job, NULL); |
4449 | |
4450 | @@ -6368,7 +6407,7 @@ |
4451 | |
4452 | pos = 0; |
4453 | lineno = 1; |
4454 | - job = parse_job (NULL, "test", buf, strlen (buf), &pos, &lineno); |
4455 | + job = parse_job (NULL, NULL, "test", buf, strlen (buf), &pos, &lineno); |
4456 | |
4457 | TEST_EQ_P (job, NULL); |
4458 | |
4459 | @@ -6387,7 +6426,7 @@ |
4460 | |
4461 | pos = 0; |
4462 | lineno = 1; |
4463 | - job = parse_job (NULL, "test", buf, strlen (buf), &pos, &lineno); |
4464 | + job = parse_job (NULL, NULL, "test", buf, strlen (buf), &pos, &lineno); |
4465 | |
4466 | TEST_EQ_P (job, NULL); |
4467 | |
4468 | @@ -6406,7 +6445,7 @@ |
4469 | |
4470 | pos = 0; |
4471 | lineno = 1; |
4472 | - job = parse_job (NULL, "test", buf, strlen (buf), &pos, &lineno); |
4473 | + job = parse_job (NULL, NULL, "test", buf, strlen (buf), &pos, &lineno); |
4474 | |
4475 | TEST_EQ_P (job, NULL); |
4476 | |
4477 | @@ -6435,7 +6474,7 @@ |
4478 | TEST_ALLOC_FAIL { |
4479 | pos = 0; |
4480 | lineno = 1; |
4481 | - job = parse_job (NULL, "test", buf, strlen (buf), |
4482 | + job = parse_job (NULL, NULL, "test", buf, strlen (buf), |
4483 | &pos, &lineno); |
4484 | |
4485 | if (test_alloc_failed) { |
4486 | @@ -6469,7 +6508,7 @@ |
4487 | TEST_ALLOC_FAIL { |
4488 | pos = 0; |
4489 | lineno = 1; |
4490 | - job = parse_job (NULL, "test", buf, strlen (buf), |
4491 | + job = parse_job (NULL, NULL, "test", buf, strlen (buf), |
4492 | &pos, &lineno); |
4493 | |
4494 | if (test_alloc_failed) { |
4495 | @@ -6503,7 +6542,7 @@ |
4496 | TEST_ALLOC_FAIL { |
4497 | pos = 0; |
4498 | lineno = 1; |
4499 | - job = parse_job (NULL, "test", buf, strlen (buf), |
4500 | + job = parse_job (NULL, NULL, "test", buf, strlen (buf), |
4501 | &pos, &lineno); |
4502 | |
4503 | if (test_alloc_failed) { |
4504 | @@ -6537,7 +6576,7 @@ |
4505 | TEST_ALLOC_FAIL { |
4506 | pos = 0; |
4507 | lineno = 1; |
4508 | - job = parse_job (NULL, "test", buf, strlen (buf), |
4509 | + job = parse_job (NULL, NULL, "test", buf, strlen (buf), |
4510 | &pos, &lineno); |
4511 | |
4512 | if (test_alloc_failed) { |
4513 | @@ -6571,7 +6610,7 @@ |
4514 | TEST_ALLOC_FAIL { |
4515 | pos = 0; |
4516 | lineno = 1; |
4517 | - job = parse_job (NULL, "test", buf, strlen (buf), |
4518 | + job = parse_job (NULL, NULL, "test", buf, strlen (buf), |
4519 | &pos, &lineno); |
4520 | |
4521 | if (test_alloc_failed) { |
4522 | @@ -6606,7 +6645,7 @@ |
4523 | TEST_ALLOC_FAIL { |
4524 | pos = 0; |
4525 | lineno = 1; |
4526 | - job = parse_job (NULL, "test", buf, strlen (buf), |
4527 | + job = parse_job (NULL, NULL, "test", buf, strlen (buf), |
4528 | &pos, &lineno); |
4529 | |
4530 | if (test_alloc_failed) { |
4531 | @@ -6641,7 +6680,7 @@ |
4532 | TEST_ALLOC_FAIL { |
4533 | pos = 0; |
4534 | lineno = 1; |
4535 | - job = parse_job (NULL, "test", buf, strlen (buf), |
4536 | + job = parse_job (NULL, NULL, "test", buf, strlen (buf), |
4537 | &pos, &lineno); |
4538 | |
4539 | if (test_alloc_failed) { |
4540 | @@ -6675,7 +6714,7 @@ |
4541 | TEST_ALLOC_FAIL { |
4542 | pos = 0; |
4543 | lineno = 1; |
4544 | - job = parse_job (NULL, "test", buf, strlen (buf), |
4545 | + job = parse_job (NULL, NULL, "test", buf, strlen (buf), |
4546 | &pos, &lineno); |
4547 | |
4548 | if (test_alloc_failed) { |
4549 | @@ -6710,7 +6749,7 @@ |
4550 | TEST_ALLOC_FAIL { |
4551 | pos = 0; |
4552 | lineno = 1; |
4553 | - job = parse_job (NULL, "test", buf, strlen (buf), |
4554 | + job = parse_job (NULL, NULL, "test", buf, strlen (buf), |
4555 | &pos, &lineno); |
4556 | |
4557 | if (test_alloc_failed) { |
4558 | @@ -6744,7 +6783,7 @@ |
4559 | TEST_ALLOC_FAIL { |
4560 | pos = 0; |
4561 | lineno = 1; |
4562 | - job = parse_job (NULL, "test", buf, strlen (buf), |
4563 | + job = parse_job (NULL, NULL, "test", buf, strlen (buf), |
4564 | &pos, &lineno); |
4565 | |
4566 | if (test_alloc_failed) { |
4567 | @@ -6778,7 +6817,7 @@ |
4568 | TEST_ALLOC_FAIL { |
4569 | pos = 0; |
4570 | lineno = 1; |
4571 | - job = parse_job (NULL, "test", buf, strlen (buf), |
4572 | + job = parse_job (NULL, NULL, "test", buf, strlen (buf), |
4573 | &pos, &lineno); |
4574 | |
4575 | if (test_alloc_failed) { |
4576 | @@ -6812,7 +6851,7 @@ |
4577 | TEST_ALLOC_FAIL { |
4578 | pos = 0; |
4579 | lineno = 1; |
4580 | - job = parse_job (NULL, "test", buf, strlen (buf), |
4581 | + job = parse_job (NULL, NULL, "test", buf, strlen (buf), |
4582 | &pos, &lineno); |
4583 | |
4584 | if (test_alloc_failed) { |
4585 | @@ -6847,7 +6886,7 @@ |
4586 | TEST_ALLOC_FAIL { |
4587 | pos = 0; |
4588 | lineno = 1; |
4589 | - job = parse_job (NULL, "test", buf, strlen (buf), |
4590 | + job = parse_job (NULL, NULL, "test", buf, strlen (buf), |
4591 | &pos, &lineno); |
4592 | |
4593 | if (test_alloc_failed) { |
4594 | @@ -6881,7 +6920,7 @@ |
4595 | TEST_ALLOC_FAIL { |
4596 | pos = 0; |
4597 | lineno = 1; |
4598 | - job = parse_job (NULL, "test", buf, strlen (buf), |
4599 | + job = parse_job (NULL, NULL, "test", buf, strlen (buf), |
4600 | &pos, &lineno); |
4601 | |
4602 | if (test_alloc_failed) { |
4603 | @@ -6917,7 +6956,7 @@ |
4604 | TEST_ALLOC_FAIL { |
4605 | pos = 0; |
4606 | lineno = 1; |
4607 | - job = parse_job (NULL, "test", buf, strlen (buf), |
4608 | + job = parse_job (NULL, NULL, "test", buf, strlen (buf), |
4609 | &pos, &lineno); |
4610 | |
4611 | if (test_alloc_failed) { |
4612 | @@ -6956,7 +6995,7 @@ |
4613 | TEST_ALLOC_FAIL { |
4614 | pos = 0; |
4615 | lineno = 1; |
4616 | - job = parse_job (NULL, "test", buf, strlen (buf), |
4617 | + job = parse_job (NULL, NULL, "test", buf, strlen (buf), |
4618 | &pos, &lineno); |
4619 | |
4620 | if (test_alloc_failed) { |
4621 | @@ -6991,7 +7030,7 @@ |
4622 | TEST_ALLOC_FAIL { |
4623 | pos = 0; |
4624 | lineno = 1; |
4625 | - job = parse_job (NULL, "test", buf, strlen (buf), |
4626 | + job = parse_job (NULL, NULL, "test", buf, strlen (buf), |
4627 | &pos, &lineno); |
4628 | |
4629 | if (test_alloc_failed) { |
4630 | @@ -7026,7 +7065,7 @@ |
4631 | TEST_ALLOC_FAIL { |
4632 | pos = 0; |
4633 | lineno = 1; |
4634 | - job = parse_job (NULL, "test", buf, strlen (buf), |
4635 | + job = parse_job (NULL, NULL, "test", buf, strlen (buf), |
4636 | &pos, &lineno); |
4637 | |
4638 | if (test_alloc_failed) { |
4639 | @@ -7060,7 +7099,7 @@ |
4640 | |
4641 | pos = 0; |
4642 | lineno = 1; |
4643 | - job = parse_job (NULL, "test", buf, strlen (buf), &pos, &lineno); |
4644 | + job = parse_job (NULL, NULL, "test", buf, strlen (buf), &pos, &lineno); |
4645 | |
4646 | TEST_EQ_P (job, NULL); |
4647 | |
4648 | @@ -7079,7 +7118,7 @@ |
4649 | |
4650 | pos = 0; |
4651 | lineno = 1; |
4652 | - job = parse_job (NULL, "test", buf, strlen (buf), &pos, &lineno); |
4653 | + job = parse_job (NULL, NULL, "test", buf, strlen (buf), &pos, &lineno); |
4654 | |
4655 | TEST_EQ_P (job, NULL); |
4656 | |
4657 | @@ -7098,7 +7137,7 @@ |
4658 | |
4659 | pos = 0; |
4660 | lineno = 1; |
4661 | - job = parse_job (NULL, "test", buf, strlen (buf), &pos, &lineno); |
4662 | + job = parse_job (NULL, NULL, "test", buf, strlen (buf), &pos, &lineno); |
4663 | |
4664 | TEST_EQ_P (job, NULL); |
4665 | |
4666 | @@ -7117,7 +7156,7 @@ |
4667 | |
4668 | pos = 0; |
4669 | lineno = 1; |
4670 | - job = parse_job (NULL, "test", buf, strlen (buf), &pos, &lineno); |
4671 | + job = parse_job (NULL, NULL, "test", buf, strlen (buf), &pos, &lineno); |
4672 | |
4673 | TEST_EQ_P (job, NULL); |
4674 | |
4675 | @@ -7136,7 +7175,7 @@ |
4676 | |
4677 | pos = 0; |
4678 | lineno = 1; |
4679 | - job = parse_job (NULL, "test", buf, strlen (buf), &pos, &lineno); |
4680 | + job = parse_job (NULL, NULL, "test", buf, strlen (buf), &pos, &lineno); |
4681 | |
4682 | TEST_EQ_P (job, NULL); |
4683 | |
4684 | @@ -7155,7 +7194,7 @@ |
4685 | |
4686 | pos = 0; |
4687 | lineno = 1; |
4688 | - job = parse_job (NULL, "test", buf, strlen (buf), &pos, &lineno); |
4689 | + job = parse_job (NULL, NULL, "test", buf, strlen (buf), &pos, &lineno); |
4690 | |
4691 | TEST_EQ_P (job, NULL); |
4692 | |
4693 | @@ -7174,7 +7213,7 @@ |
4694 | |
4695 | pos = 0; |
4696 | lineno = 1; |
4697 | - job = parse_job (NULL, "test", buf, strlen (buf), &pos, &lineno); |
4698 | + job = parse_job (NULL, NULL, "test", buf, strlen (buf), &pos, &lineno); |
4699 | |
4700 | TEST_EQ_P (job, NULL); |
4701 | |
4702 | @@ -7193,7 +7232,7 @@ |
4703 | |
4704 | pos = 0; |
4705 | lineno = 1; |
4706 | - job = parse_job (NULL, "test", buf, strlen (buf), &pos, &lineno); |
4707 | + job = parse_job (NULL, NULL, "test", buf, strlen (buf), &pos, &lineno); |
4708 | |
4709 | TEST_EQ_P (job, NULL); |
4710 | |
4711 | @@ -7212,7 +7251,7 @@ |
4712 | |
4713 | pos = 0; |
4714 | lineno = 1; |
4715 | - job = parse_job (NULL, "test", buf, strlen (buf), &pos, &lineno); |
4716 | + job = parse_job (NULL, NULL, "test", buf, strlen (buf), &pos, &lineno); |
4717 | |
4718 | TEST_EQ_P (job, NULL); |
4719 | |
4720 | @@ -7231,7 +7270,7 @@ |
4721 | |
4722 | pos = 0; |
4723 | lineno = 1; |
4724 | - job = parse_job (NULL, "test", buf, strlen (buf), &pos, &lineno); |
4725 | + job = parse_job (NULL, NULL, "test", buf, strlen (buf), &pos, &lineno); |
4726 | |
4727 | TEST_EQ_P (job, NULL); |
4728 | |
4729 | @@ -7250,7 +7289,7 @@ |
4730 | |
4731 | pos = 0; |
4732 | lineno = 1; |
4733 | - job = parse_job (NULL, "test", buf, strlen (buf), &pos, &lineno); |
4734 | + job = parse_job (NULL, NULL, "test", buf, strlen (buf), &pos, &lineno); |
4735 | |
4736 | TEST_EQ_P (job, NULL); |
4737 | |
4738 | @@ -7280,7 +7319,7 @@ |
4739 | TEST_ALLOC_FAIL { |
4740 | pos = 0; |
4741 | lineno = 1; |
4742 | - job = parse_job (NULL, "test", buf, strlen (buf), |
4743 | + job = parse_job (NULL, NULL, "test", buf, strlen (buf), |
4744 | &pos, &lineno); |
4745 | |
4746 | if (test_alloc_failed) { |
4747 | @@ -7314,7 +7353,7 @@ |
4748 | TEST_ALLOC_FAIL { |
4749 | pos = 0; |
4750 | lineno = 1; |
4751 | - job = parse_job (NULL, "test", buf, strlen (buf), |
4752 | + job = parse_job (NULL, NULL, "test", buf, strlen (buf), |
4753 | &pos, &lineno); |
4754 | |
4755 | if (test_alloc_failed) { |
4756 | @@ -7347,7 +7386,7 @@ |
4757 | |
4758 | pos = 0; |
4759 | lineno = 1; |
4760 | - job = parse_job (NULL, "test", buf, strlen (buf), &pos, &lineno); |
4761 | + job = parse_job (NULL, NULL, "test", buf, strlen (buf), &pos, &lineno); |
4762 | |
4763 | TEST_EQ_P (job, NULL); |
4764 | |
4765 | @@ -7366,7 +7405,7 @@ |
4766 | |
4767 | pos = 0; |
4768 | lineno = 1; |
4769 | - job = parse_job (NULL, "test", buf, strlen (buf), &pos, &lineno); |
4770 | + job = parse_job (NULL, NULL, "test", buf, strlen (buf), &pos, &lineno); |
4771 | |
4772 | TEST_EQ_P (job, NULL); |
4773 | |
4774 | @@ -7396,7 +7435,7 @@ |
4775 | TEST_ALLOC_FAIL { |
4776 | pos = 0; |
4777 | lineno = 1; |
4778 | - job = parse_job (NULL, "test", buf, strlen (buf), |
4779 | + job = parse_job (NULL, NULL, "test", buf, strlen (buf), |
4780 | &pos, &lineno); |
4781 | |
4782 | if (test_alloc_failed) { |
4783 | @@ -7430,7 +7469,7 @@ |
4784 | TEST_ALLOC_FAIL { |
4785 | pos = 0; |
4786 | lineno = 1; |
4787 | - job = parse_job (NULL, "test", buf, strlen (buf), |
4788 | + job = parse_job (NULL, NULL, "test", buf, strlen (buf), |
4789 | &pos, &lineno); |
4790 | |
4791 | if (test_alloc_failed) { |
4792 | @@ -7463,7 +7502,7 @@ |
4793 | |
4794 | pos = 0; |
4795 | lineno = 1; |
4796 | - job = parse_job (NULL, "test", buf, strlen (buf), &pos, &lineno); |
4797 | + job = parse_job (NULL, NULL, "test", buf, strlen (buf), &pos, &lineno); |
4798 | |
4799 | TEST_EQ_P (job, NULL); |
4800 | |
4801 | @@ -7482,7 +7521,7 @@ |
4802 | |
4803 | pos = 0; |
4804 | lineno = 1; |
4805 | - job = parse_job (NULL, "test", buf, strlen (buf), &pos, &lineno); |
4806 | + job = parse_job (NULL, NULL, "test", buf, strlen (buf), &pos, &lineno); |
4807 | |
4808 | TEST_EQ_P (job, NULL); |
4809 | |
4810 | |
4811 | === modified file 'util/man/initctl.8' |
4812 | --- util/man/initctl.8 2010-02-04 19:08:07 +0000 |
4813 | +++ util/man/initctl.8 2011-01-17 15:53:13 +0000 |
4814 | @@ -1,4 +1,4 @@ |
4815 | -.TH initctl 8 2010-02-04 "Upstart" |
4816 | +.TH initctl 8 2011-01-12 "Upstart" |
4817 | .\" |
4818 | .SH NAME |
4819 | initctl \- init daemon control tool |
4820 | @@ -157,8 +157,8 @@ |
4821 | |
4822 | Requests that an instance of the named |
4823 | .I JOB |
4824 | -be restarted, outputting the status of the job to standard output when the |
4825 | -command completes. |
4826 | +be restarted (stopped and then started), outputting the status of the |
4827 | +job to standard output when the command completes. |
4828 | |
4829 | See |
4830 | .B status |
4831 | @@ -249,10 +249,14 @@ |
4832 | .\" |
4833 | .TP |
4834 | .B list |
4835 | - |
4836 | Requests a list of the known jobs and instances, outputs the status of |
4837 | each to standard output. |
4838 | |
4839 | +Note that this command enumerates as-yet-to-run jobs (in other words |
4840 | +configuration files for which no job instances have yet been created) in |
4841 | +the output with status "stop/waiting". In effect such entries denote |
4842 | +configuration files which represent potential future jobs. |
4843 | + |
4844 | See |
4845 | .B status |
4846 | for a description of the output format and |
This is a first-pass review only.
- There are a few minor manpage updates and typo fixes that aren't
directly related to this branch, could you separate those out (ask
Colin about bzr interactive :p) and submit separately.
- That init/main.c hack is horrible :-) What did __attribute__
((unused)) do to you to make you spurn it so? ;-)
- init/parse_conf.c - this assert seems unrelated to override
support? Can you commit it separately?
- init/parse_job.c - is:
if (!update)
nih_free (class);
return NULL;
better style? discuss
stanza_manual - I couldn't work out the reason for this change, the
previous code was clearer I think
- init/conf.c
extension defines should maybe go in paths.h?
toggle_conf_name by style needs to accept a parent as the first
argument and pass to nih_strndup
conf_reload - removed the ENOENT guard, why?
conf_source_* - seems to have tab damage? the indentation changes
(and even style change!) make this diff quite hard to review
Are there debug functions used anywhere? Or are they for gdb?
Scott
On Wed, Jan 12, 2011 at 4:28 AM, James Hunt <email address hidden> wrote: /code.launchpad .net/~jamesodhu nt/upstart/ override- support/ +merge/ 45956 /blueprints. launchpad. net/ubuntu/ +spec/packagese lection- foundations- n-finish- upstart file/is_ conf_file_ std/is_ conf_file_ override) : New alt-delete( 7) man page. conf_name( ): New function. parse_job. c: /code.launchpad .net/~jamesodhu nt/upstart/ override- support/ +merge/ 45956
> James Hunt has proposed merging lp:~jamesodhunt/upstart/override-support into lp:upstart.
>
> Requested reviews:
> Scott James Remnant (scott)
>
> For more details, see:
> https:/
>
> Implemented override feature on blueprint:
>
> https:/
>
> Details:
>
> * Generic
> - fixed typos.
> - addition of debug functions useful for gdb sessions (available
> only in DEBUG build).
> * init/conf.c:
> - (toggle_conf_name): New function which convert a conf file
> name to an override name and vice versa.
> - (conf_reload): Removed ENOENT check to ensure error thrown if
> conf files/dirs do not exist.
> - (conf_reload_path): Now takes an extra override_path parameter.
> - (is_conf_
> functions to determine type of given file path.
> - majority of remaining functions updated to handle override
> files.
> * init/man/init.5: Updated to document override file support.
> * init/man/init.8: Added reference to control-
> * init/parse_conf.c: Added assertion to remind us forcibly to add
> override-handling code for directories if we ever allow content in
> 'init.conf'.
> * init/parse_job.c (parse_job): Additional parameter 'update' to
> allow override files to replace existing Job details.
> * init/test_conf.c
> - test_override(): New function.
> - test_toggle_
> * init/test_
> - Updated for extra parse_job() parameter
> - added a test feature to test_parse_job() to exercise new
> parameter to parse_job().
> * util/man/initctl.8: Clarified what it means to restart a job.
>
> To test:
>
> make check
> --
> https:/
> You are requested to review the proposed merge of lp:~jamesodhunt/ups...