tests: always use the right vtable wrapper calls

Prompted by https://github.com/systemd/systemd/pull/10836#discussion_r234598868
This commit is contained in:
Lennart Poettering 2018-11-19 14:48:28 +01:00 committed by Evgeny Vereshchagin
parent 1acacd737b
commit bd7989a3d9
2 changed files with 10 additions and 10 deletions

View File

@ -153,7 +153,7 @@ static void test(Manager *m, const char *unit_name, int status_expected, int cod
assert_se(unit_name);
assert_se(manager_load_startable_unit_or_warn(m, unit_name, NULL, &unit) >= 0);
assert_se(UNIT_VTABLE(unit)->start(unit) >= 0);
assert_se(unit_start(unit) >= 0);
check(m, unit, status_expected, code_expected);
}

View File

@ -103,7 +103,7 @@ static void check_stop_unlink(Manager *m, Unit *unit, const char *test_path, con
}
}
assert_se(UNIT_VTABLE(unit)->stop(unit) >= 0);
assert_se(unit_stop(unit) >= 0);
(void) rm_rf(test_path, REMOVE_ROOT|REMOVE_PHYSICAL);
}
@ -114,7 +114,7 @@ static void test_path_exists(Manager *m) {
assert_se(m);
assert_se(manager_load_startable_unit_or_warn(m, "path-exists.path", NULL, &unit) >= 0);
assert_se(UNIT_VTABLE(unit)->start(unit) >= 0);
assert_se(unit_start(unit) >= 0);
assert_se(touch(test_path) >= 0);
@ -127,7 +127,7 @@ static void test_path_existsglob(Manager *m) {
assert_se(m);
assert_se(manager_load_startable_unit_or_warn(m, "path-existsglob.path", NULL, &unit) >= 0);
assert_se(UNIT_VTABLE(unit)->start(unit) >= 0);
assert_se(unit_start(unit) >= 0);
assert_se(touch(test_path) >= 0);
@ -144,7 +144,7 @@ static void test_path_changed(Manager *m) {
assert_se(touch(test_path) >= 0);
assert_se(manager_load_startable_unit_or_warn(m, "path-changed.path", NULL, &unit) >= 0);
assert_se(UNIT_VTABLE(unit)->start(unit) >= 0);
assert_se(unit_start(unit) >= 0);
f = fopen(test_path, "w");
assert_se(f);
@ -163,7 +163,7 @@ static void test_path_modified(Manager *m) {
assert_se(touch(test_path) >= 0);
assert_se(manager_load_startable_unit_or_warn(m, "path-modified.path", NULL, &unit) >= 0);
assert_se(UNIT_VTABLE(unit)->start(unit) >= 0);
assert_se(unit_start(unit) >= 0);
f = fopen(test_path, "w");
assert_se(f);
@ -179,7 +179,7 @@ static void test_path_unit(Manager *m) {
assert_se(m);
assert_se(manager_load_startable_unit_or_warn(m, "path-unit.path", NULL, &unit) >= 0);
assert_se(UNIT_VTABLE(unit)->start(unit) >= 0);
assert_se(unit_start(unit) >= 0);
assert_se(touch(test_path) >= 0);
@ -195,7 +195,7 @@ static void test_path_directorynotempty(Manager *m) {
assert_se(access(test_path, F_OK) < 0);
assert_se(manager_load_startable_unit_or_warn(m, "path-directorynotempty.path", NULL, &unit) >= 0);
assert_se(UNIT_VTABLE(unit)->start(unit) >= 0);
assert_se(unit_start(unit) >= 0);
/* MakeDirectory default to no */
assert_se(access(test_path, F_OK) < 0);
@ -216,7 +216,7 @@ static void test_path_makedirectory_directorymode(Manager *m) {
assert_se(access(test_path, F_OK) < 0);
assert_se(manager_load_startable_unit_or_warn(m, "path-makedirectory.path", NULL, &unit) >= 0);
assert_se(UNIT_VTABLE(unit)->start(unit) >= 0);
assert_se(unit_start(unit) >= 0);
/* Check if the directory has been created */
assert_se(access(test_path, F_OK) >= 0);
@ -227,7 +227,7 @@ static void test_path_makedirectory_directorymode(Manager *m) {
assert_se((s.st_mode & S_IRWXG) == 0040);
assert_se((s.st_mode & S_IRWXO) == 0004);
assert_se(UNIT_VTABLE(unit)->stop(unit) >= 0);
assert_se(unit_stop(unit) >= 0);
(void) rm_rf(test_path, REMOVE_ROOT|REMOVE_PHYSICAL);
}