diff --git a/src/test/meson.build b/src/test/meson.build index e41233a3c8..ea9baedf93 100644 --- a/src/test/meson.build +++ b/src/test/meson.build @@ -171,6 +171,7 @@ simple_tests += files( 'test-path-lookup.c', 'test-path-util.c', 'test-percent-util.c', + 'test-pidfd-util.c', 'test-pidref.c', 'test-plymouth-util.c', 'test-pressure.c', diff --git a/src/test/test-pidfd-util.c b/src/test/test-pidfd-util.c new file mode 100644 index 0000000000..12e9b31334 --- /dev/null +++ b/src/test/test-pidfd-util.c @@ -0,0 +1,24 @@ +/* SPDX-License-Identifier: LGPL-2.1-or-later */ + +#include "errno-util.h" +#include "format-util.h" +#include "pidfd-util.h" +#include "process-util.h" +#include "tests.h" + +TEST(pidfd_get_inode_id_self_cached) { + int r; + + log_info("pid=" PID_FMT, getpid_cached()); + + uint64_t id; + r = pidfd_get_inode_id_self_cached(&id); + if (ERRNO_IS_NEG_NOT_SUPPORTED(r)) + log_info("pidfdid not supported"); + else { + assert(r >= 0); + log_info("pidfdid=%" PRIu64, id); + } +} + +DEFINE_TEST_MAIN(LOG_DEBUG); diff --git a/src/test/test-process-util.c b/src/test/test-process-util.c index e1d16165ba..4a46ffdbfc 100644 --- a/src/test/test-process-util.c +++ b/src/test/test-process-util.c @@ -27,7 +27,6 @@ #include "log.h" #include "namespace-util.h" #include "parse-util.h" -#include "pidfd-util.h" #include "pidref.h" #include "process-util.h" #include "procfs-util.h" @@ -1075,21 +1074,6 @@ TEST(pidref_from_same_root_fs) { ASSERT_OK_ZERO(pidref_from_same_root_fs(&child2, &self)); } -TEST(pidfd_get_inode_id_self_cached) { - int r; - - log_info("pid=" PID_FMT, getpid_cached()); - - uint64_t id; - r = pidfd_get_inode_id_self_cached(&id); - if (ERRNO_IS_NEG_NOT_SUPPORTED(r)) - log_info("pidfdid not supported"); - else { - assert(r >= 0); - log_info("pidfdid=%" PRIu64, id); - } -} - TEST(getenv_for_pid) { _cleanup_strv_free_ char **copy_env = NULL; pid_t pid = getpid_cached();