mirror of
https://github.com/NixOS/nixpkgs.git
synced 2025-06-11 12:15:34 +03:00
nixosTests.emacs-daemon: migrate to runTest
Part of NixOS#386873
This commit is contained in:
parent
667e8fbf2c
commit
71d746b1fd
2 changed files with 38 additions and 42 deletions
|
@ -360,7 +360,7 @@ in {
|
||||||
eintopf = handleTest ./eintopf.nix {};
|
eintopf = handleTest ./eintopf.nix {};
|
||||||
ejabberd = handleTest ./xmpp/ejabberd.nix {};
|
ejabberd = handleTest ./xmpp/ejabberd.nix {};
|
||||||
elk = handleTestOn ["x86_64-linux"] ./elk.nix {};
|
elk = handleTestOn ["x86_64-linux"] ./elk.nix {};
|
||||||
emacs-daemon = handleTest ./emacs-daemon.nix {};
|
emacs-daemon = runTest ./emacs-daemon.nix;
|
||||||
endlessh = handleTest ./endlessh.nix {};
|
endlessh = handleTest ./endlessh.nix {};
|
||||||
endlessh-go = handleTest ./endlessh-go.nix {};
|
endlessh-go = handleTest ./endlessh-go.nix {};
|
||||||
engelsystem = handleTest ./engelsystem.nix {};
|
engelsystem = handleTest ./engelsystem.nix {};
|
||||||
|
|
|
@ -1,52 +1,48 @@
|
||||||
import ./make-test-python.nix (
|
{ lib, ... }:
|
||||||
{ pkgs, ... }:
|
{
|
||||||
{
|
name = "emacs-daemon";
|
||||||
name = "emacs-daemon";
|
meta.maintainers = lib.teams.emacs.members;
|
||||||
meta = with pkgs.lib.maintainers; {
|
|
||||||
maintainers = [ ];
|
|
||||||
};
|
|
||||||
|
|
||||||
enableOCR = true;
|
enableOCR = true;
|
||||||
|
|
||||||
nodes.machine =
|
nodes.machine =
|
||||||
{ ... }:
|
{ ... }:
|
||||||
|
|
||||||
{
|
{
|
||||||
imports = [ ./common/x11.nix ];
|
imports = [ ./common/x11.nix ];
|
||||||
services.emacs = {
|
services.emacs = {
|
||||||
enable = true;
|
enable = true;
|
||||||
defaultEditor = true;
|
defaultEditor = true;
|
||||||
};
|
|
||||||
|
|
||||||
# Important to get the systemd service running for root
|
|
||||||
environment.variables.XDG_RUNTIME_DIR = "/run/user/0";
|
|
||||||
|
|
||||||
environment.variables.TEST_SYSTEM_VARIABLE = "system variable";
|
|
||||||
};
|
};
|
||||||
|
|
||||||
testScript = ''
|
# Important to get the systemd service running for root
|
||||||
machine.wait_for_unit("multi-user.target")
|
environment.variables.XDG_RUNTIME_DIR = "/run/user/0";
|
||||||
|
|
||||||
# checks that the EDITOR environment variable is set
|
environment.variables.TEST_SYSTEM_VARIABLE = "system variable";
|
||||||
machine.succeed('test $(basename "$EDITOR") = emacseditor')
|
};
|
||||||
|
|
||||||
# waits for the emacs service to be ready
|
testScript = ''
|
||||||
machine.wait_until_succeeds(
|
machine.wait_for_unit("multi-user.target")
|
||||||
"systemctl --user status emacs.service | grep 'Active: active'"
|
|
||||||
)
|
|
||||||
|
|
||||||
# connects to the daemon
|
# checks that the EDITOR environment variable is set
|
||||||
machine.succeed("emacsclient --no-wait --frame-parameters='((display . \"'\"$DISPLAY\"'\"))' --create-frame $EDITOR >&2")
|
machine.succeed('test $(basename "$EDITOR") = emacseditor')
|
||||||
|
|
||||||
# checks that Emacs shows the edited filename
|
# waits for the emacs service to be ready
|
||||||
machine.wait_for_text("emacseditor")
|
machine.wait_until_succeeds(
|
||||||
|
"systemctl --user status emacs.service | grep 'Active: active'"
|
||||||
|
)
|
||||||
|
|
||||||
# makes sure environment variables are accessible from Emacs
|
# connects to the daemon
|
||||||
machine.succeed(
|
machine.succeed("emacsclient --no-wait --frame-parameters='((display . \"'\"$DISPLAY\"'\"))' --create-frame $EDITOR >&2")
|
||||||
"emacsclient --eval '(getenv \"TEST_SYSTEM_VARIABLE\")' | grep -q 'system variable'"
|
|
||||||
)
|
|
||||||
|
|
||||||
machine.screenshot("emacsclient")
|
# checks that Emacs shows the edited filename
|
||||||
'';
|
machine.wait_for_text("emacseditor")
|
||||||
}
|
|
||||||
)
|
# makes sure environment variables are accessible from Emacs
|
||||||
|
machine.succeed(
|
||||||
|
"emacsclient --eval '(getenv \"TEST_SYSTEM_VARIABLE\")' | grep -q 'system variable'"
|
||||||
|
)
|
||||||
|
|
||||||
|
machine.screenshot("emacsclient")
|
||||||
|
'';
|
||||||
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue