~cjwatson/upstart/state-changed

« back to all changes in this revision

Viewing changes to init/tests/test_job_process.c

  • Committer: Scott James Remnant
  • Date: 2010-02-26 15:27:14 UTC
  • Revision ID: scott@netsplit.com-20100226152714-5kfl29y93422oo5y
* init/paths.h (DEV_FD): Drop this definition, it's needless.
* init/job_process.c (job_process_run): Rather than using /dev/fd,
use /proc/self/fd which is more Linuxish and is always guaranteed to
exist when /proc is mounted - needing no symlinks.
* init/tests/test_job_process.c (test_run): Adjust test to match.

Show diffs side-by-side

added added

removed removed

Lines of Context:
2
2
 *
3
3
 * test_job_process.c - test suite for init/job_process.c
4
4
 *
5
 
 * Copyright © 2009 Canonical Ltd.
 
5
 * Copyright © 2010 Canonical Ltd.
6
6
 * Author: Scott James Remnant <scott@netsplit.com>.
7
7
 *
8
8
 * This program is free software; you can redistribute it and/or modify
519
519
        }
520
520
 
521
521
 
522
 
        if (stat ("/dev/fd", &statbuf) < 0) {
523
 
                printf ("SKIP: no /dev/fd\n");
 
522
        if (stat ("/proc/self/fd", &statbuf) < 0) {
 
523
                printf ("SKIP: no /proc/self/fd\n");
524
524
                goto no_devfd;
525
525
        }
526
526
 
527
527
        /* Check that a particularly long script is instead invoked by
528
 
         * using the /dev/fd feature, with the shell script fed to the
 
528
         * using the /proc/self/fd feature, with the shell script fed to the
529
529
         * child process by an NihIo structure.
530
530
         */
531
531
        TEST_FEATURE ("with long script");
580
580
                TEST_EQ (WEXITSTATUS (status), 0);
581
581
 
582
582
                output = fopen (filename, "r");
583
 
                TEST_FILE_EQ_N (output, "/dev/fd/");
 
583
                TEST_FILE_EQ_N (output, "/proc/self/fd/");
584
584
                TEST_FILE_EQ (output, "\n");
585
585
                TEST_FILE_END (output);
586
586
                fclose (output);