Skip to content

Commit 54ce5db

Browse files
authored
Testcase portability: default to git unless obviously p4 (#382)
Signed-off-by: Henry Cox <[email protected]>
1 parent 39e7323 commit 54ce5db

File tree

4 files changed

+17
-13
lines changed

4 files changed

+17
-13
lines changed

tests/common.tst

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -135,15 +135,19 @@ git -C . rev-parse > /dev/null 2>&1
135135
if [ 0 == $? ] ; then
136136
# this is git
137137
IS_GIT=1
138-
USE_GIT=1
139-
GET_VERSION=${SCRIPT_DIR}/gitversion.pm
140-
GET_VERSION_EXE=${SCRIPT_DIR}/gitversion
141-
ANNOTATE=${SCRIPT_DIR}/gitblame.pm
142138
else
143139
p4 have ... > /dev/null 2>&1
144140
if [ 0 == $? ] ; then
145141
IS_P4=1
146142
fi
143+
fi
144+
145+
if [ "$IS_GIT" == 1 ] || [ "$IS_P4" == 0 ] ; then
146+
USE_GIT=1
147+
GET_VERSION=${SCRIPT_DIR}/gitversion.pm
148+
GET_VERSION_EXE=${SCRIPT_DIR}/gitversion
149+
ANNOTATE=${SCRIPT_DIR}/gitblame.pm
150+
else
147151
USE_P4=1
148152
GET_VERSION=${SCRIPT_DIR}/getp4version
149153
GET_VERSION_EXE=${SCRIPT_DIR}/getp4version

tests/lcov/extract/extract.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -248,7 +248,7 @@ if [ 0 != $? ] ; then
248248
exit 1
249249
fi
250250
fi
251-
grep -E "#.*user:.+$USER" context_comment.info
251+
grep "#user: $USER" context_comment.info
252252
if [ 0 != $? ] ; then
253253
echo "Error: did not find context data in comment field"
254254
if [ $KEEP_GOING == 0 ] ; then

tests/lcov/mcdc/mcdc.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,11 @@ if [[ 1 == $CLEAN_ONLY ]] ; then
1111
fi
1212

1313
# is this git or P4?
14-
if [ 1 == "$USE_GIT" ] ; then
14+
if [ 1 == "$USE_P4" ] ; then
15+
GET_VERSION=${SCRIPT_DIR}/P4version.pm,--local-edit,--md5
16+
else
1517
# this is git
1618
GET_VERSION=${SCRIPT_DIR}/gitversion.pm
17-
else
18-
GET_VERSION=${SCRIPT_DIR}/P4version.pm,--local-edit,--md5
1919
fi
2020

2121

tests/py2lcov/py2lcov.sh

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,14 +24,14 @@ if [ ! -f $LCOV_HOME/scripts/getp4version ] ; then
2424
MD5_OPT=',--md5'
2525
fi
2626
# is this git or P4?
27-
if [ 1 == "$USE_GIT" ] ; then
28-
# this is git
29-
VERSION="--version-script ${SCRIPT_DIR}/gitversion${MD5_OPT}"
30-
ANNOTATE="--annotate-script ${SCRIPT_DIR}/gitblame.pm,--cache,my_cache"
31-
else
27+
if [ 1 == "$IS_P4" ] ; then
3228
VERSION="--version-script ${SCRIPT_DIR}/P4version.pm,--local-edit${MD5_OPT}"
3329
ANNOTATE="--annotate-script ${SCRIPT_DIR}/p4annotate.pm,--cache,./my_cache"
3430
DEPOT=",."
31+
else
32+
# this is git
33+
VERSION="--version-script ${SCRIPT_DIR}/gitversion${MD5_OPT}"
34+
ANNOTATE="--annotate-script ${SCRIPT_DIR}/gitblame.pm,--cache,my_cache"
3535
fi
3636

3737
if [ $IS_GIT == 0 ] && [ $IS_P4 == 0 ] ; then

0 commit comments

Comments
 (0)