test: exercise PipeWire controls with an emulated sound card
This commit is contained in:
+3
-16
@@ -35,6 +35,9 @@ pkgs.testers.runNixOSTest {
|
|||||||
};
|
};
|
||||||
qemu.options = [
|
qemu.options = [
|
||||||
"-vga none"
|
"-vga none"
|
||||||
|
"-audiodev none,id=test-audio"
|
||||||
|
"-device ich9-intel-hda"
|
||||||
|
"-device hda-duplex,audiodev=test-audio"
|
||||||
"-device virtio-gpu${if hostRenderNode == null then "" else "-gl"}-pci,xres=1920,yres=1080"
|
"-device virtio-gpu${if hostRenderNode == null then "" else "-gl"}-pci,xres=1920,yres=1080"
|
||||||
]
|
]
|
||||||
++ pkgs.lib.optionals (hostRenderNode != null) [
|
++ pkgs.lib.optionals (hostRenderNode != null) [
|
||||||
@@ -50,7 +53,6 @@ pkgs.testers.runNixOSTest {
|
|||||||
LIBGL_ALWAYS_SOFTWARE = "1";
|
LIBGL_ALWAYS_SOFTWARE = "1";
|
||||||
LP_NUM_THREADS = "1";
|
LP_NUM_THREADS = "1";
|
||||||
};
|
};
|
||||||
environment.systemPackages = [ pkgs.python3 ];
|
|
||||||
users.users.dev.hashedPasswordFile = toString (
|
users.users.dev.hashedPasswordFile = toString (
|
||||||
pkgs.runCommand "test-only-password-hash" { nativeBuildInputs = [ pkgs.mkpasswd ]; } ''
|
pkgs.runCommand "test-only-password-hash" { nativeBuildInputs = [ pkgs.mkpasswd ]; } ''
|
||||||
mkpasswd --method=sha-512 --salt=nixostest desktop-test > "$out"
|
mkpasswd --method=sha-512 --salt=nixostest desktop-test > "$out"
|
||||||
@@ -60,21 +62,6 @@ pkgs.testers.runNixOSTest {
|
|||||||
user = "dev";
|
user = "dev";
|
||||||
command = "${pkgs.uwsm}/bin/uwsm start -e -D Hyprland hyprland.desktop";
|
command = "${pkgs.uwsm}/bin/uwsm start -e -D Hyprland hyprland.desktop";
|
||||||
};
|
};
|
||||||
services.pipewire.extraConfig.pipewire."99-test-audio"."context.objects" = [
|
|
||||||
{
|
|
||||||
factory = "adapter";
|
|
||||||
args = {
|
|
||||||
"factory.name" = "support.null-audio-sink";
|
|
||||||
"node.name" = "test-speakers";
|
|
||||||
"node.description" = "Test speakers";
|
|
||||||
"media.class" = "Audio/Sink";
|
|
||||||
"audio.position" = [
|
|
||||||
"FL"
|
|
||||||
"FR"
|
|
||||||
];
|
|
||||||
};
|
|
||||||
}
|
|
||||||
];
|
|
||||||
};
|
};
|
||||||
testScript = builtins.readFile ./desktop-test.py;
|
testScript = builtins.readFile ./desktop-test.py;
|
||||||
}
|
}
|
||||||
|
|||||||
+7
-1
@@ -65,7 +65,13 @@ assert "Inter" in user("fc-match Inter")
|
|||||||
# Pi's real --version is checked natively; avoid costly Node startup under TCG.
|
# Pi's real --version is checked natively; avoid costly Node startup under TCG.
|
||||||
user("test -x /run/current-system/sw/bin/pi")
|
user("test -x /run/current-system/sw/bin/pi")
|
||||||
assert "zsh" in user("getent passwd dev")
|
assert "zsh" in user("getent passwd dev")
|
||||||
assert "test-speakers" in session("wpctl status --name")
|
# QEMU emulates HDA with a silent host backend; exercise real ALSA/PipeWire nodes.
|
||||||
|
machine.wait_until_succeeds(in_session("wpctl inspect @DEFAULT_AUDIO_SINK@ | grep -q alsa_output"), timeout=90)
|
||||||
|
session("wpctl set-volume @DEFAULT_AUDIO_SINK@ 0.42")
|
||||||
|
assert "0.42" in session("wpctl get-volume @DEFAULT_AUDIO_SINK@")
|
||||||
|
session("wpctl set-mute @DEFAULT_AUDIO_SOURCE@ 1")
|
||||||
|
assert "MUTED" in session("wpctl get-volume @DEFAULT_AUDIO_SOURCE@")
|
||||||
|
session("wpctl set-mute @DEFAULT_AUDIO_SOURCE@ 0")
|
||||||
machine.succeed("systemctl is-active systemd-resolved")
|
machine.succeed("systemctl is-active systemd-resolved")
|
||||||
|
|
||||||
launch("terminal", "kitty --title 'Workspace ready' sh -c " + shlex.quote(
|
launch("terminal", "kitty --title 'Workspace ready' sh -c " + shlex.quote(
|
||||||
|
|||||||
Reference in New Issue
Block a user