Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions tests/common.mak
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,11 @@ endif
ifneq ($(COVER_DB),)
export PERL_COVER_ARGS := -MDevel::Cover=-db,$(COVER_DB),-coverage,statement,branch,condition,subroutine,-silent,1
EXEC_COVER := perl ${PERL_COVER_ARGS}
PYCOVER = COVERAGE_FILE=$(PYCOV_DB) coverage run --branch --append
export COVERAGE_COMMAND = $(shell which coverage 2>&1 > /dev/null ; if [ 0 -eq $$? ] ; then echo coverage ; else echo python3-coverage ; fi )
PYCOVER = COVERAGE_FILE=$(PYCOV_DB) ${COVERAGE_COMMAND} run --branch --append
#$(warning assigned PYCOVER='$(PYCOVER)')
endif


export TOPDIR TESTDIR
export PARENTDIR := $(dir $(patsubst %/,%,$(TOPDIR)))
export RELDIR := $(TESTDIR:$(PARENTDIR)%=%)
Expand Down
1 change: 1 addition & 0 deletions tests/gendiffcov/errs/msgtest.sh
Original file line number Diff line number Diff line change
Expand Up @@ -752,6 +752,7 @@ if [ 0 != $? ] ; then
exit 1
fi
fi

if [ -d mycache ] ; then
find mycache -type f -exec chmod ugo+r {} \;
fi
Expand Down
131 changes: 2 additions & 129 deletions tests/gendiffcov/simple/script.sh
Original file line number Diff line number Diff line change
@@ -1,139 +1,12 @@
#!/bin/bash
set +x

CLEAN_ONLY=0
COVER=

PARALLEL='--parallel 0'
PROFILE="--profile"
LOCAL_COVERAGE=1
KEEP_GOING=0

#echo "CMD: $0 $@"

while [ $# -gt 0 ] ; do

OPT=$1
shift
case $OPT in

--clean | clean )
CLEAN_ONLY=1
;;

-v | --verbose | verbose )
set -x
;;

--keep-going | -k )
KEEP_GOING=1
;;

--coverage )
if [[ "$1"x != 'x' && $1 != "-"* ]] ; then
COVER_DB=$1
LOCAL_COVERAGE=0
shift
else
COVER_DB='cover_db.dat'
fi
export PYCOV_DB="${COVER_DB}_py"
COVER="perl -MDevel::Cover=-db,${COVER_DB},-coverage,statement,branch,condition,subroutine,-silent,1 "
PYCOVER="COVERAGE_FILE=$PYCOV_DB coverage run --branch --append"
;;

--home | -home )
LCOV_HOME=$1
shift
if [ ! -f $LCOV_HOME/bin/lcov ] ; then
echo "LCOV_HOME '$LCOV_HOME' does not exist"
exit 1
fi
;;

--no-parallel )
PARALLEL=''
;;

--no-profile )
PROFILE=''
;;

--llvm )
LLVM=1
module load como/tools/llvm-gnu/11.0.0-1
# seems to have been using same gcov version as gcc/4.8.3
module load gcc/4.8.3
#EXTRA_GCOV_OPTS="--gcov-tool '\"llvm-cov gcov\"'"
CXX="clang++"
;;

* )
echo "Error: unexpected option '$OPT'"
exit 1
;;
esac
done

if [[ "x" == ${LCOV_HOME}x ]] ; then
if [ -f ../../../bin/lcov ] ; then
LCOV_HOME=../../..
else
LCOV_HOME=../../../../releng/coverage/lcov
fi
fi
LCOV_HOME=`(cd ${LCOV_HOME} ; pwd)`

if [[ ! ( -d $LCOV_HOME/bin && -d $LCOV_HOME/lib && -x $LCOV_HOME/bin/genhtml && ( -f $LCOV_HOME/lib/lcovutil.pm || -f $LCOV_HOME/lib/lcov/lcovutil.pm ) ) ]] ; then
echo "LCOV_HOME '$LCOV_HOME' seems not to be invalid"
exit 1
fi

export PATH=${LCOV_HOME}/bin:${LCOV_HOME}/share:${PATH}
export MANPATH=${MANPATH}:${LCOV_HOME}/man

ROOT=`pwd`
PARENT=`(cd .. ; pwd)`
if [ -f $LCOV_HOME/scripts/getp4version ] ; then
SCRIPT_DIR=$LCOV_HOME/scripts
else
# running test from lcov install
SCRIPT_DIR=$LCOV_HOME/share/lcov/support-scripts
MD5_OPT='--version-script --md5'
fi
if [ 'x' == "x$GENHTML_TOOL" ] ; then
GENHTML_TOOL=${LCOV_HOME}/bin/genhtml
LCOV_TOOL=${LCOV_HOME}/bin/lcov
GENINFO_TOOL=${LCOV_HOME}/bin/geninfo
SPREADSHEET_TOOL=${SCRIPT_DIR}/spreadsheet.py
fi

# is this git or P4?
git -C . rev-parse > /dev/null 2>&1
if [ 0 == $? ] ; then
# this is git
GET_VERSION=${SCRIPT_DIR}/gitversion.pm
GET_VERSION_EXE=${SCRIPT_DIR}/gitversion
ANNOTATE=${SCRIPT_DIR}/gitblame.pm
else
GET_VERSION=${SCRIPT_DIR}/getp4version
GET_VERSION_EXE=${SCRIPT_DIR}/getp4version
ANNOTATE=${SCRIPT_DIR}/p4annotate.pm
fi
CRITERIA=${SCRIPT_DIR}/criteria
SELECT=${SCRIPT_DIR}/select.pm

#PARALLEL=''
#PROFILE="''

source ../../common.tst

rm -f test.cpp *.gcno *.gcda a.out *.info *.info.gz diff.txt diff_r.txt diff_broken.txt *.log *.err *.json dumper* results.xlsx annotate.{cpp,exe} c d ./cover_db_py names.data linked.cpp linked_diff.txt *.msg
rm -rf ./baseline ./current ./differential* ./reverse ./diff_no_baseline ./no_baseline ./no_annotation ./no_owners differential_nobranch reverse_nobranch baseline-filter* noncode_differential* broken mismatchPath elidePath ./cover_db ./criteria* ./mismatched ./navigation differential_prop proportion ./annotate ./current-* ./current_prefix* select select2 html_report ./usage ./errOut ./noNames no_source linked linked_err linked_elide linked_dir failUnder expect_err expect recategorize

if [ "x$COVER" != 'x' ] && [ 0 != $LOCAL_COVERAGE ] ; then
cover -delete -db $COVER_DB
rm -rf $PYCOV_DB
fi
clean_cover

if [[ 1 == $CLEAN_ONLY ]] ; then
exit 0
Expand Down
144 changes: 27 additions & 117 deletions tests/py2lcov/py2lcov.sh
Original file line number Diff line number Diff line change
@@ -1,101 +1,30 @@
#!/bin/bash
set +x

CLEAN_ONLY=0
COVER=

PARALLEL='--parallel 0'
PROFILE="--profile"
if [ 'x' == "x${COVER_DB}" ] ; then
COVER_DB='cover_db'
fi
if [ 'x' == "x${PYCOV_DB}" ] ; then
PYCOV_DB='pycov.dat'
fi
LOCAL_COVERAGE=1
KEEP_GOING=0
while [ $# -gt 0 ] ; do

OPT=$1
shift
case $OPT in

--clean | clean )
CLEAN_ONLY=1
;;

-v | --verbose | verbose )
set -x
;;

-k | --keep-going )
KEEP_GOING=1
;;

--coverage )
#COVER="perl -MDevel::Cover "
if [[ "$1"x != 'x' && $1 != "-"* ]] ; then
COVER_DB=$1
LOCAL_COVERAGE=0
shift
fi
COVER="perl -MDevel::Cover=-db,${COVER_DB},-coverage,statement,branch,condition,subroutine,-silent,1 "
PYCOV="COVERAGE_FILE=${PYCOV_DB} coverage run --branch --append"
#PYCOV="coverage run --data-file=${PYCOV_DB} --branch --append"
;;

--home | -home )
LCOV_HOME=$1
shift
if [ ! -f $LCOV_HOME/bin/lcov ] ; then
echo "LCOV_HOME '$LCOV_HOME' does not exist"
exit 1
fi
;;

--no-parallel )
PARALLEL=''
;;

--no-profile )
PROFILE=''
;;

* )
echo "Error: unexpected option '$OPT'"
exit 1
;;
esac
done

if [ "x" == "x$LCOV_HOME" ] ; then
if [ -f ../../bin/lcov ] ; then
LCOV_HOME=../..
else
LCOV_HOME=../../../releng/coverage/lcov
fi
if [[ "x" == ${LCOV_HOME}x ]] ; then
if [ -f ../../bin/lcov ] ; then
LCOV_HOME=../..
fi
fi

LCOV_HOME=`(cd ${LCOV_HOME} ; pwd)`
source ../common.tst

if [ 'x' == "x$PY2LCOV_TOOL" ] ; then
GENHTML_TOOL=${LCOV_HOME}/bin/genhtml
LCOV_TOOL=${LCOV_HOME}/bin/lcov
PERLLCOV_TOOL=${LCOV_HOME}/bin/perl2lcov
PY2LCOV_TOOL=${LCOV_HOME}/bin/py2lcov
rm -rf *.xml* *.dat *.info *.json __pycache__ help.txt *.pyc my_cache rpt1 rpt2

clean_cover

if [[ 1 == $CLEAN_ONLY ]] ; then
exit 0
fi

PY2LCOV_SCRIPT=${LCOV_HOME}/bin/py2lcov

if [ -f $LCOV_HOME/scripts/getp4version ] ; then
SCRIPT_DIR=$LCOV_HOME/scripts
else
if [ ! -f $LCOV_HOME/scripts/getp4version ] ; then
# running test from lcov install
SCRIPT_DIR=$LCOV_HOME/share/lcov/support-scripts
MD5_OPT=',--md5'
fi
# is this git or P4?
git -C . rev-parse > /dev/null 2>&1
if [ 0 == $? ] ; then
if [ 1 == "$USE_GIT" ] ; then
# this is git
VERSION="--version-script ${SCRIPT_DIR}/gitversion${MD5_OPT}"
ANNOTATE="--annotate-script ${SCRIPT_DIR}/gitblame.pm,--cache,my_cache"
Expand All @@ -105,46 +34,27 @@ else
DEPOT=",."
fi

if [ $IS_GIT == 0 ] && [ $IS_P4 == 0 ] ; then
VERSION=
ANNOTATE="$ANNOTATE --ignore annotate"
fi

if [ ! -x $PY2LCOV_SCRIPT ] ; then
echo "missing py2lcov script - dying"
exit 1
fi

if [[ ! ( -d $LCOV_HOME/bin && -d $LCOV_HOME/lib && -x $LCOV_HOME/bin/genhtml && -f $LCOV_HOME/lib/lcovutil.pm ) ]] ; then
echo "LCOV_HOME '$LCOV_HOME' seems not to be invalid"
exit 1
fi

export PATH=${LCOV_HOME}/bin:${LCOV_HOME}/share:${PATH}
export MANPATH=${MANPATH}:${LCOV_HOME}/man

if [ 'x' == "x$GENHTML_TOOL" ] ; then
GENHTML_TOOL=${LCOV_HOME}/bin/genhtml
LCOV_TOOL=${LCOV_HOME}/bin/lcov
GENINFO_TOOL=${LCOV_HOME}/bin/geninfo
fi

ROOT=`pwd`
PARENT=`(cd .. ; pwd)`

LCOV_OPTS="--branch-coverage $PARALLEL $PROFILE"

rm -rf *.xml* *.dat *.info *.json __pycache__ help.txt *.pyc my_cache rpt1 rpt2

if [ "x$COVER" != 'x' ] && [ 0 != $LOCAL_COVERAGE ] ; then
cover -delete
rm -rf pycov
fi

if [[ 1 == $CLEAN_ONLY ]] ; then
exit 0
fi

CMD='coverage'
which $CMD
if [ 0 != $? ] ; then
CMD='python3-coverage' # ubuntu?
if [ '' != "${COVERAGE_COMMAND}" ] ; then
CMD=${COVERAGE_COMMAND}
else
CMD='coverage'
which $CMD
if [ 0 != $? ] ; then
CMD='python3-coverage' # ubuntu?
fi
fi
which $CMD
if [ 0 != $? ] ; then
Expand All @@ -161,7 +71,7 @@ if [ 0 != $? ] ; then
exit 1
fi
fi
eval ${PYCOV} ${PY2LCOV_TOOL} -o functions.info --cmd $CMD functions.dat $VERSION
eval COVERAGE_COMMAND=$CMD ${PYCOV} ${PY2LCOV_TOOL} -o functions.info --cmd $CMD functions.dat $VERSION
if [ 0 != $? ] ; then
echo "py2lcov failed function example"
if [ 0 == $KEEP_GOING ] ; then
Expand Down