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

« back to all changes in this revision

Viewing changes to init/tests/test_cfgfile.c

  • Committer: Scott James Remnant
  • Date: 2007-02-09 20:05:32 UTC
  • Revision ID: scott@netsplit.com-20070209200532-e2vakuu1zd4a2fdl
* init/cfgfile.c (cfg_stanza_limit): Support the word "unlimited" in
limit arguments for both the soft and hard values.
* init/tests/test_cfgfile.c (test_stanza_limit): Make sure that we
can make limits be unlimited.

Show diffs side-by-side

added added

removed removed

Lines of Context:
3916
3916
        nih_list_free (&job->entry);
3917
3917
 
3918
3918
 
 
3919
        /* Check that the hard resource limit can be set to unlimited with
 
3920
         * a special argument of that name
 
3921
         */
 
3922
        TEST_FEATURE ("with unlimited hard limit");
 
3923
        jf = fopen (filename, "w");
 
3924
        fprintf (jf, "exec /sbin/daemon\n");
 
3925
        fprintf (jf, "limit core 10 unlimited\n");
 
3926
        fclose (jf);
 
3927
 
 
3928
        job = cfg_read_job (NULL, filename, "test");
 
3929
 
 
3930
        TEST_ALLOC_SIZE (job, sizeof (Job));
 
3931
 
 
3932
        TEST_ALLOC_PARENT (job->limits[RLIMIT_CORE], job);
 
3933
        TEST_EQ (job->limits[RLIMIT_CORE]->rlim_cur, 10);
 
3934
        TEST_EQ (job->limits[RLIMIT_CORE]->rlim_max, RLIM_INFINITY);
 
3935
 
 
3936
        nih_list_free (&job->entry);
 
3937
 
 
3938
 
 
3939
        /* Check that the soft resource limit can be set to unlimited with
 
3940
         * a special argument of that name
 
3941
         */
 
3942
        TEST_FEATURE ("with unlimited soft limit");
 
3943
        jf = fopen (filename, "w");
 
3944
        fprintf (jf, "exec /sbin/daemon\n");
 
3945
        fprintf (jf, "limit core unlimited 20\n");
 
3946
        fclose (jf);
 
3947
 
 
3948
        job = cfg_read_job (NULL, filename, "test");
 
3949
 
 
3950
        TEST_ALLOC_SIZE (job, sizeof (Job));
 
3951
 
 
3952
        TEST_ALLOC_PARENT (job->limits[RLIMIT_CORE], job);
 
3953
        TEST_EQ (job->limits[RLIMIT_CORE]->rlim_cur, RLIM_INFINITY);
 
3954
        TEST_EQ (job->limits[RLIMIT_CORE]->rlim_max, 20);
 
3955
 
 
3956
        nih_list_free (&job->entry);
 
3957
 
 
3958
 
3919
3959
        /* Check that a limit stanza with the soft argument but no hard value
3920
3960
         * results in a syntax error.
3921
3961
         */