Skip to content

Commit

Permalink
use stable cargo for coverage builds
Browse files Browse the repository at this point in the history
  • Loading branch information
ctz committed Dec 28, 2017
1 parent 25a050e commit 7b5396d
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
1 change: 1 addition & 0 deletions .travis.yml
Expand Up @@ -14,6 +14,7 @@ matrix:
before_install:
- if [[ "$COVERAGE" == "1" ]]; then admin/build-lcov ; fi
- if [[ "$COVERAGE" == "1" ]]; then gem install coveralls-lcov ; fi
- if [[ "$COVERAGE" == "1" ]]; then rustup install stable ; fi
- if [[ "$COVERAGE" == "1" ]]; then sudo apt-get install libclang-common-3.8-dev llvm-3.8-dev ; fi
script:
- RUST_BACKTRACE=1 cargo test
Expand Down
10 changes: 7 additions & 3 deletions admin/coverage
Expand Up @@ -3,7 +3,6 @@
import os
import glob
import subprocess
from os import path

LLVM_PATH = glob.glob('/usr/lib/llvm-3.8/lib/clang/3.8.[0-9]/lib/linux/')[0]
COVERAGE_OPTIONS = '-Ccodegen-units=1 -Clink-dead-code -Cpasses=insert-gcov-profiling -Zno-landing-pads -L%s -lclang_rt.profile-x86_64' % LLVM_PATH
Expand All @@ -23,10 +22,15 @@ def run(which):
exe = filter(lambda x: '.d' not in x, glob.glob('target/debug/' + which + '-*'))[0]
sh('./' + exe)

def cargo():
# run stable cargo, because nightly is oft-broken
out = subprocess.check_output(['rustup', 'run', 'stable', 'rustup', 'which', 'cargo'])
return out.strip()

def rustc(*args):
exe = ['cargo', 'rustc', '--all-features'] + list(args)
exe = [cargo(), 'rustc', '--all-features'] + list(args)
env = dict(os.environ)
env.update(RUSTC_WRAPPER = path.abspath('./admin/coverage-rustc'),
env.update(RUSTC_WRAPPER = './admin/coverage-rustc',
COVERAGE_OPTIONS = COVERAGE_OPTIONS)
subprocess.check_call(exe, env = env)

Expand Down

0 comments on commit 7b5396d

Please sign in to comment.