Merge lp:~xnox/upstart/missing-errors into lp:upstart/async

Proposed by Dimitri John Ledkov
Status: Merged
Merged at revision: 1661
Proposed branch: lp:~xnox/upstart/missing-errors
Merge into: lp:upstart/async
Diff against target: 71 lines (+50/-0)
2 files modified
init/job_process.c (+16/-0)
init/tests/test_cgroup.c (+34/-0)
To merge this branch: bzr merge lp:~xnox/upstart/missing-errors
Reviewer Review Type Date Requested Status
James Hunt Approve
Review via email: mp+221897@code.launchpad.net
To post a comment you must log in.
Revision history for this message
James Hunt (jamesodhunt) wrote :

LGTM.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'init/job_process.c'
--- init/job_process.c 2014-06-02 20:29:33 +0000
+++ init/job_process.c 2014-06-03 14:53:11 +0000
@@ -1236,6 +1236,22 @@
1236 err, _("unable to switch security profile: %s"),1236 err, _("unable to switch security profile: %s"),
1237 strerror (err->errnum)));1237 strerror (err->errnum)));
1238 break;1238 break;
1239 case JOB_PROCESS_ERROR_CGROUP_MGR_CONNECT:
1240 err->error.message = NIH_MUST (nih_sprintf (
1241 err, _("unable to connect to CGManager: %s"),
1242 strerror (err->errnum)));
1243 break;
1244 case JOB_PROCESS_ERROR_CGROUP_SETUP:
1245 err->error.message = NIH_MUST (nih_sprintf (
1246 err, _("unable to setup cgroup: %s"),
1247 strerror (err->errnum)));
1248 break;
1249 case JOB_PROCESS_ERROR_CGROUP_ENTER:
1250 err->error.message = NIH_MUST (nih_sprintf (
1251 err, _("unable to enter cgroup: %s"),
1252 strerror (err->errnum)));
1253 break;
1254
1239 default:1255 default:
1240 nih_assert_not_reached ();1256 nih_assert_not_reached ();
1241 }1257 }
12421258
=== modified file 'init/tests/test_cgroup.c'
--- init/tests/test_cgroup.c 2014-05-13 09:03:14 +0000
+++ init/tests/test_cgroup.c 2014-06-03 14:53:11 +0000
@@ -330,6 +330,40 @@
330 assert0 (unlink (logfile_name));330 assert0 (unlink (logfile_name));
331331
332 /*******************************************************************/332 /*******************************************************************/
333 TEST_FEATURE ("Ensure bogus cgroups don't crash init");
334
335 contents = nih_sprintf (NULL,
336 "cgroup name\n"
337 "\n"
338 "exec echo hello\n");
339 TEST_NE_P (contents, NULL);
340
341 CREATE_FILE (confdir, "cgroup-name.conf", contents);
342
343 logfile_name = NIH_MUST (nih_sprintf (NULL, "%s/%s",
344 logdir,
345 "cgroup-name.log"));
346
347 cmd = nih_sprintf (NULL, "%s status %s 2>&1", get_initctl (), "cgroup-name");
348 TEST_NE_P (cmd, NULL);
349 RUN_COMMAND (NULL, cmd, &output, &lines);
350 TEST_EQ (lines, 1);
351
352 /* job is not running yet */
353 TEST_EQ_STR (output[0], "cgroup-name stop/waiting");
354 nih_free (output);
355
356 TEST_FALSE (file_exists (logfile_name));
357
358 cmd = nih_sprintf (NULL, "%s start %s 2>&1", get_initctl (), "cgroup-name");
359 TEST_NE_P (cmd, NULL);
360 RUN_COMMAND (NULL, cmd, &output, &lines);
361 TEST_EQ (lines, 1);
362
363 TEST_EQ_STR (output[0], "initctl: Job failed to start");
364
365 DELETE_FILE (confdir, "cgroup-name.conf");
366 /*******************************************************************/
333367
334 STOP_UPSTART (upstart_pid);368 STOP_UPSTART (upstart_pid);
335 TEST_DBUS_END (dbus_pid);369 TEST_DBUS_END (dbus_pid);

Subscribers

People subscribed via source and target branches