]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
test: add missing varlink IDL enum tests for Job and ServiceType
authorIvan Kruglov <mail@ikruglov.com>
Thu, 7 May 2026 09:16:51 +0000 (02:16 -0700)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Fri, 8 May 2026 15:22:04 +0000 (17:22 +0200)
PR #41583 (io.systemd.Unit.StartTransient) introduced several new varlink IDL enum types without corresponding enum consistency tests:

- JobType, JobState, JobResult in the new io.systemd.Job interface
- ServiceType in the Unit interface's ServiceContext

Add a new test-varlink-idl-job test file covering all three Job enums, and add ServiceType coverage to the existing test-varlink-idl-unit test. Export vl_type_ServiceType (was static) so it can be referenced from the test.

Co-developed-by: Claude Opus 4.6 <noreply@anthropic.com>
src/shared/varlink-io.systemd.Unit.c
src/shared/varlink-io.systemd.Unit.h
src/test/meson.build
src/test/test-varlink-idl-job.c [new file with mode: 0644]
src/test/test-varlink-idl-unit.c

index 2b1f0f2b1058b67cd84ed3255ff9951163b1ca24..be5c942fcc717d92d54600774cec7b65dc6f5794 100644 (file)
@@ -976,7 +976,7 @@ static SD_VARLINK_DEFINE_STRUCT_TYPE(
 /* Service-specific types */
 
 /* Keep in sync with service_type_table[] in src/core/service.c */
-static SD_VARLINK_DEFINE_ENUM_TYPE(
+SD_VARLINK_DEFINE_ENUM_TYPE(
                 ServiceType,
                 SD_VARLINK_DEFINE_ENUM_VALUE(simple),
                 SD_VARLINK_DEFINE_ENUM_VALUE(exec),
index a39407133844ceed509247d4c28613cc2f8285cf..f12ac60701ee65116f205a82febb755e1507b9b3 100644 (file)
@@ -32,3 +32,4 @@ extern const sd_varlink_symbol vl_type_AutomountResult;
 extern const sd_varlink_symbol vl_type_MountResult;
 extern const sd_varlink_symbol vl_type_CollectMode;
 extern const sd_varlink_symbol vl_type_JobMode;
+extern const sd_varlink_symbol vl_type_ServiceType;
index f4288119f94ba874e884f7bd027a32003da89fd3..828e309c19ef4edf0c4465c6697f410e81cd44be 100644 (file)
@@ -491,11 +491,14 @@ executables += [
                 'conditions' : ['ENABLE_UTMP'],
         },
         core_test_template + {
-                'sources' : files('test-varlink-idl-unit.c'),
+                'sources' : files('test-varlink-idl-job.c'),
         },
         core_test_template + {
                 'sources' : files('test-varlink-idl-manager.c'),
         },
+        core_test_template + {
+                'sources' : files('test-varlink-idl-unit.c'),
+        },
         test_template + {
                 'sources' : files('test-varlink-idl-machine.c'),
                 'objects' : ['systemd-machined'],
diff --git a/src/test/test-varlink-idl-job.c b/src/test/test-varlink-idl-job.c
new file mode 100644 (file)
index 0000000..23c75d5
--- /dev/null
@@ -0,0 +1,14 @@
+/* SPDX-License-Identifier: LGPL-2.1-or-later */
+
+#include "job.h"
+#include "tests.h"
+#include "test-varlink-idl-util.h"
+#include "varlink-io.systemd.Job.h"
+
+TEST(job_enums_idl) {
+        TEST_IDL_ENUM(JobType, job_type, vl_type_JobType);
+        TEST_IDL_ENUM(JobState, job_state, vl_type_JobState);
+        TEST_IDL_ENUM(JobResult, job_result, vl_type_JobResult);
+}
+
+DEFINE_TEST_MAIN(LOG_DEBUG);
index 28b49a06592585766cf483d853bcd67eed9a77b9..2469859411931182c346453a56281a5c281a2af0 100644 (file)
@@ -7,6 +7,7 @@
 #include "mount.h"
 #include "numa-util.h"
 #include "process-util.h"
+#include "service.h"
 #include "tests.h"
 #include "test-varlink-idl-util.h"
 #include "unit.h"
@@ -59,6 +60,9 @@ TEST(unit_enums_idl) {
         /* MountRuntime enums */
         TEST_IDL_ENUM(MountResult, mount_result, vl_type_MountResult);
 
+        /* ServiceContext enums */
+        TEST_IDL_ENUM(ServiceType, service_type, vl_type_ServiceType);
+
         /* UnitContext enums */
         TEST_IDL_ENUM(CollectMode, collect_mode, vl_type_CollectMode);
         TEST_IDL_ENUM(EmergencyAction, emergency_action, vl_type_EmergencyAction);