Skip to content

Commit

Permalink
Testcase portability: default to git unless obviously p4
Browse files Browse the repository at this point in the history
Signed-off-by: Henry Cox <[email protected]>
  • Loading branch information
henry2cox committed Jan 10, 2025
1 parent 39e7323 commit 2b0977d
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 13 deletions.
12 changes: 8 additions & 4 deletions tests/common.tst
Original file line number Diff line number Diff line change
Expand Up @@ -135,15 +135,19 @@ git -C . rev-parse > /dev/null 2>&1
if [ 0 == $? ] ; then
# this is git
IS_GIT=1
USE_GIT=1
GET_VERSION=${SCRIPT_DIR}/gitversion.pm
GET_VERSION_EXE=${SCRIPT_DIR}/gitversion
ANNOTATE=${SCRIPT_DIR}/gitblame.pm
else
p4 have ... > /dev/null 2>&1
if [ 0 == $? ] ; then
IS_P4=1
fi
fi

if [ "$IS_GIT" == 1 ] || [ "$IS_P4" == 0 ] ; then
USE_GIT=1
GET_VERSION=${SCRIPT_DIR}/gitversion.pm
GET_VERSION_EXE=${SCRIPT_DIR}/gitversion
ANNOTATE=${SCRIPT_DIR}/gitblame.pm
else
USE_P4=1
GET_VERSION=${SCRIPT_DIR}/getp4version
GET_VERSION_EXE=${SCRIPT_DIR}/getp4version
Expand Down
2 changes: 1 addition & 1 deletion tests/lcov/extract/extract.sh
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,7 @@ if [ 0 != $? ] ; then
exit 1
fi
fi
grep -E "#.*user:.+$USER" context_comment.info
grep "#user: $USER" context_comment.info
if [ 0 != $? ] ; then
echo "Error: did not find context data in comment field"
if [ $KEEP_GOING == 0 ] ; then
Expand Down
6 changes: 3 additions & 3 deletions tests/lcov/mcdc/mcdc.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@ if [[ 1 == $CLEAN_ONLY ]] ; then
fi

# is this git or P4?
if [ 1 == "$USE_GIT" ] ; then
if [ 1 == "$USE_P4" ] ; then
GET_VERSION=${SCRIPT_DIR}/P4version.pm,--local-edit,--md5
else
# this is git
GET_VERSION=${SCRIPT_DIR}/gitversion.pm
else
GET_VERSION=${SCRIPT_DIR}/P4version.pm,--local-edit,--md5
fi


Expand Down
10 changes: 5 additions & 5 deletions tests/py2lcov/py2lcov.sh
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,14 @@ if [ ! -f $LCOV_HOME/scripts/getp4version ] ; then
MD5_OPT=',--md5'
fi
# is this git or P4?
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"
else
if [ 1 == "$IS_P4" ] ; then
VERSION="--version-script ${SCRIPT_DIR}/P4version.pm,--local-edit${MD5_OPT}"
ANNOTATE="--annotate-script ${SCRIPT_DIR}/p4annotate.pm,--cache,./my_cache"
DEPOT=",."
else
# this is git
VERSION="--version-script ${SCRIPT_DIR}/gitversion${MD5_OPT}"
ANNOTATE="--annotate-script ${SCRIPT_DIR}/gitblame.pm,--cache,my_cache"
fi

if [ $IS_GIT == 0 ] && [ $IS_P4 == 0 ] ; then
Expand Down

0 comments on commit 2b0977d

Please sign in to comment.