1331
/* Check that if the process is restarting, and died when we killed
1332
* it, the goal remains as start and a state change is still
1333
* transitioned. This should also not be considered a failure.
1335
TEST_FEATURE ("with restarting process");
1337
NihTimer *timer = NULL;
1340
job = job_new (class, "");
1342
blocked = blocked_new (job, BLOCKED_EVENT, event);
1343
event_block (event);
1344
nih_list_add (&job->blocking, &blocked->entry);
1347
job->goal = JOB_START;
1348
job->state = JOB_KILLED;
1349
job->pid[PROCESS_MAIN] = 1;
1351
TEST_FREE_TAG (blocked);
1353
job->blocker = NULL;
1354
event->failed = FALSE;
1356
job->failed = FALSE;
1357
job->failed_process = -1;
1358
job->exit_status = 0;
1361
timer = (void *) nih_strdup (job, "test");
1364
TEST_FREE_TAG (timer);
1365
job->kill_timer = timer;
1367
job_process_handler (NULL, 1, NIH_CHILD_EXITED, 0);
1371
TEST_EQ (job->goal, JOB_START);
1372
TEST_EQ (job->state, JOB_STARTING);
1373
TEST_EQ (job->pid[PROCESS_MAIN], 0);
1375
TEST_EQ (event->blockers, 1);
1376
TEST_EQ (event->failed, FALSE);
1378
TEST_LIST_NOT_EMPTY (&job->blocking);
1379
TEST_NOT_FREE (blocked);
1380
TEST_EQ_P (blocked->event, event);
1381
event_unblock (event);
1383
TEST_NE_P (job->blocker, NULL);
1385
TEST_LIST_NOT_EMPTY (&job->blocker->blocking);
1387
blocked = (Blocked *)job->blocker->blocking.next;
1388
TEST_ALLOC_SIZE (blocked, sizeof (Blocked));
1389
TEST_ALLOC_PARENT (blocked, job->blocker);
1390
TEST_EQ (blocked->type, BLOCKED_JOB);
1391
TEST_EQ_P (blocked->job, job);
1394
TEST_LIST_EMPTY (&job->blocker->blocking);
1396
TEST_EQ (job->failed, FALSE);
1397
TEST_EQ (job->failed_process, -1);
1398
TEST_EQ (job->exit_status, 0);
1331
1404
/* Check that we can handle the pre-start process of the job exiting,
1332
1405
* and if it terminates with a good error code, end up in the running