1{ stdenv, cabal-install, cabalProject', stackProject', recurseIntoAttrs, runCommand, testSrc, compiler-nix-name }:
7 src = testSrc "coverage";
9 # Package has no exposed modules which causes
10 # haddock: No input file(s)
11 packages.bytestring-builder.doHaddock = false;
14 packages.pkga.components.library.doCoverage = true;
15 packages.pkgb.components.library.doCoverage = true;
19 # We can easily select a different compiler when using cabal,
20 # but for stack we would need a different resolver to be used..
21 cabalProj = (cabalProject' projectArgs // { inherit compiler-nix-name; });
22 stackProj = (stackProject' projectArgs);
24 exeExt = stdenv.hostPlatform.extensions.executable;
27 run = stdenv.mkDerivation {
28 name = "coverage-test";
31 ########################################################################
32 # test coverage reports with an example project
34 fileExistsNonEmpty() {
36 if [ ! -f "$file" ]; then
40 local filesize=$(command stat --format '%s' "$file")
41 if [ $filesize -eq 0 ]; then
42 echo "File must not be empty: $file"
46 findFileExistsNonEmpty() {
50 local file="$(find $searchDir -name $filePattern -print -quit)"
53 echo "Couldn't find file \"$filePattern\" in directory \"$searchDir\"."
57 local filesize=$(command stat --format '%s' "$file")
58 if [ $filesize -eq 0 ]; then
59 echo "File must not be empty: $file"
65 if [ ! -d "$dir" ]; then
69 if [ "$(ls -A $dir)" ]; then
70 echo "Dir should be empty: $dir"
76 if [ ! -d "$dir" ]; then
82 ${concatStringsSep "\n" (map (project: ''
83 pkga_basedir="${project.hsPkgs.pkga.coverageReport}/share/hpc/vanilla"
84 findFileExistsNonEmpty "$pkga_basedir/mix/pkga-0.1.0.0/" "PkgA.mix"
85 dirExistsEmpty "$pkga_basedir/tix/pkga-0.1.0.0"
86 dirExistsEmpty "$pkga_basedir/html/pkga-0.1.0.0"
88 pkgb_basedir="${project.hsPkgs.pkgb.coverageReport}/share/hpc/vanilla"
89 testTix="$pkgb_basedir/tix/pkgb-0.1.0.0/tests${exeExt}/tests${exeExt}.tix"
90 libTix="$pkgb_basedir/tix/pkgb-0.1.0.0/pkgb-0.1.0.0.tix"
91 fileExistsNonEmpty "$testTix"
92 fileExistsNonEmpty "$libTix"
93 findFileExistsNonEmpty "$pkgb_basedir/mix/pkgb-0.1.0.0/" "ConduitExample.mix"
94 findFileExistsNonEmpty "$pkgb_basedir/mix/pkgb-0.1.0.0/" "PkgB.mix"
95 fileExistsNonEmpty "$pkgb_basedir/html/pkgb-0.1.0.0/hpc_index.html"
97 filesizeTestsTix=$(command stat --format '%s' "$testTix")
98 filesizeLibTix=$(command stat --format '%s' "$libTix")
99 if (( filesizeTestsTix <= filesizeLibTix )); then
100 echo "Filesize of \"$testTix\" ($filesizeTestsTix) should be greather than that of \"$libTix\" ($filesizeLibTix). Did you forget to exclude test modules when creating \"$libTix\"?"
104 project_basedir="${project.projectCoverageReport}/share/hpc/vanilla"
105 fileExistsNonEmpty "$project_basedir/html/index.html"
106 dirExists "$project_basedir/html/pkga-0.1.0.0"
107 dirExists "$project_basedir/html/pkgb-0.1.0.0"
108 findFileExistsNonEmpty "$project_basedir/mix/" "PkgA.mix"
109 findFileExistsNonEmpty "$project_basedir/mix/" "PkgB.mix"
110 findFileExistsNonEmpty "$project_basedir/mix/" "ConduitExample.mix"
111 dirExists "$project_basedir/tix/all"
112 fileExistsNonEmpty "$project_basedir/tix/all/all.tix"
113 dirExists "$project_basedir/tix/pkga-0.1.0.0"
114 dirExists "$project_basedir/tix/pkgb-0.1.0.0"
115 fileExistsNonEmpty "$project_basedir/tix/pkgb-0.1.0.0/pkgb-0.1.0.0.tix"
116 dirExists "$project_basedir/tix/pkgb-0.1.0.0/tests${exeExt}"
117 fileExistsNonEmpty "$project_basedir/tix/pkgb-0.1.0.0/tests${exeExt}/tests${exeExt}.tix"
123 meta.platforms = platforms.all;
126 # Used for debugging with nix repl
127 inherit cabalProj stackProj;
keysesc to close
- j k
- move down, up
- enter
- open
- esc
- back, or up a level
- 1 2 3 4
- readme, files, commits, refs
- /
- filter
- y
- copy the clone command
- c
- compare the chosen commit with another (or shift-click both)
- ?
- show or hide this list