Skip to content

Commit 71d746b

Browse files
nixosTests.emacs-daemon: migrate to runTest
Part of #386873
1 parent 667e8fb commit 71d746b

File tree

2 files changed

+37
-41
lines changed

2 files changed

+37
-41
lines changed

nixos/tests/all-tests.nix

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -360,7 +360,7 @@ in {
360360
eintopf = handleTest ./eintopf.nix {};
361361
ejabberd = handleTest ./xmpp/ejabberd.nix {};
362362
elk = handleTestOn ["x86_64-linux"] ./elk.nix {};
363-
emacs-daemon = handleTest ./emacs-daemon.nix {};
363+
emacs-daemon = runTest ./emacs-daemon.nix;
364364
endlessh = handleTest ./endlessh.nix {};
365365
endlessh-go = handleTest ./endlessh-go.nix {};
366366
engelsystem = handleTest ./engelsystem.nix {};

nixos/tests/emacs-daemon.nix

Lines changed: 36 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -1,52 +1,48 @@
1-
import ./make-test-python.nix (
2-
{ pkgs, ... }:
3-
{
4-
name = "emacs-daemon";
5-
meta = with pkgs.lib.maintainers; {
6-
maintainers = [ ];
7-
};
1+
{ lib, ... }:
2+
{
3+
name = "emacs-daemon";
4+
meta.maintainers = lib.teams.emacs.members;
85

9-
enableOCR = true;
6+
enableOCR = true;
107

11-
nodes.machine =
12-
{ ... }:
8+
nodes.machine =
9+
{ ... }:
1310

14-
{
15-
imports = [ ./common/x11.nix ];
16-
services.emacs = {
17-
enable = true;
18-
defaultEditor = true;
19-
};
11+
{
12+
imports = [ ./common/x11.nix ];
13+
services.emacs = {
14+
enable = true;
15+
defaultEditor = true;
16+
};
2017

21-
# Important to get the systemd service running for root
22-
environment.variables.XDG_RUNTIME_DIR = "/run/user/0";
18+
# Important to get the systemd service running for root
19+
environment.variables.XDG_RUNTIME_DIR = "/run/user/0";
2320

24-
environment.variables.TEST_SYSTEM_VARIABLE = "system variable";
25-
};
21+
environment.variables.TEST_SYSTEM_VARIABLE = "system variable";
22+
};
2623

27-
testScript = ''
28-
machine.wait_for_unit("multi-user.target")
24+
testScript = ''
25+
machine.wait_for_unit("multi-user.target")
2926
30-
# checks that the EDITOR environment variable is set
31-
machine.succeed('test $(basename "$EDITOR") = emacseditor')
27+
# checks that the EDITOR environment variable is set
28+
machine.succeed('test $(basename "$EDITOR") = emacseditor')
3229
33-
# waits for the emacs service to be ready
34-
machine.wait_until_succeeds(
35-
"systemctl --user status emacs.service | grep 'Active: active'"
36-
)
30+
# waits for the emacs service to be ready
31+
machine.wait_until_succeeds(
32+
"systemctl --user status emacs.service | grep 'Active: active'"
33+
)
3734
38-
# connects to the daemon
39-
machine.succeed("emacsclient --no-wait --frame-parameters='((display . \"'\"$DISPLAY\"'\"))' --create-frame $EDITOR >&2")
35+
# connects to the daemon
36+
machine.succeed("emacsclient --no-wait --frame-parameters='((display . \"'\"$DISPLAY\"'\"))' --create-frame $EDITOR >&2")
4037
41-
# checks that Emacs shows the edited filename
42-
machine.wait_for_text("emacseditor")
38+
# checks that Emacs shows the edited filename
39+
machine.wait_for_text("emacseditor")
4340
44-
# makes sure environment variables are accessible from Emacs
45-
machine.succeed(
46-
"emacsclient --eval '(getenv \"TEST_SYSTEM_VARIABLE\")' | grep -q 'system variable'"
47-
)
41+
# makes sure environment variables are accessible from Emacs
42+
machine.succeed(
43+
"emacsclient --eval '(getenv \"TEST_SYSTEM_VARIABLE\")' | grep -q 'system variable'"
44+
)
4845
49-
machine.screenshot("emacsclient")
50-
'';
51-
}
52-
)
46+
machine.screenshot("emacsclient")
47+
'';
48+
}

0 commit comments

Comments
 (0)