-
Notifications
You must be signed in to change notification settings - Fork 1
/
coverage_grcov.Makefile.toml
53 lines (43 loc) · 1.7 KB
/
coverage_grcov.Makefile.toml
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
# https://crates.io/crates/grcov
[env]
COVERAGE_TARGET_DIRECTORY = "${CARGO_MAKE_WORKSPACE_WORKING_DIRECTORY}/target/coverage"
COVERAGE_BINARIES = "${COVERAGE_TARGET_DIRECTORY}/debug/deps"
COVERAGE_PROF_OUTPUT = "${COVERAGE_TARGET_DIRECTORY}/profraw"
[tasks.coverage-grcov-prepare-outdir]
private = true
script='''
#!/usr/bin/env bash
set -eux
rm -rf ${COVERAGE_PROF_OUTPUT}
mkdir -p ${COVERAGE_PROF_OUTPUT}
'''
[tasks.coverage-grcov-run-test]
condition = { rust_version = { min = "1.60.0" } }
private = true
run_task = "test"
[tasks.coverage-grcov-run-test.env]
CARGO_BUILD_TARGET_DIR = "${COVERAGE_TARGET_DIRECTORY}"
RUSTFLAGS = "-Cinstrument-coverage"
LLVM_PROFILE_FILE = "${COVERAGE_PROF_OUTPUT}/coverage-%p-%m.profraw"
[tasks.install-grcov]
condition = { env_not_set = ["SKIP_INSTALL_GRCOV"] }
private = true
command = "cargo"
args = ["install", "grcov", "--locked"]
[tasks.coverage-grcov]
condition = { rust_version = { min = "1.60.0" } }
private = true
script = '''
#!/usr/bin/env bash
set -eux
grcov ${COVERAGE_PROF_OUTPUT} \
-b ${COVERAGE_BINARIES} -s ${CARGO_MAKE_WORKSPACE_WORKING_DIRECTORY} \
-t ${GRCOV_OUTPUT_TYPE} --llvm --branch --ignore-not-existing --ignore "/*" --ignore "*/tests/*" --ignore "*/testing/*" --ignore "target/*" -o ${GRCOV_OUTPUT_PATH}
'''
dependencies = ["install-grcov", "coverage-grcov-prepare-outdir", "coverage-grcov-run-test"]
[tasks.coverage-grcov-html]
env = { GRCOV_OUTPUT_TYPE = "html", GRCOV_OUTPUT_PATH = "${COVERAGE_TARGET_DIRECTORY}/html", TEST_RUNNER = "multi-test" }
run_task = "coverage-grcov"
[tasks.coverage-grcov-lcov]
env = { GRCOV_OUTPUT_TYPE = "lcov", GRCOV_OUTPUT_PATH = "${COVERAGE_TARGET_DIRECTORY}/lcov.info", TEST_RUNNER = "multi-test" }
run_task = "coverage-grcov"