From 92945bf3d772d7cfe28052204dfe68f60a39e9c8 Mon Sep 17 00:00:00 2001 From: Guillem Jover Date: Sat, 26 Aug 2023 14:01:37 +0200 Subject: [PATCH] test: Move test_data_file() to test.h This function is generally useful for tests so that they can use data files. --- lib/dpkg/t/t-meminfo.c | 13 ------------- lib/dpkg/test.h | 13 +++++++++++++ 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/lib/dpkg/t/t-meminfo.c b/lib/dpkg/t/t-meminfo.c index b231081c6..0c3e63551 100644 --- a/lib/dpkg/t/t-meminfo.c +++ b/lib/dpkg/t/t-meminfo.c @@ -24,19 +24,6 @@ #include #include -static char * -test_data_file(const char *filename) -{ - char *pathname; - int rc; - - rc = asprintf(&pathname, "%s/t/data/%s", test_get_srcdir(), filename); - if (rc < 0) - test_bail("cannot allocate data filename"); - - return pathname; -} - static void test_meminfo(void) { diff --git a/lib/dpkg/test.h b/lib/dpkg/test.h index 1e3dce9f4..7bc0af12c 100644 --- a/lib/dpkg/test.h +++ b/lib/dpkg/test.h @@ -83,6 +83,19 @@ test_get_envdir(const char *envvar) #define test_get_builddir() \ test_get_envdir("builddir") +static inline char * +test_data_file(const char *filename) +{ + char *pathname; + int rc; + + rc = asprintf(&pathname, "%s/t/data/%s", test_get_srcdir(), filename); + if (rc < 0) + test_bail("cannot allocate data filename"); + + return pathname; +} + static inline bool test_is_verbose(void) { -- 2.11.4.GIT