on e94de40 help sign in
56 lines 1.6 kB history raw
1# Test a package set
2{ stdenv, util, cabalProject', haskellLib, recurseIntoAttrs, testSrc, compiler-nix-name }:
4with stdenv.lib;
6let
7 modules = [
8 {
9 # Package has no exposed modules which causes
10 # haddock: No input file(s)
11 packages.cabal-simple.doHaddock = false;
12 packages.cabal-simple.enableExecutableProfiling = true;
13 enableLibraryProfiling = true;
14 # executableProfiling = false;
15 }
16 ];
18 project = cabalProject' {
19 inherit compiler-nix-name;
20 src = testSrc "cabal-simple-prof";
21 inherit modules;
22 };
24 packages = project.hsPkgs;
26in recurseIntoAttrs {
27 ifdInputs = {
28 inherit (project) plan-nix;
29 };
30 run = stdenv.mkDerivation {
31 name = "cabal-simple-prof-test";
33 buildCommand = ''
34 exe="${packages.cabal-simple.components.exes.cabal-simple}/bin/cabal-simple${stdenv.hostPlatform.extensions.executable}"
36 size=$(command stat --format '%s' "$exe")
37 printf "size of executable $exe is $size. \n" >& 2
39 # fixme: run on target platform when cross-compiled
40 printf "checking whether executable runs with profiling... " >& 2
41 # Curiosity: cross compilers prodcing profiling with `+RTS -p -h` lead to the following cryptic message:
42 # cabal-simple: invalid heap profile option: -h*
43 # Hence we pass `-hc`.
44 ${toString packages.cabal-simple.components.exes.cabal-simple.config.testWrapper} $exe +RTS -p -hc
46 touch $out
47 '';
49 meta.platforms = platforms.all;
51 passthru = {
52 # Used for debugging with nix repl
53 inherit project packages;
54 };
55 };