core: Introduce ConditionPathIsSocket=

This commit is contained in:
Daan De Meyer
2026-02-23 13:08:49 +01:00
parent 54b745d7bb
commit a51e5bd1f1
6 changed files with 39 additions and 0 deletions
+2
View File
@@ -1105,6 +1105,7 @@ TEST(unit_properties) {
"ConditionPathIsMountPoint=|foo",
"ConditionPathIsReadWrite=|foo",
"ConditionPathIsEncrypted=|foo",
"ConditionPathIsSocket=|foo",
"ConditionDirectoryNotEmpty=|foo",
"ConditionFileNotEmpty=|foo",
"ConditionFileIsExecutable=|foo",
@@ -1139,6 +1140,7 @@ TEST(unit_properties) {
"AssertPathIsMountPoint=|foo",
"AssertPathIsReadWrite=|foo",
"AssertPathIsEncrypted=|foo",
"AssertPathIsSocket=|foo",
"AssertDirectoryNotEmpty=|foo",
"AssertFileNotEmpty=|foo",
"AssertFileIsExecutable=|foo",
+10
View File
@@ -110,6 +110,16 @@ TEST(condition_test_path) {
ASSERT_OK_ZERO(condition_test(condition, environ));
condition_free(condition);
if (access("/run/dbus/system_bus_socket", F_OK) >= 0) {
ASSERT_NOT_NULL((condition = condition_new(CONDITION_PATH_IS_SOCKET, "/run/dbus/system_bus_socket", false, false)));
ASSERT_OK_POSITIVE(condition_test(condition, environ));
condition_free(condition);
}
ASSERT_NOT_NULL((condition = condition_new(CONDITION_PATH_IS_SOCKET, "/sys", false, false)));
ASSERT_OK_ZERO(condition_test(condition, environ));
condition_free(condition);
ASSERT_NOT_NULL((condition = condition_new(CONDITION_PATH_IS_SYMBOLIC_LINK, "/dev/stdout", false, false)));
ASSERT_OK_POSITIVE(condition_test(condition, environ));
condition_free(condition);