diff options
Diffstat (limited to 'internal/outcome/run_test.go')
| -rw-r--r-- | internal/outcome/run_test.go | 56 |
1 files changed, 18 insertions, 38 deletions
diff --git a/internal/outcome/run_test.go b/internal/outcome/run_test.go index 6908cd2f..f2aa1638 100644 --- a/internal/outcome/run_test.go +++ b/internal/outcome/run_test.go @@ -27,7 +27,7 @@ import ( "hakurei.app/message" ) -func TestOutcomeMain(t *testing.T) { +func TestOutcomeRun(t *testing.T) { t.Parallel() msg := message.New(nil) msg.SwapVerbose(testing.Verbose()) @@ -67,18 +67,8 @@ func TestOutcomeMain(t *testing.T) { "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", ). - // ensureRuntimeDir - Ensure(m("/run/user/1971"), 0700). - UpdatePermType(system.User, m("/run/user/1971"), acl.Execute). - Ensure(m("/run/user/1971/hakurei"), 0700). - UpdatePermType(system.User, m("/run/user/1971/hakurei"), acl.Execute). - - // runtime - Ephemeral(system.Process, m("/run/user/1971/hakurei/aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"), 0700). - UpdatePerm(m("/run/user/1971/hakurei/aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"), acl.Execute). - - // spPulseOp - Link(m("/run/user/1971/pulse/native"), m("/run/user/1971/hakurei/aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/pulse")). + // spPipeWireOp + PipeWire(m("/tmp/hakurei.0/aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/pipewire")). // spDBusOp MustProxyDBus( @@ -106,8 +96,7 @@ func TestOutcomeMain(t *testing.T) { "GOOGLE_DEFAULT_CLIENT_ID=77185425430.apps.googleusercontent.com", "GOOGLE_DEFAULT_CLIENT_SECRET=OTJgUOQcT7lO7GsGZq2G4IlT", "HOME=/data/data/org.chromium.Chromium", - "PULSE_COOKIE=/.hakurei/pulse-cookie", - "PULSE_SERVER=unix:/run/user/1971/pulse/native", + "PIPEWIRE_REMOTE=/run/user/1971/pipewire-0", "SHELL=/run/current-system/sw/bin/zsh", "TERM=xterm-256color", "USER=chronos", @@ -144,7 +133,7 @@ func TestOutcomeMain(t *testing.T) { Tmpfs(fhs.AbsDevShm, 0, 01777). // spRuntimeOp - Tmpfs(fhs.AbsRunUser, 1<<12, 0755). + Tmpfs(fhs.AbsRunUser, xdgRuntimeDirSize, 0755). Bind(m("/tmp/hakurei.0/runtime/9"), m("/run/user/1971"), std.BindWritable). // spTmpdirOp @@ -157,9 +146,8 @@ func TestOutcomeMain(t *testing.T) { // spWaylandOp Bind(m("/tmp/hakurei.0/aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/wayland"), m("/run/user/1971/wayland-0"), 0). - // spPulseOp - Bind(m("/run/user/1971/hakurei/aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/pulse"), m("/run/user/1971/pulse/native"), 0). - Place(m("/.hakurei/pulse-cookie"), bytes.Repeat([]byte{0}, pulseCookieSizeMax)). + // spPipeWireOp + Bind(m("/tmp/hakurei.0/aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/pipewire"), m("/run/user/1971/pipewire-0"), 0). // spDBusOp Bind(m("/tmp/hakurei.0/aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/bus"), m("/run/user/1971/bus"), 0). @@ -244,7 +232,7 @@ func TestOutcomeMain(t *testing.T) { Tmpfs(hst.AbsPrivateTmp, 4096, 0755). DevWritable(m("/dev/"), true). Tmpfs(m("/dev/shm/"), 0, 01777). - Tmpfs(m("/run/user/"), 4096, 0755). + Tmpfs(m("/run/user/"), xdgRuntimeDirSize, 0755). Bind(m("/tmp/hakurei.0/runtime/0"), m("/run/user/65534"), std.BindWritable). Bind(m("/tmp/hakurei.0/tmpdir/0"), m("/tmp/"), std.BindWritable). Place(m("/etc/passwd"), []byte("chronos:x:65534:65534:Hakurei:/home/chronos:/run/current-system/sw/bin/zsh\n")). @@ -298,7 +286,7 @@ func TestOutcomeMain(t *testing.T) { }, Filter: true, }, - Enablements: hst.NewEnablements(hst.EWayland | hst.EDBus | hst.EPulse), + Enablements: hst.NewEnablements(hst.EWayland | hst.EDBus | hst.EPipeWire | hst.EPulse), Container: &hst.ContainerConfig{ Filesystem: []hst.FilesystemConfigJSON{ @@ -347,10 +335,7 @@ func TestOutcomeMain(t *testing.T) { Ensure(m("/tmp/hakurei.0/tmpdir/9"), 01700).UpdatePermType(system.User, m("/tmp/hakurei.0/tmpdir/9"), acl.Read, acl.Write, acl.Execute). Ephemeral(system.Process, m("/tmp/hakurei.0/ebf083d1b175911782d413369b64ce7c"), 0711). Wayland(m("/tmp/hakurei.0/ebf083d1b175911782d413369b64ce7c/wayland"), m("/run/user/1971/wayland-0"), "org.chromium.Chromium", "ebf083d1b175911782d413369b64ce7c"). - Ensure(m("/run/user/1971"), 0700).UpdatePermType(system.User, m("/run/user/1971"), acl.Execute). // this is ordered as is because the previous Ensure only calls mkdir if XDG_RUNTIME_DIR is unset - Ensure(m("/run/user/1971/hakurei"), 0700).UpdatePermType(system.User, m("/run/user/1971/hakurei"), acl.Execute). - Ephemeral(system.Process, m("/run/user/1971/hakurei/ebf083d1b175911782d413369b64ce7c"), 0700).UpdatePermType(system.Process, m("/run/user/1971/hakurei/ebf083d1b175911782d413369b64ce7c"), acl.Execute). - Link(m("/run/user/1971/pulse/native"), m("/run/user/1971/hakurei/ebf083d1b175911782d413369b64ce7c/pulse")). + PipeWire(m("/tmp/hakurei.0/ebf083d1b175911782d413369b64ce7c/pipewire")). MustProxyDBus(&hst.BusConfig{ Talk: []string{ "org.freedesktop.Notifications", @@ -397,8 +382,7 @@ func TestOutcomeMain(t *testing.T) { "DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/65534/bus", "DBUS_SYSTEM_BUS_ADDRESS=unix:path=/var/run/dbus/system_bus_socket", "HOME=/home/chronos", - "PULSE_COOKIE=" + hst.PrivateTmp + "/pulse-cookie", - "PULSE_SERVER=unix:/run/user/65534/pulse/native", + "PIPEWIRE_REMOTE=/run/user/65534/pipewire-0", "SHELL=/run/current-system/sw/bin/zsh", "TERM=xterm-256color", "USER=chronos", @@ -413,14 +397,13 @@ func TestOutcomeMain(t *testing.T) { Tmpfs(hst.AbsPrivateTmp, 4096, 0755). DevWritable(m("/dev/"), true). Tmpfs(m("/dev/shm/"), 0, 01777). - Tmpfs(m("/run/user/"), 4096, 0755). + Tmpfs(m("/run/user/"), xdgRuntimeDirSize, 0755). Bind(m("/tmp/hakurei.0/runtime/9"), m("/run/user/65534"), std.BindWritable). Bind(m("/tmp/hakurei.0/tmpdir/9"), m("/tmp/"), std.BindWritable). Place(m("/etc/passwd"), []byte("chronos:x:65534:65534:Hakurei:/home/chronos:/run/current-system/sw/bin/zsh\n")). Place(m("/etc/group"), []byte("hakurei:x:65534:\n")). Bind(m("/tmp/hakurei.0/ebf083d1b175911782d413369b64ce7c/wayland"), m("/run/user/65534/wayland-0"), 0). - Bind(m("/run/user/1971/hakurei/ebf083d1b175911782d413369b64ce7c/pulse"), m("/run/user/65534/pulse/native"), 0). - Place(m(hst.PrivateTmp+"/pulse-cookie"), bytes.Repeat([]byte{0}, pulseCookieSizeMax)). + Bind(m("/tmp/hakurei.0/ebf083d1b175911782d413369b64ce7c/pipewire"), m("/run/user/65534/pipewire-0"), 0). Bind(m("/tmp/hakurei.0/ebf083d1b175911782d413369b64ce7c/bus"), m("/run/user/65534/bus"), 0). Bind(m("/tmp/hakurei.0/ebf083d1b175911782d413369b64ce7c/system_bus_socket"), m("/var/run/dbus/system_bus_socket"), 0). Bind(m("/dev/dri"), m("/dev/dri"), std.BindWritable|std.BindDevice|std.BindOptional). @@ -440,7 +423,7 @@ func TestOutcomeMain(t *testing.T) { {"nixos chromium direct wayland", new(stubNixOS), &hst.Config{ ID: "org.chromium.Chromium", - Enablements: hst.NewEnablements(hst.EWayland | hst.EDBus | hst.EPulse), + Enablements: hst.NewEnablements(hst.EWayland | hst.EDBus | hst.EPipeWire | hst.EPulse), Container: &hst.ContainerConfig{ Env: nil, Filesystem: []hst.FilesystemConfigJSON{ @@ -502,9 +485,8 @@ func TestOutcomeMain(t *testing.T) { Ensure(m("/run/user/1971"), 0700).UpdatePermType(system.User, m("/run/user/1971"), acl.Execute). // this is ordered as is because the previous Ensure only calls mkdir if XDG_RUNTIME_DIR is unset Ensure(m("/run/user/1971/hakurei"), 0700).UpdatePermType(system.User, m("/run/user/1971/hakurei"), acl.Execute). UpdatePermType(hst.EWayland, m("/run/user/1971/wayland-0"), acl.Read, acl.Write, acl.Execute). - Ephemeral(system.Process, m("/run/user/1971/hakurei/8e2c76b066dabe574cf073bdb46eb5c1"), 0700).UpdatePermType(system.Process, m("/run/user/1971/hakurei/8e2c76b066dabe574cf073bdb46eb5c1"), acl.Execute). - Link(m("/run/user/1971/pulse/native"), m("/run/user/1971/hakurei/8e2c76b066dabe574cf073bdb46eb5c1/pulse")). Ephemeral(system.Process, m("/tmp/hakurei.0/8e2c76b066dabe574cf073bdb46eb5c1"), 0711). + PipeWire(m("/tmp/hakurei.0/8e2c76b066dabe574cf073bdb46eb5c1/pipewire")). MustProxyDBus(&hst.BusConfig{ Talk: []string{ "org.freedesktop.FileManager1", "org.freedesktop.Notifications", @@ -544,8 +526,7 @@ func TestOutcomeMain(t *testing.T) { "DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/1971/bus", "DBUS_SYSTEM_BUS_ADDRESS=unix:path=/var/run/dbus/system_bus_socket", "HOME=/var/lib/persist/module/hakurei/0/1", - "PULSE_COOKIE=" + hst.PrivateTmp + "/pulse-cookie", - "PULSE_SERVER=unix:/run/user/1971/pulse/native", + "PIPEWIRE_REMOTE=/run/user/1971/pipewire-0", "SHELL=/run/current-system/sw/bin/zsh", "TERM=xterm-256color", "USER=u0_a1", @@ -559,14 +540,13 @@ func TestOutcomeMain(t *testing.T) { Tmpfs(hst.AbsPrivateTmp, 4096, 0755). DevWritable(m("/dev/"), true). Tmpfs(m("/dev/shm/"), 0, 01777). - Tmpfs(m("/run/user/"), 4096, 0755). + Tmpfs(m("/run/user/"), xdgRuntimeDirSize, 0755). Bind(m("/tmp/hakurei.0/runtime/1"), m("/run/user/1971"), std.BindWritable). Bind(m("/tmp/hakurei.0/tmpdir/1"), m("/tmp/"), std.BindWritable). Place(m("/etc/passwd"), []byte("u0_a1:x:1971:100:Hakurei:/var/lib/persist/module/hakurei/0/1:/run/current-system/sw/bin/zsh\n")). Place(m("/etc/group"), []byte("hakurei:x:100:\n")). Bind(m("/run/user/1971/wayland-0"), m("/run/user/1971/wayland-0"), 0). - Bind(m("/run/user/1971/hakurei/8e2c76b066dabe574cf073bdb46eb5c1/pulse"), m("/run/user/1971/pulse/native"), 0). - Place(m(hst.PrivateTmp+"/pulse-cookie"), bytes.Repeat([]byte{0}, pulseCookieSizeMax)). + Bind(m("/tmp/hakurei.0/8e2c76b066dabe574cf073bdb46eb5c1/pipewire"), m("/run/user/1971/pipewire-0"), 0). Bind(m("/tmp/hakurei.0/8e2c76b066dabe574cf073bdb46eb5c1/bus"), m("/run/user/1971/bus"), 0). Bind(m("/tmp/hakurei.0/8e2c76b066dabe574cf073bdb46eb5c1/system_bus_socket"), m("/var/run/dbus/system_bus_socket"), 0). Bind(m("/bin"), m("/bin"), 0). |
