From 8ac9ea4a910aa672c461d2fe013cbf0f205dddfe Mon Sep 17 00:00:00 2001 From: Colin Date: Mon, 6 Jan 2025 01:09:07 +0000 Subject: [PATCH] bunpen: backfill tests that cover dbus proxying in a partial sandbox --- pkgs/by-name/bunpen/integration_test | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/pkgs/by-name/bunpen/integration_test b/pkgs/by-name/bunpen/integration_test index 396c8693d..43c31f6a6 100755 --- a/pkgs/by-name/bunpen/integration_test +++ b/pkgs/by-name/bunpen/integration_test @@ -364,6 +364,25 @@ test_11_dbus_07_proxy_own() { ! bunpen --bunpen-path /nix/store dbus-test-tool echo --name="com.example.Echo1" } +test_11_dbus_08_proxy_partial_sandbox() { + dbus_daemon_setup + dbus-test-tool echo --name=com.example.Echo1 & + sleep 1 # wait for readiness + + bunpen --bunpen-path /nix/store --bunpen-cap all --bunpen-dbus-talk 'com.example.Echo1' busctl --user call com.example.Echo1 / com.example.Echo1 echo s "hello" + bunpen --bunpen-path /nix/store --bunpen-keep-ipc --bunpen-dbus-talk 'com.example.Echo1' busctl --user call com.example.Echo1 / com.example.Echo1 echo s "hello" + bunpen --bunpen-path /nix/store --bunpen-keep-net --bunpen-dbus-talk 'com.example.Echo1' busctl --user call com.example.Echo1 / com.example.Echo1 echo s "hello" + bunpen --bunpen-path /nix/store --bunpen-try-keep-users --bunpen-dbus-talk 'com.example.Echo1' busctl --user call com.example.Echo1 / com.example.Echo1 echo s "hello" + mkdir file-for-test ; + bunpen --bunpen-path /nix/store --bunpen-path file-for-test --bunpen-dbus-talk 'com.example.Echo1' busctl --user call com.example.Echo1 / com.example.Echo1 echo s "hello" + bunpen --bunpen-path /nix/store --bunpen-path /proc --bunpen-dbus-talk 'com.example.Echo1' busctl --user call com.example.Echo1 / com.example.Echo1 echo s "hello" + + # TODO: fix dbus proxying with --bunpen-keep-pid! + # i think this fails because i'm using `xdg-dbus-proxy --fd=...` to signal readiness, but that flag also causes xdg-dbus-proxy to exit when the fd is closed + # (e.g. when we `exec`!) + # bunpen --bunpen-path /nix/store --bunpen-keep-pid --bunpen-path /proc --bunpen-dbus-talk 'com.example.Echo1' busctl --user call com.example.Echo1 / com.example.Echo1 echo s "hello" +} + runTests() { local testsToRun=("$@") rc=0