mirror of
https://github.com/NixOS/nixpkgs.git
synced 2026-09-29 19:30:11 +00:00
nixos/tests/speechd: init
This test ensures that the speechd module evals correctly behind its `mkIf` guard, and verifies that configuration is picked up correctly. It unfortunately does not test integration with other systems like pipewire, but the test is better than nothing in it's current state.
This commit is contained in:
@@ -1717,6 +1717,7 @@ in
|
||||
sonic-server = runTest ./sonic-server.nix;
|
||||
spacecookie = runTest ./spacecookie.nix;
|
||||
spark = handleTestOn [ "x86_64-linux" "aarch64-linux" ] ./spark { };
|
||||
speechd = runTest ./speechd.nix;
|
||||
speedtest-tracker = runTest ./speedtest-tracker.nix;
|
||||
spiped = runTest ./spiped.nix;
|
||||
spire = runTest ./spire.nix;
|
||||
|
||||
49
nixos/tests/speechd.nix
Normal file
49
nixos/tests/speechd.nix
Normal file
@@ -0,0 +1,49 @@
|
||||
{ lib, ... }:
|
||||
{
|
||||
name = "speechd";
|
||||
meta.maintainers = [ lib.maintainers.h7x4 ];
|
||||
|
||||
nodes.machine =
|
||||
{ pkgs, ... }:
|
||||
{
|
||||
imports = [ ./common/user-account.nix ];
|
||||
|
||||
environment.systemPackages = [ pkgs.speechd ];
|
||||
|
||||
# Without a real sound card, libao (speech-dispatcher's audio backend)
|
||||
# fails to open any device. libao's built-in "null" driver always succeeds.
|
||||
environment.etc."libao.conf".text = ''
|
||||
default_driver=null
|
||||
'';
|
||||
|
||||
services.speechd = {
|
||||
enable = true;
|
||||
config = ''
|
||||
AddModule "testmodule" "sd_generic" "testmodule.conf"
|
||||
DefaultModule "testmodule"
|
||||
'';
|
||||
modules.testmodule = ''
|
||||
AddVoice "en" "male1" "testmodule_voice"
|
||||
GenericLanguage "en" "en"
|
||||
GenericExecuteSynth "echo \'$DATA\' >> /tmp/speechd-spoken.txt"
|
||||
'';
|
||||
};
|
||||
};
|
||||
|
||||
testScript =
|
||||
{ nodes, ... }:
|
||||
let
|
||||
user = nodes.machine.users.users.alice;
|
||||
uid = toString user.uid;
|
||||
aliceRun = command: "su - ${user.name} -c 'XDG_RUNTIME_DIR=/run/user/${uid} ${command}'";
|
||||
in
|
||||
''
|
||||
machine.wait_for_unit("multi-user.target")
|
||||
machine.succeed("loginctl enable-linger ${user.name}")
|
||||
machine.wait_for_unit("user@${uid}.service")
|
||||
machine.wait_for_unit("speech-dispatcher.socket", "${user.name}")
|
||||
|
||||
machine.succeed("${aliceRun "spd-say 'hello'"}")
|
||||
machine.wait_until_succeeds("grep -q 'hello' /tmp/speechd-spoken.txt")
|
||||
'';
|
||||
}
|
||||
@@ -33,6 +33,7 @@
|
||||
withPico ? true,
|
||||
picotts,
|
||||
libsOnly ? false,
|
||||
nixosTests,
|
||||
}:
|
||||
|
||||
let
|
||||
@@ -152,6 +153,8 @@ stdenv.mkDerivation (finalAttrs: {
|
||||
|
||||
enableParallelBuilding = true;
|
||||
|
||||
passthru.tests.nixos = nixosTests.speechd;
|
||||
|
||||
meta = {
|
||||
description =
|
||||
"Common interface to speech synthesis" + lib.optionalString libsOnly " - client libraries only";
|
||||
|
||||
Reference in New Issue
Block a user