varlink-idl: add infra to test our enum parsers against varlink IDL enums

In many cases we want to expose enums for which we have the usual
xyz_to_string()/xyz_from_string() via Varlink as enums. Let's add some
infra to test the tables against each other, to automatically detect
when they deviate.

In order to implement this properly, let's export/introduce clean
json_underscorefy()/json_dashify(), for dealing with the fact that our
enums usually use dash separates ames, but Varlink doesn't allow that.

(This does not add the test cases for all enum types we expose right
now, but only adds the general infra).
This commit is contained in:
Lennart Poettering
2025-11-04 11:46:17 +00:00
committed by Luca Boccassi
parent 79dd24cf14
commit 030f239a19
7 changed files with 86 additions and 8 deletions
@@ -3,7 +3,7 @@
#include "bus-polkit.h"
#include "varlink-io.systemd.MountFileSystem.h"
static SD_VARLINK_DEFINE_ENUM_TYPE(
SD_VARLINK_DEFINE_ENUM_TYPE(
PartitionDesignator,
SD_VARLINK_DEFINE_ENUM_VALUE(root),
SD_VARLINK_DEFINE_ENUM_VALUE(usr),