Files
haskell.nix/test/sublib-docs/default.nix
T
Hamish Mackenzie 7078b145e9 Add support for ghcjs 8.8 and making ghcjs bundles (#828)
Fixes ghcjs 8.6.5 and 8.8.4.

Uses emscripten for ghcjs 8.8 and adds scripts for building ghcjs 8.8.

Many fixes for ghcjs test failures.

Includes relocatableConfigFiles for making relocatable ghcjs bundles.
2020-11-17 22:22:53 +13:00

56 lines
1.6 KiB
Nix

# Test a package set
{ stdenv, util, cabalProject', haskellLib, recurseIntoAttrs, testSrc, compiler-nix-name }:
with stdenv.lib;
let
project = cabalProject' {
inherit compiler-nix-name;
src = testSrc "sublib-docs";
};
packages = project.hsPkgs;
in recurseIntoAttrs {
ifdInputs = {
inherit (project) plan-nix;
};
run = stdenv.mkDerivation {
name = "sublib-docs-test";
buildCommand = ''
exe="${packages.sublib-docs.components.exes.sublib-docs.exePath}"
size=$(command stat --format '%s' "$exe")
printf "size of executable $exe is $size. \n" >& 2
# fixme: run on target platform when cross-compiled
printf "checking whether executable runs... " >& 2
cat ${haskellLib.check packages.sublib-docs.components.exes.sublib-docs}/test-stdout
'' +
# Musl and Aarch are statically linked..
optionalString (!stdenv.hostPlatform.isAarch32 && !stdenv.hostPlatform.isAarch64 && !stdenv.hostPlatform.isMusl) (''
printf "checking that executable is dynamically linked to system libraries... " >& 2
'' + optionalString (stdenv.isLinux && !stdenv.hostPlatform.isMusl) ''
ldd $exe | grep libgmp
'' + optionalString stdenv.isDarwin ''
otool -L $exe |grep .dylib
'') + ''
# Check that it looks like we have docs
test -f "${packages.sublib-docs.components.library.doc}/share/doc/sublib-docs/html/Lib.html"
test -f "${packages.sublib-docs.components.sublibs.slib.doc}/share/doc/slib/html/Slib.html"
touch $out
'';
meta.platforms = platforms.all;
passthru = {
# Used for debugging with nix repl
inherit packages;
};
};
}