test-cgroup-mask.c revision 0d8c31ff7237149b505290652864b4e7e866b2a7
/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
/***
This file is part of systemd.
Copyright 2013 David Strauss
under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 2.1 of the License, or
(at your option) any later version.
systemd is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with systemd; If not, see <http://www.gnu.org/licenses/>.
***/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <pwd.h>
#include "manager.h"
#include "unit.h"
#include "util.h"
#include "macro.h"
#include "test-helper.h"
static int test_cgroup_mask(void) {
int r;
/* Prepare the manager. */
r = manager_new(SYSTEMD_USER, true, &m);
puts("manager_new: Permission denied. Skipping test.");
return EXIT_TEST_SKIP;
}
assert(r >= 0);
/* Load units and verify hierarchy. */
/* Verify per-unit cgroups settings. */
/* Verify aggregation of member masks */
assert(unit_get_members_mask(root) == (CGROUP_CPU | CGROUP_CPUACCT | CGROUP_BLKIO | CGROUP_MEMORY));
/* Verify aggregation of sibling masks. */
/* Verify aggregation of target masks. */
assert(unit_get_target_mask(parent) == (CGROUP_CPU | CGROUP_CPUACCT | CGROUP_BLKIO | CGROUP_MEMORY));
manager_free(m);
return 0;
}
int rc = 0;
return rc;
}