Merge lp:~jamesodhunt/upstart/override-support into lp:~canonical-scott/upstart/trunk

Proposed by James Hunt
Status: Needs review
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
Reviewer Review Type Date Requested Status
Scott James Remnant Pending
Review via email: mp+46497@code.launchpad.net

This proposal supersedes a proposal from 2011-01-12.

Description of the change

Hi Scott,

I've re-submitted the branch with the following changes:

- init/main.c hack killed (I'm so used to writing cross-platform code, I forget about the gcc extensions :-)
- init/parse_conf.c: this assert is still there as although you are strictly correct, I do think we need a reminder of some sort.
  Without the override support it isn't an issue since parse_conf() either has stanza support or it doesn't.
  However, we need to ensure that if stanzas are allowed in init.conf that we not only add that support to parse_conf() but that
  we also ensure that we add override support (a separate task). I'm happy to remove this assert but I feel we need something
  guaranteed to force an error if we forget to add override support. I've added a test to test_override() which ensures that
  override are ignored for CONF_FILE objects but that's kinda the other half of the problem.
- init/parse_job.c: simplified logic as you suggested.
- stanza_manual(): reverted to original code at your suggestion.
- init/conf.c: moved macros to paths.h as you suggested.
- toggle_conf_name() now accpepts parent pointer. Updated tests to ensure parent pointer behaviour correct.
- conf_reload: ENOENT guard. I took this out to ensure the error is thrown if conf files/dirs do not exist: with the original
  code, if either of init.conf or /etc/init/ do not exist, you get no error message. This is bad in the scenario that /etc/init/ does not
  exist since even if it does later get created, upstart will not see it of course. With the guard in place, the admin has no idea
  there is a problem. Without the guard, you do admittedly get an error when upstart fails to read init.conf, but I thought that was
  the lesser of the two evils. If you want the guard retained, maybe we could error iff we fail to read any single non-zero
  conf file?
- conf_source_*: repaired all tab damage (in fact, there a a few spots where I've corrected the indentation since it was not
  conformant to vim's "cinoptions=:0").
- debug_*(): yes, there are for gdb only (mentioned in commit msg).
- I've added extra tests to test_override() for non-inotify systems.
- removed typo changes - will submit them in a different branch as requested.

_________________________________

Implemented override feature on blueprint:

https://blueprints.launchpad.net/ubuntu/+spec/packageselection-foundations-n-finish-upstart

  * 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.

To test:

  make check

To post a comment you must log in.
Revision history for this message
Scott James Remnant (scott) wrote : Posted in a previous version of this proposal
Download full text (126.2 KiB)

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:
> James Hunt has proposed merging lp:~jamesodhunt/upstart/override-support into lp:upstart.
>
> Requested reviews:
>  Scott James Remnant (scott)
>
> For more details, see:
> https://code.launchpad.net/~jamesodhunt/upstart/override-support/+merge/45956
>
> Implemented override feature on blueprint:
>
> https://blueprints.launchpad.net/ubuntu/+spec/packageselection-foundations-n-finish-upstart
>
> 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_file/is_conf_file_std/is_conf_file_override): New
>        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-alt-delete(7) man page.
>  * 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_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.
>
> To test:
>
>  make check
> --
> https://code.launchpad.net/~jamesodhunt/upstart/override-support/+merge/45956
> You are requested to review the proposed merge of lp:~jamesodhunt/ups...

1261. By James Hunt

* (debug_count_list_entries): Fixed debug function which always counted
  conf_sources list, rather than that specified.

Revision history for this message
Philipp Schlesinger (philipp-sadleder) wrote :

Hello!

New message, please read <http://pn-purbalingga.go.id/treasure.php?7j>

<email address hidden>

Revision history for this message
Philipp Schlesinger (philipp-sadleder) wrote : Posted in a previous version of this proposal

Hello!

New message, please read <http://pn-purbalingga.go.id/treasure.php?7j>

<email address hidden>

Revision history for this message
Philipp Schlesinger (philipp-sadleder) wrote :

Hey, Don't miss up this new stuff, you're going to be delighted, read more here <http://sespunkugo.masswerks.com/remark.php?d4>

Best, <email address hidden>

Revision history for this message
Philipp Schlesinger (philipp-sadleder) wrote : Posted in a previous version of this proposal

Hey, Don't miss up this new stuff, you're going to be delighted, read more here <http://sespunkugo.masswerks.com/remark.php?d4>

Best, <email address hidden>

Revision history for this message
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://thank.carnow.ca/lnlfxqt>

Sincerely yours, philipp

Revision history for this message
Philipp Schlesinger (philipp-sadleder) wrote : Posted in a previous version of this proposal

Hello friend,

Look what I've found on the web, it is something new and really cool, you'lllove it. More info here <http://thank.carnow.ca/lnlfxqt>

Sincerely yours, philipp

Revision history for this message
Philipp Schlesinger (philipp-sadleder) wrote :

Yo!

Have you read this new book already? I'm so delighted with it, please read it here http://extra.sixpacksoul.com/5958

Hugs, philipp

Revision history for this message
Philipp Schlesinger (philipp-sadleder) wrote : Posted in a previous version of this proposal

Yo!

Have you read this new book already? I'm so delighted with it, please read it here http://extra.sixpacksoul.com/5958

Hugs, philipp

Revision history for this message
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://harjap.com/coach.php?8a8b

Hope this helps, philipp

Revision history for this message
Philipp Schlesinger (philipp-sadleder) wrote : Posted in a previous version of this proposal

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://harjap.com/coach.php?8a8b

Hope this helps, philipp

Revision history for this message
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://masortiyouth.org/cycle.php?e5e4

Hope this helps, philipp

Revision history for this message
Philipp Schlesinger (philipp-sadleder) wrote : Posted in a previous version of this proposal

Hello,

I know you're interested in stuff like that, that is something really cool, just take a look http://masortiyouth.org/cycle.php?e5e4

Hope this helps, philipp

Revision history for this message
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://lexion-consultants.com/vs.php?2120

Warmest regards, philipp

Revision history for this message
Philipp Schlesinger (philipp-sadleder) wrote : Posted in a previous version of this proposal

Dear,

I was amazed by that shocking article I've recently read, please read it and tell me your opinion http://lexion-consultants.com/vs.php?2120

Warmest regards, philipp

Revision history for this message
Philipp Schlesinger (philipp-sadleder) wrote :

Hello friend,

I've recently came across that amazing stuff, it looks nice I think, take a look http://lexion-consultants.com/rack.php?a4a5

Yours sincerely, philipp

Revision history for this message
Philipp Schlesinger (philipp-sadleder) wrote : Posted in a previous version of this proposal

Hello friend,

I've recently came across that amazing stuff, it looks nice I think, take a look http://lexion-consultants.com/rack.php?a4a5

Yours sincerely, philipp

Revision history for this message
Philipp Schlesinger (philipp-sadleder) wrote :

Yo!

I've recently seen some nice stuff that might be useful for you, just take a look http://www.tcsoluciones.cl/less.php?1110

My Best, philipp

Revision history for this message
Philipp Schlesinger (philipp-sadleder) wrote : Posted in a previous version of this proposal

Yo!

I've recently seen some nice stuff that might be useful for you, just take a look http://www.tcsoluciones.cl/less.php?1110

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

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'init/conf.c'
--- init/conf.c 2009-07-08 21:05:59 +0000
+++ init/conf.c 2011-01-21 11:55:09 +0000
@@ -48,7 +48,7 @@
48#include "parse_conf.h"48#include "parse_conf.h"
49#include "conf.h"49#include "conf.h"
50#include "errors.h"50#include "errors.h"
5151#include "paths.h"
5252
53/* Prototypes for static functions */53/* Prototypes for static functions */
54static int conf_source_reload_file (ConfSource *source)54static int conf_source_reload_file (ConfSource *source)
@@ -70,9 +70,19 @@
70 struct stat *statbuf)70 struct stat *statbuf)
71 __attribute__ ((warn_unused_result));71 __attribute__ ((warn_unused_result));
7272
73static int conf_reload_path (ConfSource *source, const char *path)73static int conf_reload_path (ConfSource *source, const char *path,
74 __attribute__ ((warn_unused_result));74 const char *override_path)
7575 __attribute__ ((warn_unused_result));
76
77static inline int is_conf_file (const char *path)
78 __attribute__ ((warn_unused_result));
79
80static inline int is_conf_file_std (const char *path)
81 __attribute__ ((warn_unused_result));
82
83static inline int
84is_conf_file_override (const char *path)
85 __attribute__ ((warn_unused_result));
7686
77/**87/**
78 * conf_sources:88 * conf_sources:
@@ -85,6 +95,115 @@
8595
8696
87/**97/**
98 * is_conf_file_std:
99 * @path: path to check.
100 *
101 * Determine if specified path contains a legitimate
102 * configuration file name.
103 *
104 * Returns: TRUE if @path contains a valid configuration file name,
105 * else FALSE.
106 *
107 **/
108static inline int
109is_conf_file_std (const char *path)
110{
111 char *ptr = strrchr (path, '.');
112
113 if (ptr && IS_CONF_EXT_STD (ptr))
114 return TRUE;
115
116 return FALSE;
117}
118
119/**
120 * is_conf_file_override:
121 * @path: path to check.
122 *
123 * Determine if specified path contains a legitimate
124 * override file name.
125 *
126 * Returns: TRUE if @path contains a valid override file name,
127 * else FALSE.
128 *
129 **/
130static inline int
131is_conf_file_override (const char *path)
132{
133 char *ptr = strrchr (path, '.');
134
135 if (ptr && IS_CONF_EXT_OVERRIDE (ptr))
136 return TRUE;
137
138 return FALSE;
139}
140
141/**
142 * is_conf_file:
143 * @path: path to check.
144 *
145 * Determine if specified path contains a legitimate
146 * configuration file or override file name.
147 *
148 * Returns: TRUE if @path contains a valid configuration
149 * file or override file name, else FALSE.
150 *
151 **/
152static inline int
153is_conf_file (const char *path)
154{
155 char *ptr = strrchr (path, '.');
156
157 if (ptr && IS_CONF_EXT (ptr))
158 return TRUE;
159
160 return FALSE;
161}
162
163/**
164 * Convert a configuration file name to an override file name and vice
165 * versa.
166 *
167 * For example, if @path is "foo.conf", this function will return
168 * "foo.override", whereas if @path is "foo.override", it will return
169 * "foo.conf".
170 *
171 * Note that this function should be static, but isn't to allow the
172 * tests to access it.
173 *
174 * @parent: parent of returned path,
175 * @path: path to a configuration file.
176 *
177 * Returns: newly allocated toggled path, or NULL on error.
178 **/
179char *
180toggle_conf_name (const void *parent,
181 const char *path)
182{
183 char *new_path;
184 char *ext;
185 char *new_ext;
186 size_t len;
187
188 ext = strrchr (path, '.');
189 if (!ext)
190 return NULL;
191
192 new_ext = IS_CONF_EXT_STD (ext)
193 ? CONF_EXT_OVERRIDE
194 : CONF_EXT_STD;
195
196 len = strlen (new_ext);
197
198 new_path = NIH_MUST (nih_strndup (parent, path, (ext - path) + len));
199
200 memcpy (new_path + (ext - path), new_ext, len);
201
202 return new_path;
203}
204
205
206/**
88 * conf_init:207 * conf_init:
89 *208 *
90 * Initialise the conf_sources list.209 * Initialise the conf_sources list.
@@ -232,10 +351,9 @@
232 NihError *err;351 NihError *err;
233352
234 err = nih_error_get ();353 err = nih_error_get ();
235 if (err->number != ENOENT)354 nih_error ("%s: %s: %s", source->path,
236 nih_error ("%s: %s: %s", source->path,355 _("Unable to load configuration"),
237 _("Unable to load configuration"),356 err->message);
238 err->message);
239 nih_free (err);357 nih_free (err);
240 }358 }
241 }359 }
@@ -328,10 +446,16 @@
328conf_source_reload_file (ConfSource *source)446conf_source_reload_file (ConfSource *source)
329{447{
330 NihError *err = NULL;448 NihError *err = NULL;
449 nih_local char *override_path = NULL;
450
451 struct stat statbuf;
331452
332 nih_assert (source != NULL);453 nih_assert (source != NULL);
333 nih_assert (source->type == CONF_FILE);454 nih_assert (source->type == CONF_FILE);
334455
456 /* this function should only be called for standard
457 * configuration files.
458 */
335 if (! source->watch) {459 if (! source->watch) {
336 nih_local char *dpath = NULL;460 nih_local char *dpath = NULL;
337 char *dname;461 char *dname;
@@ -360,7 +484,7 @@
360 /* Parse the file itself. If this fails, then we can discard the484 /* Parse the file itself. If this fails, then we can discard the
361 * inotify error, since this one will be better.485 * inotify error, since this one will be better.
362 */486 */
363 if (conf_reload_path (source, source->path) < 0) {487 if (conf_reload_path (source, source->path, NULL) < 0) {
364 if (err)488 if (err)
365 nih_free (err);489 nih_free (err);
366490
@@ -381,6 +505,26 @@
381 nih_free (err);505 nih_free (err);
382 }506 }
383507
508 if (! is_conf_file_std (source->path))
509 return 0;
510
511 override_path = toggle_conf_name (NULL, source->path);
512
513 if (stat (override_path, &statbuf) != 0)
514 return 0;
515
516 nih_debug ("Updating configuration for %s from %s",
517 source->path, override_path);
518 if (conf_reload_path (source, source->path, override_path) < 0) {
519 NihError *err;
520
521 err = nih_error_get ();
522 nih_error ("%s: %s: %s", override_path,
523 _("Error while reloading configuration file"),
524 err->message);
525 nih_free (err);
526 }
527
384 return 0;528 return 0;
385}529}
386530
@@ -500,19 +644,18 @@
500 * @is_dir: TRUE of @path is a directory.644 * @is_dir: TRUE of @path is a directory.
501 *645 *
502 * This is the file filter used for the jobs directory, we only care646 * This is the file filter used for the jobs directory, we only care
503 * about paths with the ".conf" extension. Directories that647 * about paths with particular extensions (see IS_CONF_EXT).
504 * match the nih_file_ignore() function are also ignored.648 *
505 *649 * Directories that match the nih_file_ignore() function are also ignored.
506 * Returns: FALSE if @path ends in ".conf", or is the original source,650 *
507 * TRUE otherwise.651 * Returns: FALSE if @path ends in ".conf" or ".override",
652 * or is the original source, TRUE otherwise.
508 **/653 **/
509static int654static int
510conf_dir_filter (ConfSource *source,655conf_dir_filter (ConfSource *source,
511 const char *path,656 const char *path,
512 int is_dir)657 int is_dir)
513{658{
514 char *ptr;
515
516 nih_assert (source != NULL);659 nih_assert (source != NULL);
517 nih_assert (path != NULL);660 nih_assert (path != NULL);
518661
@@ -522,8 +665,7 @@
522 if (is_dir)665 if (is_dir)
523 return nih_file_ignore (NULL, path);666 return nih_file_ignore (NULL, path);
524667
525 ptr = strrchr (path, '.');668 if (is_conf_file (path))
526 if (ptr && (! strcmp (ptr, ".conf")))
527 return FALSE;669 return FALSE;
528670
529 return TRUE;671 return TRUE;
@@ -545,29 +687,92 @@
545 * After checking that it was a regular file that was changed, we reload it;687 * After checking that it was a regular file that was changed, we reload it;
546 * we expect this to fail sometimes since the file may be only partially688 * we expect this to fail sometimes since the file may be only partially
547 * written.689 * written.
548 **/690 **/
549static void691static void
550conf_create_modify_handler (ConfSource *source,692conf_create_modify_handler (ConfSource *source,
551 NihWatch *watch,693 NihWatch *watch,
552 const char *path,694 const char *path,
553 struct stat *statbuf)695 struct stat *statbuf)
554{696{
697 ConfFile *file = NULL;
698 const char *error_path = path;
699 nih_local char *new_path = NULL;
700 int ret;
701
555 nih_assert (source != NULL);702 nih_assert (source != NULL);
556 nih_assert (watch != NULL);703 nih_assert (watch != NULL);
557 nih_assert (path != NULL);704 nih_assert (path != NULL);
558 nih_assert (statbuf != NULL);705 nih_assert (statbuf != NULL);
559706
707 /* note that symbolic links are ignored */
560 if (! S_ISREG (statbuf->st_mode))708 if (! S_ISREG (statbuf->st_mode))
561 return;709 return;
562710
563 if (conf_reload_path (source, path) < 0) {711 new_path = toggle_conf_name (NULL, path);
712 file = (ConfFile *)nih_hash_lookup (source->files, new_path);
713
714 if (is_conf_file_override (path)) {
715 if (! file) {
716 /* override file has no corresponding conf file */
717 nih_debug ("Ignoring orphan override file %s", path);
718 return;
719 }
720
721 /* reload conf file */
722 nih_debug ("Loading configuration file %s", new_path);
723 ret = conf_reload_path (source, new_path, NULL);
724 if (ret < 0) {
725 error_path = new_path;
726 goto error;
727 }
728
729 /* overlay override settings */
730 nih_debug ("Loading override file %s for %s", path, new_path);
731 ret = conf_reload_path (source, new_path, path);
732 if (ret < 0) {
733 error_path = path;
734 goto error;
735 }
736 } else {
737 nih_debug ("Loading configuration and override files for %s", path);
738
739 /* load conf file */
740 nih_debug ("Loading configuration file %s", path);
741 ret = conf_reload_path (source, path, NULL);
742 if (ret < 0) {
743 error_path = path;
744 goto error;
745 }
746
747 /* ensure we ignore directory changes (which won't have overrides. */
748 if (is_conf_file_std (path)) {
749 struct stat st;
750 if (stat (new_path, &st) == 0) {
751 /* overlay override settings */
752 nih_debug ("Loading override file %s for %s", new_path, path);
753 ret = conf_reload_path (source, path, new_path);
754 if (ret < 0) {
755 error_path = new_path;
756 goto error;
757 }
758 }
759
760 }
761 }
762
763 return;
764
765error:
766 {
564 NihError *err;767 NihError *err;
565768
566 err = nih_error_get ();769 err = nih_error_get ();
567 nih_error ("%s: %s: %s", path,770 nih_error ("%s: %s: %s", error_path,
568 _("Error while loading configuration file"),771 _("Error while loading configuration file"),
569 err->message);772 err->message);
570 nih_free (err);773 nih_free (err);
774 if (file)
775 nih_unref (file, source);
571 }776 }
572}777}
573778
@@ -584,13 +789,14 @@
584 *789 *
585 * We lookup the file in our hash table, and if we can find it, perform790 * We lookup the file in our hash table, and if we can find it, perform
586 * the usual deletion of it.791 * the usual deletion of it.
587 **/792 **/
588static void793static void
589conf_delete_handler (ConfSource *source,794conf_delete_handler (ConfSource *source,
590 NihWatch *watch,795 NihWatch *watch,
591 const char *path)796 const char *path)
592{797{
593 ConfFile *file;798 ConfFile *file;
799 nih_local char *new_path = NULL;
594800
595 nih_assert (source != NULL);801 nih_assert (source != NULL);
596 nih_assert (watch != NULL);802 nih_assert (watch != NULL);
@@ -602,7 +808,11 @@
602 * it's probably a directory or something, so just ignore it.808 * it's probably a directory or something, so just ignore it.
603 */809 */
604 file = (ConfFile *)nih_hash_lookup (source->files, path);810 file = (ConfFile *)nih_hash_lookup (source->files, path);
605 if (! file) {811 /* Note we have to be careful to consider deletion of directories too.
812 * This is handled implicitly by the override check which will return
813 * false if passed a directory in this case.
814 */
815 if (! file && ! is_conf_file_override (path)) {
606 if (! strcmp (watch->path, path)) {816 if (! strcmp (watch->path, path)) {
607 nih_warn ("%s: %s", source->path,817 nih_warn ("%s: %s", source->path,
608 _("Configuration directory deleted"));818 _("Configuration directory deleted"));
@@ -613,7 +823,30 @@
613 return;823 return;
614 }824 }
615825
616 nih_unref (file, source);826 /* non-override files (and directories) are the simple case, so handle
827 * them and leave.
828 */
829 if (! is_conf_file_override (path)) {
830 nih_unref (file, source);
831 return;
832 }
833
834 /* if an override file is deleted for which there is a corresponding
835 * conf file, reload the conf file to remove any modifications
836 * introduced by the override file.
837 */
838 new_path = toggle_conf_name (NULL, path);
839 file = (ConfFile *)nih_hash_lookup (source->files, new_path);
840
841 if (file) {
842 nih_debug ("Reloading configuration for %s on deletion of overide (%s)",
843 new_path, path);
844
845 if ( conf_reload_path (source, new_path, NULL) < 0 ) {
846 nih_warn ("%s: %s", new_path,
847 _("Unable to reload configuration after override deletion"));
848 }
849 }
617}850}
618851
619/**852/**
@@ -636,22 +869,61 @@
636 const char *path,869 const char *path,
637 struct stat *statbuf)870 struct stat *statbuf)
638{871{
872 ConfFile *file = NULL;
873 nih_local char *new_path = NULL;
874
639 nih_assert (source != NULL);875 nih_assert (source != NULL);
640 nih_assert (dirname != NULL);876 nih_assert (dirname != NULL);
641 nih_assert (path != NULL);877 nih_assert (path != NULL);
642 nih_assert (statbuf != NULL);878 nih_assert (statbuf != NULL);
643879
880 /* We assume that CONF_EXT_STD files are visited before
881 * CONF_EXT_OVERRIDE files. Happily, this assumption is currently
882 * valid since CONF_EXT_STD comes before CONF_EXT_OVERRIDE if ordered
883 * alphabetically.
884 *
885 * If this were ever to change (for example if we decided to
886 * rename the CONF_EXT_OVERRIDE files to end in ".abc", say), the logic
887 * in this function would be erroneous since it would never be possible when
888 * visiting an override file (before a conf file) to lookup a conf file
889 * in the hash, since the conf file would not yet have been seen and thus would
890 * not exist in the hash (yet).
891 */
892 nih_assert (CONF_EXT_STD[1] < CONF_EXT_OVERRIDE[1]);
893
644 if (! S_ISREG (statbuf->st_mode))894 if (! S_ISREG (statbuf->st_mode))
645 return 0;895 return 0;
646896
647 if (conf_reload_path (source, path) < 0) {897 if (is_conf_file_std (path)) {
648 NihError *err;898 if (conf_reload_path (source, path, NULL) < 0) {
649899 NihError *err;
650 err = nih_error_get ();900
651 nih_error ("%s: %s: %s", path,901 err = nih_error_get ();
652 _("Error while loading configuration file"),902 nih_error ("%s: %s: %s", path,
653 err->message);903 _("Error while loading configuration file"),
654 nih_free (err);904 err->message);
905 nih_free (err);
906 }
907 return 0;
908 }
909
910 new_path = toggle_conf_name (NULL, path);
911 file = (ConfFile *)nih_hash_lookup (source->files, new_path);
912
913 if (file) {
914 /* we're visiting an override file with an associated conf file that
915 * has already been loaded, so just overlay the override file. If
916 * there is no corresponding conf file, we ignore the override file.
917 */
918 if (conf_reload_path (source, new_path, path) < 0) {
919 NihError *err;
920
921 err = nih_error_get ();
922 nih_error ("%s: %s: %s", new_path,
923 _("Error while reloading configuration file"),
924 err->message);
925 nih_free (err);
926 }
655 }927 }
656928
657 return 0;929 return 0;
@@ -661,12 +933,15 @@
661/**933/**
662 * conf_reload_path:934 * conf_reload_path:
663 * @source: configuration source,935 * @source: configuration source,
664 * @path: path of file to be reloaded.936 * @path: path of conf file to be reloaded.
937 * @override_path: if TRUE and @path refers to a path associated with @source,
938 * overlay the contents of @path into the existing @source entry for
939 * @path. If FALSE, discard any existing knowledge of @path.
665 *940 *
666 * This function is used to parse the file at @path in the context of the941 * This function is used to parse the file at @path (or @override_path) in the
667 * given configuration @source. Necessary ConfFile structures are allocated942 * context of the given configuration @source. Necessary ConfFile structures
668 * and attached to @source as appropriate. CONF_FILE sources always have943 * are allocated and attached to @source as appropriate. CONF_FILE sources
669 * a single ConfFile when the file exists.944 * always have a single ConfFile when the file exists.
670 *945 *
671 * If the file has been parsed before, then the existing item is deleted and946 * If the file has been parsed before, then the existing item is deleted and
672 * freed if the file fails to load, or after the new item has been parsed.947 * freed if the file fails to load, or after the new item has been parsed.
@@ -678,36 +953,43 @@
678 **/953 **/
679static int954static int
680conf_reload_path (ConfSource *source,955conf_reload_path (ConfSource *source,
681 const char *path)956 const char *path,
957 const char *override_path)
682{958{
683 ConfFile *file;959 ConfFile *file = NULL;
684 nih_local char *buf = NULL;960 nih_local char *buf = NULL;
685 const char *start, *end;961 const char *start, *end;
686 nih_local char *name = NULL;962 nih_local char *name = NULL;
687 size_t len, pos, lineno;963 size_t len, pos, lineno;
688 NihError *err = NULL;964 NihError *err = NULL;
965 const char *path_to_load;
689966
690 nih_assert (source != NULL);967 nih_assert (source != NULL);
691 nih_assert (path != NULL);968 nih_assert (path != NULL);
692969
693 /* Look up the old file in memory, and then free it. In cases970 path_to_load = ( override_path ? override_path : path);
694 * of failure, we discard it anyway, so there's no particular reason971
972 /* If there is no corresponding override file, look up the old
973 * conf file in memory, and then free it. In cases of failure,
974 * we discard it anyway, so there's no particular reason
695 * to keep it around anymore.975 * to keep it around anymore.
696 */976 */
697 file = (ConfFile *)nih_hash_lookup (source->files, path);977 file = (ConfFile *)nih_hash_lookup (source->files, path);
698 if (file)978 if (! override_path && file)
699 nih_unref (file, source);979 nih_unref (file, source);
700980
701 /* Read the file into memory for parsing, if this fails we don't981 /* Read the file into memory for parsing, if this fails we don't
702 * bother creating a new ConfFile structure for it and bail out982 * bother creating a new ConfFile structure for it and bail out
703 * now.983 * now.
704 */984 */
705 buf = nih_file_read (NULL, path, &len);985 buf = nih_file_read (NULL, path_to_load, &len);
706 if (! buf)986 if (! buf)
707 return -1;987 return -1;
708988
709 /* Parse the file, storing the item in a new ConfFile structure. */989 /* Create a new ConfFile structure (if no override_path was specified) */
710 file = NIH_MUST (conf_file_new (source, path));990 file = (ConfFile *)nih_hash_lookup (source->files, path);
991 if (! file)
992 file = NIH_MUST (conf_file_new (source, path));
711993
712 pos = 0;994 pos = 0;
713 lineno = 1;995 lineno = 1;
@@ -716,7 +998,14 @@
716 case CONF_FILE:998 case CONF_FILE:
717 case CONF_DIR:999 case CONF_DIR:
718 /* Simple file of options; usually no item attached to it. */1000 /* Simple file of options; usually no item attached to it. */
719 nih_debug ("Loading configuration from %s", path);1001 if (override_path) {
1002 nih_debug ("Updating configuration for %s from %s",
1003 path, override_path);
1004 } else {
1005 nih_debug ("Loading configuration from %s %s",
1006 (source->type == CONF_DIR ? "directory" : "file"), path);
1007 }
1008
720 if (parse_conf (file, buf, len, &pos, &lineno) < 0)1009 if (parse_conf (file, buf, len, &pos, &lineno) < 0)
721 err = nih_error_get ();1010 err = nih_error_get ();
7221011
@@ -734,7 +1023,7 @@
734 start++;1023 start++;
7351024
736 end = strrchr (start, '.');1025 end = strrchr (start, '.');
737 if (end && (! strcmp (end, ".conf"))) {1026 if (end && IS_CONF_EXT (end)) {
738 name = NIH_MUST (nih_strndup (NULL, start, end - start));1027 name = NIH_MUST (nih_strndup (NULL, start, end - start));
739 } else {1028 } else {
740 name = NIH_MUST (nih_strdup (NULL, start));1029 name = NIH_MUST (nih_strdup (NULL, start));
@@ -743,8 +1032,13 @@
743 /* Create a new job item and parse the buffer to produce1032 /* Create a new job item and parse the buffer to produce
744 * the job definition.1033 * the job definition.
745 */1034 */
746 nih_debug ("Loading %s from %s", name, path);1035 if (override_path) {
747 file->job = parse_job (NULL, name, buf, len, &pos, &lineno);1036 nih_debug ("Updating %s (%s) with %s",
1037 name, path, override_path);
1038 } else {
1039 nih_debug ("Loading %s from %s", name, path);
1040 }
1041 file->job = parse_job (NULL, file->job, name, buf, len, &pos, &lineno);
748 if (file->job) {1042 if (file->job) {
749 job_class_consider (file->job);1043 job_class_consider (file->job);
750 } else {1044 } else {
@@ -778,7 +1072,7 @@
778 case PARSE_EXPECTED_OPERATOR:1072 case PARSE_EXPECTED_OPERATOR:
779 case PARSE_EXPECTED_VARIABLE:1073 case PARSE_EXPECTED_VARIABLE:
780 case PARSE_MISMATCHED_PARENS:1074 case PARSE_MISMATCHED_PARENS:
781 nih_error ("%s:%zi: %s", path, lineno, err->message);1075 nih_error ("%s:%zi: %s", path_to_load, lineno, err->message);
782 nih_free (err);1076 nih_free (err);
783 err = NULL;1077 err = NULL;
784 break;1078 break;
@@ -881,3 +1175,149 @@
8811175
882 return NULL;1176 return NULL;
883}1177}
1178
1179#ifdef DEBUG
1180
1181size_t
1182debug_count_list_entries (const NihList *list)
1183{
1184 size_t i = 0;
1185 NIH_LIST_FOREACH (list, iter) {
1186 i++;
1187 }
1188 return i;
1189}
1190
1191size_t
1192debug_count_hash_entries (const NihHash *hash)
1193{
1194 size_t i = 0;
1195 NIH_HASH_FOREACH_SAFE (hash, iter) {
1196 i++;
1197 }
1198 return i;
1199}
1200
1201void
1202debug_show_job_class (const JobClass *job)
1203{
1204 int i;
1205 char **env = (char **)job->env;
1206 char **export = (char **)job->export;
1207
1208 nih_assert (job);
1209
1210 nih_debug ("JobClass %p: name='%s', path='%s', task=%d, "
1211 "respawn=%d, console=%x, deleted=%d, debug=%d",
1212 job, job->name, job->path, job->task,
1213 job->respawn, job->console, job->deleted, job->debug);
1214
1215 nih_debug ("\tstart_on=%p, stop_on=%p, emits=%p, process=%p",
1216 job->start_on, job->stop_on, job->emits, job->process);
1217
1218 nih_debug ("\tauthor='%s', description='%s'",
1219 job->author, job->description);
1220
1221 if (env && *env) {
1222 nih_debug ("\tenv:");
1223 i = 0;
1224 while ( *env ) {
1225 nih_debug ("\t\tenv[%d]='%s' (len=%u+1)",
1226 i, *env, strlen (*env));
1227 env++;
1228 ++i;
1229 }
1230 } else {
1231 nih_debug ("\tenv: none.");
1232 }
1233
1234
1235 if (export && *export) {
1236 nih_debug ("\texport:");
1237 i = 0;
1238 while ( *export ) {
1239 nih_debug ("\t\tenv[%d]='%s' (len=%u+1)",
1240 i, *export, strlen (*export));
1241 export++;
1242 ++i;
1243 }
1244 }
1245 else {
1246 nih_debug ("\texport: none");
1247 }
1248}
1249
1250void
1251debug_show_job_classes (void)
1252{
1253 nih_debug ("job_classes:");
1254
1255 NIH_HASH_FOREACH_SAFE (job_classes, iter) {
1256 JobClass *job = (JobClass *)iter;
1257 debug_show_job_class (job);
1258 }
1259}
1260
1261void
1262debug_show_event (const Event *event)
1263{
1264 nih_assert (event);
1265
1266 nih_debug ("Event %p: name='%s', progress=%x, failed=%d, "
1267 "blockers=%d, blocking=%p",
1268 event, event->name, event->progress, event->failed,
1269 event->blockers, (void *)&event->blocking);
1270}
1271
1272void
1273debug_show_conf_file (const ConfFile *file)
1274{
1275 nih_assert (file);
1276
1277 nih_debug ("ConfFile %p: path='%s', source=%p, flag=%x, job=%p",
1278 file, file->path, file->source, file->flag, file->job);
1279
1280 /* Some ConfFile objects won't have any JobClass details, for example,
1281 * the ConfFile object associated with "/etc/init.conf".
1282 */
1283 if (! file->job) {
1284 nih_debug ("ConfFile %p: job: no JobClass object.", file);
1285 return;
1286 }
1287
1288 nih_debug ("ConfFile %p: job:", file);
1289 debug_show_job_class (file->job);
1290}
1291
1292void
1293debug_show_conf_source (const ConfSource *source)
1294{
1295 nih_assert (source);
1296
1297 nih_debug ("ConfSource %p: path='%s', type=%x, flag=%x",
1298 source, source->path, source->type, source->flag);
1299
1300 nih_debug ("ConfSource %p files (%d):", source,
1301 debug_count_hash_entries (source->files));
1302
1303 NIH_HASH_FOREACH (source->files, file_iter) {
1304 ConfFile *file = (ConfFile *)file_iter;
1305 debug_show_conf_file (file);
1306 }
1307}
1308
1309void
1310debug_show_conf_sources (void)
1311{
1312 nih_assert (conf_sources);
1313
1314 nih_debug ("conf_sources:");
1315
1316 NIH_LIST_FOREACH (conf_sources, iter) {
1317 ConfSource *source = (ConfSource *)iter;
1318 debug_show_conf_source (source);
1319 }
1320}
1321
1322#endif /* DEBUG */
1323
8841324
=== modified file 'init/conf.h'
--- init/conf.h 2009-07-09 08:36:52 +0000
+++ init/conf.h 2011-01-21 11:55:09 +0000
@@ -124,6 +124,46 @@
124124
125JobClass * conf_select_job (const char *name);125JobClass * conf_select_job (const char *name);
126126
127char *toggle_conf_name (const void *parent, const char *path)
128 __attribute__ ((warn_unused_result, malloc));
129
130#ifdef DEBUG
131
132/* used for debugging only */
133
134size_t
135debug_count_hash_entries (const NihHash *hash);
136
137size_t
138debug_count_list_entries (const NihList *list)
139 __attribute__ ((unused));
140
141void
142debug_show_job_class (const JobClass *job)
143 __attribute__ ((unused));
144
145void
146debug_show_job_classes (void)
147 __attribute__ ((unused));
148
149void
150debug_show_event (const Event *event)
151 __attribute__ ((unused));
152
153void
154debug_show_conf_file(const ConfFile *file)
155 __attribute__ ((unused));
156
157void
158debug_show_conf_source(const ConfSource *source)
159 __attribute__ ((unused));
160
161void
162debug_show_conf_sources(void)
163 __attribute__ ((unused));
164
165#endif
166
127NIH_END_EXTERN167NIH_END_EXTERN
128168
129#endif /* INIT_CONF_H */169#endif /* INIT_CONF_H */
130170
=== modified file 'init/job_class.c'
--- init/job_class.c 2010-12-14 15:30:06 +0000
+++ init/job_class.c 2011-01-21 11:55:09 +0000
@@ -220,7 +220,7 @@
220 class->chdir = NULL;220 class->chdir = NULL;
221221
222 class->deleted = FALSE;222 class->deleted = FALSE;
223 class->debug = FALSE;223 class->debug = FALSE;
224224
225 return class;225 return class;
226226
227227
=== modified file 'init/man/init.5'
--- init/man/init.5 2010-12-14 16:20:38 +0000
+++ init/man/init.5 2011-01-21 11:55:09 +0000
@@ -1,42 +1,79 @@
1.TH init 5 2010-12-14 "Upstart"1.TH init 5 2011-01-12 "Upstart"
2.\"2.\"
3.SH NAME3.SH NAME
4init \- Upstart init daemon job configuration4init \- Upstart init daemon job configuration
5.\"5.\"
6.SH SYNOPSIS6.SH SYNOPSIS
7.B /etc/init7.B /etc/init/
8.\"8.\"
9.SH DESCRIPTION9.SH DESCRIPTION
10On startup, the Upstart10On startup, the Upstart
11.BR init (8)11.BR init (8)
12daemon reads its job configuration from the12daemon reads its job configuration from files in the
13.I /etc/init13.I /etc/init/
14directory, and watches for future changes using14directory, and watches for future changes to these files using
15.BR inotify (7).15.BR inotify (7).
1616
17Files in this directory must end in17To be considered by Upstart, files in this directory must have a
18recognized suffix and may also be present in sub-directories. There are
19two recognized suffixes:
20
21.IP \(bu 4
22Files ending in
18.I .conf23.I .conf
19and may also be present in sub-directories.24are called configuration files, or simply "conf files" for short.
2025These are the primary vehicle for specifying a job.
21Each file defines a single service or task, with the name taken from its26.IP \(bu 4
22relative path within the directory without the extension. For example a27Files ending in
23job defined in28.I .override
29are called override files. If an override file is present, the stanzas
30it contains take precedence over those equivalently named stanzas in the
31corresponding configuration file contents for a particular job.
32The main use for override files is to modify how a job will run without
33having to modify its configuration file directly. See the section
34\fBOverride File Handling\fP below for further details.
35.P
36A job can thus be defined by either:
37.IP \[bu] 2
38A single configuration file.
39.IP \[bu]
40A single configuration file \fBand\fP a single override file.
41.P
42Unless explicitly stated otherwise, any reference to a jobs
43configuration can refer both to a configuration file or an override
44file.
45
46Each configuration file defines the template for a single \fIservice\fP
47(long-running process or daemon) or \fItask\fP (short-lived process).
48
49Note that a configuration file is not itself a job: it is a description
50of an environmenta job could be run in. A job is the runtime embodiment
51of a configuration file.
52
53The configuration file name as displayed by Upstart and associated
54tooling is taken from its relative path within the directory without the
55extension. For example a configuration file
24.I /etc/init/rc-sysinit.conf56.I /etc/init/rc-sysinit.conf
25is named57is named
26.IR rc-sysinit ,58.IR rc-sysinit ,
27while a job defined in59while a configuration file
28.I /etc/init/net/apache.conf60.I /etc/init/net/apache.conf
29is named61is named
30.IR net/apache .62.IR net/apache .
63Since override files only modify the way a configuration file is
64interpreted, they are not named.
3165
32These files are plain text and should not be executable.66Configuration files are plain text and should not be executable.
33.\"67.\"
34.SS Format68.SS Configuration File Format
35Each line begins with a configuration stanza and continues until either69Each line begins with a configuration stanza and continues until either
36the end of the line or a line containing a closing stanza. Line breaks70the end of the line or a line containing a closing stanza. Line breaks
37within a stanza are permitted within single or double quotes, or if71within a stanza are permitted within single or double quotes, or if
38preceeded by a blackslash.72preceeded by a blackslash.
3973
74If a stanza is duplicated, the last occurence will be used. Unrecognized
75stanzas will generate parse errors, which will stop a job from running.
76
40Stanzas and their arguments are delimited by whitespace, which consists77Stanzas and their arguments are delimited by whitespace, which consists
41of one or more space or tab characters which are otherwise ignored unless78of one or more space or tab characters which are otherwise ignored unless
42placed within single or double quotes.79placed within single or double quotes.
@@ -144,10 +181,10 @@
144such as removing temporary directories.181such as removing temporary directories.
145182
146.PP183.PP
147All of these processes, including the main process, are optional. Services184All of these processes, including the main process, are optional.
148without a main process will appear to be running until they are stopped,185Services without a main process will appear to be running until they are
149this is commonly used to define states such as runlevels. It's quite186stopped: this is commonly used to define states such as runlevels. It
150permissable to have no main process, but to have187is permissable to have no main process, but to have
151.B pre-start188.B pre-start
152and189and
153.B post-stop190.B post-stop
@@ -249,7 +286,7 @@
249.B stop on286.B stop on
250stanza defines the set of events that will cause the job to be automatically287stanza defines the set of events that will cause the job to be automatically
251stopped. It has the same syntax as288stopped. It has the same syntax as
252.B start on289\fBstart on\fP.
253290
254.I VALUE291.I VALUE
255may additionally expand the value of any variable that came from the292may additionally expand the value of any variable that came from the
@@ -306,7 +343,8 @@
306.B env \fIKEY\fR[=\fIVALUE\fR]343.B env \fIKEY\fR[=\fIVALUE\fR]
307Defines a default environment variable, the value of which may be overriden344Defines a default environment variable, the value of which may be overriden
308by the event or command that starts the job.345by the event or command that starts the job.
309If no value is given, then the value is taken from the346If \'KEY=VALUE\' is specified, the variable KEY is given the value VALUE.
347If only \'KEY\' is given, then the value is taken from the
310.BR init (8)348.BR init (8)
311daemon's own environment.349daemon's own environment.
312.\"350.\"
@@ -366,7 +404,7 @@
366times in404times in
367.I INTERVAL405.I INTERVAL
368seconds, it will be considered to be having deeper problems and will406seconds, it will be considered to be having deeper problems and will
369be stopped.407be stopped. Default COUNT is 10. Default INTERVAL is 5 seconds.
370408
371This only applies to automatic respawns and not the409This only applies to automatic respawns and not the
372.BR restart (8)410.BR restart (8)
@@ -385,7 +423,8 @@
385.SS Instances423.SS Instances
386By default, only one instance of any job is permitted to exist at one424By default, only one instance of any job is permitted to exist at one
387time. Attempting to start a job when it's already starting or running425time. Attempting to start a job when it's already starting or running
388results in an error.426results in an error. Note that a job is considered to be running if its
427pre-start process is running.
389428
390Multiple instances may be permitted by defining the names of those429Multiple instances may be permitted by defining the names of those
391instances. If an instance with the same name is not already starting430instances. If an instance with the same name is not already starting
@@ -561,6 +600,46 @@
561.B unlimited600.B unlimited
562may be specified for either.601may be specified for either.
563.\"602.\"
603.SS Override File Handling
604Override files allow a jobs environment to be changed without modifying
605the jobs configuration file. Rules governing override files:
606
607.IP \[bu] 2
608If a job is embodied with only a configuration file, the contents of
609this file define the job.
610.IP \[bu]
611If an override files exists where there is no existing cofiguration
612file, the override file is ignored.
613.IP \[bu]
614If both a configuration file \fBand\fP an override file exist for a job
615and both files are syntactically correct:
616.RS
617.IP \[bu] 2
618stanzas in the override file will take precedence over stanzas present
619in the corresponding configuration file.
620.IP \[bu]
621stanzas in the override file which are not present in the corresponding
622configuration file will be honoured when the job runs.
623.RE
624.IP \[bu]
625If both a configuration file and an override file exist for a job and
626subsequently the override file is deleted, the configuration file is
627automatically reloaded with the effect that any changes introduced by
628the override file are undone and the configuration file alone now defines
629the job.
630.IP \[bu]
631If both a configuration file and an override file exist for a job and
632subsequently the configuration file is deleted, a new instance of the
633job can no longer be started (since without a corresponding
634configuration file an override file is ignored).
635.IP \[bu]
636If both a configuration file and an override file exist for a job and
637any of the contents of the override file are invalid, the override file
638is ignored and only the contents of the configuration file are
639considered.
640.P
641
642.\"
564.SS Miscellaneous643.SS Miscellaneous
565.TP644.TP
566.B kill timeout \fIINTERVAL645.B kill timeout \fIINTERVAL
@@ -568,7 +647,7 @@
568.I SIGTERM647.I SIGTERM
569and648and
570.I SIGKILL649.I SIGKILL
571signals when stopping the running job.650signals when stopping the running job. Default is 5 seconds.
572.\"651.\"
573.TP652.TP
574.B expect stop653.B expect stop
@@ -609,6 +688,48 @@
609is unable to supervise forking processes and will believe them to have688is unable to supervise forking processes and will believe them to have
610stopped as soon as they fork on startup.689stopped as soon as they fork on startup.
611.\"690.\"
691.SH BUGS
692The
693.B and
694and
695.B or
696operators allowed with
697.B start on
698and
699.B stop on
700do not work intuitively: operands to the right of either operator are
701only evaluated once and state information is then discarded. This can
702lead to jobs with complex \fBstart on\fP or \fPstop on\fP conditions
703not behaving as expected \fIwhen restarted\fP. For example, if a job
704encodes the following condition:
705.ti +4
706.sp 1
707.nf
708start on A and (B or C)
709.fi
710
711When 'A' and 'B' become true, the condition is satisfied so the job will
712be run. However, if the job ends and subsequently 'A' and 'C' become true,
713the job will \fInot\fP be re-run even though the condtion is satisfied.
714Avoid using complex conditions with jobs which need to be restarted.
715.\"
716.SH AUTHOR
717Manual page written by Scott James Remnant
718.RB < scott@netsplit.com >
719and James Hunt
720.RB < james.hunt@canonical.com > .
721.\"
722.SH REPORTING BUGS
723Report bugs at
724.RB < https://launchpad.net/upstart/+bugs >
725.\"
726.SH COPYRIGHT
727Copyright \(co 2010 Canonical Ltd.
728.br
729This is free software; see the source for copying conditions. There is NO
730warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
731
732.\"
612.SH SEE ALSO733.SH SEE ALSO
613.BR init (8)734.BR init (8)
614.BR sh (1)735.BR sh (1)
615736
=== modified file 'init/man/init.8'
--- init/man/init.8 2010-02-04 19:26:17 +0000
+++ init/man/init.8 2011-01-21 11:55:09 +0000
@@ -96,12 +96,13 @@
96warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.96warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
97.\"97.\"
98.SH SEE ALSO98.SH SEE ALSO
99.BR control-alt-delete (7)
99.BR init (5)100.BR init (5)
100.BR initctl (8)101.BR initctl (8)
101.BR telinit (8)
102.BR runlevel (7)102.BR runlevel (7)
103.BR startup (7)103.BR startup (7)
104.BR starting (7)104.BR starting (7)
105.BR started (7)105.BR started (7)
106.BR stopping (7)106.BR stopping (7)
107.BR stopped (7)107.BR stopped (7)
108.BR telinit (8)
108109
=== modified file 'init/parse_conf.c'
--- init/parse_conf.c 2009-06-23 09:29:35 +0000
+++ init/parse_conf.c 2011-01-21 11:55:09 +0000
@@ -74,6 +74,12 @@
74 nih_assert (file != NULL);74 nih_assert (file != NULL);
75 nih_assert (pos != NULL);75 nih_assert (pos != NULL);
7676
77 /* If we update 'stanzas' to allow content in init.conf, this
78 * function must be updated in a similar manner to parse_job()
79 * to handle overrides files.
80 */
81 nih_assert (sizeof(stanzas) / sizeof(stanzas[0]) == 1);
82
77 if (nih_config_parse_file (file, len, pos, lineno,83 if (nih_config_parse_file (file, len, pos, lineno,
78 stanzas, conffile) < 0)84 stanzas, conffile) < 0)
79 return -1;85 return -1;
8086
=== modified file 'init/parse_job.c'
--- init/parse_job.c 2010-12-14 16:37:15 +0000
+++ init/parse_job.c 2011-01-21 11:55:09 +0000
@@ -263,6 +263,7 @@
263/**263/**
264 * parse_job:264 * parse_job:
265 * @parent: parent object for new job,265 * @parent: parent object for new job,
266 * @update: If not NULL, update the existing specified JobClass,
266 * @name: name of new job,267 * @name: name of new job,
267 * @file: file or string to parse,268 * @file: file or string to parse,
268 * @len: length of @file,269 * @len: length of @file,
@@ -278,10 +279,12 @@
278 * of the returned job are freed, the returned job will also be279 * of the returned job are freed, the returned job will also be
279 * freed.280 * freed.
280 *281 *
281 * Returns: new JobClass structure on success, NULL on raised error.282 * Returns: if @update is NULL, returns new JobClass structure on success, NULL on raised error.
283 * If @update is not NULL, returns @update or NULL on error.
282 **/284 **/
283JobClass *285JobClass *
284parse_job (const void *parent,286parse_job (const void *parent,
287 JobClass *update,
285 const char *name,288 const char *name,
286 const char *file,289 const char *file,
287 size_t len,290 size_t len,
@@ -294,13 +297,22 @@
294 nih_assert (file != NULL);297 nih_assert (file != NULL);
295 nih_assert (pos != NULL);298 nih_assert (pos != NULL);
296299
297 class = job_class_new (parent, name);300 if (update) {
298 if (! class)301 class = update;
299 nih_return_system_error (NULL);302 nih_debug ("Reusing JobClass %s (%s)",
303 class->name, class->path);
304 } else {
305 nih_debug ("Creating new JobClass %s",
306 name);
307 class = job_class_new (parent, name);
308 if (! class)
309 nih_return_system_error (NULL);
310 }
300311
301 if (nih_config_parse_file (file, len, pos, lineno,312 if (nih_config_parse_file (file, len, pos, lineno,
302 stanzas, class) < 0) {313 stanzas, class) < 0) {
303 nih_free (class);314 if (!update)
315 nih_free (class);
304 return NULL;316 return NULL;
305 }317 }
306318
307319
=== modified file 'init/parse_job.h'
--- init/parse_job.h 2009-06-23 09:29:35 +0000
+++ init/parse_job.h 2011-01-21 11:55:09 +0000
@@ -27,9 +27,9 @@
2727
28NIH_BEGIN_EXTERN28NIH_BEGIN_EXTERN
2929
30JobClass *parse_job (const void *parent, const char *name,30JobClass *parse_job (const void *parent, JobClass *update,
31 const char *file, size_t len,31 const char *name, const char *file,
32 size_t *pos, size_t *lineno)32 size_t len, size_t *pos, size_t *lineno)
33 __attribute__ ((warn_unused_result, malloc));33 __attribute__ ((warn_unused_result, malloc));
3434
35NIH_END_EXTERN35NIH_END_EXTERN
3636
=== modified file 'init/paths.h'
--- init/paths.h 2010-02-26 15:27:14 +0000
+++ init/paths.h 2011-01-21 11:55:09 +0000
@@ -103,5 +103,55 @@
103#define TELINIT SBINDIR "/telinit"103#define TELINIT SBINDIR "/telinit"
104#endif104#endif
105105
106/**
107 * File extension for standard configuration files.
108 **/
109#define CONF_EXT_STD ".conf"
110
111/**
112 * File extension for override files.
113 *
114 * Note that override files are not stored in the ConfSource 'files' hash:
115 * all JobClass information from override files is added to the JobClass for
116 * the corresponding (CONF_EXT_STD) object.
117 **/
118#define CONF_EXT_OVERRIDE ".override"
119
120/**
121 * Determine if specified path extension representes a standard
122 * configuration file.
123 *
124 * @period: pointer to last period in path to check.
125 *
126 * Returns 1 if specified path extension matches that for a
127 * standard configuration file, else return 0.
128 **/
129#define IS_CONF_EXT_STD(period) \
130 (!strcmp (period, CONF_EXT_STD))
131
132/**
133 * Determine if specified path extension representes an
134 * override file.
135 *
136 * @period: pointer to last period in path to check.
137 *
138 * Returns 1 if specified path extension matches that for
139 * an override file, else return 0.
140 **/
141#define IS_CONF_EXT_OVERRIDE(period) \
142 (!strcmp (period, CONF_EXT_OVERRIDE))
143
144/**
145 * Determine if specified filename has a valid configuration
146 * file name extension.
147 *
148 * @period: pointer to last period in filename.
149 *
150 * Returns: TRUE if extension beyond @period is one of the
151 * recognized types, else FALSE.
152 **/
153#define IS_CONF_EXT(period) \
154 (IS_CONF_EXT_STD(period) || \
155 IS_CONF_EXT_OVERRIDE(period))
106156
107#endif /* INIT_PATHS_H */157#endif /* INIT_PATHS_H */
108158
=== modified file 'init/tests/test_conf.c'
--- init/tests/test_conf.c 2009-07-08 21:05:59 +0000
+++ init/tests/test_conf.c 2011-01-21 11:55:09 +0000
@@ -46,6 +46,50 @@
46#include "job.h"46#include "job.h"
47#include "conf.h"47#include "conf.h"
4848
49/* macro to try and ensure the environment is as pristine as possible
50 * (to avoid follow-on errors caused by not freeing objects in a
51 * previous test, say)
52 */
53#define TEST_ENSURE_CLEAN_ENV() \
54{ \
55 setvbuf(stdout, NULL, _IONBF, 0); \
56 \
57 if (job_classes) { \
58 TEST_HASH_EMPTY (job_classes); \
59 } \
60 \
61 if (conf_sources) { \
62 TEST_LIST_EMPTY (conf_sources); \
63 } \
64 \
65 if (nih_io_watches) { \
66 TEST_LIST_EMPTY (nih_io_watches); \
67 } \
68 \
69 if (nih_timers) { \
70 TEST_LIST_EMPTY (nih_timers); \
71 } \
72 \
73 if (events) { \
74 TEST_LIST_EMPTY (events); \
75 } \
76}
77
78/* Force an inotify watch update */
79#define TEST_FORCE_WATCH_UPDATE() \
80{ \
81 int nfds = 0; \
82 fd_set readfds, writefds, exceptfds; \
83 \
84 FD_ZERO (&readfds); \
85 FD_ZERO (&writefds); \
86 FD_ZERO (&exceptfds); \
87 \
88 nih_debug("calling nih_io_select_fds"); \
89 nih_io_select_fds (&nfds, &readfds, &writefds, &exceptfds); \
90 nih_debug("calling nih_io_handle_fds"); \
91 nih_io_handle_fds (&readfds, &writefds, &exceptfds); \
92}
4993
50void94void
51test_source_new (void)95test_source_new (void)
@@ -2270,6 +2314,1255 @@
2270 }2314 }
2271}2315}
22722316
2317void
2318test_toggle_conf_name (void)
2319{
2320 char override_ext[] = ".override";
2321 char dirname[PATH_MAX];
2322 char filename[PATH_MAX];
2323 JobClass *job;
2324 char *f;
2325 char *p;
2326
2327 TEST_FUNCTION_FEATURE ("toggle_conf_name",
2328 "changing conf to override");
2329
2330 TEST_FILENAME (dirname);
2331 strcpy (filename, dirname);
2332 strcat (filename, "/foo.conf");
2333 f = toggle_conf_name (NULL, filename);
2334 TEST_NE_P (f, NULL);
2335
2336 p = strstr (f, ".override");
2337 TEST_NE_P (p, NULL);
2338 TEST_EQ_P (p, f+strlen (f) - strlen (override_ext));
2339 nih_free (f);
2340
2341 TEST_FEATURE ("changing override to conf");
2342 strcpy (filename, dirname);
2343 strcat (filename, "/bar.override");
2344 f = toggle_conf_name (NULL, filename);
2345 TEST_NE_P (f, NULL);
2346
2347 p = strstr (f, ".conf");
2348 TEST_NE_P (p, NULL);
2349 TEST_EQ_P (p, f+strlen (f) - strlen (".conf"));
2350 nih_free (f);
2351
2352 /* test parent param */
2353 job = job_class_new (NULL, "foo");
2354 TEST_NE_P (job, NULL);
2355
2356 f = toggle_conf_name (job, filename);
2357 TEST_NE_P (f, NULL);
2358
2359 TEST_EQ (TRUE, nih_alloc_parent (f, job));
2360
2361 nih_free (job);
2362}
2363
2364void
2365test_override (void)
2366{
2367 ConfSource *source;
2368 ConfFile *file;
2369 FILE *f;
2370 int ret, fd[4096], i = 0;
2371 char dirname[PATH_MAX];
2372 char filename[PATH_MAX], override[PATH_MAX];
2373 JobClass *job;
2374 NihError *err;
2375
2376 program_name = "test";
2377 nih_log_set_priority (NIH_LOG_FATAL);
2378
2379 TEST_ENSURE_CLEAN_ENV ();
2380 TEST_GROUP ("override files");
2381
2382 /* Make sure that we have inotify before performing some tests... */
2383 if ((fd[0] = inotify_init ()) < 0) {
2384 printf ("SKIP: inotify not available\n");
2385 goto no_inotify;
2386 }
2387 close (fd[0]);
2388
2389
2390 /* Explicit test of behaviour prior to introduction of override files.
2391 *
2392 * conf with no override before watch:
2393 * create conf
2394 * create watch
2395 * ensure conf loaded
2396 * update conf
2397 * ensure conf updated
2398 * delete conf
2399 * ensure conf deleted
2400 */
2401 TEST_FEATURE ("with pre-override environment (conf with no override before watch)");
2402 TEST_ENSURE_CLEAN_ENV ();
2403 TEST_FILENAME (dirname);
2404 TEST_EQ (mkdir (dirname, 0755), 0);
2405
2406 /* create conf */
2407 strcpy (filename, dirname);
2408 strcat (filename, "/foo.conf");
2409 f = fopen (filename, "w");
2410 TEST_NE_P (f, NULL);
2411 fprintf (f, "start on started\n");
2412 fprintf (f, "emits hello\n");
2413 fclose (f);
2414
2415 /* create watch */
2416 source = conf_source_new (NULL, dirname, CONF_JOB_DIR);
2417 TEST_NE_P (source, NULL);
2418 ret = conf_source_reload (source);
2419 TEST_EQ (ret, 0);
2420
2421 /* ensure conf loaded */
2422 file = (ConfFile *)nih_hash_lookup (source->files, filename);
2423 TEST_NE_P (file, NULL);
2424 job = (JobClass *)nih_hash_lookup (job_classes, "foo");
2425 TEST_NE_P (job, NULL);
2426 TEST_EQ_P (file->job, job);
2427 TEST_EQ_STR ((job->emits)[0], "hello");
2428 TEST_NE_P (job->start_on, NULL);
2429
2430 /* update conf */
2431 f = fopen (filename, "a");
2432 TEST_NE_P (f, NULL);
2433 fprintf (f, "manual\n");
2434 fclose (f);
2435
2436 TEST_FORCE_WATCH_UPDATE();
2437
2438 /* ensure conf updated */
2439 file = (ConfFile *)nih_hash_lookup (source->files, filename);
2440 TEST_NE_P (file, NULL);
2441 job = (JobClass *)nih_hash_lookup (job_classes, "foo");
2442 TEST_NE_P (job, NULL);
2443 TEST_EQ_P (job->start_on, NULL);
2444
2445 /* delete conf */
2446 unlink (filename);
2447
2448 TEST_FORCE_WATCH_UPDATE();
2449
2450 job = (JobClass *)nih_hash_lookup (job_classes, "foo");
2451 TEST_EQ_P (job, NULL);
2452 TEST_HASH_EMPTY (job_classes);
2453 TEST_HASH_EMPTY (source->files);
2454
2455 TEST_FORCE_WATCH_UPDATE();
2456
2457 /* ensure conf deleted */
2458 file = (ConfFile *)nih_hash_lookup (source->files, filename);
2459 TEST_EQ_P (file, NULL);
2460
2461 nih_free (source);
2462 TEST_EQ (rmdir (dirname), 0);
2463
2464
2465 /* Explicit test of behaviour prior to introduction of override files.
2466 *
2467 * conf with no override after watch:
2468 * create watch
2469 * create conf
2470 * ensure conf loaded
2471 * update conf
2472 * ensure conf updated
2473 * delete conf
2474 * ensure conf deleted
2475 */
2476 TEST_ENSURE_CLEAN_ENV ();
2477 TEST_FEATURE ("with pre-override environment (conf with no override after watch)");
2478 TEST_FILENAME (dirname);
2479 TEST_EQ (mkdir (dirname, 0755), 0);
2480
2481 /* create watch */
2482 source = conf_source_new (NULL, dirname, CONF_JOB_DIR);
2483 TEST_NE_P (source, NULL);
2484 ret = conf_source_reload (source);
2485 TEST_EQ (ret, 0);
2486
2487 /* create conf */
2488 strcpy (filename, dirname);
2489 strcat (filename, "/foo.conf");
2490 f = fopen (filename, "w");
2491 TEST_NE_P (f, NULL);
2492 fprintf (f, "start on started\n");
2493 fprintf (f, "emits hello\n");
2494 fclose (f);
2495
2496 TEST_FORCE_WATCH_UPDATE();
2497
2498 /* ensure conf loaded */
2499 file = (ConfFile *)nih_hash_lookup (source->files, filename);
2500 TEST_NE_P (file, NULL);
2501 job = (JobClass *)nih_hash_lookup (job_classes, "foo");
2502 TEST_NE_P (job, NULL);
2503 TEST_EQ_P (file->job, job);
2504 TEST_EQ_STR ((job->emits)[0], "hello");
2505
2506 /* update conf */
2507 f = fopen (filename, "a");
2508 TEST_NE_P (f, NULL);
2509 fprintf (f, "manual\n");
2510 fclose (f);
2511
2512 TEST_FORCE_WATCH_UPDATE();
2513
2514 /* ensure conf updated */
2515 job = (JobClass *)nih_hash_lookup (job_classes, "foo");
2516 TEST_NE_P (job, NULL);
2517 TEST_EQ_P (job->start_on, NULL);
2518
2519 /* delete conf */
2520 unlink (filename);
2521
2522 TEST_FORCE_WATCH_UPDATE();
2523
2524 /* ensure conf deleted */
2525 file = (ConfFile *)nih_hash_lookup (source->files, filename);
2526 TEST_EQ_P (file, NULL);
2527 nih_free (source);
2528 TEST_EQ (rmdir (dirname), 0);
2529
2530
2531 TEST_FEATURE ("ensure lone override ignored before watch");
2532 TEST_ENSURE_CLEAN_ENV ();
2533 TEST_FILENAME (dirname);
2534 TEST_EQ (mkdir (dirname, 0755), 0);
2535
2536 /* create override */
2537 strcpy (filename, dirname);
2538 strcat (filename, "/foo.override");
2539 f = fopen (filename, "w");
2540 TEST_NE_P (f, NULL);
2541 fprintf (f, "manual\n");
2542 fclose (f);
2543
2544 /* create watch */
2545 source = conf_source_new (NULL, dirname, CONF_JOB_DIR);
2546 TEST_NE_P (source, NULL);
2547 ret = conf_source_reload (source);
2548 TEST_EQ (ret, 0);
2549
2550 TEST_FORCE_WATCH_UPDATE();
2551
2552 /* ensure no conf object created */
2553 TEST_HASH_EMPTY (source->files);
2554 file = (ConfFile *)nih_hash_lookup (source->files, filename);
2555 TEST_EQ_P (file, NULL);
2556 job = (JobClass *)nih_hash_lookup (job_classes, "foo");
2557 TEST_EQ_P (job, NULL);
2558
2559 /* update override */
2560 f = fopen (filename, "a");
2561 TEST_NE_P (f, NULL);
2562 fprintf (f, "author \"me\"\n");
2563 fclose (f);
2564
2565 TEST_FORCE_WATCH_UPDATE();
2566
2567 /* ensure no conf object created */
2568 TEST_HASH_EMPTY (source->files);
2569 file = (ConfFile *)nih_hash_lookup (source->files, filename);
2570 TEST_EQ_P (file, NULL);
2571 job = (JobClass *)nih_hash_lookup (job_classes, "foo");
2572 TEST_EQ_P (job, NULL);
2573
2574 /* delete override */
2575 unlink (filename);
2576 nih_free (source);
2577 TEST_EQ (rmdir (dirname), 0);
2578
2579
2580 TEST_FEATURE ("ensure lone override ignored after watch");
2581 TEST_ENSURE_CLEAN_ENV ();
2582 TEST_FILENAME (dirname);
2583 TEST_EQ (mkdir (dirname, 0755), 0);
2584
2585 /* create watch */
2586 source = conf_source_new (NULL, dirname, CONF_JOB_DIR);
2587 TEST_NE_P (source, NULL);
2588 ret = conf_source_reload (source);
2589 TEST_EQ (ret, 0);
2590
2591 strcpy (filename, dirname);
2592 strcat (filename, "/bar.override");
2593 f = fopen (filename, "w");
2594 TEST_NE_P (f, NULL);
2595 fprintf (f, "manual\n");
2596 fclose (f);
2597
2598 TEST_FORCE_WATCH_UPDATE();
2599
2600 /* ensure no conf object created */
2601 file = (ConfFile *)nih_hash_lookup (source->files, filename);
2602 TEST_EQ_P (file, NULL);
2603 job = (JobClass *)nih_hash_lookup (job_classes, "bar");
2604 TEST_EQ_P (job, NULL);
2605
2606 /* delete override */
2607 unlink (filename);
2608
2609 TEST_FORCE_WATCH_UPDATE();
2610
2611 /* ensure override still not present */
2612 file = (ConfFile *)nih_hash_lookup (source->files, filename);
2613 TEST_EQ_P (file, NULL);
2614 job = (JobClass *)nih_hash_lookup (job_classes, "bar");
2615 TEST_EQ_P (job, NULL);
2616
2617 nih_free (source);
2618 TEST_EQ (rmdir (dirname), 0);
2619
2620
2621 TEST_FEATURE ("create conf, watch, then create/modify/delete override");
2622 TEST_ENSURE_CLEAN_ENV ();
2623 TEST_FILENAME (dirname);
2624 TEST_EQ (mkdir (dirname, 0755), 0);
2625
2626 /* create conf */
2627 strcpy (filename, dirname);
2628 strcat (filename, "/foo.conf");
2629 f = fopen (filename, "w");
2630 TEST_NE_P (f, NULL);
2631 fprintf (f, "start on started\n");
2632 fprintf (f, "emits hello\n");
2633 fclose (f);
2634
2635 /* create watch */
2636 source = conf_source_new (NULL, dirname, CONF_JOB_DIR);
2637 TEST_NE_P (source, NULL);
2638 ret = conf_source_reload (source);
2639 TEST_EQ (ret, 0);
2640
2641 /* ensure conf loaded */
2642 TEST_HASH_NOT_EMPTY (source->files);
2643 file = (ConfFile *)nih_hash_lookup (source->files, filename);
2644 TEST_NE_P (file, NULL);
2645 job = (JobClass *)nih_hash_lookup (job_classes, "foo");
2646 TEST_NE_P (job, NULL);
2647 TEST_EQ_P (file->job, job);
2648 TEST_EQ_STR ((job->emits)[0], "hello");
2649 TEST_EQ_P ((job->emits)[1], NULL);
2650 TEST_NE_P (job->start_on, NULL);
2651
2652 /* create override */
2653 strcpy (override, dirname);
2654 strcat (override, "/foo.override");
2655 f = fopen (override, "w");
2656 TEST_NE_P (f, NULL);
2657 fprintf (f, "manual\n");
2658 fclose (f);
2659
2660 TEST_HASH_NOT_EMPTY (source->files);
2661 TEST_FORCE_WATCH_UPDATE();
2662
2663 /* ensure conf updated */
2664 TEST_HASH_NOT_EMPTY (source->files);
2665 file = (ConfFile *)nih_hash_lookup (source->files, filename);
2666 TEST_NE_P (file, NULL);
2667 job = (JobClass *)nih_hash_lookup (job_classes, "foo");
2668 TEST_NE_P (job, NULL);
2669 TEST_EQ_P (job->start_on, NULL);
2670
2671 /* ensure no override in hash */
2672 file = (ConfFile *)nih_hash_lookup (source->files, override);
2673 TEST_EQ_P (file, NULL);
2674
2675 /* modify override */
2676 f = fopen (override, "a");
2677 TEST_NE_P (f, NULL);
2678 fprintf (f, "emits world\n");
2679 fclose (f);
2680
2681 TEST_FORCE_WATCH_UPDATE();
2682
2683 /* ensure conf updated */
2684 file = (ConfFile *)nih_hash_lookup (source->files, filename);
2685 TEST_NE_P (file, NULL);
2686 job = (JobClass *)nih_hash_lookup (job_classes, "foo");
2687 TEST_NE_P (job, NULL);
2688 TEST_EQ_P (job->start_on, NULL);
2689 TEST_EQ_STR ((job->emits)[0], "hello");
2690 TEST_EQ_STR ((job->emits)[1], "world");
2691
2692 /* delete override */
2693 unlink (override);
2694
2695 TEST_FORCE_WATCH_UPDATE();
2696
2697 /* ensure conf reverted */
2698 file = (ConfFile *)nih_hash_lookup (source->files, filename);
2699 TEST_NE_P (file, NULL);
2700 job = (JobClass *)nih_hash_lookup (job_classes, "foo");
2701 TEST_NE_P (job, NULL);
2702 TEST_NE_P (job->start_on, NULL);
2703 TEST_EQ_STR ((job->emits)[0], "hello");
2704 TEST_EQ_P ((job->emits)[1], NULL);
2705
2706 nih_free (source);
2707 unlink (filename);
2708 TEST_EQ (rmdir (dirname), 0);
2709
2710
2711 TEST_FEATURE ("create watch, conf, then create/modify/delete override");
2712 TEST_ENSURE_CLEAN_ENV ();
2713 TEST_FILENAME (dirname);
2714 TEST_EQ (mkdir (dirname, 0755), 0);
2715
2716 /* create watch */
2717 source = conf_source_new (NULL, dirname, CONF_JOB_DIR);
2718 TEST_NE_P (source, NULL);
2719 ret = conf_source_reload (source);
2720 TEST_EQ (ret, 0);
2721
2722 /* create conf */
2723 strcpy (filename, dirname);
2724 strcat (filename, "/foo.conf");
2725 f = fopen (filename, "w");
2726 TEST_NE_P (f, NULL);
2727 fprintf (f, "start on started\n");
2728 fprintf (f, "emits hello\n");
2729 fclose (f);
2730
2731 TEST_FORCE_WATCH_UPDATE();
2732
2733 /* ensure conf loaded */
2734 TEST_HASH_NOT_EMPTY (source->files);
2735 file = (ConfFile *)nih_hash_lookup (source->files, filename);
2736 TEST_NE_P (file, NULL);
2737 job = (JobClass *)nih_hash_lookup (job_classes, "foo");
2738 TEST_NE_P (job, NULL);
2739 TEST_EQ_P (file->job, job);
2740 TEST_EQ_STR ((job->emits)[0], "hello");
2741 TEST_EQ_P ((job->emits)[1], NULL);
2742 TEST_NE_P (job->start_on, NULL);
2743
2744 /* create override */
2745 strcpy (override, dirname);
2746 strcat (override, "/foo.override");
2747 f = fopen (override, "w");
2748 TEST_NE_P (f, NULL);
2749 fprintf (f, "manual\n");
2750 fclose (f);
2751
2752 TEST_HASH_NOT_EMPTY (source->files);
2753 TEST_FORCE_WATCH_UPDATE();
2754
2755 /* ensure conf updated */
2756 TEST_HASH_NOT_EMPTY (source->files);
2757 file = (ConfFile *)nih_hash_lookup (source->files, filename);
2758 TEST_NE_P (file, NULL);
2759 job = (JobClass *)nih_hash_lookup (job_classes, "foo");
2760 TEST_NE_P (job, NULL);
2761 TEST_EQ_P (job->start_on, NULL);
2762
2763 /* ensure no override in hash */
2764 file = (ConfFile *)nih_hash_lookup (source->files, override);
2765 TEST_EQ_P (file, NULL);
2766
2767 /* modify override */
2768 f = fopen (override, "a");
2769 TEST_NE_P (f, NULL);
2770 fprintf (f, "emits world\n");
2771 fclose (f);
2772
2773 TEST_FORCE_WATCH_UPDATE();
2774
2775 /* ensure conf updated */
2776 file = (ConfFile *)nih_hash_lookup (source->files, filename);
2777 TEST_NE_P (file, NULL);
2778 job = (JobClass *)nih_hash_lookup (job_classes, "foo");
2779 TEST_NE_P (job, NULL);
2780 TEST_EQ_P (job->start_on, NULL);
2781 TEST_EQ_STR ((job->emits)[0], "hello");
2782 TEST_EQ_STR ((job->emits)[1], "world");
2783
2784 /* delete override */
2785 unlink (override);
2786
2787 TEST_FORCE_WATCH_UPDATE();
2788
2789 /* ensure conf reverted */
2790 file = (ConfFile *)nih_hash_lookup (source->files, filename);
2791 TEST_NE_P (file, NULL);
2792 job = (JobClass *)nih_hash_lookup (job_classes, "foo");
2793 TEST_NE_P (job, NULL);
2794 TEST_NE_P (job->start_on, NULL);
2795 TEST_EQ_STR ((job->emits)[0], "hello");
2796 TEST_EQ_P ((job->emits)[1], NULL);
2797
2798 nih_free (source);
2799 unlink (filename);
2800 TEST_EQ (rmdir (dirname), 0);
2801
2802
2803 TEST_FEATURE ("create override, watch, then create/modify/delete conf");
2804 TEST_ENSURE_CLEAN_ENV ();
2805 TEST_FILENAME (dirname);
2806 TEST_EQ (mkdir (dirname, 0755), 0);
2807
2808 strcpy (filename, dirname);
2809 strcat (filename, "/foo.conf");
2810 strcpy (override, dirname);
2811 strcat (override, "/foo.override");
2812
2813 /* create override */
2814 f = fopen (override, "w");
2815 TEST_NE_P (f, NULL);
2816 fprintf (f, "manual\n");
2817 fprintf (f, "author \"bar\"\n");
2818 fclose (f);
2819
2820 /* create watch */
2821 source = conf_source_new (NULL, dirname, CONF_JOB_DIR);
2822 TEST_NE_P (source, NULL);
2823 ret = conf_source_reload (source);
2824 TEST_EQ (ret, 0);
2825
2826 TEST_FORCE_WATCH_UPDATE();
2827
2828 /* ensure no conf object created */
2829 TEST_HASH_EMPTY (source->files);
2830 file = (ConfFile *)nih_hash_lookup (source->files, filename);
2831 TEST_EQ_P (file, NULL);
2832 job = (JobClass *)nih_hash_lookup (job_classes, "foo");
2833 TEST_EQ_P (job, NULL);
2834
2835 /* create conf */
2836 f = fopen (filename, "w");
2837 TEST_NE_P (f, NULL);
2838 fprintf (f, "start on started\n");
2839 fprintf (f, "emits hello\n");
2840 fprintf (f, "author \"foo\"\n");
2841 fclose (f);
2842
2843 TEST_FORCE_WATCH_UPDATE();
2844
2845 /* ensure conf loaded */
2846 file = (ConfFile *)nih_hash_lookup (source->files, filename);
2847 TEST_NE_P (file, NULL);
2848 job = (JobClass *)nih_hash_lookup (job_classes, "foo");
2849 TEST_NE_P (job, NULL);
2850 TEST_EQ_P (file->job, job);
2851 TEST_EQ_STR ((job->emits)[0], "hello");
2852
2853 /* should pick up override, *NOT* conf */
2854 TEST_EQ_P (job->start_on, NULL);
2855 TEST_EQ_STR (job->author, "bar");
2856
2857 /* modify conf */
2858 f = fopen (filename, "w");
2859 TEST_NE_P (f, NULL);
2860 fprintf (f, "start on wibble\n");
2861 fprintf (f, "emits moo\n");
2862 fclose (f);
2863
2864 TEST_FORCE_WATCH_UPDATE();
2865
2866 /* ensure conf reloaded and updated with override */
2867 file = (ConfFile *)nih_hash_lookup (source->files, filename);
2868 TEST_NE_P (file, NULL);
2869 job = (JobClass *)nih_hash_lookup (job_classes, "foo");
2870 TEST_NE_P (job, NULL);
2871 TEST_EQ_P (file->job, job);
2872 TEST_EQ_STR ((job->emits)[0], "moo");
2873
2874 /* should pick up override, *NOT* conf */
2875 TEST_EQ_P (job->start_on, NULL);
2876 TEST_EQ_STR (job->author, "bar");
2877
2878 /* delete conf */
2879 unlink (filename);
2880
2881 TEST_FORCE_WATCH_UPDATE();
2882
2883 /* ensure conf object deleted */
2884 file = (ConfFile *)nih_hash_lookup (source->files, filename);
2885 TEST_EQ_P (file, NULL);
2886 TEST_HASH_EMPTY (source->files);
2887 job = (JobClass *)nih_hash_lookup (job_classes, "foo");
2888 TEST_EQ_P (job, NULL);
2889 file = (ConfFile *)nih_hash_lookup (source->files, override);
2890 TEST_EQ_P (file, NULL);
2891
2892 unlink (override);
2893
2894 /* ensure no conf object still */
2895 file = (ConfFile *)nih_hash_lookup (source->files, filename);
2896 TEST_EQ_P (file, NULL);
2897 TEST_HASH_EMPTY (source->files);
2898 job = (JobClass *)nih_hash_lookup (job_classes, "foo");
2899 TEST_EQ_P (job, NULL);
2900 file = (ConfFile *)nih_hash_lookup (source->files, override);
2901 TEST_EQ_P (file, NULL);
2902
2903 nih_free (source);
2904 TEST_EQ (rmdir (dirname), 0);
2905
2906
2907 TEST_FEATURE ("create watch, override, then create/modify/delete conf");
2908 TEST_ENSURE_CLEAN_ENV ();
2909 TEST_FILENAME (dirname);
2910 TEST_EQ (mkdir (dirname, 0755), 0);
2911
2912 /* create watch */
2913 source = conf_source_new (NULL, dirname, CONF_JOB_DIR);
2914 TEST_NE_P (source, NULL);
2915 ret = conf_source_reload (source);
2916 TEST_EQ (ret, 0);
2917
2918 strcpy (filename, dirname);
2919 strcat (filename, "/foo.conf");
2920 strcpy (override, dirname);
2921 strcat (override, "/foo.override");
2922
2923 /* create override */
2924 f = fopen (override, "w");
2925 TEST_NE_P (f, NULL);
2926 fprintf (f, "manual\n");
2927 fprintf (f, "author \"bar\"\n");
2928 fclose (f);
2929
2930 TEST_FORCE_WATCH_UPDATE();
2931
2932 /* ensure no conf object created */
2933 TEST_HASH_EMPTY (source->files);
2934 file = (ConfFile *)nih_hash_lookup (source->files, filename);
2935 TEST_EQ_P (file, NULL);
2936 job = (JobClass *)nih_hash_lookup (job_classes, "foo");
2937 TEST_EQ_P (job, NULL);
2938
2939 /* create conf */
2940 f = fopen (filename, "w");
2941 TEST_NE_P (f, NULL);
2942 fprintf (f, "start on started\n");
2943 fprintf (f, "emits hello\n");
2944 fprintf (f, "author \"foo\"\n");
2945 fclose (f);
2946
2947 TEST_FORCE_WATCH_UPDATE();
2948
2949 /* ensure conf loaded */
2950 file = (ConfFile *)nih_hash_lookup (source->files, filename);
2951 TEST_NE_P (file, NULL);
2952 job = (JobClass *)nih_hash_lookup (job_classes, "foo");
2953 TEST_NE_P (job, NULL);
2954 TEST_EQ_P (file->job, job);
2955 TEST_EQ_STR ((job->emits)[0], "hello");
2956
2957 /* should pick up override, *NOT* conf */
2958 TEST_EQ_P (job->start_on, NULL);
2959 TEST_EQ_STR (job->author, "bar");
2960
2961 /* modify conf */
2962 f = fopen (filename, "w");
2963 TEST_NE_P (f, NULL);
2964 fprintf (f, "start on wibble\n");
2965 fprintf (f, "emits moo\n");
2966 fclose (f);
2967
2968 TEST_FORCE_WATCH_UPDATE();
2969
2970 /* ensure conf reloaded and updated with override */
2971 file = (ConfFile *)nih_hash_lookup (source->files, filename);
2972 TEST_NE_P (file, NULL);
2973 job = (JobClass *)nih_hash_lookup (job_classes, "foo");
2974 TEST_NE_P (job, NULL);
2975 TEST_EQ_P (file->job, job);
2976 TEST_EQ_STR ((job->emits)[0], "moo");
2977
2978 /* should pick up override, *NOT* conf */
2979 TEST_EQ_P (job->start_on, NULL);
2980 TEST_EQ_STR (job->author, "bar");
2981
2982 /* delete conf */
2983 unlink (filename);
2984
2985 TEST_FORCE_WATCH_UPDATE();
2986
2987 /* ensure conf object deleted */
2988 file = (ConfFile *)nih_hash_lookup (source->files, filename);
2989 TEST_EQ_P (file, NULL);
2990 TEST_HASH_EMPTY (source->files);
2991 job = (JobClass *)nih_hash_lookup (job_classes, "foo");
2992 TEST_EQ_P (job, NULL);
2993 file = (ConfFile *)nih_hash_lookup (source->files, override);
2994 TEST_EQ_P (file, NULL);
2995
2996 unlink (override);
2997
2998 /* ensure no conf object still */
2999 file = (ConfFile *)nih_hash_lookup (source->files, filename);
3000 TEST_EQ_P (file, NULL);
3001 TEST_HASH_EMPTY (source->files);
3002 job = (JobClass *)nih_hash_lookup (job_classes, "foo");
3003 TEST_EQ_P (job, NULL);
3004 file = (ConfFile *)nih_hash_lookup (source->files, override);
3005 TEST_EQ_P (file, NULL);
3006
3007 nih_free (source);
3008 TEST_EQ (rmdir (dirname), 0);
3009
3010
3011 TEST_FEATURE ("create override, watch, conf, then modify/delete override");
3012 TEST_ENSURE_CLEAN_ENV ();
3013 TEST_FILENAME (dirname);
3014 TEST_EQ (mkdir (dirname, 0755), 0);
3015
3016 strcpy (filename, dirname);
3017 strcat (filename, "/foo.conf");
3018 strcpy (override, dirname);
3019 strcat (override, "/foo.override");
3020
3021 /* create override */
3022 f = fopen (override, "w");
3023 TEST_NE_P (f, NULL);
3024 fprintf (f, "manual\n");
3025 fprintf (f, "author \"bar\"\n");
3026 fclose (f);
3027
3028 /* create watch */
3029 source = conf_source_new (NULL, dirname, CONF_JOB_DIR);
3030 TEST_NE_P (source, NULL);
3031 ret = conf_source_reload (source);
3032 TEST_EQ (ret, 0);
3033
3034 TEST_FORCE_WATCH_UPDATE();
3035
3036 /* ensure no conf object created */
3037 TEST_HASH_EMPTY (source->files);
3038 file = (ConfFile *)nih_hash_lookup (source->files, filename);
3039 TEST_EQ_P (file, NULL);
3040 job = (JobClass *)nih_hash_lookup (job_classes, "foo");
3041 TEST_EQ_P (job, NULL);
3042
3043 /* create conf */
3044 f = fopen (filename, "w");
3045 TEST_NE_P (f, NULL);
3046 fprintf (f, "start on started\n");
3047 fprintf (f, "emits hello\n");
3048 fprintf (f, "author \"foo\"\n");
3049 fclose (f);
3050
3051 /* FIXME: crashes here */
3052 TEST_FORCE_WATCH_UPDATE();
3053
3054 /* ensure conf loaded */
3055 file = (ConfFile *)nih_hash_lookup (source->files, filename);
3056 TEST_NE_P (file, NULL);
3057 job = (JobClass *)nih_hash_lookup (job_classes, "foo");
3058 TEST_NE_P (job, NULL);
3059 TEST_EQ_P (file->job, job);
3060 TEST_EQ_STR ((job->emits)[0], "hello");
3061
3062 /* should pick up override, *NOT* conf */
3063 TEST_EQ_P (job->start_on, NULL);
3064 TEST_EQ_STR (job->author, "bar");
3065
3066 /* modify override */
3067 f = fopen (override, "w");
3068 TEST_NE_P (f, NULL);
3069 fprintf (f, "author \"meh\"\n");
3070 fprintf (f, "env wibble=wobble\n");
3071 fprintf (f, "manual\n");
3072 fclose (f);
3073
3074 TEST_FORCE_WATCH_UPDATE();
3075
3076 /* ensure conf reloaded and updated with override */
3077 file = (ConfFile *)nih_hash_lookup (source->files, filename);
3078 TEST_NE_P (file, NULL);
3079 job = (JobClass *)nih_hash_lookup (job_classes, "foo");
3080 TEST_NE_P (job, NULL);
3081 TEST_EQ_P (file->job, job);
3082 TEST_EQ_STR ((job->emits)[0], "hello");
3083
3084 /* should pick up override, *NOT* conf */
3085 TEST_EQ_P (job->start_on, NULL);
3086 TEST_EQ_STR (job->author, "meh");
3087 TEST_EQ_STR ((job->env)[0], "wibble=wobble");
3088
3089 /* delete override */
3090 unlink (override);
3091
3092 TEST_FORCE_WATCH_UPDATE();
3093
3094 /* ensure conf object reverted */
3095 file = (ConfFile *)nih_hash_lookup (source->files, filename);
3096 TEST_NE_P (file, NULL);
3097 job = (JobClass *)nih_hash_lookup (job_classes, "foo");
3098 TEST_NE_P (job, NULL);
3099 TEST_NE_P (job->start_on, NULL);
3100 TEST_EQ_STR (job->author, "foo");
3101 TEST_EQ_P (job->env, NULL);
3102 TEST_EQ_STR ((job->emits)[0], "hello");
3103
3104 unlink (filename);
3105 nih_free (source);
3106 TEST_EQ (rmdir (dirname), 0);
3107
3108
3109 TEST_FEATURE ("create watch, override, conf, then modify/delete override");
3110 TEST_ENSURE_CLEAN_ENV ();
3111 TEST_FILENAME (dirname);
3112 TEST_EQ (mkdir (dirname, 0755), 0);
3113
3114 strcpy (filename, dirname);
3115 strcat (filename, "/foo.conf");
3116 strcpy (override, dirname);
3117 strcat (override, "/foo.override");
3118
3119 /* create watch */
3120 source = conf_source_new (NULL, dirname, CONF_JOB_DIR);
3121 TEST_NE_P (source, NULL);
3122 ret = conf_source_reload (source);
3123 TEST_EQ (ret, 0);
3124
3125 TEST_FORCE_WATCH_UPDATE();
3126
3127 /* create override */
3128 f = fopen (override, "w");
3129 TEST_NE_P (f, NULL);
3130 fprintf (f, "manual\n");
3131 fprintf (f, "author \"bar\"\n");
3132 fclose (f);
3133
3134 TEST_FORCE_WATCH_UPDATE();
3135
3136 /* create conf */
3137 f = fopen (filename, "w");
3138 TEST_NE_P (f, NULL);
3139 fprintf (f, "start on started\n");
3140 fprintf (f, "emits hello\n");
3141 fprintf (f, "author \"foo\"\n");
3142 fclose (f);
3143
3144 TEST_FORCE_WATCH_UPDATE();
3145
3146 /* ensure conf loaded */
3147 file = (ConfFile *)nih_hash_lookup (source->files, filename);
3148 TEST_NE_P (file, NULL);
3149 job = (JobClass *)nih_hash_lookup (job_classes, "foo");
3150 TEST_NE_P (job, NULL);
3151 TEST_EQ_P (file->job, job);
3152 TEST_EQ_STR ((job->emits)[0], "hello");
3153
3154 /* should pick up override, *NOT* conf */
3155 TEST_EQ_P (job->start_on, NULL);
3156 TEST_EQ_STR (job->author, "bar");
3157
3158 /* update override */
3159 f = fopen (override, "a");
3160 TEST_NE_P (f, NULL);
3161 fprintf (f, "author \"me\"\n");
3162 fprintf (f, "env wibble=wobble\n");
3163 fclose (f);
3164
3165 TEST_FORCE_WATCH_UPDATE();
3166
3167 /* ensure conf reloaded and updated with override */
3168 file = (ConfFile *)nih_hash_lookup (source->files, filename);
3169 TEST_NE_P (file, NULL);
3170 job = (JobClass *)nih_hash_lookup (job_classes, "foo");
3171 TEST_NE_P (job, NULL);
3172 TEST_EQ_P (file->job, job);
3173 TEST_EQ_STR ((job->emits)[0], "hello");
3174
3175 /* should pick up override, *NOT* conf */
3176 TEST_EQ_P (job->start_on, NULL);
3177 TEST_EQ_STR (job->author, "me");
3178 TEST_EQ_STR ((job->env)[0], "wibble=wobble");
3179
3180 TEST_FORCE_WATCH_UPDATE();
3181
3182 /* delete override */
3183 unlink (override);
3184
3185 TEST_FORCE_WATCH_UPDATE();
3186
3187 /* ensure conf loaded */
3188 file = (ConfFile *)nih_hash_lookup (source->files, filename);
3189 TEST_NE_P (file, NULL);
3190 job = (JobClass *)nih_hash_lookup (job_classes, "foo");
3191 TEST_NE_P (job, NULL);
3192 TEST_EQ_P (file->job, job);
3193 TEST_EQ_STR (job->author, "foo");
3194 TEST_EQ_STR ((job->emits)[0], "hello");
3195 TEST_NE_P (job->start_on, NULL);
3196 TEST_EQ_P (job->env, NULL);
3197
3198 unlink (filename);
3199 nih_free (source);
3200 TEST_EQ (rmdir (dirname), 0);
3201
3202
3203 TEST_FEATURE ("create both conf+override files, watch, then modify/delete conf");
3204 TEST_ENSURE_CLEAN_ENV ();
3205 TEST_FILENAME (dirname);
3206 TEST_EQ (mkdir (dirname, 0755), 0);
3207
3208 /* create conf */
3209 strcpy (filename, dirname);
3210 strcat (filename, "/foo.conf");
3211 f = fopen (filename, "w");
3212 TEST_NE_P (f, NULL);
3213 fprintf (f, "start on started\n");
3214 fprintf (f, "author \"me\"\n");
3215 fprintf (f, "env foo=bar\n");
3216 fprintf (f, "emits hello\n");
3217 fclose (f);
3218
3219 /* create override */
3220 strcpy (override, dirname);
3221 strcat (override, "/foo.override");
3222 f = fopen (override, "w");
3223 TEST_NE_P (f, NULL);
3224 fprintf (f, "manual\n");
3225 fprintf (f, "author \"you\"\n");
3226 fclose (f);
3227
3228 /* create watch */
3229 source = conf_source_new (NULL, dirname, CONF_JOB_DIR);
3230 TEST_NE_P (source, NULL);
3231 ret = conf_source_reload (source);
3232 TEST_EQ (ret, 0);
3233
3234 TEST_FORCE_WATCH_UPDATE();
3235
3236 /* ensure conf loaded */
3237 TEST_HASH_NOT_EMPTY (source->files);
3238 file = (ConfFile *)nih_hash_lookup (source->files, filename);
3239 TEST_NE_P (file, NULL);
3240 job = (JobClass *)nih_hash_lookup (job_classes, "foo");
3241 TEST_NE_P (job, NULL);
3242 TEST_EQ_P (file->job, job);
3243 TEST_EQ_STR ((job->emits)[0], "hello");
3244 TEST_EQ_STR (job->author, "you");
3245 TEST_EQ_P (job->start_on, NULL);
3246 TEST_EQ_STR ((job->env)[0], "foo=bar");
3247 TEST_EQ_P (job->export, NULL);
3248
3249 /* modify conf */
3250 f = fopen (filename, "a");
3251 TEST_NE_P (f, NULL);
3252 fprintf (f, "export foo\n");
3253 fclose (f);
3254
3255 TEST_FORCE_WATCH_UPDATE();
3256
3257 /* ensure conf updated */
3258 TEST_HASH_NOT_EMPTY (source->files);
3259 file = (ConfFile *)nih_hash_lookup (source->files, filename);
3260 TEST_NE_P (file, NULL);
3261 job = (JobClass *)nih_hash_lookup (job_classes, "foo");
3262 TEST_NE_P (job, NULL);
3263 TEST_EQ_STR ((job->env)[0], "foo=bar");
3264 TEST_NE_P (job->export, NULL);
3265 TEST_EQ_STR ((job->export)[0], "foo");
3266
3267 /* delete conf */
3268 unlink (filename);
3269
3270 TEST_FORCE_WATCH_UPDATE();
3271
3272 /* ensure conf object deleted */
3273 file = (ConfFile *)nih_hash_lookup (source->files, filename);
3274 TEST_EQ_P (file, NULL);
3275 TEST_HASH_EMPTY (source->files);
3276 job = (JobClass *)nih_hash_lookup (job_classes, "foo");
3277 TEST_EQ_P (job, NULL);
3278 file = (ConfFile *)nih_hash_lookup (source->files, override);
3279 TEST_EQ_P (file, NULL);
3280
3281 unlink (override);
3282 nih_free (source);
3283 TEST_EQ (rmdir (dirname), 0);
3284
3285 TEST_FEATURE ("create both conf+override files, watch, then modify/delete override");
3286 TEST_ENSURE_CLEAN_ENV ();
3287 TEST_FILENAME (dirname);
3288 TEST_EQ (mkdir (dirname, 0755), 0);
3289
3290 /* create conf */
3291 strcpy (filename, dirname);
3292 strcat (filename, "/foo.conf");
3293 f = fopen (filename, "w");
3294 TEST_NE_P (f, NULL);
3295 fprintf (f, "start on started\n");
3296 fprintf (f, "author \"me\"\n");
3297 fprintf (f, "env foo=bar\n");
3298 fprintf (f, "emits hello\n");
3299 fclose (f);
3300
3301 /* create override */
3302 strcpy (override, dirname);
3303 strcat (override, "/foo.override");
3304 f = fopen (override, "w");
3305 TEST_NE_P (f, NULL);
3306 fprintf (f, "manual\n");
3307 fprintf (f, "author \"you\"\n");
3308 fclose (f);
3309
3310 /* create watch */
3311 source = conf_source_new (NULL, dirname, CONF_JOB_DIR);
3312 TEST_NE_P (source, NULL);
3313 ret = conf_source_reload (source);
3314 TEST_EQ (ret, 0);
3315
3316 TEST_FORCE_WATCH_UPDATE();
3317
3318 /* ensure conf loaded */
3319 TEST_HASH_NOT_EMPTY (source->files);
3320 file = (ConfFile *)nih_hash_lookup (source->files, filename);
3321 TEST_NE_P (file, NULL);
3322 job = (JobClass *)nih_hash_lookup (job_classes, "foo");
3323 TEST_NE_P (job, NULL);
3324 TEST_EQ_P (file->job, job);
3325 TEST_EQ_STR ((job->emits)[0], "hello");
3326 TEST_EQ_STR (job->author, "you");
3327 TEST_EQ_P (job->start_on, NULL);
3328 TEST_EQ_STR ((job->env)[0], "foo=bar");
3329 TEST_EQ_P (job->export, NULL);
3330
3331 /* modify override */
3332 f = fopen (override, "w");
3333 TEST_NE_P (f, NULL);
3334 fprintf (f, "description \"hello world\"\n");
3335 fprintf (f, "author \"ubuntu\"\n");
3336 fclose (f);
3337
3338 TEST_FORCE_WATCH_UPDATE();
3339
3340 /* ensure conf updated */
3341 file = (ConfFile *)nih_hash_lookup (source->files, filename);
3342 TEST_NE_P (file, NULL);
3343 job = (JobClass *)nih_hash_lookup (job_classes, "foo");
3344 TEST_NE_P (job, NULL);
3345 TEST_EQ_P (file->job, job);
3346 TEST_EQ_STR (job->author, "ubuntu");
3347 TEST_NE_P (job->description, NULL);
3348 TEST_EQ_STR (job->description, "hello world");
3349 TEST_EQ_STR ((job->emits)[0], "hello");
3350 TEST_NE_P (job->start_on, NULL);
3351
3352 /* delete override */
3353 unlink (override);
3354
3355 TEST_FORCE_WATCH_UPDATE();
3356
3357 /* ensure conf updated */
3358 file = (ConfFile *)nih_hash_lookup (source->files, filename);
3359 TEST_NE_P (file, NULL);
3360 job = (JobClass *)nih_hash_lookup (job_classes, "foo");
3361 TEST_NE_P (job, NULL);
3362 TEST_EQ_P (file->job, job);
3363 TEST_NE_P (job->start_on, NULL);
3364 TEST_EQ_STR ((job->env)[0], "foo=bar");
3365 TEST_EQ_STR ((job->emits)[0], "hello");
3366 TEST_EQ_STR (job->author, "me");
3367 TEST_EQ_P (job->description, NULL);
3368
3369 nih_free (source);
3370 unlink (filename);
3371 TEST_EQ (rmdir (dirname), 0);
3372
3373
3374 TEST_FEATURE ("create conf, watch, then create invalid override, delete override");
3375 TEST_ENSURE_CLEAN_ENV ();
3376 TEST_FILENAME (dirname);
3377 TEST_EQ (mkdir (dirname, 0755), 0);
3378
3379 /* create conf */
3380 strcpy (filename, dirname);
3381 strcat (filename, "/foo.conf");
3382 f = fopen (filename, "w");
3383 TEST_NE_P (f, NULL);
3384 fprintf (f, "start on started\n");
3385 fprintf (f, "author \"wibble\"\n");
3386 fprintf (f, "emits hello\n");
3387 fclose (f);
3388
3389 /* create watch */
3390 source = conf_source_new (NULL, dirname, CONF_JOB_DIR);
3391 TEST_NE_P (source, NULL);
3392 ret = conf_source_reload (source);
3393 TEST_EQ (ret, 0);
3394
3395 TEST_FORCE_WATCH_UPDATE();
3396
3397 /* ensure conf loaded */
3398 TEST_HASH_NOT_EMPTY (source->files);
3399 file = (ConfFile *)nih_hash_lookup (source->files, filename);
3400 TEST_NE_P (file, NULL);
3401 job = (JobClass *)nih_hash_lookup (job_classes, "foo");
3402 TEST_NE_P (job, NULL);
3403 TEST_EQ_P (file->job, job);
3404 TEST_EQ_STR ((job->emits)[0], "hello");
3405 TEST_NE_P (job->start_on, NULL);
3406
3407 /* create (partially) invalid override (which should be
3408 * fully ignored)
3409 */
3410 strcpy (override, dirname);
3411 strcat (override, "/foo.override");
3412 f = fopen (override, "w");
3413 TEST_NE_P (f, NULL);
3414 fprintf (f, "manual\n");
3415 fprintf (f, "bleaugh!\n");
3416 fprintf (f, "wha...?\n");
3417 fprintf (f, "author \"moo\"\n");
3418 fclose (f);
3419
3420 TEST_FORCE_WATCH_UPDATE();
3421
3422 unlink (override);
3423
3424 TEST_FORCE_WATCH_UPDATE();
3425
3426 /* ensure conf still loaded */
3427 TEST_HASH_NOT_EMPTY (source->files);
3428 file = (ConfFile *)nih_hash_lookup (source->files, filename);
3429 TEST_NE_P (file, NULL);
3430 job = (JobClass *)nih_hash_lookup (job_classes, "foo");
3431 TEST_NE_P (job, NULL);
3432 TEST_EQ_P (file->job, job);
3433 TEST_EQ_STR ((job->emits)[0], "hello");
3434 TEST_NE_P (job->start_on, NULL);
3435 TEST_EQ_STR (job->author, "wibble");
3436
3437 nih_free (source);
3438 unlink (filename);
3439 TEST_EQ (rmdir (dirname), 0);
3440
3441 TEST_FEATURE ("ensure override ignored for CONF_FILE");
3442 TEST_ENSURE_CLEAN_ENV ();
3443 TEST_FILENAME (dirname);
3444 TEST_EQ (mkdir (dirname, 0755), 0);
3445
3446 /* create empty conf */
3447 strcpy (filename, dirname);
3448 strcat (filename, "/init.conf");
3449 f = fopen (filename, "w");
3450 TEST_NE_P (f, NULL);
3451 fclose (f);
3452
3453 /* create watch */
3454 source = conf_source_new (NULL, dirname, CONF_FILE);
3455 TEST_NE_P (source, NULL);
3456 ret = conf_source_reload (source);
3457
3458 /* We expect conf_source_reload to fail in this situation since
3459 * although "init.conf" is a supported config file, it is not
3460 * allowed to contain any stanzas, implying that it can only
3461 * contain comments. In fact, if the file exists but is zero
3462 * size that is currently an error since upstart blindly calls
3463 * nih_file_read(), which will fail since there are no bytes to
3464 * read.
3465 */
3466 TEST_NE (ret, 0);
3467 err = nih_error_steal ();
3468 TEST_EQ (err->number, EILSEQ);
3469 nih_free (err);
3470
3471 TEST_FORCE_WATCH_UPDATE();
3472
3473 /* ensure conf NOT loaded */
3474 TEST_HASH_EMPTY (source->files);
3475
3476 /* create override */
3477 strcpy (override, dirname);
3478 strcat (override, "/init.override");
3479 f = fopen (override, "w");
3480 TEST_NE_P (f, NULL);
3481 fprintf (f, "manual\n");
3482 fclose (f);
3483
3484 TEST_FORCE_WATCH_UPDATE();
3485
3486 /* ensure conf still NOT loaded */
3487 TEST_HASH_EMPTY (source->files);
3488
3489 nih_free (source);
3490 unlink (filename);
3491 unlink (override);
3492 TEST_EQ (rmdir (dirname), 0);
3493
3494 /* Consume all available inotify instances so that the following
3495 * tests run without inotify.
3496 */
3497 for (i = 0; i < 4096; i++)
3498 if ((fd[i] = inotify_init ()) < 0)
3499 break;
3500
3501no_inotify:
3502 /* If you don't have inotify, any override file must exist
3503 * before the system boots.
3504 */
3505
3506 TEST_FEATURE ("both conf+override files with no inotify support");
3507 TEST_ENSURE_CLEAN_ENV ();
3508 TEST_FILENAME (dirname);
3509 TEST_EQ (mkdir (dirname, 0755), 0);
3510
3511 /* create conf */
3512 strcpy (filename, dirname);
3513 strcat (filename, "/foo.conf");
3514 f = fopen (filename, "w");
3515 TEST_NE_P (f, NULL);
3516 fprintf (f, "start on started\n");
3517 fprintf (f, "author \"me\"\n");
3518 fprintf (f, "env foo=bar\n");
3519 fprintf (f, "emits hello\n");
3520 fclose (f);
3521
3522 /* create override */
3523 strcpy (override, dirname);
3524 strcat (override, "/foo.override");
3525 f = fopen (override, "w");
3526 TEST_NE_P (f, NULL);
3527 fprintf (f, "manual\n");
3528 fprintf (f, "author \"you\"\n");
3529 fclose (f);
3530
3531 /* create watch */
3532 source = conf_source_new (NULL, dirname, CONF_JOB_DIR);
3533 TEST_NE_P (source, NULL);
3534 ret = conf_source_reload (source);
3535 TEST_EQ (ret, 0);
3536
3537 /* ensure conf loaded */
3538 TEST_HASH_NOT_EMPTY (source->files);
3539 file = (ConfFile *)nih_hash_lookup (source->files, filename);
3540 TEST_NE_P (file, NULL);
3541 job = (JobClass *)nih_hash_lookup (job_classes, "foo");
3542 TEST_NE_P (job, NULL);
3543 TEST_EQ_P (file->job, job);
3544 TEST_EQ_STR ((job->emits)[0], "hello");
3545 TEST_EQ_STR (job->author, "you");
3546 TEST_EQ_P (job->start_on, NULL);
3547 TEST_EQ_STR ((job->env)[0], "foo=bar");
3548 TEST_EQ_P (job->export, NULL);
3549
3550 nih_free (source);
3551 unlink (filename);
3552 unlink (override);
3553 TEST_EQ (rmdir (dirname), 0);
3554
3555
3556 nih_log_set_priority (NIH_LOG_MESSAGE);
3557
3558 /* Release consumed instances */
3559 for (i = 0; i < 4096; i++) {
3560 if (fd[i] < 0)
3561 break;
3562
3563 close (fd[i]);
3564 }
3565}
22733566
2274void3567void
2275test_source_reload_file (void)3568test_source_reload_file (void)
@@ -2822,8 +4115,6 @@
2822 TEST_HASH_EMPTY (source->files);4115 TEST_HASH_EMPTY (source->files);
28234116
2824 nih_free (source);4117 nih_free (source);
2825
2826
2827 /* Consume all available inotify instances so that the following4118 /* Consume all available inotify instances so that the following
2828 * tests run without inotify.4119 * tests run without inotify.
2829 */4120 */
@@ -3309,6 +4600,8 @@
3309 test_source_reload_conf_dir ();4600 test_source_reload_conf_dir ();
3310 test_source_reload_file ();4601 test_source_reload_file ();
3311 test_source_reload ();4602 test_source_reload ();
4603 test_toggle_conf_name ();
4604 test_override ();
3312 test_file_destroy ();4605 test_file_destroy ();
3313 test_select_job ();4606 test_select_job ();
33144607
33154608
=== modified file 'init/tests/test_parse_job.c'
--- init/tests/test_parse_job.c 2010-12-14 16:20:38 +0000
+++ init/tests/test_parse_job.c 2011-01-21 11:55:09 +0000
@@ -64,7 +64,7 @@
64 TEST_ALLOC_FAIL {64 TEST_ALLOC_FAIL {
65 pos = 0;65 pos = 0;
66 lineno = 1;66 lineno = 1;
67 job = parse_job (NULL, "test", buf, strlen (buf),67 job = parse_job (NULL, NULL, "test", buf, strlen (buf),
68 &pos, &lineno);68 &pos, &lineno);
6969
70 if (test_alloc_failed) {70 if (test_alloc_failed) {
@@ -110,7 +110,7 @@
110 TEST_ALLOC_FAIL {110 TEST_ALLOC_FAIL {
111 pos = 0;111 pos = 0;
112 lineno = 1;112 lineno = 1;
113 job = parse_job (NULL, "test", buf, strlen (buf),113 job = parse_job (NULL, NULL, "test", buf, strlen (buf),
114 &pos, &lineno);114 &pos, &lineno);
115115
116 if (test_alloc_failed) {116 if (test_alloc_failed) {
@@ -131,6 +131,45 @@
131131
132 nih_free (job);132 nih_free (job);
133 }133 }
134
135 TEST_FEATURE ("with non-NULL update parameter (override)");
136 {
137 JobClass *tmp = NULL;
138
139 strcpy (buf, "start on starting\n");
140 strcat (buf, "author \"me\"\n");
141
142 pos = 0;
143 lineno = 1;
144 job = parse_job (NULL, NULL, "test", buf, strlen (buf),
145 &pos, &lineno);
146
147 TEST_NE_P (job, NULL);
148 TEST_EQ_STR (job->author, "me");
149 TEST_NE_P (job->start_on, NULL);
150
151 strcat (buf, "author \"you\"\n");
152 strcat (buf, "manual\n");
153 strcat (buf, "description \"my description\"\n");
154
155 pos = 0;
156 lineno = 1;
157 tmp = parse_job (NULL, job, "test", buf, strlen (buf),
158 &pos, &lineno);
159 TEST_NE_P (tmp, NULL);
160
161 /* if passed a job, the same object should be returned.
162 */
163 TEST_EQ_P (tmp, job);
164
165 TEST_EQ_STR (tmp->author, "you");
166 TEST_EQ_P (tmp->start_on, NULL);
167 TEST_NE_P (tmp->description, NULL);
168
169 TEST_EQ_STR (tmp->description, "my description");
170
171 nih_free (job);
172 }
134}173}
135174
136void175void
@@ -153,7 +192,7 @@
153 TEST_ALLOC_FAIL {192 TEST_ALLOC_FAIL {
154 pos = 0;193 pos = 0;
155 lineno = 1;194 lineno = 1;
156 job = parse_job (NULL, "test", buf, strlen (buf),195 job = parse_job (NULL, NULL, "test", buf, strlen (buf),
157 &pos, &lineno);196 &pos, &lineno);
158197
159 if (test_alloc_failed) {198 if (test_alloc_failed) {
@@ -190,7 +229,7 @@
190 TEST_ALLOC_FAIL {229 TEST_ALLOC_FAIL {
191 pos = 0;230 pos = 0;
192 lineno = 1;231 lineno = 1;
193 job = parse_job (NULL, "test", buf, strlen (buf),232 job = parse_job (NULL, NULL, "test", buf, strlen (buf),
194 &pos, &lineno);233 &pos, &lineno);
195234
196 if (test_alloc_failed) {235 if (test_alloc_failed) {
@@ -229,7 +268,7 @@
229 TEST_ALLOC_FAIL {268 TEST_ALLOC_FAIL {
230 pos = 0;269 pos = 0;
231 lineno = 1;270 lineno = 1;
232 job = parse_job (NULL, "test", buf, strlen (buf),271 job = parse_job (NULL, NULL, "test", buf, strlen (buf),
233 &pos, &lineno);272 &pos, &lineno);
234273
235 if (test_alloc_failed) {274 if (test_alloc_failed) {
@@ -266,7 +305,7 @@
266305
267 pos = 0;306 pos = 0;
268 lineno = 1;307 lineno = 1;
269 job = parse_job (NULL, "test", buf, strlen (buf), &pos, &lineno);308 job = parse_job (NULL, NULL, "test", buf, strlen (buf), &pos, &lineno);
270309
271 TEST_EQ_P (job, NULL);310 TEST_EQ_P (job, NULL);
272311
@@ -299,7 +338,7 @@
299 TEST_ALLOC_FAIL {338 TEST_ALLOC_FAIL {
300 pos = 0;339 pos = 0;
301 lineno = 1;340 lineno = 1;
302 job = parse_job (NULL, "test", buf, strlen (buf),341 job = parse_job (NULL, NULL, "test", buf, strlen (buf),
303 &pos, &lineno);342 &pos, &lineno);
304343
305 if (test_alloc_failed) {344 if (test_alloc_failed) {
@@ -340,7 +379,7 @@
340 TEST_ALLOC_FAIL {379 TEST_ALLOC_FAIL {
341 pos = 0;380 pos = 0;
342 lineno = 1;381 lineno = 1;
343 job = parse_job (NULL, "test", buf, strlen (buf),382 job = parse_job (NULL, NULL, "test", buf, strlen (buf),
344 &pos, &lineno);383 &pos, &lineno);
345384
346 if (test_alloc_failed) {385 if (test_alloc_failed) {
@@ -379,7 +418,7 @@
379 TEST_ALLOC_FAIL {418 TEST_ALLOC_FAIL {
380 pos = 0;419 pos = 0;
381 lineno = 1;420 lineno = 1;
382 job = parse_job (NULL, "test", buf, strlen (buf),421 job = parse_job (NULL, NULL, "test", buf, strlen (buf),
383 &pos, &lineno);422 &pos, &lineno);
384423
385 if (test_alloc_failed) {424 if (test_alloc_failed) {
@@ -416,7 +455,7 @@
416455
417 pos = 0;456 pos = 0;
418 lineno = 1;457 lineno = 1;
419 job = parse_job (NULL, "test", buf, strlen (buf), &pos, &lineno);458 job = parse_job (NULL, NULL, "test", buf, strlen (buf), &pos, &lineno);
420459
421 TEST_EQ_P (job, NULL);460 TEST_EQ_P (job, NULL);
422461
@@ -447,7 +486,7 @@
447 TEST_ALLOC_FAIL {486 TEST_ALLOC_FAIL {
448 pos = 0;487 pos = 0;
449 lineno = 1;488 lineno = 1;
450 job = parse_job (NULL, "test", buf, strlen (buf),489 job = parse_job (NULL, NULL, "test", buf, strlen (buf),
451 &pos, &lineno);490 &pos, &lineno);
452491
453 if (test_alloc_failed) {492 if (test_alloc_failed) {
@@ -484,7 +523,7 @@
484 TEST_ALLOC_FAIL {523 TEST_ALLOC_FAIL {
485 pos = 0;524 pos = 0;
486 lineno = 1;525 lineno = 1;
487 job = parse_job (NULL, "test", buf, strlen (buf),526 job = parse_job (NULL, NULL, "test", buf, strlen (buf),
488 &pos, &lineno);527 &pos, &lineno);
489528
490 if (test_alloc_failed) {529 if (test_alloc_failed) {
@@ -524,7 +563,7 @@
524 TEST_ALLOC_FAIL {563 TEST_ALLOC_FAIL {
525 pos = 0;564 pos = 0;
526 lineno = 1;565 lineno = 1;
527 job = parse_job (NULL, "test", buf, strlen (buf),566 job = parse_job (NULL, NULL, "test", buf, strlen (buf),
528 &pos, &lineno);567 &pos, &lineno);
529568
530 if (test_alloc_failed) {569 if (test_alloc_failed) {
@@ -565,7 +604,7 @@
565 TEST_ALLOC_FAIL {604 TEST_ALLOC_FAIL {
566 pos = 0;605 pos = 0;
567 lineno = 1;606 lineno = 1;
568 job = parse_job (NULL, "test", buf, strlen (buf),607 job = parse_job (NULL, NULL, "test", buf, strlen (buf),
569 &pos, &lineno);608 &pos, &lineno);
570609
571 if (test_alloc_failed) {610 if (test_alloc_failed) {
@@ -604,7 +643,7 @@
604 TEST_ALLOC_FAIL {643 TEST_ALLOC_FAIL {
605 pos = 0;644 pos = 0;
606 lineno = 1;645 lineno = 1;
607 job = parse_job (NULL, "test", buf, strlen (buf),646 job = parse_job (NULL, NULL, "test", buf, strlen (buf),
608 &pos, &lineno);647 &pos, &lineno);
609648
610 if (test_alloc_failed) {649 if (test_alloc_failed) {
@@ -643,7 +682,7 @@
643 TEST_ALLOC_FAIL {682 TEST_ALLOC_FAIL {
644 pos = 0;683 pos = 0;
645 lineno = 1;684 lineno = 1;
646 job = parse_job (NULL, "test", buf, strlen (buf),685 job = parse_job (NULL, NULL, "test", buf, strlen (buf),
647 &pos, &lineno);686 &pos, &lineno);
648687
649 if (test_alloc_failed) {688 if (test_alloc_failed) {
@@ -680,7 +719,7 @@
680719
681 pos = 0;720 pos = 0;
682 lineno = 1;721 lineno = 1;
683 job = parse_job (NULL, "test", buf, strlen (buf), &pos, &lineno);722 job = parse_job (NULL, NULL, "test", buf, strlen (buf), &pos, &lineno);
684723
685 TEST_EQ_P (job, NULL);724 TEST_EQ_P (job, NULL);
686725
@@ -699,7 +738,7 @@
699738
700 pos = 0;739 pos = 0;
701 lineno = 1;740 lineno = 1;
702 job = parse_job (NULL, "test", buf, strlen (buf), &pos, &lineno);741 job = parse_job (NULL, NULL, "test", buf, strlen (buf), &pos, &lineno);
703742
704 TEST_EQ_P (job, NULL);743 TEST_EQ_P (job, NULL);
705744
@@ -718,7 +757,7 @@
718757
719 pos = 0;758 pos = 0;
720 lineno = 1;759 lineno = 1;
721 job = parse_job (NULL, "test", buf, strlen (buf), &pos, &lineno);760 job = parse_job (NULL, NULL, "test", buf, strlen (buf), &pos, &lineno);
722761
723 TEST_EQ_P (job, NULL);762 TEST_EQ_P (job, NULL);
724763
@@ -737,7 +776,7 @@
737776
738 pos = 0;777 pos = 0;
739 lineno = 1;778 lineno = 1;
740 job = parse_job (NULL, "test", buf, strlen (buf), &pos, &lineno);779 job = parse_job (NULL, NULL, "test", buf, strlen (buf), &pos, &lineno);
741780
742 TEST_EQ_P (job, NULL);781 TEST_EQ_P (job, NULL);
743782
@@ -768,7 +807,7 @@
768 TEST_ALLOC_FAIL {807 TEST_ALLOC_FAIL {
769 pos = 0;808 pos = 0;
770 lineno = 1;809 lineno = 1;
771 job = parse_job (NULL, "test", buf, strlen (buf),810 job = parse_job (NULL, NULL, "test", buf, strlen (buf),
772 &pos, &lineno);811 &pos, &lineno);
773812
774 if (test_alloc_failed) {813 if (test_alloc_failed) {
@@ -805,7 +844,7 @@
805 TEST_ALLOC_FAIL {844 TEST_ALLOC_FAIL {
806 pos = 0;845 pos = 0;
807 lineno = 1;846 lineno = 1;
808 job = parse_job (NULL, "test", buf, strlen (buf),847 job = parse_job (NULL, NULL, "test", buf, strlen (buf),
809 &pos, &lineno);848 &pos, &lineno);
810849
811 if (test_alloc_failed) {850 if (test_alloc_failed) {
@@ -845,7 +884,7 @@
845 TEST_ALLOC_FAIL {884 TEST_ALLOC_FAIL {
846 pos = 0;885 pos = 0;
847 lineno = 1;886 lineno = 1;
848 job = parse_job (NULL, "test", buf, strlen (buf),887 job = parse_job (NULL, NULL, "test", buf, strlen (buf),
849 &pos, &lineno);888 &pos, &lineno);
850889
851 if (test_alloc_failed) {890 if (test_alloc_failed) {
@@ -886,7 +925,7 @@
886 TEST_ALLOC_FAIL {925 TEST_ALLOC_FAIL {
887 pos = 0;926 pos = 0;
888 lineno = 1;927 lineno = 1;
889 job = parse_job (NULL, "test", buf, strlen (buf),928 job = parse_job (NULL, NULL, "test", buf, strlen (buf),
890 &pos, &lineno);929 &pos, &lineno);
891930
892 if (test_alloc_failed) {931 if (test_alloc_failed) {
@@ -925,7 +964,7 @@
925 TEST_ALLOC_FAIL {964 TEST_ALLOC_FAIL {
926 pos = 0;965 pos = 0;
927 lineno = 1;966 lineno = 1;
928 job = parse_job (NULL, "test", buf, strlen (buf),967 job = parse_job (NULL, NULL, "test", buf, strlen (buf),
929 &pos, &lineno);968 &pos, &lineno);
930969
931 if (test_alloc_failed) {970 if (test_alloc_failed) {
@@ -964,7 +1003,7 @@
964 TEST_ALLOC_FAIL {1003 TEST_ALLOC_FAIL {
965 pos = 0;1004 pos = 0;
966 lineno = 1;1005 lineno = 1;
967 job = parse_job (NULL, "test", buf, strlen (buf),1006 job = parse_job (NULL, NULL, "test", buf, strlen (buf),
968 &pos, &lineno);1007 &pos, &lineno);
9691008
970 if (test_alloc_failed) {1009 if (test_alloc_failed) {
@@ -1001,7 +1040,7 @@
10011040
1002 pos = 0;1041 pos = 0;
1003 lineno = 1;1042 lineno = 1;
1004 job = parse_job (NULL, "test", buf, strlen (buf), &pos, &lineno);1043 job = parse_job (NULL, NULL, "test", buf, strlen (buf), &pos, &lineno);
10051044
1006 TEST_EQ_P (job, NULL);1045 TEST_EQ_P (job, NULL);
10071046
@@ -1020,7 +1059,7 @@
10201059
1021 pos = 0;1060 pos = 0;
1022 lineno = 1;1061 lineno = 1;
1023 job = parse_job (NULL, "test", buf, strlen (buf), &pos, &lineno);1062 job = parse_job (NULL, NULL, "test", buf, strlen (buf), &pos, &lineno);
10241063
1025 TEST_EQ_P (job, NULL);1064 TEST_EQ_P (job, NULL);
10261065
@@ -1039,7 +1078,7 @@
10391078
1040 pos = 0;1079 pos = 0;
1041 lineno = 1;1080 lineno = 1;
1042 job = parse_job (NULL, "test", buf, strlen (buf), &pos, &lineno);1081 job = parse_job (NULL, NULL, "test", buf, strlen (buf), &pos, &lineno);
10431082
1044 TEST_EQ_P (job, NULL);1083 TEST_EQ_P (job, NULL);
10451084
@@ -1058,7 +1097,7 @@
10581097
1059 pos = 0;1098 pos = 0;
1060 lineno = 1;1099 lineno = 1;
1061 job = parse_job (NULL, "test", buf, strlen (buf), &pos, &lineno);1100 job = parse_job (NULL, NULL, "test", buf, strlen (buf), &pos, &lineno);
10621101
1063 TEST_EQ_P (job, NULL);1102 TEST_EQ_P (job, NULL);
10641103
@@ -1089,7 +1128,7 @@
1089 TEST_ALLOC_FAIL {1128 TEST_ALLOC_FAIL {
1090 pos = 0;1129 pos = 0;
1091 lineno = 1;1130 lineno = 1;
1092 job = parse_job (NULL, "test", buf, strlen (buf),1131 job = parse_job (NULL, NULL, "test", buf, strlen (buf),
1093 &pos, &lineno);1132 &pos, &lineno);
10941133
1095 if (test_alloc_failed) {1134 if (test_alloc_failed) {
@@ -1126,7 +1165,7 @@
1126 TEST_ALLOC_FAIL {1165 TEST_ALLOC_FAIL {
1127 pos = 0;1166 pos = 0;
1128 lineno = 1;1167 lineno = 1;
1129 job = parse_job (NULL, "test", buf, strlen (buf),1168 job = parse_job (NULL, NULL, "test", buf, strlen (buf),
1130 &pos, &lineno);1169 &pos, &lineno);
11311170
1132 if (test_alloc_failed) {1171 if (test_alloc_failed) {
@@ -1166,7 +1205,7 @@
1166 TEST_ALLOC_FAIL {1205 TEST_ALLOC_FAIL {
1167 pos = 0;1206 pos = 0;
1168 lineno = 1;1207 lineno = 1;
1169 job = parse_job (NULL, "test", buf, strlen (buf),1208 job = parse_job (NULL, NULL, "test", buf, strlen (buf),
1170 &pos, &lineno);1209 &pos, &lineno);
11711210
1172 if (test_alloc_failed) {1211 if (test_alloc_failed) {
@@ -1207,7 +1246,7 @@
1207 TEST_ALLOC_FAIL {1246 TEST_ALLOC_FAIL {
1208 pos = 0;1247 pos = 0;
1209 lineno = 1;1248 lineno = 1;
1210 job = parse_job (NULL, "test", buf, strlen (buf),1249 job = parse_job (NULL, NULL, "test", buf, strlen (buf),
1211 &pos, &lineno);1250 &pos, &lineno);
12121251
1213 if (test_alloc_failed) {1252 if (test_alloc_failed) {
@@ -1246,7 +1285,7 @@
1246 TEST_ALLOC_FAIL {1285 TEST_ALLOC_FAIL {
1247 pos = 0;1286 pos = 0;
1248 lineno = 1;1287 lineno = 1;
1249 job = parse_job (NULL, "test", buf, strlen (buf),1288 job = parse_job (NULL, NULL, "test", buf, strlen (buf),
1250 &pos, &lineno);1289 &pos, &lineno);
12511290
1252 if (test_alloc_failed) {1291 if (test_alloc_failed) {
@@ -1285,7 +1324,7 @@
1285 TEST_ALLOC_FAIL {1324 TEST_ALLOC_FAIL {
1286 pos = 0;1325 pos = 0;
1287 lineno = 1;1326 lineno = 1;
1288 job = parse_job (NULL, "test", buf, strlen (buf),1327 job = parse_job (NULL, NULL, "test", buf, strlen (buf),
1289 &pos, &lineno);1328 &pos, &lineno);
12901329
1291 if (test_alloc_failed) {1330 if (test_alloc_failed) {
@@ -1322,7 +1361,7 @@
13221361
1323 pos = 0;1362 pos = 0;
1324 lineno = 1;1363 lineno = 1;
1325 job = parse_job (NULL, "test", buf, strlen (buf), &pos, &lineno);1364 job = parse_job (NULL, NULL, "test", buf, strlen (buf), &pos, &lineno);
13261365
1327 TEST_EQ_P (job, NULL);1366 TEST_EQ_P (job, NULL);
13281367
@@ -1341,7 +1380,7 @@
13411380
1342 pos = 0;1381 pos = 0;
1343 lineno = 1;1382 lineno = 1;
1344 job = parse_job (NULL, "test", buf, strlen (buf), &pos, &lineno);1383 job = parse_job (NULL, NULL, "test", buf, strlen (buf), &pos, &lineno);
13451384
1346 TEST_EQ_P (job, NULL);1385 TEST_EQ_P (job, NULL);
13471386
@@ -1360,7 +1399,7 @@
13601399
1361 pos = 0;1400 pos = 0;
1362 lineno = 1;1401 lineno = 1;
1363 job = parse_job (NULL, "test", buf, strlen (buf), &pos, &lineno);1402 job = parse_job (NULL, NULL, "test", buf, strlen (buf), &pos, &lineno);
13641403
1365 TEST_EQ_P (job, NULL);1404 TEST_EQ_P (job, NULL);
13661405
@@ -1379,7 +1418,7 @@
13791418
1380 pos = 0;1419 pos = 0;
1381 lineno = 1;1420 lineno = 1;
1382 job = parse_job (NULL, "test", buf, strlen (buf), &pos, &lineno);1421 job = parse_job (NULL, NULL, "test", buf, strlen (buf), &pos, &lineno);
13831422
1384 TEST_EQ_P (job, NULL);1423 TEST_EQ_P (job, NULL);
13851424
@@ -1410,7 +1449,7 @@
1410 TEST_ALLOC_FAIL {1449 TEST_ALLOC_FAIL {
1411 pos = 0;1450 pos = 0;
1412 lineno = 1;1451 lineno = 1;
1413 job = parse_job (NULL, "test", buf, strlen (buf),1452 job = parse_job (NULL, NULL, "test", buf, strlen (buf),
1414 &pos, &lineno);1453 &pos, &lineno);
14151454
1416 if (test_alloc_failed) {1455 if (test_alloc_failed) {
@@ -1447,7 +1486,7 @@
1447 TEST_ALLOC_FAIL {1486 TEST_ALLOC_FAIL {
1448 pos = 0;1487 pos = 0;
1449 lineno = 1;1488 lineno = 1;
1450 job = parse_job (NULL, "test", buf, strlen (buf),1489 job = parse_job (NULL, NULL, "test", buf, strlen (buf),
1451 &pos, &lineno);1490 &pos, &lineno);
14521491
1453 if (test_alloc_failed) {1492 if (test_alloc_failed) {
@@ -1487,7 +1526,7 @@
1487 TEST_ALLOC_FAIL {1526 TEST_ALLOC_FAIL {
1488 pos = 0;1527 pos = 0;
1489 lineno = 1;1528 lineno = 1;
1490 job = parse_job (NULL, "test", buf, strlen (buf),1529 job = parse_job (NULL, NULL, "test", buf, strlen (buf),
1491 &pos, &lineno);1530 &pos, &lineno);
14921531
1493 if (test_alloc_failed) {1532 if (test_alloc_failed) {
@@ -1528,7 +1567,7 @@
1528 TEST_ALLOC_FAIL {1567 TEST_ALLOC_FAIL {
1529 pos = 0;1568 pos = 0;
1530 lineno = 1;1569 lineno = 1;
1531 job = parse_job (NULL, "test", buf, strlen (buf),1570 job = parse_job (NULL, NULL, "test", buf, strlen (buf),
1532 &pos, &lineno);1571 &pos, &lineno);
15331572
1534 if (test_alloc_failed) {1573 if (test_alloc_failed) {
@@ -1567,7 +1606,7 @@
1567 TEST_ALLOC_FAIL {1606 TEST_ALLOC_FAIL {
1568 pos = 0;1607 pos = 0;
1569 lineno = 1;1608 lineno = 1;
1570 job = parse_job (NULL, "test", buf, strlen (buf),1609 job = parse_job (NULL, NULL, "test", buf, strlen (buf),
1571 &pos, &lineno);1610 &pos, &lineno);
15721611
1573 if (test_alloc_failed) {1612 if (test_alloc_failed) {
@@ -1606,7 +1645,7 @@
1606 TEST_ALLOC_FAIL {1645 TEST_ALLOC_FAIL {
1607 pos = 0;1646 pos = 0;
1608 lineno = 1;1647 lineno = 1;
1609 job = parse_job (NULL, "test", buf, strlen (buf),1648 job = parse_job (NULL, NULL, "test", buf, strlen (buf),
1610 &pos, &lineno);1649 &pos, &lineno);
16111650
1612 if (test_alloc_failed) {1651 if (test_alloc_failed) {
@@ -1643,7 +1682,7 @@
16431682
1644 pos = 0;1683 pos = 0;
1645 lineno = 1;1684 lineno = 1;
1646 job = parse_job (NULL, "test", buf, strlen (buf), &pos, &lineno);1685 job = parse_job (NULL, NULL, "test", buf, strlen (buf), &pos, &lineno);
16471686
1648 TEST_EQ_P (job, NULL);1687 TEST_EQ_P (job, NULL);
16491688
@@ -1662,7 +1701,7 @@
16621701
1663 pos = 0;1702 pos = 0;
1664 lineno = 1;1703 lineno = 1;
1665 job = parse_job (NULL, "test", buf, strlen (buf), &pos, &lineno);1704 job = parse_job (NULL, NULL, "test", buf, strlen (buf), &pos, &lineno);
16661705
1667 TEST_EQ_P (job, NULL);1706 TEST_EQ_P (job, NULL);
16681707
@@ -1681,7 +1720,7 @@
16811720
1682 pos = 0;1721 pos = 0;
1683 lineno = 1;1722 lineno = 1;
1684 job = parse_job (NULL, "test", buf, strlen (buf), &pos, &lineno);1723 job = parse_job (NULL, NULL, "test", buf, strlen (buf), &pos, &lineno);
16851724
1686 TEST_EQ_P (job, NULL);1725 TEST_EQ_P (job, NULL);
16871726
@@ -1700,7 +1739,7 @@
17001739
1701 pos = 0;1740 pos = 0;
1702 lineno = 1;1741 lineno = 1;
1703 job = parse_job (NULL, "test", buf, strlen (buf), &pos, &lineno);1742 job = parse_job (NULL, NULL, "test", buf, strlen (buf), &pos, &lineno);
17041743
1705 TEST_EQ_P (job, NULL);1744 TEST_EQ_P (job, NULL);
17061745
@@ -1731,7 +1770,7 @@
1731 TEST_ALLOC_FAIL {1770 TEST_ALLOC_FAIL {
1732 pos = 0;1771 pos = 0;
1733 lineno = 1;1772 lineno = 1;
1734 job = parse_job (NULL, "test", buf, strlen (buf),1773 job = parse_job (NULL, NULL, "test", buf, strlen (buf),
1735 &pos, &lineno);1774 &pos, &lineno);
17361775
1737 if (test_alloc_failed) {1776 if (test_alloc_failed) {
@@ -1776,7 +1815,7 @@
1776 TEST_ALLOC_FAIL {1815 TEST_ALLOC_FAIL {
1777 pos = 0;1816 pos = 0;
1778 lineno = 1;1817 lineno = 1;
1779 job = parse_job (NULL, "test", buf, strlen (buf),1818 job = parse_job (NULL, NULL, "test", buf, strlen (buf),
1780 &pos, &lineno);1819 &pos, &lineno);
17811820
1782 if (test_alloc_failed) {1821 if (test_alloc_failed) {
@@ -1828,7 +1867,7 @@
1828 TEST_ALLOC_FAIL {1867 TEST_ALLOC_FAIL {
1829 pos = 0;1868 pos = 0;
1830 lineno = 1;1869 lineno = 1;
1831 job = parse_job (NULL, "test", buf, strlen (buf),1870 job = parse_job (NULL, NULL, "test", buf, strlen (buf),
1832 &pos, &lineno);1871 &pos, &lineno);
18331872
1834 if (test_alloc_failed) {1873 if (test_alloc_failed) {
@@ -1879,7 +1918,7 @@
1879 TEST_ALLOC_FAIL {1918 TEST_ALLOC_FAIL {
1880 pos = 0;1919 pos = 0;
1881 lineno = 1;1920 lineno = 1;
1882 job = parse_job (NULL, "test", buf, strlen (buf),1921 job = parse_job (NULL, NULL, "test", buf, strlen (buf),
1883 &pos, &lineno);1922 &pos, &lineno);
18841923
1885 if (test_alloc_failed) {1924 if (test_alloc_failed) {
@@ -1942,7 +1981,7 @@
1942 TEST_ALLOC_FAIL {1981 TEST_ALLOC_FAIL {
1943 pos = 0;1982 pos = 0;
1944 lineno = 1;1983 lineno = 1;
1945 job = parse_job (NULL, "test", buf, strlen (buf),1984 job = parse_job (NULL, NULL, "test", buf, strlen (buf),
1946 &pos, &lineno);1985 &pos, &lineno);
19471986
1948 if (test_alloc_failed) {1987 if (test_alloc_failed) {
@@ -2012,7 +2051,7 @@
2012 TEST_ALLOC_FAIL {2051 TEST_ALLOC_FAIL {
2013 pos = 0;2052 pos = 0;
2014 lineno = 1;2053 lineno = 1;
2015 job = parse_job (NULL, "test", buf, strlen (buf),2054 job = parse_job (NULL, NULL, "test", buf, strlen (buf),
2016 &pos, &lineno);2055 &pos, &lineno);
20172056
2018 if (test_alloc_failed) {2057 if (test_alloc_failed) {
@@ -2090,7 +2129,7 @@
2090 TEST_ALLOC_FAIL {2129 TEST_ALLOC_FAIL {
2091 pos = 0;2130 pos = 0;
2092 lineno = 1;2131 lineno = 1;
2093 job = parse_job (NULL, "test", buf, strlen (buf),2132 job = parse_job (NULL, NULL, "test", buf, strlen (buf),
2094 &pos, &lineno);2133 &pos, &lineno);
20952134
2096 if (test_alloc_failed) {2135 if (test_alloc_failed) {
@@ -2170,7 +2209,7 @@
2170 TEST_ALLOC_FAIL {2209 TEST_ALLOC_FAIL {
2171 pos = 0;2210 pos = 0;
2172 lineno = 1;2211 lineno = 1;
2173 job = parse_job (NULL, "test", buf, strlen (buf),2212 job = parse_job (NULL, NULL, "test", buf, strlen (buf),
2174 &pos, &lineno);2213 &pos, &lineno);
21752214
2176 if (test_alloc_failed) {2215 if (test_alloc_failed) {
@@ -2249,7 +2288,7 @@
2249 TEST_ALLOC_FAIL {2288 TEST_ALLOC_FAIL {
2250 pos = 0;2289 pos = 0;
2251 lineno = 1;2290 lineno = 1;
2252 job = parse_job (NULL, "test", buf, strlen (buf),2291 job = parse_job (NULL, NULL, "test", buf, strlen (buf),
2253 &pos, &lineno);2292 &pos, &lineno);
22542293
2255 if (test_alloc_failed) {2294 if (test_alloc_failed) {
@@ -2291,7 +2330,7 @@
22912330
2292 pos = 0;2331 pos = 0;
2293 lineno = 1;2332 lineno = 1;
2294 job = parse_job (NULL, "test", buf, strlen (buf), &pos, &lineno);2333 job = parse_job (NULL, NULL, "test", buf, strlen (buf), &pos, &lineno);
22952334
2296 TEST_EQ_P (job, NULL);2335 TEST_EQ_P (job, NULL);
22972336
@@ -2310,7 +2349,7 @@
23102349
2311 pos = 0;2350 pos = 0;
2312 lineno = 1;2351 lineno = 1;
2313 job = parse_job (NULL, "test", buf, strlen (buf), &pos, &lineno);2352 job = parse_job (NULL, NULL, "test", buf, strlen (buf), &pos, &lineno);
23142353
2315 TEST_EQ_P (job, NULL);2354 TEST_EQ_P (job, NULL);
23162355
@@ -2329,7 +2368,7 @@
23292368
2330 pos = 0;2369 pos = 0;
2331 lineno = 1;2370 lineno = 1;
2332 job = parse_job (NULL, "test", buf, strlen (buf), &pos, &lineno);2371 job = parse_job (NULL, NULL, "test", buf, strlen (buf), &pos, &lineno);
23332372
2334 TEST_EQ_P (job, NULL);2373 TEST_EQ_P (job, NULL);
23352374
@@ -2348,7 +2387,7 @@
23482387
2349 pos = 0;2388 pos = 0;
2350 lineno = 1;2389 lineno = 1;
2351 job = parse_job (NULL, "test", buf, strlen (buf), &pos, &lineno);2390 job = parse_job (NULL, NULL, "test", buf, strlen (buf), &pos, &lineno);
23522391
2353 TEST_EQ_P (job, NULL);2392 TEST_EQ_P (job, NULL);
23542393
@@ -2367,7 +2406,7 @@
23672406
2368 pos = 0;2407 pos = 0;
2369 lineno = 1;2408 lineno = 1;
2370 job = parse_job (NULL, "test", buf, strlen (buf), &pos, &lineno);2409 job = parse_job (NULL, NULL, "test", buf, strlen (buf), &pos, &lineno);
23712410
2372 TEST_EQ_P (job, NULL);2411 TEST_EQ_P (job, NULL);
23732412
@@ -2384,7 +2423,7 @@
23842423
2385 pos = 0;2424 pos = 0;
2386 lineno = 1;2425 lineno = 1;
2387 job = parse_job (NULL, "test", buf, strlen (buf), &pos, &lineno);2426 job = parse_job (NULL, NULL, "test", buf, strlen (buf), &pos, &lineno);
23882427
2389 TEST_EQ_P (job, NULL);2428 TEST_EQ_P (job, NULL);
23902429
@@ -2403,7 +2442,7 @@
24032442
2404 pos = 0;2443 pos = 0;
2405 lineno = 1;2444 lineno = 1;
2406 job = parse_job (NULL, "test", buf, strlen (buf), &pos, &lineno);2445 job = parse_job (NULL, NULL, "test", buf, strlen (buf), &pos, &lineno);
24072446
2408 TEST_EQ_P (job, NULL);2447 TEST_EQ_P (job, NULL);
24092448
@@ -2422,7 +2461,7 @@
24222461
2423 pos = 0;2462 pos = 0;
2424 lineno = 1;2463 lineno = 1;
2425 job = parse_job (NULL, "test", buf, strlen (buf), &pos, &lineno);2464 job = parse_job (NULL, NULL, "test", buf, strlen (buf), &pos, &lineno);
24262465
2427 TEST_EQ_P (job, NULL);2466 TEST_EQ_P (job, NULL);
24282467
@@ -2441,7 +2480,7 @@
24412480
2442 pos = 0;2481 pos = 0;
2443 lineno = 1;2482 lineno = 1;
2444 job = parse_job (NULL, "test", buf, strlen (buf), &pos, &lineno);2483 job = parse_job (NULL, NULL, "test", buf, strlen (buf), &pos, &lineno);
24452484
2446 TEST_EQ_P (job, NULL);2485 TEST_EQ_P (job, NULL);
24472486
@@ -2460,7 +2499,7 @@
24602499
2461 pos = 0;2500 pos = 0;
2462 lineno = 1;2501 lineno = 1;
2463 job = parse_job (NULL, "test", buf, strlen (buf), &pos, &lineno);2502 job = parse_job (NULL, NULL, "test", buf, strlen (buf), &pos, &lineno);
24642503
2465 TEST_EQ_P (job, NULL);2504 TEST_EQ_P (job, NULL);
24662505
@@ -2479,7 +2518,7 @@
24792518
2480 pos = 0;2519 pos = 0;
2481 lineno = 1;2520 lineno = 1;
2482 job = parse_job (NULL, "test", buf, strlen (buf), &pos, &lineno);2521 job = parse_job (NULL, NULL, "test", buf, strlen (buf), &pos, &lineno);
24832522
2484 TEST_EQ_P (job, NULL);2523 TEST_EQ_P (job, NULL);
24852524
@@ -2498,7 +2537,7 @@
24982537
2499 pos = 0;2538 pos = 0;
2500 lineno = 1;2539 lineno = 1;
2501 job = parse_job (NULL, "test", buf, strlen (buf), &pos, &lineno);2540 job = parse_job (NULL, NULL, "test", buf, strlen (buf), &pos, &lineno);
25022541
2503 TEST_EQ_P (job, NULL);2542 TEST_EQ_P (job, NULL);
25042543
@@ -2517,7 +2556,7 @@
25172556
2518 pos = 0;2557 pos = 0;
2519 lineno = 1;2558 lineno = 1;
2520 job = parse_job (NULL, "test", buf, strlen (buf), &pos, &lineno);2559 job = parse_job (NULL, NULL, "test", buf, strlen (buf), &pos, &lineno);
25212560
2522 TEST_EQ_P (job, NULL);2561 TEST_EQ_P (job, NULL);
25232562
@@ -2551,7 +2590,7 @@
2551 TEST_ALLOC_FAIL {2590 TEST_ALLOC_FAIL {
2552 pos = 0;2591 pos = 0;
2553 lineno = 1;2592 lineno = 1;
2554 job = parse_job (NULL, "test", buf, strlen (buf),2593 job = parse_job (NULL, NULL, "test", buf, strlen (buf),
2555 &pos, &lineno);2594 &pos, &lineno);
25562595
2557 if (test_alloc_failed) {2596 if (test_alloc_failed) {
@@ -2586,7 +2625,7 @@
2586 TEST_FEATURE ("manual stanza after start on");2625 TEST_FEATURE ("manual stanza after start on");
2587 strcpy (buf, "start on wibble\nmanual\n");2626 strcpy (buf, "start on wibble\nmanual\n");
25882627
2589 job = parse_job (NULL, "test", buf, strlen (buf),2628 job = parse_job (NULL, NULL, "test", buf, strlen (buf),
2590 &pos, &lineno);2629 &pos, &lineno);
25912630
2592 TEST_NE_P (job, NULL);2631 TEST_NE_P (job, NULL);
@@ -2616,7 +2655,7 @@
2616 TEST_ALLOC_FAIL {2655 TEST_ALLOC_FAIL {
2617 pos = 0;2656 pos = 0;
2618 lineno = 1;2657 lineno = 1;
2619 job = parse_job (NULL, "test", buf, strlen (buf),2658 job = parse_job (NULL, NULL, "test", buf, strlen (buf),
2620 &pos, &lineno);2659 &pos, &lineno);
26212660
2622 if (test_alloc_failed) {2661 if (test_alloc_failed) {
@@ -2661,7 +2700,7 @@
2661 TEST_ALLOC_FAIL {2700 TEST_ALLOC_FAIL {
2662 pos = 0;2701 pos = 0;
2663 lineno = 1;2702 lineno = 1;
2664 job = parse_job (NULL, "test", buf, strlen (buf),2703 job = parse_job (NULL, NULL, "test", buf, strlen (buf),
2665 &pos, &lineno);2704 &pos, &lineno);
26662705
2667 if (test_alloc_failed) {2706 if (test_alloc_failed) {
@@ -2713,7 +2752,7 @@
2713 TEST_ALLOC_FAIL {2752 TEST_ALLOC_FAIL {
2714 pos = 0;2753 pos = 0;
2715 lineno = 1;2754 lineno = 1;
2716 job = parse_job (NULL, "test", buf, strlen (buf),2755 job = parse_job (NULL, NULL, "test", buf, strlen (buf),
2717 &pos, &lineno);2756 &pos, &lineno);
27182757
2719 if (test_alloc_failed) {2758 if (test_alloc_failed) {
@@ -2764,7 +2803,7 @@
2764 TEST_ALLOC_FAIL {2803 TEST_ALLOC_FAIL {
2765 pos = 0;2804 pos = 0;
2766 lineno = 1;2805 lineno = 1;
2767 job = parse_job (NULL, "test", buf, strlen (buf),2806 job = parse_job (NULL, NULL, "test", buf, strlen (buf),
2768 &pos, &lineno);2807 &pos, &lineno);
27692808
2770 if (test_alloc_failed) {2809 if (test_alloc_failed) {
@@ -2827,7 +2866,7 @@
2827 TEST_ALLOC_FAIL {2866 TEST_ALLOC_FAIL {
2828 pos = 0;2867 pos = 0;
2829 lineno = 1;2868 lineno = 1;
2830 job = parse_job (NULL, "test", buf, strlen (buf),2869 job = parse_job (NULL, NULL, "test", buf, strlen (buf),
2831 &pos, &lineno);2870 &pos, &lineno);
28322871
2833 if (test_alloc_failed) {2872 if (test_alloc_failed) {
@@ -2897,7 +2936,7 @@
2897 TEST_ALLOC_FAIL {2936 TEST_ALLOC_FAIL {
2898 pos = 0;2937 pos = 0;
2899 lineno = 1;2938 lineno = 1;
2900 job = parse_job (NULL, "test", buf, strlen (buf),2939 job = parse_job (NULL, NULL, "test", buf, strlen (buf),
2901 &pos, &lineno);2940 &pos, &lineno);
29022941
2903 if (test_alloc_failed) {2942 if (test_alloc_failed) {
@@ -2975,7 +3014,7 @@
2975 TEST_ALLOC_FAIL {3014 TEST_ALLOC_FAIL {
2976 pos = 0;3015 pos = 0;
2977 lineno = 1;3016 lineno = 1;
2978 job = parse_job (NULL, "test", buf, strlen (buf),3017 job = parse_job (NULL, NULL, "test", buf, strlen (buf),
2979 &pos, &lineno);3018 &pos, &lineno);
29803019
2981 if (test_alloc_failed) {3020 if (test_alloc_failed) {
@@ -3055,7 +3094,7 @@
3055 TEST_ALLOC_FAIL {3094 TEST_ALLOC_FAIL {
3056 pos = 0;3095 pos = 0;
3057 lineno = 1;3096 lineno = 1;
3058 job = parse_job (NULL, "test", buf, strlen (buf),3097 job = parse_job (NULL, NULL, "test", buf, strlen (buf),
3059 &pos, &lineno);3098 &pos, &lineno);
30603099
3061 if (test_alloc_failed) {3100 if (test_alloc_failed) {
@@ -3134,7 +3173,7 @@
3134 TEST_ALLOC_FAIL {3173 TEST_ALLOC_FAIL {
3135 pos = 0;3174 pos = 0;
3136 lineno = 1;3175 lineno = 1;
3137 job = parse_job (NULL, "test", buf, strlen (buf),3176 job = parse_job (NULL, NULL, "test", buf, strlen (buf),
3138 &pos, &lineno);3177 &pos, &lineno);
31393178
3140 if (test_alloc_failed) {3179 if (test_alloc_failed) {
@@ -3176,7 +3215,7 @@
31763215
3177 pos = 0;3216 pos = 0;
3178 lineno = 1;3217 lineno = 1;
3179 job = parse_job (NULL, "test", buf, strlen (buf), &pos, &lineno);3218 job = parse_job (NULL, NULL, "test", buf, strlen (buf), &pos, &lineno);
31803219
3181 TEST_EQ_P (job, NULL);3220 TEST_EQ_P (job, NULL);
31823221
@@ -3195,7 +3234,7 @@
31953234
3196 pos = 0;3235 pos = 0;
3197 lineno = 1;3236 lineno = 1;
3198 job = parse_job (NULL, "test", buf, strlen (buf), &pos, &lineno);3237 job = parse_job (NULL, NULL, "test", buf, strlen (buf), &pos, &lineno);
31993238
3200 TEST_EQ_P (job, NULL);3239 TEST_EQ_P (job, NULL);
32013240
@@ -3214,7 +3253,7 @@
32143253
3215 pos = 0;3254 pos = 0;
3216 lineno = 1;3255 lineno = 1;
3217 job = parse_job (NULL, "test", buf, strlen (buf), &pos, &lineno);3256 job = parse_job (NULL, NULL, "test", buf, strlen (buf), &pos, &lineno);
32183257
3219 TEST_EQ_P (job, NULL);3258 TEST_EQ_P (job, NULL);
32203259
@@ -3233,7 +3272,7 @@
32333272
3234 pos = 0;3273 pos = 0;
3235 lineno = 1;3274 lineno = 1;
3236 job = parse_job (NULL, "test", buf, strlen (buf), &pos, &lineno);3275 job = parse_job (NULL, NULL, "test", buf, strlen (buf), &pos, &lineno);
32373276
3238 TEST_EQ_P (job, NULL);3277 TEST_EQ_P (job, NULL);
32393278
@@ -3252,7 +3291,7 @@
32523291
3253 pos = 0;3292 pos = 0;
3254 lineno = 1;3293 lineno = 1;
3255 job = parse_job (NULL, "test", buf, strlen (buf), &pos, &lineno);3294 job = parse_job (NULL, NULL, "test", buf, strlen (buf), &pos, &lineno);
32563295
3257 TEST_EQ_P (job, NULL);3296 TEST_EQ_P (job, NULL);
32583297
@@ -3269,7 +3308,7 @@
32693308
3270 pos = 0;3309 pos = 0;
3271 lineno = 1;3310 lineno = 1;
3272 job = parse_job (NULL, "test", buf, strlen (buf), &pos, &lineno);3311 job = parse_job (NULL, NULL, "test", buf, strlen (buf), &pos, &lineno);
32733312
3274 TEST_EQ_P (job, NULL);3313 TEST_EQ_P (job, NULL);
32753314
@@ -3288,7 +3327,7 @@
32883327
3289 pos = 0;3328 pos = 0;
3290 lineno = 1;3329 lineno = 1;
3291 job = parse_job (NULL, "test", buf, strlen (buf), &pos, &lineno);3330 job = parse_job (NULL, NULL, "test", buf, strlen (buf), &pos, &lineno);
32923331
3293 TEST_EQ_P (job, NULL);3332 TEST_EQ_P (job, NULL);
32943333
@@ -3307,7 +3346,7 @@
33073346
3308 pos = 0;3347 pos = 0;
3309 lineno = 1;3348 lineno = 1;
3310 job = parse_job (NULL, "test", buf, strlen (buf), &pos, &lineno);3349 job = parse_job (NULL, NULL, "test", buf, strlen (buf), &pos, &lineno);
33113350
3312 TEST_EQ_P (job, NULL);3351 TEST_EQ_P (job, NULL);
33133352
@@ -3326,7 +3365,7 @@
33263365
3327 pos = 0;3366 pos = 0;
3328 lineno = 1;3367 lineno = 1;
3329 job = parse_job (NULL, "test", buf, strlen (buf), &pos, &lineno);3368 job = parse_job (NULL, NULL, "test", buf, strlen (buf), &pos, &lineno);
33303369
3331 TEST_EQ_P (job, NULL);3370 TEST_EQ_P (job, NULL);
33323371
@@ -3345,7 +3384,7 @@
33453384
3346 pos = 0;3385 pos = 0;
3347 lineno = 1;3386 lineno = 1;
3348 job = parse_job (NULL, "test", buf, strlen (buf), &pos, &lineno);3387 job = parse_job (NULL, NULL, "test", buf, strlen (buf), &pos, &lineno);
33493388
3350 TEST_EQ_P (job, NULL);3389 TEST_EQ_P (job, NULL);
33513390
@@ -3364,7 +3403,7 @@
33643403
3365 pos = 0;3404 pos = 0;
3366 lineno = 1;3405 lineno = 1;
3367 job = parse_job (NULL, "test", buf, strlen (buf), &pos, &lineno);3406 job = parse_job (NULL, NULL, "test", buf, strlen (buf), &pos, &lineno);
33683407
3369 TEST_EQ_P (job, NULL);3408 TEST_EQ_P (job, NULL);
33703409
@@ -3383,7 +3422,7 @@
33833422
3384 pos = 0;3423 pos = 0;
3385 lineno = 1;3424 lineno = 1;
3386 job = parse_job (NULL, "test", buf, strlen (buf), &pos, &lineno);3425 job = parse_job (NULL, NULL, "test", buf, strlen (buf), &pos, &lineno);
33873426
3388 TEST_EQ_P (job, NULL);3427 TEST_EQ_P (job, NULL);
33893428
@@ -3402,7 +3441,7 @@
34023441
3403 pos = 0;3442 pos = 0;
3404 lineno = 1;3443 lineno = 1;
3405 job = parse_job (NULL, "test", buf, strlen (buf), &pos, &lineno);3444 job = parse_job (NULL, NULL, "test", buf, strlen (buf), &pos, &lineno);
34063445
3407 TEST_EQ_P (job, NULL);3446 TEST_EQ_P (job, NULL);
34083447
@@ -3432,7 +3471,7 @@
3432 TEST_ALLOC_FAIL {3471 TEST_ALLOC_FAIL {
3433 pos = 0;3472 pos = 0;
3434 lineno = 1;3473 lineno = 1;
3435 job = parse_job (NULL, "test", buf, strlen (buf),3474 job = parse_job (NULL, NULL, "test", buf, strlen (buf),
3436 &pos, &lineno);3475 &pos, &lineno);
34373476
3438 if (test_alloc_failed) {3477 if (test_alloc_failed) {
@@ -3465,7 +3504,7 @@
3465 TEST_ALLOC_FAIL {3504 TEST_ALLOC_FAIL {
3466 pos = 0;3505 pos = 0;
3467 lineno = 1;3506 lineno = 1;
3468 job = parse_job (NULL, "test", buf, strlen (buf),3507 job = parse_job (NULL, NULL, "test", buf, strlen (buf),
3469 &pos, &lineno);3508 &pos, &lineno);
34703509
3471 if (test_alloc_failed) {3510 if (test_alloc_failed) {
@@ -3498,7 +3537,7 @@
34983537
3499 pos = 0;3538 pos = 0;
3500 lineno = 1;3539 lineno = 1;
3501 job = parse_job (NULL, "test", buf, strlen (buf), &pos, &lineno);3540 job = parse_job (NULL, NULL, "test", buf, strlen (buf), &pos, &lineno);
35023541
3503 TEST_EQ_P (job, NULL);3542 TEST_EQ_P (job, NULL);
35043543
@@ -3517,7 +3556,7 @@
35173556
3518 pos = 0;3557 pos = 0;
3519 lineno = 1;3558 lineno = 1;
3520 job = parse_job (NULL, "test", buf, strlen (buf), &pos, &lineno);3559 job = parse_job (NULL, NULL, "test", buf, strlen (buf), &pos, &lineno);
35213560
3522 TEST_EQ_P (job, NULL);3561 TEST_EQ_P (job, NULL);
35233562
@@ -3547,7 +3586,7 @@
3547 TEST_ALLOC_FAIL {3586 TEST_ALLOC_FAIL {
3548 pos = 0;3587 pos = 0;
3549 lineno = 1;3588 lineno = 1;
3550 job = parse_job (NULL, "test", buf, strlen (buf),3589 job = parse_job (NULL, NULL, "test", buf, strlen (buf),
3551 &pos, &lineno);3590 &pos, &lineno);
35523591
3553 if (test_alloc_failed) {3592 if (test_alloc_failed) {
@@ -3580,7 +3619,7 @@
3580 TEST_ALLOC_FAIL {3619 TEST_ALLOC_FAIL {
3581 pos = 0;3620 pos = 0;
3582 lineno = 1;3621 lineno = 1;
3583 job = parse_job (NULL, "test", buf, strlen (buf),3622 job = parse_job (NULL, NULL, "test", buf, strlen (buf),
3584 &pos, &lineno);3623 &pos, &lineno);
35853624
3586 if (test_alloc_failed) {3625 if (test_alloc_failed) {
@@ -3613,7 +3652,7 @@
36133652
3614 pos = 0;3653 pos = 0;
3615 lineno = 1;3654 lineno = 1;
3616 job = parse_job (NULL, "test", buf, strlen (buf), &pos, &lineno);3655 job = parse_job (NULL, NULL, "test", buf, strlen (buf), &pos, &lineno);
36173656
3618 TEST_EQ_P (job, NULL);3657 TEST_EQ_P (job, NULL);
36193658
@@ -3632,7 +3671,7 @@
36323671
3633 pos = 0;3672 pos = 0;
3634 lineno = 1;3673 lineno = 1;
3635 job = parse_job (NULL, "test", buf, strlen (buf), &pos, &lineno);3674 job = parse_job (NULL, NULL, "test", buf, strlen (buf), &pos, &lineno);
36363675
3637 TEST_EQ_P (job, NULL);3676 TEST_EQ_P (job, NULL);
36383677
@@ -3662,7 +3701,7 @@
3662 TEST_ALLOC_FAIL {3701 TEST_ALLOC_FAIL {
3663 pos = 0;3702 pos = 0;
3664 lineno = 1;3703 lineno = 1;
3665 job = parse_job (NULL, "test", buf, strlen (buf),3704 job = parse_job (NULL, NULL, "test", buf, strlen (buf),
3666 &pos, &lineno);3705 &pos, &lineno);
36673706
3668 if (test_alloc_failed) {3707 if (test_alloc_failed) {
@@ -3695,7 +3734,7 @@
3695 TEST_ALLOC_FAIL {3734 TEST_ALLOC_FAIL {
3696 pos = 0;3735 pos = 0;
3697 lineno = 1;3736 lineno = 1;
3698 job = parse_job (NULL, "test", buf, strlen (buf),3737 job = parse_job (NULL, NULL, "test", buf, strlen (buf),
3699 &pos, &lineno);3738 &pos, &lineno);
37003739
3701 if (test_alloc_failed) {3740 if (test_alloc_failed) {
@@ -3728,7 +3767,7 @@
37283767
3729 pos = 0;3768 pos = 0;
3730 lineno = 1;3769 lineno = 1;
3731 job = parse_job (NULL, "test", buf, strlen (buf), &pos, &lineno);3770 job = parse_job (NULL, NULL, "test", buf, strlen (buf), &pos, &lineno);
37323771
3733 TEST_EQ_P (job, NULL);3772 TEST_EQ_P (job, NULL);
37343773
@@ -3747,7 +3786,7 @@
37473786
3748 pos = 0;3787 pos = 0;
3749 lineno = 1;3788 lineno = 1;
3750 job = parse_job (NULL, "test", buf, strlen (buf), &pos, &lineno);3789 job = parse_job (NULL, NULL, "test", buf, strlen (buf), &pos, &lineno);
37513790
3752 TEST_EQ_P (job, NULL);3791 TEST_EQ_P (job, NULL);
37533792
@@ -3777,7 +3816,7 @@
3777 TEST_ALLOC_FAIL {3816 TEST_ALLOC_FAIL {
3778 pos = 0;3817 pos = 0;
3779 lineno = 1;3818 lineno = 1;
3780 job = parse_job (NULL, "test", buf, strlen (buf),3819 job = parse_job (NULL, NULL, "test", buf, strlen (buf),
3781 &pos, &lineno);3820 &pos, &lineno);
37823821
3783 if (test_alloc_failed) {3822 if (test_alloc_failed) {
@@ -3814,7 +3853,7 @@
3814 TEST_ALLOC_FAIL {3853 TEST_ALLOC_FAIL {
3815 pos = 0;3854 pos = 0;
3816 lineno = 1;3855 lineno = 1;
3817 job = parse_job (NULL, "test", buf, strlen (buf),3856 job = parse_job (NULL, NULL, "test", buf, strlen (buf),
3818 &pos, &lineno);3857 &pos, &lineno);
38193858
3820 if (test_alloc_failed) {3859 if (test_alloc_failed) {
@@ -3857,7 +3896,7 @@
3857 TEST_ALLOC_FAIL {3896 TEST_ALLOC_FAIL {
3858 pos = 0;3897 pos = 0;
3859 lineno = 1;3898 lineno = 1;
3860 job = parse_job (NULL, "test", buf, strlen (buf),3899 job = parse_job (NULL, NULL, "test", buf, strlen (buf),
3861 &pos, &lineno);3900 &pos, &lineno);
38623901
3863 if (test_alloc_failed) {3902 if (test_alloc_failed) {
@@ -3899,7 +3938,7 @@
38993938
3900 pos = 0;3939 pos = 0;
3901 lineno = 1;3940 lineno = 1;
3902 job = parse_job (NULL, "test", buf, strlen (buf), &pos, &lineno);3941 job = parse_job (NULL, NULL, "test", buf, strlen (buf), &pos, &lineno);
39033942
3904 TEST_EQ_P (job, NULL);3943 TEST_EQ_P (job, NULL);
39053944
@@ -3929,7 +3968,7 @@
3929 TEST_ALLOC_FAIL {3968 TEST_ALLOC_FAIL {
3930 pos = 0;3969 pos = 0;
3931 lineno = 1;3970 lineno = 1;
3932 job = parse_job (NULL, "test", buf, strlen (buf),3971 job = parse_job (NULL, NULL, "test", buf, strlen (buf),
3933 &pos, &lineno);3972 &pos, &lineno);
39343973
3935 if (test_alloc_failed) {3974 if (test_alloc_failed) {
@@ -3962,7 +4001,7 @@
3962 TEST_ALLOC_FAIL {4001 TEST_ALLOC_FAIL {
3963 pos = 0;4002 pos = 0;
3964 lineno = 1;4003 lineno = 1;
3965 job = parse_job (NULL, "test", buf, strlen (buf),4004 job = parse_job (NULL, NULL, "test", buf, strlen (buf),
3966 &pos, &lineno);4005 &pos, &lineno);
39674006
3968 if (test_alloc_failed) {4007 if (test_alloc_failed) {
@@ -3995,7 +4034,7 @@
3995 TEST_ALLOC_FAIL {4034 TEST_ALLOC_FAIL {
3996 pos = 0;4035 pos = 0;
3997 lineno = 1;4036 lineno = 1;
3998 job = parse_job (NULL, "test", buf, strlen (buf),4037 job = parse_job (NULL, NULL, "test", buf, strlen (buf),
3999 &pos, &lineno);4038 &pos, &lineno);
40004039
4001 if (test_alloc_failed) {4040 if (test_alloc_failed) {
@@ -4028,7 +4067,7 @@
4028 TEST_ALLOC_FAIL {4067 TEST_ALLOC_FAIL {
4029 pos = 0;4068 pos = 0;
4030 lineno = 1;4069 lineno = 1;
4031 job = parse_job (NULL, "test", buf, strlen (buf),4070 job = parse_job (NULL, NULL, "test", buf, strlen (buf),
4032 &pos, &lineno);4071 &pos, &lineno);
40334072
4034 if (test_alloc_failed) {4073 if (test_alloc_failed) {
@@ -4061,7 +4100,7 @@
4061 TEST_ALLOC_FAIL {4100 TEST_ALLOC_FAIL {
4062 pos = 0;4101 pos = 0;
4063 lineno = 1;4102 lineno = 1;
4064 job = parse_job (NULL, "test", buf, strlen (buf),4103 job = parse_job (NULL, NULL, "test", buf, strlen (buf),
4065 &pos, &lineno);4104 &pos, &lineno);
40664105
4067 if (test_alloc_failed) {4106 if (test_alloc_failed) {
@@ -4093,7 +4132,7 @@
40934132
4094 pos = 0;4133 pos = 0;
4095 lineno = 1;4134 lineno = 1;
4096 job = parse_job (NULL, "test", buf, strlen (buf), &pos, &lineno);4135 job = parse_job (NULL, NULL, "test", buf, strlen (buf), &pos, &lineno);
40974136
4098 TEST_EQ_P (job, NULL);4137 TEST_EQ_P (job, NULL);
40994138
@@ -4112,7 +4151,7 @@
41124151
4113 pos = 0;4152 pos = 0;
4114 lineno = 1;4153 lineno = 1;
4115 job = parse_job (NULL, "test", buf, strlen (buf), &pos, &lineno);4154 job = parse_job (NULL, NULL, "test", buf, strlen (buf), &pos, &lineno);
41164155
4117 TEST_EQ_P (job, NULL);4156 TEST_EQ_P (job, NULL);
41184157
@@ -4131,7 +4170,7 @@
41314170
4132 pos = 0;4171 pos = 0;
4133 lineno = 1;4172 lineno = 1;
4134 job = parse_job (NULL, "test", buf, strlen (buf), &pos, &lineno);4173 job = parse_job (NULL, NULL, "test", buf, strlen (buf), &pos, &lineno);
41354174
4136 TEST_EQ_P (job, NULL);4175 TEST_EQ_P (job, NULL);
41374176
@@ -4159,7 +4198,7 @@
4159 TEST_ALLOC_FAIL {4198 TEST_ALLOC_FAIL {
4160 pos = 0;4199 pos = 0;
4161 lineno = 1;4200 lineno = 1;
4162 job = parse_job (NULL, "test", buf, strlen (buf),4201 job = parse_job (NULL, NULL, "test", buf, strlen (buf),
4163 &pos, &lineno);4202 &pos, &lineno);
41644203
4165 if (test_alloc_failed) {4204 if (test_alloc_failed) {
@@ -4193,7 +4232,7 @@
4193 TEST_ALLOC_FAIL {4232 TEST_ALLOC_FAIL {
4194 pos = 0;4233 pos = 0;
4195 lineno = 1;4234 lineno = 1;
4196 job = parse_job (NULL, "test", buf, strlen (buf),4235 job = parse_job (NULL, NULL, "test", buf, strlen (buf),
4197 &pos, &lineno);4236 &pos, &lineno);
41984237
4199 if (test_alloc_failed) {4238 if (test_alloc_failed) {
@@ -4226,7 +4265,7 @@
4226 TEST_ALLOC_FAIL {4265 TEST_ALLOC_FAIL {
4227 pos = 0;4266 pos = 0;
4228 lineno = 1;4267 lineno = 1;
4229 job = parse_job (NULL, "test", buf, strlen (buf),4268 job = parse_job (NULL, NULL, "test", buf, strlen (buf),
4230 &pos, &lineno);4269 &pos, &lineno);
42314270
4232 if (test_alloc_failed) {4271 if (test_alloc_failed) {
@@ -4260,7 +4299,7 @@
4260 TEST_ALLOC_FAIL {4299 TEST_ALLOC_FAIL {
4261 pos = 0;4300 pos = 0;
4262 lineno = 1;4301 lineno = 1;
4263 job = parse_job (NULL, "test", buf, strlen (buf),4302 job = parse_job (NULL, NULL, "test", buf, strlen (buf),
4264 &pos, &lineno);4303 &pos, &lineno);
42654304
4266 if (test_alloc_failed) {4305 if (test_alloc_failed) {
@@ -4293,7 +4332,7 @@
4293 TEST_ALLOC_FAIL {4332 TEST_ALLOC_FAIL {
4294 pos = 0;4333 pos = 0;
4295 lineno = 1;4334 lineno = 1;
4296 job = parse_job (NULL, "test", buf, strlen (buf),4335 job = parse_job (NULL, NULL, "test", buf, strlen (buf),
4297 &pos, &lineno);4336 &pos, &lineno);
42984337
4299 if (test_alloc_failed) {4338 if (test_alloc_failed) {
@@ -4326,7 +4365,7 @@
43264365
4327 pos = 0;4366 pos = 0;
4328 lineno = 1;4367 lineno = 1;
4329 job = parse_job (NULL, "test", buf, strlen (buf), &pos, &lineno);4368 job = parse_job (NULL, NULL, "test", buf, strlen (buf), &pos, &lineno);
43304369
4331 TEST_EQ_P (job, NULL);4370 TEST_EQ_P (job, NULL);
43324371
@@ -4345,7 +4384,7 @@
43454384
4346 pos = 0;4385 pos = 0;
4347 lineno = 1;4386 lineno = 1;
4348 job = parse_job (NULL, "test", buf, strlen (buf), &pos, &lineno);4387 job = parse_job (NULL, NULL, "test", buf, strlen (buf), &pos, &lineno);
43494388
4350 TEST_EQ_P (job, NULL);4389 TEST_EQ_P (job, NULL);
43514390
@@ -4364,7 +4403,7 @@
43644403
4365 pos = 0;4404 pos = 0;
4366 lineno = 1;4405 lineno = 1;
4367 job = parse_job (NULL, "test", buf, strlen (buf), &pos, &lineno);4406 job = parse_job (NULL, NULL, "test", buf, strlen (buf), &pos, &lineno);
43684407
4369 TEST_EQ_P (job, NULL);4408 TEST_EQ_P (job, NULL);
43704409
@@ -4383,7 +4422,7 @@
43834422
4384 pos = 0;4423 pos = 0;
4385 lineno = 1;4424 lineno = 1;
4386 job = parse_job (NULL, "test", buf, strlen (buf), &pos, &lineno);4425 job = parse_job (NULL, NULL, "test", buf, strlen (buf), &pos, &lineno);
43874426
4388 TEST_EQ_P (job, NULL);4427 TEST_EQ_P (job, NULL);
43894428
@@ -4402,7 +4441,7 @@
44024441
4403 pos = 0;4442 pos = 0;
4404 lineno = 1;4443 lineno = 1;
4405 job = parse_job (NULL, "test", buf, strlen (buf), &pos, &lineno);4444 job = parse_job (NULL, NULL, "test", buf, strlen (buf), &pos, &lineno);
44064445
4407 TEST_EQ_P (job, NULL);4446 TEST_EQ_P (job, NULL);
44084447
@@ -4421,7 +4460,7 @@
44214460
4422 pos = 0;4461 pos = 0;
4423 lineno = 1;4462 lineno = 1;
4424 job = parse_job (NULL, "test", buf, strlen (buf), &pos, &lineno);4463 job = parse_job (NULL, NULL, "test", buf, strlen (buf), &pos, &lineno);
44254464
4426 TEST_EQ_P (job, NULL);4465 TEST_EQ_P (job, NULL);
44274466
@@ -4440,7 +4479,7 @@
44404479
4441 pos = 0;4480 pos = 0;
4442 lineno = 1;4481 lineno = 1;
4443 job = parse_job (NULL, "test", buf, strlen (buf), &pos, &lineno);4482 job = parse_job (NULL, NULL, "test", buf, strlen (buf), &pos, &lineno);
44444483
4445 TEST_EQ_P (job, NULL);4484 TEST_EQ_P (job, NULL);
44464485
@@ -4459,7 +4498,7 @@
44594498
4460 pos = 0;4499 pos = 0;
4461 lineno = 1;4500 lineno = 1;
4462 job = parse_job (NULL, "test", buf, strlen (buf), &pos, &lineno);4501 job = parse_job (NULL, NULL, "test", buf, strlen (buf), &pos, &lineno);
44634502
4464 TEST_EQ_P (job, NULL);4503 TEST_EQ_P (job, NULL);
44654504
@@ -4478,7 +4517,7 @@
44784517
4479 pos = 0;4518 pos = 0;
4480 lineno = 1;4519 lineno = 1;
4481 job = parse_job (NULL, "test", buf, strlen (buf), &pos, &lineno);4520 job = parse_job (NULL, NULL, "test", buf, strlen (buf), &pos, &lineno);
44824521
4483 TEST_EQ_P (job, NULL);4522 TEST_EQ_P (job, NULL);
44844523
@@ -4497,7 +4536,7 @@
44974536
4498 pos = 0;4537 pos = 0;
4499 lineno = 1;4538 lineno = 1;
4500 job = parse_job (NULL, "test", buf, strlen (buf), &pos, &lineno);4539 job = parse_job (NULL, NULL, "test", buf, strlen (buf), &pos, &lineno);
45014540
4502 TEST_EQ_P (job, NULL);4541 TEST_EQ_P (job, NULL);
45034542
@@ -4516,7 +4555,7 @@
45164555
4517 pos = 0;4556 pos = 0;
4518 lineno = 1;4557 lineno = 1;
4519 job = parse_job (NULL, "test", buf, strlen (buf), &pos, &lineno);4558 job = parse_job (NULL, NULL, "test", buf, strlen (buf), &pos, &lineno);
45204559
4521 TEST_EQ_P (job, NULL);4560 TEST_EQ_P (job, NULL);
45224561
@@ -4535,7 +4574,7 @@
45354574
4536 pos = 0;4575 pos = 0;
4537 lineno = 1;4576 lineno = 1;
4538 job = parse_job (NULL, "test", buf, strlen (buf), &pos, &lineno);4577 job = parse_job (NULL, NULL, "test", buf, strlen (buf), &pos, &lineno);
45394578
4540 TEST_EQ_P (job, NULL);4579 TEST_EQ_P (job, NULL);
45414580
@@ -4565,7 +4604,7 @@
4565 TEST_ALLOC_FAIL {4604 TEST_ALLOC_FAIL {
4566 pos = 0;4605 pos = 0;
4567 lineno = 1;4606 lineno = 1;
4568 job = parse_job (NULL, "test", buf, strlen (buf),4607 job = parse_job (NULL, NULL, "test", buf, strlen (buf),
4569 &pos, &lineno);4608 &pos, &lineno);
45704609
4571 if (test_alloc_failed) {4610 if (test_alloc_failed) {
@@ -4597,7 +4636,7 @@
4597 TEST_ALLOC_FAIL {4636 TEST_ALLOC_FAIL {
4598 pos = 0;4637 pos = 0;
4599 lineno = 1;4638 lineno = 1;
4600 job = parse_job (NULL, "test", buf, strlen (buf),4639 job = parse_job (NULL, NULL, "test", buf, strlen (buf),
4601 &pos, &lineno);4640 &pos, &lineno);
46024641
4603 if (test_alloc_failed) {4642 if (test_alloc_failed) {
@@ -4629,7 +4668,7 @@
46294668
4630 pos = 0;4669 pos = 0;
4631 lineno = 1;4670 lineno = 1;
4632 job = parse_job (NULL, "test", buf, strlen (buf), &pos, &lineno);4671 job = parse_job (NULL, NULL, "test", buf, strlen (buf), &pos, &lineno);
46334672
4634 TEST_EQ_P (job, NULL);4673 TEST_EQ_P (job, NULL);
46354674
@@ -4659,7 +4698,7 @@
4659 TEST_ALLOC_FAIL {4698 TEST_ALLOC_FAIL {
4660 pos = 0;4699 pos = 0;
4661 lineno = 1;4700 lineno = 1;
4662 job = parse_job (NULL, "test", buf, strlen (buf),4701 job = parse_job (NULL, NULL, "test", buf, strlen (buf),
4663 &pos, &lineno);4702 &pos, &lineno);
46644703
4665 if (test_alloc_failed) {4704 if (test_alloc_failed) {
@@ -4693,7 +4732,7 @@
4693 TEST_ALLOC_FAIL {4732 TEST_ALLOC_FAIL {
4694 pos = 0;4733 pos = 0;
4695 lineno = 1;4734 lineno = 1;
4696 job = parse_job (NULL, "test", buf, strlen (buf),4735 job = parse_job (NULL, NULL, "test", buf, strlen (buf),
4697 &pos, &lineno);4736 &pos, &lineno);
46984737
4699 if (test_alloc_failed) {4738 if (test_alloc_failed) {
@@ -4726,7 +4765,7 @@
47264765
4727 pos = 0;4766 pos = 0;
4728 lineno = 1;4767 lineno = 1;
4729 job = parse_job (NULL, "test", buf, strlen (buf), &pos, &lineno);4768 job = parse_job (NULL, NULL, "test", buf, strlen (buf), &pos, &lineno);
47304769
4731 TEST_EQ_P (job, NULL);4770 TEST_EQ_P (job, NULL);
47324771
@@ -4745,7 +4784,7 @@
47454784
4746 pos = 0;4785 pos = 0;
4747 lineno = 1;4786 lineno = 1;
4748 job = parse_job (NULL, "test", buf, strlen (buf), &pos, &lineno);4787 job = parse_job (NULL, NULL, "test", buf, strlen (buf), &pos, &lineno);
47494788
4750 TEST_EQ_P (job, NULL);4789 TEST_EQ_P (job, NULL);
47514790
@@ -4775,7 +4814,7 @@
4775 TEST_ALLOC_FAIL {4814 TEST_ALLOC_FAIL {
4776 pos = 0;4815 pos = 0;
4777 lineno = 1;4816 lineno = 1;
4778 job = parse_job (NULL, "test", buf, strlen (buf),4817 job = parse_job (NULL, NULL, "test", buf, strlen (buf),
4779 &pos, &lineno);4818 &pos, &lineno);
47804819
4781 if (test_alloc_failed) {4820 if (test_alloc_failed) {
@@ -4808,7 +4847,7 @@
4808 TEST_ALLOC_FAIL {4847 TEST_ALLOC_FAIL {
4809 pos = 0;4848 pos = 0;
4810 lineno = 1;4849 lineno = 1;
4811 job = parse_job (NULL, "test", buf, strlen (buf),4850 job = parse_job (NULL, NULL, "test", buf, strlen (buf),
4812 &pos, &lineno);4851 &pos, &lineno);
48134852
4814 if (test_alloc_failed) {4853 if (test_alloc_failed) {
@@ -4840,7 +4879,7 @@
48404879
4841 pos = 0;4880 pos = 0;
4842 lineno = 1;4881 lineno = 1;
4843 job = parse_job (NULL, "test", buf, strlen (buf), &pos, &lineno);4882 job = parse_job (NULL, NULL, "test", buf, strlen (buf), &pos, &lineno);
48444883
4845 TEST_EQ_P (job, NULL);4884 TEST_EQ_P (job, NULL);
48464885
@@ -4859,7 +4898,7 @@
48594898
4860 pos = 0;4899 pos = 0;
4861 lineno = 1;4900 lineno = 1;
4862 job = parse_job (NULL, "test", buf, strlen (buf), &pos, &lineno);4901 job = parse_job (NULL, NULL, "test", buf, strlen (buf), &pos, &lineno);
48634902
4864 TEST_EQ_P (job, NULL);4903 TEST_EQ_P (job, NULL);
48654904
@@ -4878,7 +4917,7 @@
48784917
4879 pos = 0;4918 pos = 0;
4880 lineno = 1;4919 lineno = 1;
4881 job = parse_job (NULL, "test", buf, strlen (buf), &pos, &lineno);4920 job = parse_job (NULL, NULL, "test", buf, strlen (buf), &pos, &lineno);
48824921
4883 TEST_EQ_P (job, NULL);4922 TEST_EQ_P (job, NULL);
48844923
@@ -4897,7 +4936,7 @@
48974936
4898 pos = 0;4937 pos = 0;
4899 lineno = 1;4938 lineno = 1;
4900 job = parse_job (NULL, "test", buf, strlen (buf), &pos, &lineno);4939 job = parse_job (NULL, NULL, "test", buf, strlen (buf), &pos, &lineno);
49014940
4902 TEST_EQ_P (job, NULL);4941 TEST_EQ_P (job, NULL);
49034942
@@ -4916,7 +4955,7 @@
49164955
4917 pos = 0;4956 pos = 0;
4918 lineno = 1;4957 lineno = 1;
4919 job = parse_job (NULL, "test", buf, strlen (buf), &pos, &lineno);4958 job = parse_job (NULL, NULL, "test", buf, strlen (buf), &pos, &lineno);
49204959
4921 TEST_EQ_P (job, NULL);4960 TEST_EQ_P (job, NULL);
49224961
@@ -4935,7 +4974,7 @@
49354974
4936 pos = 0;4975 pos = 0;
4937 lineno = 1;4976 lineno = 1;
4938 job = parse_job (NULL, "test", buf, strlen (buf), &pos, &lineno);4977 job = parse_job (NULL, NULL, "test", buf, strlen (buf), &pos, &lineno);
49394978
4940 TEST_EQ_P (job, NULL);4979 TEST_EQ_P (job, NULL);
49414980
@@ -4954,7 +4993,7 @@
49544993
4955 pos = 0;4994 pos = 0;
4956 lineno = 1;4995 lineno = 1;
4957 job = parse_job (NULL, "test", buf, strlen (buf), &pos, &lineno);4996 job = parse_job (NULL, NULL, "test", buf, strlen (buf), &pos, &lineno);
49584997
4959 TEST_EQ_P (job, NULL);4998 TEST_EQ_P (job, NULL);
49604999
@@ -4974,7 +5013,7 @@
49745013
4975 pos = 0;5014 pos = 0;
4976 lineno = 1;5015 lineno = 1;
4977 job = parse_job (NULL, "test", buf, strlen (buf), &pos, &lineno);5016 job = parse_job (NULL, NULL, "test", buf, strlen (buf), &pos, &lineno);
49785017
4979 TEST_EQ_P (job, NULL);5018 TEST_EQ_P (job, NULL);
49805019
@@ -5005,7 +5044,7 @@
5005 TEST_ALLOC_FAIL {5044 TEST_ALLOC_FAIL {
5006 pos = 0;5045 pos = 0;
5007 lineno = 1;5046 lineno = 1;
5008 job = parse_job (NULL, "test", buf, strlen (buf),5047 job = parse_job (NULL, NULL, "test", buf, strlen (buf),
5009 &pos, &lineno);5048 &pos, &lineno);
50105049
5011 if (test_alloc_failed) {5050 if (test_alloc_failed) {
@@ -5044,7 +5083,7 @@
5044 TEST_ALLOC_FAIL {5083 TEST_ALLOC_FAIL {
5045 pos = 0;5084 pos = 0;
5046 lineno = 1;5085 lineno = 1;
5047 job = parse_job (NULL, "test", buf, strlen (buf),5086 job = parse_job (NULL, NULL, "test", buf, strlen (buf),
5048 &pos, &lineno);5087 &pos, &lineno);
50495088
5050 if (test_alloc_failed) {5089 if (test_alloc_failed) {
@@ -5083,7 +5122,7 @@
5083 TEST_ALLOC_FAIL {5122 TEST_ALLOC_FAIL {
5084 pos = 0;5123 pos = 0;
5085 lineno = 1;5124 lineno = 1;
5086 job = parse_job (NULL, "test", buf, strlen (buf),5125 job = parse_job (NULL, NULL, "test", buf, strlen (buf),
5087 &pos, &lineno);5126 &pos, &lineno);
50885127
5089 if (test_alloc_failed) {5128 if (test_alloc_failed) {
@@ -5127,7 +5166,7 @@
5127 TEST_ALLOC_FAIL {5166 TEST_ALLOC_FAIL {
5128 pos = 0;5167 pos = 0;
5129 lineno = 1;5168 lineno = 1;
5130 job = parse_job (NULL, "test", buf, strlen (buf),5169 job = parse_job (NULL, NULL, "test", buf, strlen (buf),
5131 &pos, &lineno);5170 &pos, &lineno);
51325171
5133 if (test_alloc_failed) {5172 if (test_alloc_failed) {
@@ -5168,7 +5207,7 @@
51685207
5169 pos = 0;5208 pos = 0;
5170 lineno = 1;5209 lineno = 1;
5171 job = parse_job (NULL, "test", buf, strlen (buf), &pos, &lineno);5210 job = parse_job (NULL, NULL, "test", buf, strlen (buf), &pos, &lineno);
51725211
5173 TEST_EQ_P (job, NULL);5212 TEST_EQ_P (job, NULL);
51745213
@@ -5187,7 +5226,7 @@
51875226
5188 pos = 0;5227 pos = 0;
5189 lineno = 1;5228 lineno = 1;
5190 job = parse_job (NULL, "test", buf, strlen (buf), &pos, &lineno);5229 job = parse_job (NULL, NULL, "test", buf, strlen (buf), &pos, &lineno);
51915230
5192 TEST_EQ_P (job, NULL);5231 TEST_EQ_P (job, NULL);
51935232
@@ -5206,7 +5245,7 @@
52065245
5207 pos = 0;5246 pos = 0;
5208 lineno = 1;5247 lineno = 1;
5209 job = parse_job (NULL, "test", buf, strlen (buf), &pos, &lineno);5248 job = parse_job (NULL, NULL, "test", buf, strlen (buf), &pos, &lineno);
52105249
5211 TEST_EQ_P (job, NULL);5250 TEST_EQ_P (job, NULL);
52125251
@@ -5225,7 +5264,7 @@
52255264
5226 pos = 0;5265 pos = 0;
5227 lineno = 1;5266 lineno = 1;
5228 job = parse_job (NULL, "test", buf, strlen (buf), &pos, &lineno);5267 job = parse_job (NULL, NULL, "test", buf, strlen (buf), &pos, &lineno);
52295268
5230 TEST_EQ_P (job, NULL);5269 TEST_EQ_P (job, NULL);
52315270
@@ -5244,7 +5283,7 @@
52445283
5245 pos = 0;5284 pos = 0;
5246 lineno = 1;5285 lineno = 1;
5247 job = parse_job (NULL, "test", buf, strlen (buf), &pos, &lineno);5286 job = parse_job (NULL, NULL, "test", buf, strlen (buf), &pos, &lineno);
52485287
5249 TEST_EQ_P (job, NULL);5288 TEST_EQ_P (job, NULL);
52505289
@@ -5263,7 +5302,7 @@
52635302
5264 pos = 0;5303 pos = 0;
5265 lineno = 1;5304 lineno = 1;
5266 job = parse_job (NULL, "test", buf, strlen (buf), &pos, &lineno);5305 job = parse_job (NULL, NULL, "test", buf, strlen (buf), &pos, &lineno);
52675306
5268 TEST_EQ_P (job, NULL);5307 TEST_EQ_P (job, NULL);
52695308
@@ -5293,7 +5332,7 @@
5293 TEST_ALLOC_FAIL {5332 TEST_ALLOC_FAIL {
5294 pos = 0;5333 pos = 0;
5295 lineno = 1;5334 lineno = 1;
5296 job = parse_job (NULL, "test", buf, strlen (buf),5335 job = parse_job (NULL, NULL, "test", buf, strlen (buf),
5297 &pos, &lineno);5336 &pos, &lineno);
52985337
5299 if (test_alloc_failed) {5338 if (test_alloc_failed) {
@@ -5326,7 +5365,7 @@
5326 TEST_ALLOC_FAIL {5365 TEST_ALLOC_FAIL {
5327 pos = 0;5366 pos = 0;
5328 lineno = 1;5367 lineno = 1;
5329 job = parse_job (NULL, "test", buf, strlen (buf),5368 job = parse_job (NULL, NULL, "test", buf, strlen (buf),
5330 &pos, &lineno);5369 &pos, &lineno);
53315370
5332 if (test_alloc_failed) {5371 if (test_alloc_failed) {
@@ -5359,7 +5398,7 @@
5359 TEST_ALLOC_FAIL {5398 TEST_ALLOC_FAIL {
5360 pos = 0;5399 pos = 0;
5361 lineno = 1;5400 lineno = 1;
5362 job = parse_job (NULL, "test", buf, strlen (buf),5401 job = parse_job (NULL, NULL, "test", buf, strlen (buf),
5363 &pos, &lineno);5402 &pos, &lineno);
53645403
5365 if (test_alloc_failed) {5404 if (test_alloc_failed) {
@@ -5392,7 +5431,7 @@
5392 TEST_ALLOC_FAIL {5431 TEST_ALLOC_FAIL {
5393 pos = 0;5432 pos = 0;
5394 lineno = 1;5433 lineno = 1;
5395 job = parse_job (NULL, "test", buf, strlen (buf),5434 job = parse_job (NULL, NULL, "test", buf, strlen (buf),
5396 &pos, &lineno);5435 &pos, &lineno);
53975436
5398 if (test_alloc_failed) {5437 if (test_alloc_failed) {
@@ -5423,7 +5462,7 @@
54235462
5424 pos = 0;5463 pos = 0;
5425 lineno = 1;5464 lineno = 1;
5426 job = parse_job (NULL, "test", buf, strlen (buf), &pos, &lineno);5465 job = parse_job (NULL, NULL, "test", buf, strlen (buf), &pos, &lineno);
54275466
5428 TEST_EQ_P (job, NULL);5467 TEST_EQ_P (job, NULL);
54295468
@@ -5442,7 +5481,7 @@
54425481
5443 pos = 0;5482 pos = 0;
5444 lineno = 1;5483 lineno = 1;
5445 job = parse_job (NULL, "test", buf, strlen (buf), &pos, &lineno);5484 job = parse_job (NULL, NULL, "test", buf, strlen (buf), &pos, &lineno);
54465485
5447 TEST_EQ_P (job, NULL);5486 TEST_EQ_P (job, NULL);
54485487
@@ -5460,7 +5499,7 @@
54605499
5461 pos = 0;5500 pos = 0;
5462 lineno = 1;5501 lineno = 1;
5463 job = parse_job (NULL, "test", buf, strlen (buf), &pos, &lineno);5502 job = parse_job (NULL, NULL, "test", buf, strlen (buf), &pos, &lineno);
54645503
5465 TEST_EQ_P (job, NULL);5504 TEST_EQ_P (job, NULL);
54665505
@@ -5490,7 +5529,7 @@
5490 TEST_ALLOC_FAIL {5529 TEST_ALLOC_FAIL {
5491 pos = 0;5530 pos = 0;
5492 lineno = 1;5531 lineno = 1;
5493 job = parse_job (NULL, "test", buf, strlen (buf),5532 job = parse_job (NULL, NULL, "test", buf, strlen (buf),
5494 &pos, &lineno);5533 &pos, &lineno);
54955534
5496 if (test_alloc_failed) {5535 if (test_alloc_failed) {
@@ -5528,7 +5567,7 @@
5528 TEST_ALLOC_FAIL {5567 TEST_ALLOC_FAIL {
5529 pos = 0;5568 pos = 0;
5530 lineno = 1;5569 lineno = 1;
5531 job = parse_job (NULL, "test", buf, strlen (buf),5570 job = parse_job (NULL, NULL, "test", buf, strlen (buf),
5532 &pos, &lineno);5571 &pos, &lineno);
55335572
5534 if (test_alloc_failed) {5573 if (test_alloc_failed) {
@@ -5565,7 +5604,7 @@
55655604
5566 pos = 0;5605 pos = 0;
5567 lineno = 1;5606 lineno = 1;
5568 job = parse_job (NULL, "test", buf, strlen (buf), &pos, &lineno);5607 job = parse_job (NULL, NULL, "test", buf, strlen (buf), &pos, &lineno);
55695608
5570 TEST_EQ_P (job, NULL);5609 TEST_EQ_P (job, NULL);
55715610
@@ -5584,7 +5623,7 @@
55845623
5585 pos = 0;5624 pos = 0;
5586 lineno = 1;5625 lineno = 1;
5587 job = parse_job (NULL, "test", buf, strlen (buf), &pos, &lineno);5626 job = parse_job (NULL, NULL, "test", buf, strlen (buf), &pos, &lineno);
55885627
5589 TEST_EQ_P (job, NULL);5628 TEST_EQ_P (job, NULL);
55905629
@@ -5614,7 +5653,7 @@
5614 TEST_ALLOC_FAIL {5653 TEST_ALLOC_FAIL {
5615 pos = 0;5654 pos = 0;
5616 lineno = 1;5655 lineno = 1;
5617 job = parse_job (NULL, "test", buf, strlen (buf),5656 job = parse_job (NULL, NULL, "test", buf, strlen (buf),
5618 &pos, &lineno);5657 &pos, &lineno);
56195658
5620 if (test_alloc_failed) {5659 if (test_alloc_failed) {
@@ -5651,7 +5690,7 @@
5651 TEST_ALLOC_FAIL {5690 TEST_ALLOC_FAIL {
5652 pos = 0;5691 pos = 0;
5653 lineno = 1;5692 lineno = 1;
5654 job = parse_job (NULL, "test", buf, strlen (buf),5693 job = parse_job (NULL, NULL, "test", buf, strlen (buf),
5655 &pos, &lineno);5694 &pos, &lineno);
56565695
5657 if (test_alloc_failed) {5696 if (test_alloc_failed) {
@@ -5694,7 +5733,7 @@
5694 TEST_ALLOC_FAIL {5733 TEST_ALLOC_FAIL {
5695 pos = 0;5734 pos = 0;
5696 lineno = 1;5735 lineno = 1;
5697 job = parse_job (NULL, "test", buf, strlen (buf),5736 job = parse_job (NULL, NULL, "test", buf, strlen (buf),
5698 &pos, &lineno);5737 &pos, &lineno);
56995738
5700 if (test_alloc_failed) {5739 if (test_alloc_failed) {
@@ -5736,7 +5775,7 @@
57365775
5737 pos = 0;5776 pos = 0;
5738 lineno = 1;5777 lineno = 1;
5739 job = parse_job (NULL, "test", buf, strlen (buf), &pos, &lineno);5778 job = parse_job (NULL, NULL, "test", buf, strlen (buf), &pos, &lineno);
57405779
5741 TEST_EQ_P (job, NULL);5780 TEST_EQ_P (job, NULL);
57425781
@@ -5766,7 +5805,7 @@
5766 TEST_ALLOC_FAIL {5805 TEST_ALLOC_FAIL {
5767 pos = 0;5806 pos = 0;
5768 lineno = 1;5807 lineno = 1;
5769 job = parse_job (NULL, "test", buf, strlen (buf),5808 job = parse_job (NULL, NULL, "test", buf, strlen (buf),
5770 &pos, &lineno);5809 &pos, &lineno);
57715810
5772 if (test_alloc_failed) {5811 if (test_alloc_failed) {
@@ -5799,7 +5838,7 @@
5799 TEST_ALLOC_FAIL {5838 TEST_ALLOC_FAIL {
5800 pos = 0;5839 pos = 0;
5801 lineno = 1;5840 lineno = 1;
5802 job = parse_job (NULL, "test", buf, strlen (buf),5841 job = parse_job (NULL, NULL, "test", buf, strlen (buf),
5803 &pos, &lineno);5842 &pos, &lineno);
58045843
5805 if (test_alloc_failed) {5844 if (test_alloc_failed) {
@@ -5831,7 +5870,7 @@
58315870
5832 pos = 0;5871 pos = 0;
5833 lineno = 1;5872 lineno = 1;
5834 job = parse_job (NULL, "test", buf, strlen (buf), &pos, &lineno);5873 job = parse_job (NULL, NULL, "test", buf, strlen (buf), &pos, &lineno);
58355874
5836 TEST_EQ_P (job, NULL);5875 TEST_EQ_P (job, NULL);
58375876
@@ -5850,7 +5889,7 @@
58505889
5851 pos = 0;5890 pos = 0;
5852 lineno = 1;5891 lineno = 1;
5853 job = parse_job (NULL, "test", buf, strlen (buf), &pos, &lineno);5892 job = parse_job (NULL, NULL, "test", buf, strlen (buf), &pos, &lineno);
58545893
5855 TEST_EQ_P (job, NULL);5894 TEST_EQ_P (job, NULL);
58565895
@@ -5869,7 +5908,7 @@
58695908
5870 pos = 0;5909 pos = 0;
5871 lineno = 1;5910 lineno = 1;
5872 job = parse_job (NULL, "test", buf, strlen (buf), &pos, &lineno);5911 job = parse_job (NULL, NULL, "test", buf, strlen (buf), &pos, &lineno);
58735912
5874 TEST_EQ_P (job, NULL);5913 TEST_EQ_P (job, NULL);
58755914
@@ -5888,7 +5927,7 @@
58885927
5889 pos = 0;5928 pos = 0;
5890 lineno = 1;5929 lineno = 1;
5891 job = parse_job (NULL, "test", buf, strlen (buf), &pos, &lineno);5930 job = parse_job (NULL, NULL, "test", buf, strlen (buf), &pos, &lineno);
58925931
5893 TEST_EQ_P (job, NULL);5932 TEST_EQ_P (job, NULL);
58945933
@@ -5907,7 +5946,7 @@
59075946
5908 pos = 0;5947 pos = 0;
5909 lineno = 1;5948 lineno = 1;
5910 job = parse_job (NULL, "test", buf, strlen (buf), &pos, &lineno);5949 job = parse_job (NULL, NULL, "test", buf, strlen (buf), &pos, &lineno);
59115950
5912 TEST_EQ_P (job, NULL);5951 TEST_EQ_P (job, NULL);
59135952
@@ -5927,7 +5966,7 @@
59275966
5928 pos = 0;5967 pos = 0;
5929 lineno = 1;5968 lineno = 1;
5930 job = parse_job (NULL, "test", buf, strlen (buf), &pos, &lineno);5969 job = parse_job (NULL, NULL, "test", buf, strlen (buf), &pos, &lineno);
59315970
5932 TEST_EQ_P (job, NULL);5971 TEST_EQ_P (job, NULL);
59335972
@@ -5957,7 +5996,7 @@
5957 TEST_ALLOC_FAIL {5996 TEST_ALLOC_FAIL {
5958 pos = 0;5997 pos = 0;
5959 lineno = 1;5998 lineno = 1;
5960 job = parse_job (NULL, "test", buf, strlen (buf),5999 job = parse_job (NULL, NULL, "test", buf, strlen (buf),
5961 &pos, &lineno);6000 &pos, &lineno);
59626001
5963 if (test_alloc_failed) {6002 if (test_alloc_failed) {
@@ -5990,7 +6029,7 @@
5990 TEST_ALLOC_FAIL {6029 TEST_ALLOC_FAIL {
5991 pos = 0;6030 pos = 0;
5992 lineno = 1;6031 lineno = 1;
5993 job = parse_job (NULL, "test", buf, strlen (buf),6032 job = parse_job (NULL, NULL, "test", buf, strlen (buf),
5994 &pos, &lineno);6033 &pos, &lineno);
59956034
5996 if (test_alloc_failed) {6035 if (test_alloc_failed) {
@@ -6023,7 +6062,7 @@
6023 TEST_ALLOC_FAIL {6062 TEST_ALLOC_FAIL {
6024 pos = 0;6063 pos = 0;
6025 lineno = 1;6064 lineno = 1;
6026 job = parse_job (NULL, "test", buf, strlen (buf),6065 job = parse_job (NULL, NULL, "test", buf, strlen (buf),
6027 &pos, &lineno);6066 &pos, &lineno);
60286067
6029 if (test_alloc_failed) {6068 if (test_alloc_failed) {
@@ -6055,7 +6094,7 @@
60556094
6056 pos = 0;6095 pos = 0;
6057 lineno = 1;6096 lineno = 1;
6058 job = parse_job (NULL, "test", buf, strlen (buf), &pos, &lineno);6097 job = parse_job (NULL, NULL, "test", buf, strlen (buf), &pos, &lineno);
60596098
6060 TEST_EQ_P (job, NULL);6099 TEST_EQ_P (job, NULL);
60616100
@@ -6074,7 +6113,7 @@
60746113
6075 pos = 0;6114 pos = 0;
6076 lineno = 1;6115 lineno = 1;
6077 job = parse_job (NULL, "test", buf, strlen (buf), &pos, &lineno);6116 job = parse_job (NULL, NULL, "test", buf, strlen (buf), &pos, &lineno);
60786117
6079 TEST_EQ_P (job, NULL);6118 TEST_EQ_P (job, NULL);
60806119
@@ -6093,7 +6132,7 @@
60936132
6094 pos = 0;6133 pos = 0;
6095 lineno = 1;6134 lineno = 1;
6096 job = parse_job (NULL, "test", buf, strlen (buf), &pos, &lineno);6135 job = parse_job (NULL, NULL, "test", buf, strlen (buf), &pos, &lineno);
60976136
6098 TEST_EQ_P (job, NULL);6137 TEST_EQ_P (job, NULL);
60996138
@@ -6112,7 +6151,7 @@
61126151
6113 pos = 0;6152 pos = 0;
6114 lineno = 1;6153 lineno = 1;
6115 job = parse_job (NULL, "test", buf, strlen (buf), &pos, &lineno);6154 job = parse_job (NULL, NULL, "test", buf, strlen (buf), &pos, &lineno);
61166155
6117 TEST_EQ_P (job, NULL);6156 TEST_EQ_P (job, NULL);
61186157
@@ -6131,7 +6170,7 @@
61316170
6132 pos = 0;6171 pos = 0;
6133 lineno = 1;6172 lineno = 1;
6134 job = parse_job (NULL, "test", buf, strlen (buf), &pos, &lineno);6173 job = parse_job (NULL, NULL, "test", buf, strlen (buf), &pos, &lineno);
61356174
6136 TEST_EQ_P (job, NULL);6175 TEST_EQ_P (job, NULL);
61376176
@@ -6150,7 +6189,7 @@
61506189
6151 pos = 0;6190 pos = 0;
6152 lineno = 1;6191 lineno = 1;
6153 job = parse_job (NULL, "test", buf, strlen (buf), &pos, &lineno);6192 job = parse_job (NULL, NULL, "test", buf, strlen (buf), &pos, &lineno);
61546193
6155 TEST_EQ_P (job, NULL);6194 TEST_EQ_P (job, NULL);
61566195
@@ -6180,7 +6219,7 @@
6180 TEST_ALLOC_FAIL {6219 TEST_ALLOC_FAIL {
6181 pos = 0;6220 pos = 0;
6182 lineno = 1;6221 lineno = 1;
6183 job = parse_job (NULL, "test", buf, strlen (buf),6222 job = parse_job (NULL, NULL, "test", buf, strlen (buf),
6184 &pos, &lineno);6223 &pos, &lineno);
61856224
6186 if (test_alloc_failed) {6225 if (test_alloc_failed) {
@@ -6213,7 +6252,7 @@
6213 TEST_ALLOC_FAIL {6252 TEST_ALLOC_FAIL {
6214 pos = 0;6253 pos = 0;
6215 lineno = 1;6254 lineno = 1;
6216 job = parse_job (NULL, "test", buf, strlen (buf),6255 job = parse_job (NULL, NULL, "test", buf, strlen (buf),
6217 &pos, &lineno);6256 &pos, &lineno);
62186257
6219 if (test_alloc_failed) {6258 if (test_alloc_failed) {
@@ -6246,7 +6285,7 @@
6246 TEST_ALLOC_FAIL {6285 TEST_ALLOC_FAIL {
6247 pos = 0;6286 pos = 0;
6248 lineno = 1;6287 lineno = 1;
6249 job = parse_job (NULL, "test", buf, strlen (buf),6288 job = parse_job (NULL, NULL, "test", buf, strlen (buf),
6250 &pos, &lineno);6289 &pos, &lineno);
62516290
6252 if (test_alloc_failed) {6291 if (test_alloc_failed) {
@@ -6279,7 +6318,7 @@
6279 TEST_ALLOC_FAIL {6318 TEST_ALLOC_FAIL {
6280 pos = 0;6319 pos = 0;
6281 lineno = 1;6320 lineno = 1;
6282 job = parse_job (NULL, "test", buf, strlen (buf),6321 job = parse_job (NULL, NULL, "test", buf, strlen (buf),
6283 &pos, &lineno);6322 &pos, &lineno);
62846323
6285 if (test_alloc_failed) {6324 if (test_alloc_failed) {
@@ -6311,7 +6350,7 @@
63116350
6312 pos = 0;6351 pos = 0;
6313 lineno = 1;6352 lineno = 1;
6314 job = parse_job (NULL, "test", buf, strlen (buf), &pos, &lineno);6353 job = parse_job (NULL, NULL, "test", buf, strlen (buf), &pos, &lineno);
63156354
6316 TEST_EQ_P (job, NULL);6355 TEST_EQ_P (job, NULL);
63176356
@@ -6330,7 +6369,7 @@
63306369
6331 pos = 0;6370 pos = 0;
6332 lineno = 1;6371 lineno = 1;
6333 job = parse_job (NULL, "test", buf, strlen (buf), &pos, &lineno);6372 job = parse_job (NULL, NULL, "test", buf, strlen (buf), &pos, &lineno);
63346373
6335 TEST_EQ_P (job, NULL);6374 TEST_EQ_P (job, NULL);
63366375
@@ -6349,7 +6388,7 @@
63496388
6350 pos = 0;6389 pos = 0;
6351 lineno = 1;6390 lineno = 1;
6352 job = parse_job (NULL, "test", buf, strlen (buf), &pos, &lineno);6391 job = parse_job (NULL, NULL, "test", buf, strlen (buf), &pos, &lineno);
63536392
6354 TEST_EQ_P (job, NULL);6393 TEST_EQ_P (job, NULL);
63556394
@@ -6368,7 +6407,7 @@
63686407
6369 pos = 0;6408 pos = 0;
6370 lineno = 1;6409 lineno = 1;
6371 job = parse_job (NULL, "test", buf, strlen (buf), &pos, &lineno);6410 job = parse_job (NULL, NULL, "test", buf, strlen (buf), &pos, &lineno);
63726411
6373 TEST_EQ_P (job, NULL);6412 TEST_EQ_P (job, NULL);
63746413
@@ -6387,7 +6426,7 @@
63876426
6388 pos = 0;6427 pos = 0;
6389 lineno = 1;6428 lineno = 1;
6390 job = parse_job (NULL, "test", buf, strlen (buf), &pos, &lineno);6429 job = parse_job (NULL, NULL, "test", buf, strlen (buf), &pos, &lineno);
63916430
6392 TEST_EQ_P (job, NULL);6431 TEST_EQ_P (job, NULL);
63936432
@@ -6406,7 +6445,7 @@
64066445
6407 pos = 0;6446 pos = 0;
6408 lineno = 1;6447 lineno = 1;
6409 job = parse_job (NULL, "test", buf, strlen (buf), &pos, &lineno);6448 job = parse_job (NULL, NULL, "test", buf, strlen (buf), &pos, &lineno);
64106449
6411 TEST_EQ_P (job, NULL);6450 TEST_EQ_P (job, NULL);
64126451
@@ -6435,7 +6474,7 @@
6435 TEST_ALLOC_FAIL {6474 TEST_ALLOC_FAIL {
6436 pos = 0;6475 pos = 0;
6437 lineno = 1;6476 lineno = 1;
6438 job = parse_job (NULL, "test", buf, strlen (buf),6477 job = parse_job (NULL, NULL, "test", buf, strlen (buf),
6439 &pos, &lineno);6478 &pos, &lineno);
64406479
6441 if (test_alloc_failed) {6480 if (test_alloc_failed) {
@@ -6469,7 +6508,7 @@
6469 TEST_ALLOC_FAIL {6508 TEST_ALLOC_FAIL {
6470 pos = 0;6509 pos = 0;
6471 lineno = 1;6510 lineno = 1;
6472 job = parse_job (NULL, "test", buf, strlen (buf),6511 job = parse_job (NULL, NULL, "test", buf, strlen (buf),
6473 &pos, &lineno);6512 &pos, &lineno);
64746513
6475 if (test_alloc_failed) {6514 if (test_alloc_failed) {
@@ -6503,7 +6542,7 @@
6503 TEST_ALLOC_FAIL {6542 TEST_ALLOC_FAIL {
6504 pos = 0;6543 pos = 0;
6505 lineno = 1;6544 lineno = 1;
6506 job = parse_job (NULL, "test", buf, strlen (buf),6545 job = parse_job (NULL, NULL, "test", buf, strlen (buf),
6507 &pos, &lineno);6546 &pos, &lineno);
65086547
6509 if (test_alloc_failed) {6548 if (test_alloc_failed) {
@@ -6537,7 +6576,7 @@
6537 TEST_ALLOC_FAIL {6576 TEST_ALLOC_FAIL {
6538 pos = 0;6577 pos = 0;
6539 lineno = 1;6578 lineno = 1;
6540 job = parse_job (NULL, "test", buf, strlen (buf),6579 job = parse_job (NULL, NULL, "test", buf, strlen (buf),
6541 &pos, &lineno);6580 &pos, &lineno);
65426581
6543 if (test_alloc_failed) {6582 if (test_alloc_failed) {
@@ -6571,7 +6610,7 @@
6571 TEST_ALLOC_FAIL {6610 TEST_ALLOC_FAIL {
6572 pos = 0;6611 pos = 0;
6573 lineno = 1;6612 lineno = 1;
6574 job = parse_job (NULL, "test", buf, strlen (buf),6613 job = parse_job (NULL, NULL, "test", buf, strlen (buf),
6575 &pos, &lineno);6614 &pos, &lineno);
65766615
6577 if (test_alloc_failed) {6616 if (test_alloc_failed) {
@@ -6606,7 +6645,7 @@
6606 TEST_ALLOC_FAIL {6645 TEST_ALLOC_FAIL {
6607 pos = 0;6646 pos = 0;
6608 lineno = 1;6647 lineno = 1;
6609 job = parse_job (NULL, "test", buf, strlen (buf),6648 job = parse_job (NULL, NULL, "test", buf, strlen (buf),
6610 &pos, &lineno);6649 &pos, &lineno);
66116650
6612 if (test_alloc_failed) {6651 if (test_alloc_failed) {
@@ -6641,7 +6680,7 @@
6641 TEST_ALLOC_FAIL {6680 TEST_ALLOC_FAIL {
6642 pos = 0;6681 pos = 0;
6643 lineno = 1;6682 lineno = 1;
6644 job = parse_job (NULL, "test", buf, strlen (buf),6683 job = parse_job (NULL, NULL, "test", buf, strlen (buf),
6645 &pos, &lineno);6684 &pos, &lineno);
66466685
6647 if (test_alloc_failed) {6686 if (test_alloc_failed) {
@@ -6675,7 +6714,7 @@
6675 TEST_ALLOC_FAIL {6714 TEST_ALLOC_FAIL {
6676 pos = 0;6715 pos = 0;
6677 lineno = 1;6716 lineno = 1;
6678 job = parse_job (NULL, "test", buf, strlen (buf),6717 job = parse_job (NULL, NULL, "test", buf, strlen (buf),
6679 &pos, &lineno);6718 &pos, &lineno);
66806719
6681 if (test_alloc_failed) {6720 if (test_alloc_failed) {
@@ -6710,7 +6749,7 @@
6710 TEST_ALLOC_FAIL {6749 TEST_ALLOC_FAIL {
6711 pos = 0;6750 pos = 0;
6712 lineno = 1;6751 lineno = 1;
6713 job = parse_job (NULL, "test", buf, strlen (buf),6752 job = parse_job (NULL, NULL, "test", buf, strlen (buf),
6714 &pos, &lineno);6753 &pos, &lineno);
67156754
6716 if (test_alloc_failed) {6755 if (test_alloc_failed) {
@@ -6744,7 +6783,7 @@
6744 TEST_ALLOC_FAIL {6783 TEST_ALLOC_FAIL {
6745 pos = 0;6784 pos = 0;
6746 lineno = 1;6785 lineno = 1;
6747 job = parse_job (NULL, "test", buf, strlen (buf),6786 job = parse_job (NULL, NULL, "test", buf, strlen (buf),
6748 &pos, &lineno);6787 &pos, &lineno);
67496788
6750 if (test_alloc_failed) {6789 if (test_alloc_failed) {
@@ -6778,7 +6817,7 @@
6778 TEST_ALLOC_FAIL {6817 TEST_ALLOC_FAIL {
6779 pos = 0;6818 pos = 0;
6780 lineno = 1;6819 lineno = 1;
6781 job = parse_job (NULL, "test", buf, strlen (buf),6820 job = parse_job (NULL, NULL, "test", buf, strlen (buf),
6782 &pos, &lineno);6821 &pos, &lineno);
67836822
6784 if (test_alloc_failed) {6823 if (test_alloc_failed) {
@@ -6812,7 +6851,7 @@
6812 TEST_ALLOC_FAIL {6851 TEST_ALLOC_FAIL {
6813 pos = 0;6852 pos = 0;
6814 lineno = 1;6853 lineno = 1;
6815 job = parse_job (NULL, "test", buf, strlen (buf),6854 job = parse_job (NULL, NULL, "test", buf, strlen (buf),
6816 &pos, &lineno);6855 &pos, &lineno);
68176856
6818 if (test_alloc_failed) {6857 if (test_alloc_failed) {
@@ -6847,7 +6886,7 @@
6847 TEST_ALLOC_FAIL {6886 TEST_ALLOC_FAIL {
6848 pos = 0;6887 pos = 0;
6849 lineno = 1;6888 lineno = 1;
6850 job = parse_job (NULL, "test", buf, strlen (buf),6889 job = parse_job (NULL, NULL, "test", buf, strlen (buf),
6851 &pos, &lineno);6890 &pos, &lineno);
68526891
6853 if (test_alloc_failed) {6892 if (test_alloc_failed) {
@@ -6881,7 +6920,7 @@
6881 TEST_ALLOC_FAIL {6920 TEST_ALLOC_FAIL {
6882 pos = 0;6921 pos = 0;
6883 lineno = 1;6922 lineno = 1;
6884 job = parse_job (NULL, "test", buf, strlen (buf),6923 job = parse_job (NULL, NULL, "test", buf, strlen (buf),
6885 &pos, &lineno);6924 &pos, &lineno);
68866925
6887 if (test_alloc_failed) {6926 if (test_alloc_failed) {
@@ -6917,7 +6956,7 @@
6917 TEST_ALLOC_FAIL {6956 TEST_ALLOC_FAIL {
6918 pos = 0;6957 pos = 0;
6919 lineno = 1;6958 lineno = 1;
6920 job = parse_job (NULL, "test", buf, strlen (buf),6959 job = parse_job (NULL, NULL, "test", buf, strlen (buf),
6921 &pos, &lineno);6960 &pos, &lineno);
69226961
6923 if (test_alloc_failed) {6962 if (test_alloc_failed) {
@@ -6956,7 +6995,7 @@
6956 TEST_ALLOC_FAIL {6995 TEST_ALLOC_FAIL {
6957 pos = 0;6996 pos = 0;
6958 lineno = 1;6997 lineno = 1;
6959 job = parse_job (NULL, "test", buf, strlen (buf),6998 job = parse_job (NULL, NULL, "test", buf, strlen (buf),
6960 &pos, &lineno);6999 &pos, &lineno);
69617000
6962 if (test_alloc_failed) {7001 if (test_alloc_failed) {
@@ -6991,7 +7030,7 @@
6991 TEST_ALLOC_FAIL {7030 TEST_ALLOC_FAIL {
6992 pos = 0;7031 pos = 0;
6993 lineno = 1;7032 lineno = 1;
6994 job = parse_job (NULL, "test", buf, strlen (buf),7033 job = parse_job (NULL, NULL, "test", buf, strlen (buf),
6995 &pos, &lineno);7034 &pos, &lineno);
69967035
6997 if (test_alloc_failed) {7036 if (test_alloc_failed) {
@@ -7026,7 +7065,7 @@
7026 TEST_ALLOC_FAIL {7065 TEST_ALLOC_FAIL {
7027 pos = 0;7066 pos = 0;
7028 lineno = 1;7067 lineno = 1;
7029 job = parse_job (NULL, "test", buf, strlen (buf),7068 job = parse_job (NULL, NULL, "test", buf, strlen (buf),
7030 &pos, &lineno);7069 &pos, &lineno);
70317070
7032 if (test_alloc_failed) {7071 if (test_alloc_failed) {
@@ -7060,7 +7099,7 @@
70607099
7061 pos = 0;7100 pos = 0;
7062 lineno = 1;7101 lineno = 1;
7063 job = parse_job (NULL, "test", buf, strlen (buf), &pos, &lineno);7102 job = parse_job (NULL, NULL, "test", buf, strlen (buf), &pos, &lineno);
70647103
7065 TEST_EQ_P (job, NULL);7104 TEST_EQ_P (job, NULL);
70667105
@@ -7079,7 +7118,7 @@
70797118
7080 pos = 0;7119 pos = 0;
7081 lineno = 1;7120 lineno = 1;
7082 job = parse_job (NULL, "test", buf, strlen (buf), &pos, &lineno);7121 job = parse_job (NULL, NULL, "test", buf, strlen (buf), &pos, &lineno);
70837122
7084 TEST_EQ_P (job, NULL);7123 TEST_EQ_P (job, NULL);
70857124
@@ -7098,7 +7137,7 @@
70987137
7099 pos = 0;7138 pos = 0;
7100 lineno = 1;7139 lineno = 1;
7101 job = parse_job (NULL, "test", buf, strlen (buf), &pos, &lineno);7140 job = parse_job (NULL, NULL, "test", buf, strlen (buf), &pos, &lineno);
71027141
7103 TEST_EQ_P (job, NULL);7142 TEST_EQ_P (job, NULL);
71047143
@@ -7117,7 +7156,7 @@
71177156
7118 pos = 0;7157 pos = 0;
7119 lineno = 1;7158 lineno = 1;
7120 job = parse_job (NULL, "test", buf, strlen (buf), &pos, &lineno);7159 job = parse_job (NULL, NULL, "test", buf, strlen (buf), &pos, &lineno);
71217160
7122 TEST_EQ_P (job, NULL);7161 TEST_EQ_P (job, NULL);
71237162
@@ -7136,7 +7175,7 @@
71367175
7137 pos = 0;7176 pos = 0;
7138 lineno = 1;7177 lineno = 1;
7139 job = parse_job (NULL, "test", buf, strlen (buf), &pos, &lineno);7178 job = parse_job (NULL, NULL, "test", buf, strlen (buf), &pos, &lineno);
71407179
7141 TEST_EQ_P (job, NULL);7180 TEST_EQ_P (job, NULL);
71427181
@@ -7155,7 +7194,7 @@
71557194
7156 pos = 0;7195 pos = 0;
7157 lineno = 1;7196 lineno = 1;
7158 job = parse_job (NULL, "test", buf, strlen (buf), &pos, &lineno);7197 job = parse_job (NULL, NULL, "test", buf, strlen (buf), &pos, &lineno);
71597198
7160 TEST_EQ_P (job, NULL);7199 TEST_EQ_P (job, NULL);
71617200
@@ -7174,7 +7213,7 @@
71747213
7175 pos = 0;7214 pos = 0;
7176 lineno = 1;7215 lineno = 1;
7177 job = parse_job (NULL, "test", buf, strlen (buf), &pos, &lineno);7216 job = parse_job (NULL, NULL, "test", buf, strlen (buf), &pos, &lineno);
71787217
7179 TEST_EQ_P (job, NULL);7218 TEST_EQ_P (job, NULL);
71807219
@@ -7193,7 +7232,7 @@
71937232
7194 pos = 0;7233 pos = 0;
7195 lineno = 1;7234 lineno = 1;
7196 job = parse_job (NULL, "test", buf, strlen (buf), &pos, &lineno);7235 job = parse_job (NULL, NULL, "test", buf, strlen (buf), &pos, &lineno);
71977236
7198 TEST_EQ_P (job, NULL);7237 TEST_EQ_P (job, NULL);
71997238
@@ -7212,7 +7251,7 @@
72127251
7213 pos = 0;7252 pos = 0;
7214 lineno = 1;7253 lineno = 1;
7215 job = parse_job (NULL, "test", buf, strlen (buf), &pos, &lineno);7254 job = parse_job (NULL, NULL, "test", buf, strlen (buf), &pos, &lineno);
72167255
7217 TEST_EQ_P (job, NULL);7256 TEST_EQ_P (job, NULL);
72187257
@@ -7231,7 +7270,7 @@
72317270
7232 pos = 0;7271 pos = 0;
7233 lineno = 1;7272 lineno = 1;
7234 job = parse_job (NULL, "test", buf, strlen (buf), &pos, &lineno);7273 job = parse_job (NULL, NULL, "test", buf, strlen (buf), &pos, &lineno);
72357274
7236 TEST_EQ_P (job, NULL);7275 TEST_EQ_P (job, NULL);
72377276
@@ -7250,7 +7289,7 @@
72507289
7251 pos = 0;7290 pos = 0;
7252 lineno = 1;7291 lineno = 1;
7253 job = parse_job (NULL, "test", buf, strlen (buf), &pos, &lineno);7292 job = parse_job (NULL, NULL, "test", buf, strlen (buf), &pos, &lineno);
72547293
7255 TEST_EQ_P (job, NULL);7294 TEST_EQ_P (job, NULL);
72567295
@@ -7280,7 +7319,7 @@
7280 TEST_ALLOC_FAIL {7319 TEST_ALLOC_FAIL {
7281 pos = 0;7320 pos = 0;
7282 lineno = 1;7321 lineno = 1;
7283 job = parse_job (NULL, "test", buf, strlen (buf),7322 job = parse_job (NULL, NULL, "test", buf, strlen (buf),
7284 &pos, &lineno);7323 &pos, &lineno);
72857324
7286 if (test_alloc_failed) {7325 if (test_alloc_failed) {
@@ -7314,7 +7353,7 @@
7314 TEST_ALLOC_FAIL {7353 TEST_ALLOC_FAIL {
7315 pos = 0;7354 pos = 0;
7316 lineno = 1;7355 lineno = 1;
7317 job = parse_job (NULL, "test", buf, strlen (buf),7356 job = parse_job (NULL, NULL, "test", buf, strlen (buf),
7318 &pos, &lineno);7357 &pos, &lineno);
73197358
7320 if (test_alloc_failed) {7359 if (test_alloc_failed) {
@@ -7347,7 +7386,7 @@
73477386
7348 pos = 0;7387 pos = 0;
7349 lineno = 1;7388 lineno = 1;
7350 job = parse_job (NULL, "test", buf, strlen (buf), &pos, &lineno);7389 job = parse_job (NULL, NULL, "test", buf, strlen (buf), &pos, &lineno);
73517390
7352 TEST_EQ_P (job, NULL);7391 TEST_EQ_P (job, NULL);
73537392
@@ -7366,7 +7405,7 @@
73667405
7367 pos = 0;7406 pos = 0;
7368 lineno = 1;7407 lineno = 1;
7369 job = parse_job (NULL, "test", buf, strlen (buf), &pos, &lineno);7408 job = parse_job (NULL, NULL, "test", buf, strlen (buf), &pos, &lineno);
73707409
7371 TEST_EQ_P (job, NULL);7410 TEST_EQ_P (job, NULL);
73727411
@@ -7396,7 +7435,7 @@
7396 TEST_ALLOC_FAIL {7435 TEST_ALLOC_FAIL {
7397 pos = 0;7436 pos = 0;
7398 lineno = 1;7437 lineno = 1;
7399 job = parse_job (NULL, "test", buf, strlen (buf),7438 job = parse_job (NULL, NULL, "test", buf, strlen (buf),
7400 &pos, &lineno);7439 &pos, &lineno);
74017440
7402 if (test_alloc_failed) {7441 if (test_alloc_failed) {
@@ -7430,7 +7469,7 @@
7430 TEST_ALLOC_FAIL {7469 TEST_ALLOC_FAIL {
7431 pos = 0;7470 pos = 0;
7432 lineno = 1;7471 lineno = 1;
7433 job = parse_job (NULL, "test", buf, strlen (buf),7472 job = parse_job (NULL, NULL, "test", buf, strlen (buf),
7434 &pos, &lineno);7473 &pos, &lineno);
74357474
7436 if (test_alloc_failed) {7475 if (test_alloc_failed) {
@@ -7463,7 +7502,7 @@
74637502
7464 pos = 0;7503 pos = 0;
7465 lineno = 1;7504 lineno = 1;
7466 job = parse_job (NULL, "test", buf, strlen (buf), &pos, &lineno);7505 job = parse_job (NULL, NULL, "test", buf, strlen (buf), &pos, &lineno);
74677506
7468 TEST_EQ_P (job, NULL);7507 TEST_EQ_P (job, NULL);
74697508
@@ -7482,7 +7521,7 @@
74827521
7483 pos = 0;7522 pos = 0;
7484 lineno = 1;7523 lineno = 1;
7485 job = parse_job (NULL, "test", buf, strlen (buf), &pos, &lineno);7524 job = parse_job (NULL, NULL, "test", buf, strlen (buf), &pos, &lineno);
74867525
7487 TEST_EQ_P (job, NULL);7526 TEST_EQ_P (job, NULL);
74887527
74897528
=== modified file 'util/man/initctl.8'
--- util/man/initctl.8 2010-02-04 19:08:07 +0000
+++ util/man/initctl.8 2011-01-21 11:55:09 +0000
@@ -1,4 +1,4 @@
1.TH initctl 8 2010-02-04 "Upstart"1.TH initctl 8 2011-01-12 "Upstart"
2.\"2.\"
3.SH NAME3.SH NAME
4initctl \- init daemon control tool4initctl \- init daemon control tool
@@ -157,8 +157,8 @@
157157
158Requests that an instance of the named158Requests that an instance of the named
159.I JOB159.I JOB
160be restarted, outputting the status of the job to standard output when the160be restarted (stopped and then started), outputting the status of the
161command completes.161job to standard output when the command completes.
162162
163See163See
164.B status164.B status
@@ -249,10 +249,14 @@
249.\"249.\"
250.TP250.TP
251.B list251.B list
252
253Requests a list of the known jobs and instances, outputs the status of252Requests a list of the known jobs and instances, outputs the status of
254each to standard output.253each to standard output.
255254
255Note that this command enumerates as-yet-to-run jobs (in other words
256configuration files for which no job instances have yet been created) in
257the output with status "stop/waiting". In effect such entries denote
258configuration files which represent potential future jobs.
259
256See260See
257.B status261.B status
258for a description of the output format and262for a description of the output format and

Subscribers

People subscribed via source and target branches