-
Notifications
You must be signed in to change notification settings - Fork 20
/
coverage_grcov.Makefile.toml
54 lines (44 loc) · 1.89 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
54
# https://crates.io/crates/grcov
[env]
COVERAGE_WORKING_DIRECTORY = "${CARGO_MAKE_WORKSPACE_WORKING_DIRECTORY}/target/coverage"
COVERAGE_BINARIES = "${CARGO_MAKE_WORKSPACE_WORKING_DIRECTORY}/target/debug"
COVERAGE_PROF_OUTPUT = "${COVERAGE_WORKING_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_INCREMENTAL = "0"
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"]
# NOTE: ignore coverage for swapper and zapper contracts because their tests are based on `osmosis-testing` which don't work for grcov
[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 "*/mock*" --ignore "*/tests/*" --ignore "*/testing/*" --ignore "target/*" --ignore "contracts/swapper/*" --ignore "*/zapper/*" -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_WORKING_DIRECTORY}/html", TEST_RUNNER = "multi-test" }
run_task = "coverage-grcov"
[tasks.coverage-grcov-lcov]
env = { GRCOV_OUTPUT_TYPE = "lcov", GRCOV_OUTPUT_PATH = "${COVERAGE_WORKING_DIRECTORY}/lcov.info", TEST_RUNNER = "multi-test" }
run_task = "coverage-grcov"