diff options
author | Vincent Haupert <mail@vincent-haupert.de> | 2021-03-01 23:00:46 +0100 |
---|---|---|
committer | Cole Helbling <cole.e.helbling@outlook.com> | 2021-03-06 16:26:22 -0800 |
commit | 6aa878679ab9d1d0f5557b95a786b192fcf0f936 (patch) | |
tree | 733d0c0f59277eb6688544389cbd905abc501e10 /pkgs/shells | |
parent | b0c7213bd45a1d81ba797b18f8f861f06a92e82f (diff) |
fish: execute fish tests
Still includes `coreutils` in `checkInputs`.
macOS: disables some pexpect tests which depend on pkill/pgrep
(see #103180).
Diffstat (limited to 'pkgs/shells')
-rw-r--r-- | pkgs/shells/fish/default.nix | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/pkgs/shells/fish/default.nix b/pkgs/shells/fish/default.nix index a1e59eeac0fa..581785beb7a5 100644 --- a/pkgs/shells/fish/default.nix +++ b/pkgs/shells/fish/default.nix @@ -17,6 +17,7 @@ , python3 , cmake , fishPlugins +, procps , runCommand , writeText @@ -143,6 +144,41 @@ let sha256 = "sha256-TwKT7Z9qa3fkfUHvq+YvMxnobvyL+DzFhzMET7xvkhE="; }; + # Fix FHS paths in tests + postPatch = '' + # src/fish_tests.cpp + sed -i 's|/bin/ls|${coreutils}/bin/ls|' src/fish_tests.cpp + sed -i 's|L"/usr"|L"/nix"|' src/fish_tests.cpp + sed -i 's|L"/bin/echo"|L"${coreutils}/bin/echo"|' src/fish_tests.cpp + sed -i 's|L"/bin/c"|L"${coreutils}/bin/c"|' src/fish_tests.cpp + sed -i 's|L"/bin/ca"|L"${coreutils}/bin/ca"|' src/fish_tests.cpp + + # tests/checks/cd.fish + sed -i 's|/bin/pwd|${coreutils}/bin/pwd|' tests/checks/cd.fish + + # tests/checks/redirect.fish + sed -i 's|/bin/echo|${coreutils}/bin/echo|' tests/checks/redirect.fish + + # tests/checks/vars_as_commands.fish + sed -i 's|/usr/bin|${coreutils}/bin|' tests/checks/vars_as_commands.fish + + # tests/checks/jobs.fish + sed -i 's|ps -o stat|${procps}/bin/ps -o stat|' tests/checks/jobs.fish + sed -i 's|/bin/echo|${coreutils}/bin/echo|' tests/checks/jobs.fish + + # tests/checks/job-control-noninteractive.fish + sed -i 's|/bin/echo|${coreutils}/bin/echo|' tests/checks/job-control-noninteractive.fish + + # tests/checks/complete.fish + sed -i 's|/bin/ls|${coreutils}/bin/ls|' tests/checks/complete.fish + '' + lib.optionalString stdenv.isDarwin '' + # Tests use pkill/pgrep which are currently not built on Darwin + # See https://github.com/NixOS/nixpkgs/pull/103180 + rm tests/pexpects/exit.py + rm tests/pexpects/job_summary.py + rm tests/pexpects/signals.py + ''; + nativeBuildInputs = [ cmake ]; @@ -174,6 +210,18 @@ let gettext ] ++ lib.optional (!stdenv.isDarwin) man-db; + doCheck = true; + + checkInputs = [ + coreutils + (python3.withPackages(ps: [ps.pexpect])) + procps + ]; + + checkPhase = '' + make test + ''; + postInstall = with lib; '' sed -r "s|command grep|command ${gnugrep}/bin/grep|" \ -i "$out/share/fish/functions/grep.fish" |