Skip to content

Testcase portability: default to git unless obviously p4 #382

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jan 11, 2025
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
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
Copy link
Contributor

@hartwork hartwork Jan 11, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@henry2cox with the new text, we could add -F on top?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@henry2cox update: this change can probably be just reverted (in favor of pull request #383)

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