From: Ivan Kruglov Date: Tue, 12 May 2026 15:55:08 +0000 (-0700) Subject: test: add SocketContext/Runtime enum and integration tests X-Git-Tag: v261-rc1~174^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=cf6e46c863af63b8eef18eae0258adb8e7f55cfd;p=thirdparty%2Fsystemd.git test: add SocketContext/Runtime enum and integration tests Co-developed-by: Claude Opus 4.6 --- diff --git a/src/test/test-varlink-idl-unit.c b/src/test/test-varlink-idl-unit.c index e03f5edff5a..7859f2d7359 100644 --- a/src/test/test-varlink-idl-unit.c +++ b/src/test/test-varlink-idl-unit.c @@ -10,6 +10,7 @@ #include "process-util.h" #include "scope.h" #include "service.h" +#include "socket.h" #include "swap.h" #include "tests.h" #include "test-varlink-idl-util.h" @@ -76,6 +77,14 @@ TEST(unit_enums_idl) { /* ScopeRuntime enums */ TEST_IDL_ENUM(ScopeResult, scope_result, vl_type_ScopeResult); + /* SocketContext enums */ + TEST_IDL_ENUM(SocketAddressBindIPv6Only, socket_address_bind_ipv6_only, vl_type_SocketBindIPv6Only); + TEST_IDL_ENUM(SocketTimestamping, socket_timestamping, vl_type_SocketTimestamping); + TEST_IDL_ENUM(SocketDeferTrigger, socket_defer_trigger, vl_type_SocketDeferTrigger); + + /* SocketRuntime enums */ + TEST_IDL_ENUM(SocketResult, socket_result, vl_type_SocketResult); + /* SwapRuntime enums */ TEST_IDL_ENUM(SwapResult, swap_result, vl_type_SwapResult); diff --git a/test/units/TEST-74-AUX-UTILS.varlinkctl.sh b/test/units/TEST-74-AUX-UTILS.varlinkctl.sh index 3e78cf34e9e..de56b37c315 100755 --- a/test/units/TEST-74-AUX-UTILS.varlinkctl.sh +++ b/test/units/TEST-74-AUX-UTILS.varlinkctl.sh @@ -258,6 +258,12 @@ test -n "$scope_id" scope_params=$(jq -cn --arg name "$scope_id" '{name: $name}') varlinkctl call /run/systemd/io.systemd.Manager io.systemd.Unit.List "$scope_params" | jq -e '.context.Scope' varlinkctl call /run/systemd/io.systemd.Manager io.systemd.Unit.List "$scope_params" | jq -e '.runtime.Scope' +# test for SocketContext/Runtime +socket_id=$(varlinkctl call --collect /run/systemd/io.systemd.Manager io.systemd.Unit.List '{}' | jq -r '.[] | select(.context.Type == "socket" and .runtime.LoadState == "loaded") .context.ID // empty' | tail -n 1) +test -n "$socket_id" +socket_params=$(jq -cn --arg name "$socket_id" '{name: $name}') +varlinkctl call /run/systemd/io.systemd.Manager io.systemd.Unit.List "$socket_params" | jq -e '.context.Socket' +varlinkctl call /run/systemd/io.systemd.Manager io.systemd.Unit.List "$socket_params" | jq -e '.runtime.Socket' # test for SwapContext/Runtime (swap units may not be present on all systems) swap_id=$(varlinkctl call --collect /run/systemd/io.systemd.Manager io.systemd.Unit.List '{}' | jq -r '.[] | select(.context.Type == "swap" and .runtime.LoadState == "loaded") .context.ID // empty' | tail -n 1) if test -n "$swap_id"; then