valeriyvdovin / rpms / systemd

Forked from rpms/systemd 4 years ago
Clone

Blame SOURCES/0381-tests-always-use-the-right-vtable-wrapper-calls.patch

4cad4c
From 9a6fa8659e7c6b18c95754e6fa9417f03b6341df Mon Sep 17 00:00:00 2001
4cad4c
From: Lennart Poettering <lennart@poettering.net>
4cad4c
Date: Mon, 19 Nov 2018 14:48:28 +0100
4cad4c
Subject: [PATCH] tests: always use the right vtable wrapper calls
4cad4c
4cad4c
Prompted by https://github.com/systemd/systemd/pull/10836#discussion_r234598868
4cad4c
4cad4c
(cherry picked from commit bd7989a3d90e5d97e09f1eef33d09b2469a79f4d)
4cad4c
4cad4c
Related: #1737283
4cad4c
---
4cad4c
 src/test/test-execute.c |  2 +-
4cad4c
 src/test/test-path.c    | 18 +++++++++---------
4cad4c
 2 files changed, 10 insertions(+), 10 deletions(-)
4cad4c
4cad4c
diff --git a/src/test/test-execute.c b/src/test/test-execute.c
4cad4c
index 0f8dc883b1..d88de52d2a 100644
4cad4c
--- a/src/test/test-execute.c
4cad4c
+++ b/src/test/test-execute.c
4cad4c
@@ -129,7 +129,7 @@ static void test(Manager *m, const char *unit_name, int status_expected, int cod
4cad4c
         assert_se(unit_name);
4cad4c
 
4cad4c
         assert_se(manager_load_startable_unit_or_warn(m, unit_name, NULL, &unit) >= 0);
4cad4c
-        assert_se(UNIT_VTABLE(unit)->start(unit) >= 0);
4cad4c
+        assert_se(unit_start(unit) >= 0);
4cad4c
         check(m, unit, status_expected, code_expected);
4cad4c
 }
4cad4c
 
4cad4c
diff --git a/src/test/test-path.c b/src/test/test-path.c
4cad4c
index 209eb2e366..3a1469ae02 100644
4cad4c
--- a/src/test/test-path.c
4cad4c
+++ b/src/test/test-path.c
4cad4c
@@ -106,7 +106,7 @@ static void check_stop_unlink(Manager *m, Unit *unit, const char *test_path, con
4cad4c
                 }
4cad4c
         }
4cad4c
 
4cad4c
-        assert_se(UNIT_VTABLE(unit)->stop(unit) >= 0);
4cad4c
+        assert_se(unit_stop(unit) >= 0);
4cad4c
         (void) rm_rf(test_path, REMOVE_ROOT|REMOVE_PHYSICAL);
4cad4c
 }
4cad4c
 
4cad4c
@@ -117,7 +117,7 @@ static void test_path_exists(Manager *m) {
4cad4c
         assert_se(m);
4cad4c
 
4cad4c
         assert_se(manager_load_startable_unit_or_warn(m, "path-exists.path", NULL, &unit) >= 0);
4cad4c
-        assert_se(UNIT_VTABLE(unit)->start(unit) >= 0);
4cad4c
+        assert_se(unit_start(unit) >= 0);
4cad4c
 
4cad4c
         assert_se(touch(test_path) >= 0);
4cad4c
 
4cad4c
@@ -130,7 +130,7 @@ static void test_path_existsglob(Manager *m) {
4cad4c
 
4cad4c
         assert_se(m);
4cad4c
         assert_se(manager_load_startable_unit_or_warn(m, "path-existsglob.path", NULL, &unit) >= 0);
4cad4c
-        assert_se(UNIT_VTABLE(unit)->start(unit) >= 0);
4cad4c
+        assert_se(unit_start(unit) >= 0);
4cad4c
 
4cad4c
         assert_se(touch(test_path) >= 0);
4cad4c
 
4cad4c
@@ -147,7 +147,7 @@ static void test_path_changed(Manager *m) {
4cad4c
         assert_se(touch(test_path) >= 0);
4cad4c
 
4cad4c
         assert_se(manager_load_startable_unit_or_warn(m, "path-changed.path", NULL, &unit) >= 0);
4cad4c
-        assert_se(UNIT_VTABLE(unit)->start(unit) >= 0);
4cad4c
+        assert_se(unit_start(unit) >= 0);
4cad4c
 
4cad4c
         f = fopen(test_path, "w");
4cad4c
         assert_se(f);
4cad4c
@@ -166,7 +166,7 @@ static void test_path_modified(Manager *m) {
4cad4c
         assert_se(touch(test_path) >= 0);
4cad4c
 
4cad4c
         assert_se(manager_load_startable_unit_or_warn(m, "path-modified.path", NULL, &unit) >= 0);
4cad4c
-        assert_se(UNIT_VTABLE(unit)->start(unit) >= 0);
4cad4c
+        assert_se(unit_start(unit) >= 0);
4cad4c
 
4cad4c
         f = fopen(test_path, "w");
4cad4c
         assert_se(f);
4cad4c
@@ -182,7 +182,7 @@ static void test_path_unit(Manager *m) {
4cad4c
         assert_se(m);
4cad4c
 
4cad4c
         assert_se(manager_load_startable_unit_or_warn(m, "path-unit.path", NULL, &unit) >= 0);
4cad4c
-        assert_se(UNIT_VTABLE(unit)->start(unit) >= 0);
4cad4c
+        assert_se(unit_start(unit) >= 0);
4cad4c
 
4cad4c
         assert_se(touch(test_path) >= 0);
4cad4c
 
4cad4c
@@ -198,7 +198,7 @@ static void test_path_directorynotempty(Manager *m) {
4cad4c
         assert_se(access(test_path, F_OK) < 0);
4cad4c
 
4cad4c
         assert_se(manager_load_startable_unit_or_warn(m, "path-directorynotempty.path", NULL, &unit) >= 0);
4cad4c
-        assert_se(UNIT_VTABLE(unit)->start(unit) >= 0);
4cad4c
+        assert_se(unit_start(unit) >= 0);
4cad4c
 
4cad4c
         /* MakeDirectory default to no */
4cad4c
         assert_se(access(test_path, F_OK) < 0);
4cad4c
@@ -219,7 +219,7 @@ static void test_path_makedirectory_directorymode(Manager *m) {
4cad4c
         assert_se(access(test_path, F_OK) < 0);
4cad4c
 
4cad4c
         assert_se(manager_load_startable_unit_or_warn(m, "path-makedirectory.path", NULL, &unit) >= 0);
4cad4c
-        assert_se(UNIT_VTABLE(unit)->start(unit) >= 0);
4cad4c
+        assert_se(unit_start(unit) >= 0);
4cad4c
 
4cad4c
         /* Check if the directory has been created */
4cad4c
         assert_se(access(test_path, F_OK) >= 0);
4cad4c
@@ -230,7 +230,7 @@ static void test_path_makedirectory_directorymode(Manager *m) {
4cad4c
         assert_se((s.st_mode & S_IRWXG) == 0040);
4cad4c
         assert_se((s.st_mode & S_IRWXO) == 0004);
4cad4c
 
4cad4c
-        assert_se(UNIT_VTABLE(unit)->stop(unit) >= 0);
4cad4c
+        assert_se(unit_stop(unit) >= 0);
4cad4c
         (void) rm_rf(test_path, REMOVE_ROOT|REMOVE_PHYSICAL);
4cad4c
 }
4cad4c