| 1 |
#!/bin/bash |
| 2 |
# |
| 3 |
# A little helper to overload default datalad executables with the one ran |
| 4 |
# through coverage |
| 5 |
|
| 6 |
set -eu |
| 7 |
|
| 8 |
bin=$(basename $0) |
| 9 |
curbin=$(which "$bin") |
| 10 |
curdatalad=$(which datalad) |
| 11 |
curdir=$(dirname $curdatalad) |
| 12 |
|
| 13 |
COVERAGE_RUN="-m coverage run" |
| 14 |
export COVERAGE_PROCESS_START=$PWD/../.coveragerc |
| 15 |
export PYTHONPATH="$PWD/../tools/coverage-bin/" |
| 16 |
export PATH=${PATH//$curdir:/} |
| 17 |
newdatalad=$(which datalad) |
| 18 |
newbin=$(which $bin) |
| 19 |
newpython=$(sed -ne '1s/#!//gp' $newdatalad) |
| 20 |
|
| 21 |
if [ $newdatalad = $curdatalad ]; then |
| 22 |
echo "E: binary remained the same: $newdatalad" >&2 |
| 23 |
exit 1 |
| 24 |
fi |
| 25 |
|
| 26 |
touch /tmp/coverages |
| 27 |
export COVERAGE_FILE=/tmp/.coverage-entrypoints-$RANDOM |
| 28 |
echo "Running now $newpython $COVERAGE_RUN --include=datalad/* -a $newbin $@" >> /tmp/coverages |
| 29 |
#$newpython $COVERAGE_RUN --include=datalad/* -a $newbin "$@" |
| 30 |
$newpython $COVERAGE_RUN -a $newbin "$@" |