test-install.c revision 0ec0deaa30d0e68430f03fa6f32affa576481d18
/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
/***
This file is part of systemd.
Copyright 2011 Lennart Poettering
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 <string.h>
#include <stdio.h>
#include "install.h"
static void dump_changes(UnitFileChange *c, unsigned n) {
unsigned i;
assert_se(n == 0 || c);
for (i = 0; i < n; i++) {
if (c[i].type == UNIT_FILE_UNLINK)
else if (c[i].type == UNIT_FILE_SYMLINK)
}
}
Hashmap *h;
UnitFileList *p;
Iterator i;
int r;
unsigned n_changes = 0;
UnitFileState state = 0;
h = hashmap_new(&string_hash_ops);
assert_se(r == 0);
HASHMAP_FOREACH(p, h, i) {
(p->state == s));
p->path,
}
log_error("enable");
assert_se(r >= 0);
log_error("enable2");
assert_se(r >= 0);
assert_se(r >= 0);
log_error("disable");
n_changes = 0;
assert_se(r >= 0);
assert_se(r >= 0);
log_error("mask");
n_changes = 0;
assert_se(r >= 0);
log_error("mask2");
assert_se(r >= 0);
assert_se(r >= 0);
log_error("unmask");
n_changes = 0;
assert_se(r >= 0);
log_error("unmask2");
assert_se(r >= 0);
assert_se(r >= 0);
log_error("mask");
n_changes = 0;
assert_se(r >= 0);
assert_se(r >= 0);
log_error("disable");
n_changes = 0;
assert_se(r >= 0);
log_error("disable2");
assert_se(r >= 0);
assert_se(r >= 0);
log_error("umask");
n_changes = 0;
assert_se(r >= 0);
assert_se(r >= 0);
log_error("enable files2");
n_changes = 0;
assert_se(r >= 0);
assert_se(r >= 0);
log_error("disable files2");
n_changes = 0;
r = unit_file_disable(UNIT_FILE_SYSTEM, false, NULL, STRV_MAKE(basename(files2[0])), &changes, &n_changes);
assert_se(r >= 0);
assert_se(r < 0);
log_error("link files2");
n_changes = 0;
assert_se(r >= 0);
assert_se(r >= 0);
log_error("disable files2");
n_changes = 0;
r = unit_file_disable(UNIT_FILE_SYSTEM, false, NULL, STRV_MAKE(basename(files2[0])), &changes, &n_changes);
assert_se(r >= 0);
assert_se(r < 0);
log_error("link files2");
n_changes = 0;
assert_se(r >= 0);
assert_se(r >= 0);
log_error("reenable files2");
n_changes = 0;
r = unit_file_reenable(UNIT_FILE_SYSTEM, false, NULL, (char**) files2, false, &changes, &n_changes);
assert_se(r >= 0);
assert_se(r >= 0);
log_error("disable files2");
n_changes = 0;
r = unit_file_disable(UNIT_FILE_SYSTEM, false, NULL, STRV_MAKE(basename(files2[0])), &changes, &n_changes);
assert_se(r >= 0);
assert_se(r < 0);
log_error("preset files");
n_changes = 0;
r = unit_file_preset(UNIT_FILE_SYSTEM, false, NULL, (char**) files, UNIT_FILE_PRESET_FULL, false, &changes, &n_changes);
assert_se(r >= 0);
assert_se(r >= 0);
return 0;
}