~vorlon/ubuntu/raring/upstart/lp.1199778

« back to all changes in this revision

Viewing changes to init/tests/test_event.c

  • Committer: Scott James Remnant
  • Date: 2007-02-07 19:38:19 UTC
  • Revision ID: scott@netsplit.com-20070207193819-dlkvc6bafes25gfr
* init/tests/test_job.c (test_new, test_change_state) 
(test_run_script, test_start, test_stop): 
* init/job.h (Job): goal_event is now an EventEmission, and is
a direct pointer to the one in the events queue, rather than a copy.
* init/process.c (process_setup_environment): Reference the event
name and environment through the goal event, not directly.
* init/job.c (job_run_script): Reference the event name and
environment through the goal event, not directly.
(job_change_state, job_child_reaper): Replace direct setting of the
job goal with a call to job_stop; the process state is always
PROCESS_NONE in all three cases, so this is completely safe.
(_job_start, _job_stop): Merge these two functions together into
(job_change_goal): which behaves a lot more like job_change_state,
except that it doesn't loop.  This handles the changing of the
emission.
(job_start, job_start_event, job_stop, job_stop_event): Simplify
these functions, now they just call job_change_goal passing in
the emission pointer (or NULL).

Show diffs side-by-side

added added

removed removed

Lines of Context:
345
345
        nih_list_add (&job->start_events, &event->entry);
346
346
 
347
347
        em1 = event_emit ("test", NULL, NULL, my_emission_cb, &em1);
348
 
        em1->jobs++; /* FIXME hack until we fix goal_event stuff */
349
348
 
350
349
        event_poll ();
351
350
 
461
460
 
462
461
        waitpid (job->pid, NULL, 0);
463
462
 
464
 
        TEST_EQ_STR (job->goal_event->name, "test/failed");
 
463
        TEST_EQ_STR (job->goal_event->event.name, "test/failed");
465
464
 
466
 
        /* FIXME will need to finish that emission and call poll again */
 
465
        event_emit_finished (job->goal_event);
 
466
        event_poll ();
467
467
 
468
468
        nih_list_free (&job->entry);
469
469