diff options
author | Filipe Brandenburger <filbranden@google.com> | 2018-09-12 08:15:09 +0200 |
---|---|---|
committer | Filipe Brandenburger <filbranden@google.com> | 2018-09-12 18:49:03 +0200 |
commit | 55890a40c3ec0c061c04d1395a38c26313132d12 (patch) | |
tree | 93b3f267b25b6bc894d72e6e52cdafde89674dd0 /src/test/test-umount.c | |
parent | Set theme jekyll-theme-slate (diff) | |
download | systemd-55890a40c3ec0c061c04d1395a38c26313132d12.tar.xz systemd-55890a40c3ec0c061c04d1395a38c26313132d12.zip |
test: remove support for suffix in get_testdata_dir()
Instead, use path_join() in callers wherever needed.
Diffstat (limited to 'src/test/test-umount.c')
-rw-r--r-- | src/test/test-umount.c | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/src/test/test-umount.c b/src/test/test-umount.c index 770d1a73c8..c068f7a0f0 100644 --- a/src/test/test-umount.c +++ b/src/test/test-umount.c @@ -1,6 +1,8 @@ /* SPDX-License-Identifier: LGPL-2.1+ */ +#include "alloc-util.h" #include "log.h" +#include "path-util.h" #include "string-util.h" #include "tests.h" #include "umount.h" @@ -8,10 +10,14 @@ static void test_mount_points_list(const char *fname) { _cleanup_(mount_points_list_free) LIST_HEAD(MountPoint, mp_list_head); + _cleanup_free_ char *testdata_fname = NULL; MountPoint *m; log_info("/* %s(\"%s\") */", __func__, fname ?: "/proc/self/mountinfo"); + if (fname) + fname = testdata_fname = path_join(NULL, get_testdata_dir(), fname); + LIST_HEAD_INIT(mp_list_head); assert_se(mount_points_list_get(fname, &mp_list_head) >= 0); @@ -26,10 +32,14 @@ static void test_mount_points_list(const char *fname) { static void test_swap_list(const char *fname) { _cleanup_(mount_points_list_free) LIST_HEAD(MountPoint, mp_list_head); + _cleanup_free_ char *testdata_fname = NULL; MountPoint *m; log_info("/* %s(\"%s\") */", __func__, fname ?: "/proc/swaps"); + if (fname) + fname = testdata_fname = path_join(NULL, get_testdata_dir(), fname); + LIST_HEAD_INIT(mp_list_head); assert_se(swap_list_get(fname, &mp_list_head) >= 0); @@ -48,10 +58,10 @@ int main(int argc, char **argv) { log_open(); test_mount_points_list(NULL); - test_mount_points_list(get_testdata_dir("/test-umount/empty.mountinfo")); - test_mount_points_list(get_testdata_dir("/test-umount/garbled.mountinfo")); - test_mount_points_list(get_testdata_dir("/test-umount/rhbug-1554943.mountinfo")); + test_mount_points_list("/test-umount/empty.mountinfo"); + test_mount_points_list("/test-umount/garbled.mountinfo"); + test_mount_points_list("/test-umount/rhbug-1554943.mountinfo"); test_swap_list(NULL); - test_swap_list(get_testdata_dir("/test-umount/example.swaps")); + test_swap_list("/test-umount/example.swaps"); } |