Skip to content

Commit a0b8b9e

Browse files
committed
Try using source-based code coverage
1 parent c88d935 commit a0b8b9e

File tree

2 files changed

+14
-8
lines changed

2 files changed

+14
-8
lines changed

.github/workflows/cron-ci.yaml

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -27,12 +27,12 @@ jobs:
2727
with:
2828
toolchain: nightly
2929
override: true
30+
components: llvm-tools-preview
3031
- uses: actions-rs/cargo@v1
3132
with:
3233
command: build
33-
args: --verbose
34+
args: --release --verbose
3435
env:
35-
CARGO_INCREMENTAL: '0'
3636
RUSTC_WRAPPER: './scripts/codecoverage-rustc-wrapper.sh'
3737
- uses: actions/setup-python@v1
3838
with:
@@ -49,17 +49,23 @@ jobs:
4949
working-directory: ./extra_tests
5050
env:
5151
RUSTPYTHON_TESTS_NOBUILD: 'true'
52-
RUSTPYTHON_DEBUG: 'true'
52+
LLVM_PROFILE_FILE: 'snippet-%p.profraw'
5353
- name: run cpython tests
54-
run: target/debug/rustpython -m test -v
54+
run: target/release/rustpython -m test -v
5555
env:
5656
RUSTPYTHONPATH: ${{ github.workspace }}/Lib
57-
- uses: actions-rs/grcov@v0.1
58-
id: coverage
57+
LLVM_PROFILE_FILE: 'regrtest.profraw'
58+
- name: prepare code coverage data
59+
run: |
60+
rusttool() {
61+
local tool=$1; shift; "$(rustc --print target-libdir)/../bin/llvm-$tool" "$@"
62+
}
63+
rusttool profdata merge extra_tests/snippet-*.profraw regrtest.profraw --output codecov.profdata
64+
rusttool cov export --instr-profile codecov.profdata target/release/rustpython >codecov.lcov
5965
- name: upload to Codecov
6066
uses: codecov/codecov-action@v1
6167
with:
62-
file: ${{ steps.coverage.outputs.report }}
68+
file: ./codecov.lcov
6369

6470
testdata:
6571
name: Collect regression test data

scripts/codecoverage-rustc-wrapper.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ get_crate_name() {
1414

1515
case $(get_crate_name "$@") in
1616
rustpython_*|rustpython)
17-
EXTRA=(-Zprofile -Ccodegen-units=1 -Cinline-threshold=0 -Clink-dead-code -Coverflow-checks=off -Zpanic_abort_tests) # -Cpanic=abort
17+
EXTRA=(-Zinstrument-coverage)
1818
;;
1919

2020
*) EXTRA=() ;;

0 commit comments

Comments
 (0)