-
Notifications
You must be signed in to change notification settings - Fork 5
/
default.nix
71 lines (65 loc) · 2.33 KB
/
default.nix
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
{ kapack ? import (fetchTarball {
url = "https://github.com/oar-team/nur-kapack/archive/0d4b1953409f8580bdc0000d999ae4c95d637b37.tar.gz";
sha256 = "sha256:1ap9x390h7ii9zb867dqiqpxkm88520g8yp5ngssa3bw47lyyjxa";
}) {}
, simgrid ? kapack.simgrid-329
, doCoverage ? true
, coverageCoveralls ? false
, coverageGcovTxt ? false
, coverageHtml ? false
, useClang ? false
}:
assert kapack.pkgs.lib.assertMsg (!(doCoverage && useClang)) "Cannot do coverage with clang";
let
pkgs = kapack.pkgs;
stdenv = if useClang then pkgs.clangStdenv else pkgs.stdenv;
jobs = rec {
remote_simgrid = stdenv.mkDerivation rec {
pname = "remote-simgrid";
version = "0.3.0-git";
src = ./.;
nativeBuildInputs = [ pkgs.meson pkgs.pkgconfig pkgs.ninja ]
++ pkgs.lib.optional doCoverage [ pkgs.gcovr ];
buildInputs = [ simgrid pkgs.docopt_cpp pkgs.boost pkgs.protobuf ];
preConfigure = "rm -rf build cov";
mesonBuildType = "debug";
mesonFlags = []
++ pkgs.lib.optional doCoverage [ "-Db_coverage=true" ];
preCheck = pkgs.lib.optionalString doCoverage ''
mkdir ../cov
cp rsg.p/*.gcno ../cov/
cp librsg.so.p/*.gcno ../cov/
export GCOV_PREFIX=$(realpath ../cov)
export GCOV_PREFIX_STRIP=5
export GCOV_ERROR_FILE=/dev/null # do not break logs with gcov messages
'';
postCheck = pkgs.lib.optionalString doCoverage ''
cd ../cov
gcov -p *.gcno 1>/dev/null 2>&1
mkdir report
'' + pkgs.lib.optionalString coverageGcovTxt ''
mkdir -p report/gcov-txt
cp \^\#src\#*.gcov report/gcov-txt/
'' + pkgs.lib.optionalString coverageHtml ''
mkdir -p report/html
'' + ''
gcovr -g -k -r .. --filter '\.\./src/' --exclude '.*tcp_socket.*' \
--txt report/file-summary.txt \
--csv report/file-summary.csv \
--json-summary report/file-summary.json \
'' + pkgs.lib.optionalString coverageCoveralls ''
--coveralls report/coveralls.json \
'' + pkgs.lib.optionalString coverageHtml ''
--html-details report/html/index.html \
'' + ''
--print-summary
cd -
'';
postInstall = pkgs.lib.optionalString doCoverage ''
cp -r ../cov/report $out/cov-report
'';
doCheck = true;
};
};
in
jobs.remote_simgrid