Skip to content

Commit b60341f

Browse files
committed
tests: avoid pipefail SIGPIPE in module checks
1 parent d889d56 commit b60341f

File tree

8 files changed

+27
-18
lines changed

8 files changed

+27
-18
lines changed

modules/ghostty/check.nix

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ let
3131
in
3232
pkgs.runCommand "ghostty" { } ''
3333
"${ghosttyWrapped}/bin/ghostty" +validate-config
34-
"${ghosttyWrapped}/bin/ghostty" +version | grep -q "${ghosttyWrapped.version}"
34+
[[ "$(${ghosttyWrapped}/bin/ghostty +version)" == *"${ghosttyWrapped.version}"* ]]
3535
3636
"${ghosttyFileWrapped}/bin/ghostty" +validate-config
3737

modules/git/check.nix

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,6 @@ let
1717

1818
in
1919
pkgs.runCommand "git-test" { } ''
20-
"${gitWrapped}/bin/git" --version | grep -q "git"
20+
[[ "$(${gitWrapped}/bin/git --version)" == *git* ]]
2121
touch $out
2222
''

modules/i3/check.nix

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ pkgs.runCommand "i3-test" { nativeBuildInputs = [ pkgs.dbus ]; } ''
2424
dbus-daemon --session --address="$DBUS_SESSION_BUS_ADDRESS" --nofork --nopidfile --print-address &
2525
DBUS_PID=$!
2626
27-
"${i3Wrapped}/bin/i3" --version | grep -q "${i3Wrapped.version}"
27+
[[ "$(${i3Wrapped}/bin/i3 --version)" == *"${i3Wrapped.version}"* ]]
2828
2929
kill $DBUS_PID 2>/dev/null || true
3030

modules/jujutsu/check.nix

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,8 @@ let
1616
}).wrapper;
1717
in
1818
pkgs.runCommand "jujutsu-test" { } ''
19-
"${jujutsuWrapped}/bin/jj" config list --user | grep -q 'user.name = "Test User"'
20-
"${jujutsuWrapped}/bin/jj" config list --user | grep -q 'user.email = "test@example.com"'
19+
config_list="$(${jujutsuWrapped}/bin/jj config list --user)"
20+
[[ "$config_list" == *'user.name = "Test User"'* ]]
21+
[[ "$config_list" == *'user.email = "test@example.com"'* ]]
2122
touch $out
2223
''

modules/kanshi/check.nix

Lines changed: 18 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4,22 +4,30 @@
44
}:
55

66
let
7-
kanshiWrapped =
8-
(self.wrapperModules.kanshi.apply {
9-
inherit pkgs;
7+
kanshiApplied = self.wrapperModules.kanshi.apply {
8+
inherit pkgs;
109

11-
configFile.content = ''
12-
profile {
13-
output eDP-1 enable scale 2
14-
}
15-
'';
10+
configFile.content = ''
11+
profile {
12+
output eDP-1 enable scale 2
13+
}
14+
'';
15+
};
1616

17-
}).wrapper;
17+
kanshiWrapped = kanshiApplied.wrapper;
18+
kanshiConfigPath = toString kanshiApplied.config.configFile.path;
1819

1920
in
2021
pkgs.runCommand "kanshi-test" { } ''
22+
help_output="$(${kanshiWrapped}/bin/kanshi --help 2>&1)"
23+
[[ "$help_output" == *config* ]]
2124
22-
"${kanshiWrapped}/bin/kanshi" --help 2>&1 | grep -q "config"
25+
test -f "${kanshiConfigPath}"
26+
grep -qF 'output eDP-1 enable scale 2' "${kanshiConfigPath}"
27+
28+
wrapper_script=$(<"${kanshiWrapped}/bin/kanshi")
29+
[[ "$wrapper_script" == *"--config"* ]]
30+
[[ "$wrapper_script" == *"${kanshiConfigPath}"* ]]
2331
2432
touch $out
2533
''

modules/mpv/check.nix

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,6 @@ let
1515

1616
in
1717
pkgs.runCommand "mpv-test" { } ''
18-
"${mpvWrapped}/bin/mpv" --version | grep -q "mpv"
18+
[[ "$(${mpvWrapped}/bin/mpv --version)" == *mpv* ]]
1919
touch $out
2020
''

modules/niri/check.nix

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ let
111111
in
112112
pkgs.runCommand "niri-test" { } ''
113113
cat ${niriWrapped}/bin/niri
114-
"${niriWrapped}/bin/niri" --version | grep -q "${niriWrapped.version}"
114+
[[ "$(${niriWrapped}/bin/niri --version)" == *"${niriWrapped.version}"* ]]
115115
"${niriWrapped}/bin/niri" validate
116116
# since config is now checked at build time, testing a bad config is impossible
117117
touch $out

modules/udiskie/check.nix

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,6 @@ let
1616
}).wrapper;
1717
in
1818
pkgs.runCommand "udiskie-test" { } ''
19-
"${udiskieWrapped}/bin/udiskie" --version | grep -q "udiskie"
19+
[[ "$(${udiskieWrapped}/bin/udiskie --version)" == *udiskie* ]]
2020
touch $out
2121
''

0 commit comments

Comments
 (0)