fish: add fish_config tests

Checks whether the fish_config script does run.
Cannot check running the web server though (since that requires a port).
This commit is contained in:
Profpatsch 2017-08-05 22:23:49 +02:00
parent b7290a283a
commit 46eb0e2cd1

View file

@ -85,9 +85,8 @@ let
$__extra_confdir
end
'';
in
stdenv.mkDerivation rec {
fish = stdenv.mkDerivation rec {
name = "fish-${version}";
version = "2.6.0";
@ -169,4 +168,35 @@ stdenv.mkDerivation rec {
passthru = {
shellPath = "/bin/fish";
};
}
};
tests = {
# Test the fish_config tool by checking the generated splash page.
# Since the webserver requires a port to run, it is not started.
fishConfig =
let fishScript = writeText "test.fish" ''
set -x __fish_bin_dir ${fish}/bin
echo $__fish_bin_dir
cp -r ${fish}/share/fish/tools/web_config/* .
chmod -R +w *
# we delete everything after the fileurl is assigned
sed -e '/fileurl =/q' -i webconfig.py
echo "print(fileurl)" >> webconfig.py
# and check whether the message appears on the page
cat (${python3}/bin/python ./webconfig.py \
| tail -n1 | sed -ne 's|.*\(/tmp/.*\)|\1|p' \
) | grep 'a href="http://localhost.*Start the Fish Web config'
# cannot test the http server because it needs a localhost port
'';
in ''
HOME=$(mktemp -d)
${fish}/bin/fish ${fishScript}
'';
};
# FIXME(Profpatsch) replace withTests stub
withTests = flip const;
in withTests tests fish