[systemd-devel] [PATCH 2/2] test: Make testing work on systems without or old systemd

Holger Hans Peter Freyther holger at freyther.de
Wed Jul 17 22:31:29 PDT 2013


On Thu, Jul 18, 2013 at 06:16:48AM +0200, Zbigniew Jędrzejewski-Szmek wrote:

> Can we use the STRINGIFY macro instead?

I can try.

> >          /* Note: this might actually not find anything, if systemd was
> >           * not installed before. That should be fine too. */
> > -        r = catalog_update(database, NULL, catalog_file_dirs);
> > +        r = catalog_update(database, NULL, catalog_dirs);
> OK, so now the comment either was always inaccurate, or just became inaccurate.
> Does it really fail if the catalog was not installed before?
> I wanted the case of no installed systemd to be a test for a missing catalog,
> so it was on purpose.
> 
> >          assert(r >= 0);

Yes, you will ran into this assert. We can pass a dir with ["/nonexistant"] and
stat that it is non-existant.


> Wouldn't access("/etc/machine-id", F_OK) look better, and avoid the extra
> variable?

okay.

> > -        log_info("pid1 comm: '%s'", a);
> > +        if (stat("/proc/1/comm", &st) == 0) {
> > +                assert_se(get_process_comm(1, &a) >= 0);
> > +                log_info("pid1 comm: '%s'", a);
> > +        } else {
> > +                log_info("/proc/1/comm does not exist.");
> log_warning?

I just made it match the other output level.


More information about the systemd-devel mailing list