~jamesodhunt/upstart/bug-1089159

« back to all changes in this revision

Viewing changes to test/test_util_common.c

  • Committer: James Hunt
  • Date: 2013-10-02 08:59:20 UTC
  • Revision ID: james.hunt@ubuntu.com-20131002085920-ifwf07yh2aetu5bf
* test/test_util_common.c:
  - set_upstart_session(): Call get_initctl_binary() rather than using
    define value.
  - get_initctl(): As above.
  - get_initctl_binary(): Check that file exists for parity with
    get_upstart_binary().

Show diffs side-by-side

added added

removed removed

Lines of Context:
155
155
        if (! getenv ("XDG_RUNTIME_DIR"))
156
156
                return FALSE;
157
157
 
158
 
        cmd = nih_sprintf (NULL, "%s list-sessions 2>&1", INITCTL_BINARY);
 
158
        cmd = nih_sprintf (NULL, "%s list-sessions 2>&1", get_initctl_binary ());
159
159
        TEST_NE_P (cmd, NULL);
160
160
 
161
161
        /* We expect the list-sessions command to return a valid session
351
351
        int         ret;
352
352
 
353
353
        ret = sprintf (path, "%s %s",
354
 
                        INITCTL_BINARY,
 
354
                        get_initctl_binary (),
355
355
                        test_user_mode
356
356
                        ? "--user"
357
357
                        : "--session");
568
568
const char *
569
569
get_initctl_binary (void)
570
570
{
571
 
        return INITCTL_BINARY;
 
571
        static const char *initctl_binary = INITCTL_BINARY;
 
572
 
 
573
        TEST_TRUE (file_exists (initctl_binary));
 
574
 
 
575
        return initctl_binary;
572
576
}
573
577
 
574
578
/**