nixosTests.xrdp-with-audio-pulseaudio: migrate to runTest
Part Of #386873
This commit is contained in:
@@ -1293,7 +1293,7 @@ in {
|
|||||||
xmonad-xdg-autostart = handleTest ./xmonad-xdg-autostart.nix {};
|
xmonad-xdg-autostart = handleTest ./xmonad-xdg-autostart.nix {};
|
||||||
xpadneo = handleTest ./xpadneo.nix {};
|
xpadneo = handleTest ./xpadneo.nix {};
|
||||||
xrdp = handleTest ./xrdp.nix {};
|
xrdp = handleTest ./xrdp.nix {};
|
||||||
xrdp-with-audio-pulseaudio = handleTest ./xrdp-with-audio-pulseaudio.nix {};
|
xrdp-with-audio-pulseaudio = runTest ./xrdp-with-audio-pulseaudio.nix;
|
||||||
xscreensaver = handleTest ./xscreensaver.nix {};
|
xscreensaver = handleTest ./xscreensaver.nix {};
|
||||||
xss-lock = runTest ./xss-lock.nix;
|
xss-lock = runTest ./xss-lock.nix;
|
||||||
xterm = runTest ./xterm.nix;
|
xterm = runTest ./xterm.nix;
|
||||||
|
|||||||
@@ -1,110 +1,108 @@
|
|||||||
import ./make-test-python.nix (
|
{ pkgs, ... }:
|
||||||
{ pkgs, ... }:
|
{
|
||||||
{
|
# How to interactively test this module if the audio actually works
|
||||||
# How to interactively test this module if the audio actually works
|
|
||||||
|
|
||||||
# - nix run .#pulseaudio-module-xrdp.tests.xrdp-with-audio-pulseaudio.driverInteractive
|
# - nix run .#pulseaudio-module-xrdp.tests.xrdp-with-audio-pulseaudio.driverInteractive
|
||||||
# - test_script() # launches the terminal and the tests itself
|
# - test_script() # launches the terminal and the tests itself
|
||||||
# - server.send_monitor_command("hostfwd_add tcp::3389-:3389") # forward the RDP port to the host
|
# - server.send_monitor_command("hostfwd_add tcp::3389-:3389") # forward the RDP port to the host
|
||||||
# - Connect with the RDP client you like (ex: Remmina)
|
# - Connect with the RDP client you like (ex: Remmina)
|
||||||
# - Don't forget to enable audio support. In remmina: Advanced -> Audio output mode to Local (default is Off)
|
# - Don't forget to enable audio support. In remmina: Advanced -> Audio output mode to Local (default is Off)
|
||||||
# - Open a browser or something that plays sound. Ex: chromium
|
# - Open a browser or something that plays sound. Ex: chromium
|
||||||
|
|
||||||
name = "xrdp-with-audio-pulseaudio";
|
name = "xrdp-with-audio-pulseaudio";
|
||||||
meta = with pkgs.lib.maintainers; {
|
meta = with pkgs.lib.maintainers; {
|
||||||
maintainers = [ lucasew ];
|
maintainers = [ lucasew ];
|
||||||
};
|
};
|
||||||
|
|
||||||
nodes = {
|
nodes = {
|
||||||
server =
|
server =
|
||||||
{ pkgs, ... }:
|
{ pkgs, ... }:
|
||||||
{
|
{
|
||||||
imports = [ ./common/user-account.nix ];
|
imports = [ ./common/user-account.nix ];
|
||||||
|
|
||||||
environment.etc."xrdp/test.txt".text = "Shouldn't conflict";
|
environment.etc."xrdp/test.txt".text = "Shouldn't conflict";
|
||||||
|
|
||||||
services.xrdp.enable = true;
|
services.xrdp.enable = true;
|
||||||
services.xrdp.audio.enable = true;
|
services.xrdp.audio.enable = true;
|
||||||
services.xrdp.defaultWindowManager = "${pkgs.xterm}/bin/xterm";
|
services.xrdp.defaultWindowManager = "${pkgs.xterm}/bin/xterm";
|
||||||
|
|
||||||
services.pulseaudio = {
|
services.pulseaudio = {
|
||||||
enable = true;
|
enable = true;
|
||||||
};
|
};
|
||||||
|
|
||||||
systemd.user.services.pactl-list = {
|
systemd.user.services.pactl-list = {
|
||||||
script = ''
|
script = ''
|
||||||
while [ ! -S /tmp/.xrdp/xrdp_chansrv_audio_in_socket_* ]; do
|
while [ ! -S /tmp/.xrdp/xrdp_chansrv_audio_in_socket_* ]; do
|
||||||
sleep 1
|
|
||||||
done
|
|
||||||
sleep 1
|
sleep 1
|
||||||
${pkgs.pulseaudio}/bin/pactl list
|
done
|
||||||
echo Source:
|
sleep 1
|
||||||
${pkgs.pulseaudio}/bin/pactl get-default-source | tee /tmp/pulseaudio-source
|
${pkgs.pulseaudio}/bin/pactl list
|
||||||
echo Sink:
|
echo Source:
|
||||||
${pkgs.pulseaudio}/bin/pactl get-default-sink | tee /tmp/pulseaudio-sink
|
${pkgs.pulseaudio}/bin/pactl get-default-source | tee /tmp/pulseaudio-source
|
||||||
|
echo Sink:
|
||||||
|
${pkgs.pulseaudio}/bin/pactl get-default-sink | tee /tmp/pulseaudio-sink
|
||||||
|
|
||||||
'';
|
'';
|
||||||
wantedBy = [ "default.target" ];
|
wantedBy = [ "default.target" ];
|
||||||
};
|
|
||||||
|
|
||||||
networking.firewall.allowedTCPPorts = [ 3389 ];
|
|
||||||
};
|
};
|
||||||
|
|
||||||
client =
|
networking.firewall.allowedTCPPorts = [ 3389 ];
|
||||||
{ pkgs, ... }:
|
};
|
||||||
{
|
|
||||||
imports = [
|
|
||||||
./common/x11.nix
|
|
||||||
./common/user-account.nix
|
|
||||||
];
|
|
||||||
test-support.displayManager.auto.user = "alice";
|
|
||||||
|
|
||||||
environment.systemPackages = [ pkgs.freerdp ];
|
client =
|
||||||
|
{ pkgs, ... }:
|
||||||
|
{
|
||||||
|
imports = [
|
||||||
|
./common/x11.nix
|
||||||
|
./common/user-account.nix
|
||||||
|
];
|
||||||
|
test-support.displayManager.auto.user = "alice";
|
||||||
|
|
||||||
services.xrdp.enable = true;
|
environment.systemPackages = [ pkgs.freerdp ];
|
||||||
services.xrdp.audio.enable = true;
|
|
||||||
services.xrdp.defaultWindowManager = "${pkgs.icewm}/bin/icewm";
|
|
||||||
|
|
||||||
services.pulseaudio = {
|
services.xrdp.enable = true;
|
||||||
enable = true;
|
services.xrdp.audio.enable = true;
|
||||||
};
|
services.xrdp.defaultWindowManager = "${pkgs.icewm}/bin/icewm";
|
||||||
|
|
||||||
|
services.pulseaudio = {
|
||||||
|
enable = true;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
};
|
||||||
|
|
||||||
testScript =
|
testScript =
|
||||||
{ nodes, ... }:
|
{ nodes, ... }:
|
||||||
let
|
let
|
||||||
user = nodes.client.config.users.users.alice;
|
user = nodes.client.config.users.users.alice;
|
||||||
in
|
in
|
||||||
''
|
''
|
||||||
start_all()
|
start_all()
|
||||||
|
|
||||||
client.wait_for_x()
|
client.wait_for_x()
|
||||||
client.wait_for_file("${user.home}/.Xauthority")
|
client.wait_for_file("${user.home}/.Xauthority")
|
||||||
client.succeed("xauth merge ${user.home}/.Xauthority")
|
client.succeed("xauth merge ${user.home}/.Xauthority")
|
||||||
|
|
||||||
client.sleep(5)
|
client.sleep(5)
|
||||||
|
|
||||||
client.execute("xterm >&2 &")
|
client.execute("xterm >&2 &")
|
||||||
client.sleep(1)
|
client.sleep(1)
|
||||||
|
|
||||||
client.send_chars("xfreerdp /cert-tofu /w:640 /h:480 /v:127.0.0.1 /u:${user.name} /p:${user.password} /sound\n")
|
client.send_chars("xfreerdp /cert-tofu /w:640 /h:480 /v:127.0.0.1 /u:${user.name} /p:${user.password} /sound\n")
|
||||||
|
|
||||||
client.sleep(10)
|
client.sleep(10)
|
||||||
|
|
||||||
client.succeed("[ -S /tmp/.xrdp/xrdp_chansrv_audio_in_socket_* ]") # checks if it's a socket
|
client.succeed("[ -S /tmp/.xrdp/xrdp_chansrv_audio_in_socket_* ]") # checks if it's a socket
|
||||||
client.sleep(5)
|
client.sleep(5)
|
||||||
client.screenshot("localrdp")
|
client.screenshot("localrdp")
|
||||||
|
|
||||||
client.execute("xterm >&2 &")
|
client.execute("xterm >&2 &")
|
||||||
client.sleep(1)
|
client.sleep(1)
|
||||||
client.send_chars("xfreerdp /cert-tofu /w:640 /h:480 /v:server /u:${user.name} /p:${user.password} /sound\n")
|
client.send_chars("xfreerdp /cert-tofu /w:640 /h:480 /v:server /u:${user.name} /p:${user.password} /sound\n")
|
||||||
client.sleep(10)
|
client.sleep(10)
|
||||||
|
|
||||||
server.succeed("[ -S /tmp/.xrdp/xrdp_chansrv_audio_in_socket_* ]") # checks if it's a socket
|
server.succeed("[ -S /tmp/.xrdp/xrdp_chansrv_audio_in_socket_* ]") # checks if it's a socket
|
||||||
server.succeed('[ "$(cat /tmp/pulseaudio-source)" == "xrdp-source" ]')
|
server.succeed('[ "$(cat /tmp/pulseaudio-source)" == "xrdp-source" ]')
|
||||||
server.succeed('[ "$(cat /tmp/pulseaudio-sink)" == "xrdp-sink" ]')
|
server.succeed('[ "$(cat /tmp/pulseaudio-sink)" == "xrdp-sink" ]')
|
||||||
client.screenshot("remoterdp")
|
client.screenshot("remoterdp")
|
||||||
'';
|
'';
|
||||||
}
|
}
|
||||||
)
|
|
||||||
|
|||||||
Reference in New Issue
Block a user