bunpen: backfill tests that cover dbus proxying in a partial sandbox

This commit is contained in:
2025-01-06 01:09:07 +00:00
parent 94ffab5874
commit 8ac9ea4a91

View File

@@ -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