Skip to content

Commit

Permalink
Add cargo-kconv to travis config
Browse files Browse the repository at this point in the history
- Use cargo-kconv to install kconv, upload to coveralls
- Add script to workaround ICE in rustc when building proptest with
'-C link-dead-code'
  • Loading branch information
boustrophedon committed Jan 26, 2019
1 parent 4b910e3 commit e975cee
Show file tree
Hide file tree
Showing 2 changed files with 55 additions and 0 deletions.
27 changes: 27 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,30 @@ cache: cargo
rust:
- stable
- beta
addons:
apt:
packages:
# for kcov build
- binutils-dev
- libcurl4-openssl-dev
- zlib1g-dev
- libdw-dev
- libiberty-dev
- libelf-dev
- cmake
- gcc
- pkg-config
- jq

jobs:
include:
- stage: "Coverage"
name: "cargo-kcov"
script:
- cargo kcov --version || cargo install cargo-kcov
- |
[[ -x $HOME/.cargo/bin/kcov ]] && echo "kcov bin found in cache" || cargo kcov --print-install-kcov-sh | sh
# FIXME: When rust-lang/rust#52478 is fixed, we can remove the rustc shim script
# but also cargo kcov seems to fail with a different error when doing the build by itself.
- RUSTC="./rustc_ice_proptest_fix.sh" cargo test --no-run
- cargo kcov --verbose --no-clean-rebuild --coveralls
28 changes: 28 additions & 0 deletions rustc_ice_proptest_fix.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
#!/usr/bin/env python3
#
# This script modifies calls to rustc such that the '-C link-dead-code'
# compiler option is not passed only when building the proptest crate.
# The link-dead-code option is necessary for accurate code coverage.
# When https://github.com/rust-lang/rust/issues/52478 is fixed, or proptest is
# modified to somehow not trigger the bug, this script can be deleted, and the
# travis config updated.

import os
import sys

argv = sys.argv[1:]

try:
pkg_name = os.environ['CARGO_PKG_NAME']
except KeyError:
pass
else:
if pkg_name == 'proptest':
try:
pos = list(zip(argv, argv[1:])).index(('-C', 'link-dead-code'))
except ValueError:
pass
else:
argv[pos:pos + 2] = []

os.execv('/usr/bin/env', ['env', 'rustc'] + argv)

0 comments on commit e975cee

Please sign in to comment.