[systemd-devel] [PATCH] Added test for unit file state returned by unit_file_get_state and unit_file_get_list.
Zbigniew Jędrzejewski-Szmek
zbyszek at in.waw.pl
Sun Oct 5 14:27:24 PDT 2014
On Fri, Oct 03, 2014 at 04:03:14PM -0700, Ken Sedgwick wrote:
> +const char *subdir = "/test-enabled-root";
> +char root_dir[UNIT_NAME_MAX + 2 + 1] = TEST_DIR;
> +
> +#define confirm_unit_state(unit, expected) \
> + assert_se(unit_file_get_state(UNIT_FILE_SYSTEM, root_dir,
> unit) == expected)
> +
> +static void test_enabled(int argc, char* argv[]) {
> + Hashmap *h;
> + UnitFileList *p;
> + Iterator i;
> + int r;
> +
> + strncat(root_dir, subdir, strlen(subdir));
This is safe, but ungainly. Why not just:
const char *root_dir;
root_dir = strappenda(TEST_DIR, "/test-enabled-root");
Test looks useful, but like David wrote, can you please remove the non-essential
bits from the service files?
Zbyszek
More information about the systemd-devel
mailing list