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
|
#!/bin/bash
#
# A little helper to overload default datalad executables with the one ran
# through coverage
set -eu
bin=$(basename $0)
curbin=$(which "$bin")
curdatalad=$(which datalad)
curdir=$(dirname $curdatalad)
COVERAGE_RUN="-m coverage run"
export COVERAGE_PROCESS_START=$PWD/../.coveragerc
export PYTHONPATH="$PWD/../tools/coverage-bin/"
export PATH=${PATH//$curdir:/}
newdatalad=$(which datalad)
newbin=$(which $bin)
newpython=$(sed -ne '1s/#!//gp' $newdatalad)
if [ $newdatalad = $curdatalad ]; then
echo "E: binary remained the same: $newdatalad" >&2
exit 1
fi
touch /tmp/coverages
export COVERAGE_FILE=/tmp/.coverage-entrypoints-$RANDOM
echo "Running now $newpython $COVERAGE_RUN --include=datalad/* -a $newbin $@" >> /tmp/coverages
#$newpython $COVERAGE_RUN --include=datalad/* -a $newbin "$@"
$newpython $COVERAGE_RUN -a $newbin "$@"
|