Skip to content

Commit 2bbb9e4

Browse files
committed
WIP
1 parent 4615d4c commit 2bbb9e4

File tree

5 files changed

+121
-124
lines changed

5 files changed

+121
-124
lines changed

builder/comp-builder.nix

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -362,6 +362,7 @@ let
362362
+ (lib.optionalString doCoverage ''
363363
mkdir -p $out/share
364364
cp -r dist/hpc $out/share
365+
cp dist/setup-config $out/
365366
'')
366367
}
367368
runHook postInstall

docs/dev/coverage.md

Lines changed: 98 additions & 96 deletions
Original file line numberDiff line numberDiff line change
@@ -31,39 +31,40 @@ The coverage information generated will look something like this:
3131
/nix/store/...-my-project-0.1.0.0-coverage-report/
3232
└── share
3333
└── hpc
34-
├── mix
35-
│   ├── my-library-0.1.0.0
36-
│   │   └── my-library-0.1.0.0-ERSaOroBZhe9awsoBkhmcV
37-
│   │   ├── My.Lib.Config.mix
38-
│   │   ├── My.Lib.Types.mix
39-
│   │   └── My.Lib.Util.mix
40-
│   └── my-test-1
41-
│   ├── Spec.mix
42-
│   └── Main.mix
43-
├── tix
44-
│ ├── my-library-0.1.0.0
45-
│ │   └── my-library-0.1.0.0.tix
46-
│ └── my-test-1
47-
│ └── my-test-1.tix
48-
└── html
49-
├── my-library-0.1.0.0
50-
│   ├── my-library-0.1.0.0-ERSaOroBZhe9awsoBkhmcV
51-
│   │ ├── My.Lib.Config.hs.html
52-
│   │ ├── My.Lib.Types.hs.html
53-
│   │ └── My.Lib.Util.hs.html
54-
│   ├── hpc_index_alt.html
55-
│   ├── hpc_index_exp.html
56-
│   ├── hpc_index_fun.html
57-
│   └── hpc_index.html
58-
└── my-test-1
59-
├── my-library-0.1.0.0-ERSaOroBZhe9awsoBkhmcV
60-
│ ├── My.Lib.Config.hs.html
61-
│ ├── My.Lib.Types.hs.html
62-
│ └── My.Lib.Util.hs.html
63-
├── hpc_index_alt.html
64-
├── hpc_index_exp.html
65-
├── hpc_index_fun.html
66-
└── hpc_index.html
34+
└── vanilla
35+
├── mix
36+
│   ├── my-library-0.1.0.0
37+
│   │   └── my-library-0.1.0.0-ERSaOroBZhe9awsoBkhmcV
38+
│   │   ├── My.Lib.Config.mix
39+
│   │   ├── My.Lib.Types.mix
40+
│   │   └── My.Lib.Util.mix
41+
│   └── my-test-1
42+
│   ├── Spec.mix
43+
│   └── Main.mix
44+
├── tix
45+
│ ├── my-library-0.1.0.0
46+
│ │   └── my-library-0.1.0.0.tix
47+
│ └── my-test-1
48+
│ └── my-test-1.tix
49+
└── html
50+
├── my-library-0.1.0.0
51+
│   ├── my-library-0.1.0.0-ERSaOroBZhe9awsoBkhmcV
52+
│   │ ├── My.Lib.Config.hs.html
53+
│   │ ├── My.Lib.Types.hs.html
54+
│   │ └── My.Lib.Util.hs.html
55+
│   ├── hpc_index_alt.html
56+
│   ├── hpc_index_exp.html
57+
│   ├── hpc_index_fun.html
58+
│   └── hpc_index.html
59+
└── my-test-1
60+
├── my-library-0.1.0.0-ERSaOroBZhe9awsoBkhmcV
61+
│ ├── My.Lib.Config.hs.html
62+
│ ├── My.Lib.Types.hs.html
63+
│ └── My.Lib.Util.hs.html
64+
├── hpc_index_alt.html
65+
├── hpc_index_exp.html
66+
├── hpc_index_fun.html
67+
└── hpc_index.html
6768
```
6869

6970
- The mix files are copied verbatim from the builds with coverage.
@@ -93,69 +94,70 @@ like this:
9394
/nix/store/...-coverage-report
9495
└── share
9596
└── hpc
96-
├── mix
97-
│   ├── my-library-0.1.0.0
98-
│   │   └── my-library-0.1.0.0-ERSaOroBZhe9awsoBkhmcV
99-
│   │   ├── My.Lib.Config.mix
100-
│   │   ├── My.Lib.Types.mix
101-
│   │   └── My.Lib.Util.mix
102-
│   ├── my-test-1
103-
│   │   ├── Spec.mix
104-
│   │   └── Main.mix
105-
│   ├── other-library-0.1.0.0
106-
│   │   └── other-library-0.1.0.0-48EVZBwW9Kj29VTaRMhBDf
107-
│   │   ├── Other.Lib.A.mix
108-
│   │   └── Other.Lib.B.mix
109-
│   └── other-test-1
110-
│   ├── Spec.mix
111-
│   └── Main.mix
112-
├── tix
113-
│ ├── all
114-
│ │   └── all.tix
115-
│ ├── my-library-0.1.0.0
116-
│ │   └── my-library-0.1.0.0.tix
117-
│ ├── my-test-1
118-
│ │   └── my-test-1.tix
119-
│ ├── other-library-0.1.0.0
120-
│ │   └── other-library-0.1.0.0.tix
121-
│ └── other-test-1
122-
│ └── other-test-1.tix
123-
└── html
124-
├── my-library-0.1.0.0
125-
│   ├── my-library-0.1.0.0-ERSaOroBZhe9awsoBkhmcV
126-
│   │ ├── My.Lib.Config.hs.html
127-
│   │ ├── My.Lib.Types.hs.html
128-
│   │ └── My.Lib.Util.hs.html
129-
│   ├── hpc_index_alt.html
130-
│   ├── hpc_index_exp.html
131-
│   ├── hpc_index_fun.html
132-
│   └── hpc_index.html
133-
├── my-test-1
134-
│   ├── my-library-0.1.0.0-ERSaOroBZhe9awsoBkhmcV
135-
│   │ ├── My.Lib.Config.hs.html
136-
│   │ ├── My.Lib.Types.hs.html
137-
│   │ └── My.Lib.Util.hs.html
138-
│   ├── hpc_index_alt.html
139-
│   ├── hpc_index_exp.html
140-
│   ├── hpc_index_fun.html
141-
│   └── hpc_index.html
142-
├── other-libray-0.1.0.0
143-
│   ├── other-library-0.1.0.0-48EVZBwW9Kj29VTaRMhBDf
144-
│   │   ├── Other.Lib.A.hs.html
145-
│   │   └── Other.Lib.B.hs.html
146-
│   ├── hpc_index_alt.html
147-
│   ├── hpc_index_exp.html
148-
│   ├── hpc_index_fun.html
149-
│   └── hpc_index.html
150-
├── other-test-1
151-
│   ├── other-library-0.1.0.0-48EVZBwW9Kj29VTaRMhBDf
152-
│   │   ├── Other.Lib.A.hs.html
153-
│   │   └── Other.Lib.B.hs.html
154-
│   ├── hpc_index_alt.html
155-
│   ├── hpc_index_exp.html
156-
│   ├── hpc_index_fun.html
157-
│   └── hpc_index.html
158-
└── index.html
97+
└── vanilla
98+
├── mix
99+
│   ├── my-library-0.1.0.0
100+
│   │   └── my-library-0.1.0.0-ERSaOroBZhe9awsoBkhmcV
101+
│   │   ├── My.Lib.Config.mix
102+
│   │   ├── My.Lib.Types.mix
103+
│   │   └── My.Lib.Util.mix
104+
│   ├── my-test-1
105+
│   │   ├── Spec.mix
106+
│   │   └── Main.mix
107+
│   ├── other-library-0.1.0.0
108+
│   │   └── other-library-0.1.0.0-48EVZBwW9Kj29VTaRMhBDf
109+
│   │   ├── Other.Lib.A.mix
110+
│   │   └── Other.Lib.B.mix
111+
│   └── other-test-1
112+
│   ├── Spec.mix
113+
│   └── Main.mix
114+
├── tix
115+
│ ├── all
116+
│ │   └── all.tix
117+
│ ├── my-library-0.1.0.0
118+
│ │   └── my-library-0.1.0.0.tix
119+
│ ├── my-test-1
120+
│ │   └── my-test-1.tix
121+
│ ├── other-library-0.1.0.0
122+
│ │   └── other-library-0.1.0.0.tix
123+
│ └── other-test-1
124+
│ └── other-test-1.tix
125+
└── html
126+
├── my-library-0.1.0.0
127+
│   ├── my-library-0.1.0.0-ERSaOroBZhe9awsoBkhmcV
128+
│   │ ├── My.Lib.Config.hs.html
129+
│   │ ├── My.Lib.Types.hs.html
130+
│   │ └── My.Lib.Util.hs.html
131+
│   ├── hpc_index_alt.html
132+
│   ├── hpc_index_exp.html
133+
│   ├── hpc_index_fun.html
134+
│   └── hpc_index.html
135+
├── my-test-1
136+
│   ├── my-library-0.1.0.0-ERSaOroBZhe9awsoBkhmcV
137+
│   │ ├── My.Lib.Config.hs.html
138+
│   │ ├── My.Lib.Types.hs.html
139+
│   │ └── My.Lib.Util.hs.html
140+
│   ├── hpc_index_alt.html
141+
│   ├── hpc_index_exp.html
142+
│   ├── hpc_index_fun.html
143+
│   └── hpc_index.html
144+
├── other-libray-0.1.0.0
145+
│   ├── other-library-0.1.0.0-48EVZBwW9Kj29VTaRMhBDf
146+
│   │   ├── Other.Lib.A.hs.html
147+
│   │   └── Other.Lib.B.hs.html
148+
│   ├── hpc_index_alt.html
149+
│   ├── hpc_index_exp.html
150+
│   ├── hpc_index_fun.html
151+
│   └── hpc_index.html
152+
├── other-test-1
153+
│   ├── other-library-0.1.0.0-48EVZBwW9Kj29VTaRMhBDf
154+
│   │   ├── Other.Lib.A.hs.html
155+
│   │   └── Other.Lib.B.hs.html
156+
│   ├── hpc_index_alt.html
157+
│   ├── hpc_index_exp.html
158+
│   ├── hpc_index_fun.html
159+
│   └── hpc_index.html
160+
└── index.html
159161
```
160162

161163
All of the coverage information is copied verbatim from the coverage

lib/check.nix

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ in stdenv.mkDerivation ({
3434
${toString component.testWrapper} ${drv}/bin/${drv.exeName} ${lib.concatStringsSep " " component.testFlags} | tee $out/test-stdout
3535
3636
# Copy over tix files, if they exist
37-
find . -iname '*.tix' -exec mkdir -p $out/share/hpc/tix/${drv.exeName} \; -exec cp {} $out/share/hpc/tix/${drv.exeName}/ \;
37+
find . -iname '*.tix' -exec mkdir -p $out/share/hpc/vanilla/tix/${drv.exeName} \; -exec cp {} $out/share/hpc/vanilla/tix/${drv.exeName}/ \;
3838
3939
runHook postCheck
4040
'';

lib/cover-project.nix

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -69,34 +69,34 @@ let
6969
in pkgs.runCommand "project-coverage-report"
7070
{ buildInputs = (with pkgs; [ghc]); }
7171
''
72-
mkdir -p $out/share/hpc/tix/all
73-
mkdir -p $out/share/hpc/mix/
74-
mkdir -p $out/share/hpc/html/
72+
mkdir -p $out/share/hpc/vanilla/tix/all
73+
mkdir -p $out/share/hpc/vanilla/mix/
74+
mkdir -p $out/share/hpc/vanilla/html/
7575
7676
# Create tix file with test run information for all packages
77-
tixFile="$out/share/hpc/tix/all/all.tix"
77+
tixFile="$out/share/hpc/vanilla/tix/all/all.tix"
7878
hpcSumCmd=("hpc" "sum" "--union" "--output=$tixFile")
7979
tixFiles=()
8080
8181
${with lib; concatStringsSep "\n" (mapAttrsToList (n: package: ''
8282
identifier="${package.identifier.name}-${package.identifier.version}"
8383
report=${getPackageCoverageReport n}
84-
tix="$report/share/hpc/tix/$identifier/$identifier.tix"
84+
tix="$report/share/hpc/vanilla/tix/$identifier/$identifier.tix"
8585
if test -f "$tix"; then
8686
tixFiles+=("$tix")
8787
fi
8888
8989
# Copy mix and tix information over from each report
90-
cp -R $report/share/hpc/mix/* $out/share/hpc/mix
91-
cp -R $report/share/hpc/tix/* $out/share/hpc/tix
92-
cp -R $report/share/hpc/html/* $out/share/hpc/html
90+
cp -R $report/share/hpc/vanilla/mix/* $out/share/hpc/vanilla/mix
91+
cp -R $report/share/hpc/vanilla/tix/* $out/share/hpc/vanilla/tix
92+
cp -R $report/share/hpc/vanilla/html/* $out/share/hpc/vanilla/html
9393
'') packages)}
9494
9595
if [ ''${#tixFiles[@]} -ne 0 ]; then
9696
hpcSumCmd+=("''${tixFiles[@]}")
9797
echo "''${hpcSumCmd[@]}"
9898
eval "''${hpcSumCmd[@]}"
9999
100-
cp ${projectIndexHtml} $out/share/hpc/html/index.html
100+
cp ${projectIndexHtml} $out/share/hpc/vanilla/html/index.html
101101
fi
102102
''

lib/cover.nix

Lines changed: 12 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,9 @@ in pkgs.runCommand (identifier + "-coverage-report")
1919
find $1 -iwholename "*/hpc/vanilla/mix" -exec find {} -maxdepth 1 -type d -iwholename "*/mix/*" \; -quit
2020
}
2121
22-
mkdir -p $out/share/hpc/mix/${identifier}
23-
mkdir -p $out/share/hpc/tix/${identifier}
24-
mkdir -p $out/share/hpc/html/${identifier}
22+
mkdir -p $out/share/hpc/vanilla/mix/${identifier}
23+
mkdir -p $out/share/hpc/vanilla/tix/${identifier}
24+
mkdir -p $out/share/hpc/vanilla/html/${identifier}
2525
2626
local src=${library.src.outPath}
2727
@@ -30,7 +30,7 @@ in pkgs.runCommand (identifier + "-coverage-report")
3030
# Copy over mix files
3131
local mixDir=$(findMixDir $drv)
3232
if [ ! -z "$mixDir" ]; then
33-
cp -R "$mixDir" $out/share/hpc/mix/
33+
cp -R "$mixDir" $out/share/hpc/vanilla/mix/
3434
3535
hpcMarkupCmdBase+=("--hpcdir=$mixDir")
3636
fi
@@ -52,33 +52,26 @@ in pkgs.runCommand (identifier + "-coverage-report")
5252
excludedModules+=("$module")
5353
done
5454
55-
hpcSumCmdBase=("hpc" "sum" "--union" "--output=$out/share/hpc/tix/${identifier}/${identifier}.tix")
55+
hpcSumCmdBase=("hpc" "sum" "--union" "--output=$out/share/hpc/vanilla/tix/${identifier}/${identifier}.tix")
5656
for exclude in ''${excludedModules[@]}; do
5757
hpcSumCmdBase+=("--exclude=$exclude")
5858
hpcMarkupCmdBase+=("--exclude=$exclude")
5959
done
6060
61-
hpcMarkupCmdAll=("''${hpcMarkupCmdBase[@]}" "--destdir=$out/share/hpc/html/${identifier}")
61+
hpcMarkupCmdAll=("''${hpcMarkupCmdBase[@]}" "--destdir=$out/share/hpc/vanilla/html/${identifier}")
6262
6363
hpcSumCmd=()
6464
${lib.concatStringsSep "\n" (builtins.map (check: ''
65-
if [ -d "${check}/share/hpc/tix" ]; then
66-
local hpcMarkupCmdEachTest=("''${hpcMarkupCmdBase[@]}" "--destdir=$out/share/hpc/html/${check.exeName}")
67-
68-
pushd ${check}/share/hpc/tix
65+
if [ -d "${check}/share/hpc/vanilla/tix" ]; then
66+
pushd ${check}/share/hpc/vanilla/tix
6967
7068
tixFileRel="$(find . -iwholename "*.tix" -type f -print -quit)"
7169
72-
mkdir -p $out/share/hpc/tix/$(dirname $tixFileRel)
73-
cp $tixFileRel $out/share/hpc/tix/$tixFileRel
70+
mkdir -p $out/share/hpc/vanilla/tix/$(dirname $tixFileRel)
71+
cp $tixFileRel $out/share/hpc/vanilla/tix/$tixFileRel
7472
7573
# Output tix file with test modules excluded
76-
hpcSumCmd+=("$out/share/hpc/tix/$tixFileRel")
77-
78-
hpcMarkupCmdEachTest+=("$out/share/hpc/tix/$tixFileRel")
79-
80-
echo "''${hpcMarkupCmdEachTest[@]}"
81-
eval "''${hpcMarkupCmdEachTest[@]}"
74+
hpcSumCmd+=("$out/share/hpc/vanilla/tix/$tixFileRel")
8275
8376
popd
8477
fi
@@ -92,6 +85,7 @@ in pkgs.runCommand (identifier + "-coverage-report")
9285
echo "''${hpcSumCmd[@]}"
9386
eval "''${hpcSumCmd[@]}"
9487
88+
hpcMarkupCmdAll+=("$out/share/hpc/vanilla/tix/${identifier}/${identifier}.tix")
9589
echo "''${hpcMarkupCmdAll[@]}"
9690
eval "''${hpcMarkupCmdAll[@]}"
9791
fi

0 commit comments

Comments
 (0)