summaryrefslogtreecommitdiffstats
path: root/src/test
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2024-10-15 11:37:39 +0200
committerGitHub <noreply@github.com>2024-10-15 11:37:39 +0200
commit6f9826b6d8dd6f847174617ba9ae211e1d061375 (patch)
tree4305c3e23ed4779686a87f5f0bb39b440d6527e0 /src/test
parentMerge pull request #34769 from yuwata/machine-by-name-or-pid (diff)
parentsd-json: drop sd_json_dispatch_pid() again, as we prefer json_dispatch_pidref... (diff)
downloadsystemd-6f9826b6d8dd6f847174617ba9ae211e1d061375.tar.xz
systemd-6f9826b6d8dd6f847174617ba9ae211e1d061375.zip
Merge pull request #34723 from poettering/machined-pidref-more
machined: switch remaining Varlink overs over to use json_dispatch_pidref() and friends
Diffstat (limited to 'src/test')
-rw-r--r--src/test/test-pidref.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/test/test-pidref.c b/src/test/test-pidref.c
index 53ed10d153..7298b36596 100644
--- a/src/test/test-pidref.c
+++ b/src/test/test-pidref.c
@@ -224,4 +224,20 @@ TEST(pidref_verify) {
assert_se(pidref_verify(&pidref) == (pidref.fd >= 0));
}
+TEST(pidref_is_automatic) {
+ assert_se(!pidref_is_automatic(NULL));
+ assert_se(!pidref_is_automatic(&PIDREF_NULL));
+ assert_se(!pidref_is_automatic(&PIDREF_MAKE_FROM_PID(1)));
+ assert_se(!pidref_is_automatic(&PIDREF_MAKE_FROM_PID(getpid_cached())));
+ assert_se(pidref_is_automatic(&PIDREF_AUTOMATIC));
+
+ assert_se(!pid_is_automatic(0));
+ assert_se(!pid_is_automatic(1));
+ assert_se(!pid_is_automatic(getpid_cached()));
+ assert_se(pid_is_automatic(PID_AUTOMATIC));
+
+ assert_se(!pidref_is_set(&PIDREF_AUTOMATIC));
+ assert_se(!pid_is_valid(PID_AUTOMATIC));
+}
+
DEFINE_TEST_MAIN(LOG_DEBUG);