@@ -141,21 +141,27 @@ if [[ 1 == $CLEAN_ONLY ]] ; then
141
141
exit 0
142
142
fi
143
143
144
- which coverage
144
+ CMD=' coverage'
145
+ which $CMD
145
146
if [ 0 != $? ] ; then
147
+ CMD=' python3-coverage' # ubuntu?
148
+ fi
149
+ which $CMD
150
+ if [ 0 != $? ] ; then
151
+ echo " cannot find 'coverage' or 'python3-coverage'"
146
152
echo " unable to run py2lcov - please install python Coverage.py package"
147
153
exit 1
148
154
fi
149
155
150
156
# some corner cases:
151
- COVERAGE_FILE=./functions.dat coverage run --branch ./test.py
157
+ COVERAGE_FILE=./functions.dat $CMD run --branch ./test.py
152
158
if [ 0 != $? ] ; then
153
159
echo " coverage functions failed"
154
160
if [ 0 == $KEEP_GOING ] ; then
155
161
exit 1
156
162
fi
157
163
fi
158
- eval ${PYCOV} ${PY2LCOV_TOOL} -o functions.info functions.dat $VERSION
164
+ eval ${PYCOV} ${PY2LCOV_TOOL} -o functions.info --cmd $CMD functions.dat $VERSION
159
165
if [ 0 != $? ] ; then
160
166
echo " py2lcov failed function example"
161
167
if [ 0 == $KEEP_GOING ] ; then
208
214
209
215
210
216
# legacy mode: run with intermediate XML file
211
- COVERAGE_FILE=./functions.dat coverage xml -o functions.xml
217
+ COVERAGE_FILE=./functions.dat $CMD xml -o functions.xml
212
218
if [ 0 != $? ] ; then
213
219
echo " coverage xml failed"
214
220
exit 1
@@ -232,7 +238,7 @@ if [ 0 != $? ] ; then
232
238
fi
233
239
234
240
# run again, generating checksum data...
235
- eval ${PYCOV} ${PY2LCOV_TOOL} -o checksum.info functions.dat $VERSION --checksum
241
+ eval ${PYCOV} ${PY2LCOV_TOOL} --cmd $CMD - o checksum.info functions.dat $VERSION --checksum
236
242
if [ 0 != $? ] ; then
237
243
echo " py2lcov failed function example"
238
244
if [ 0 == $KEEP_GOING ] ; then
262
268
263
269
264
270
# run without generating function data:
265
- eval ${PYCOV} ${PY2LCOV_TOOL} functions.dat -o no_functions.info $VERSION --no-function
271
+ eval ${PYCOV} ${PY2LCOV_TOOL} functions.dat --cmd $CMD - o no_functions.info $VERSION --no-function
266
272
if [ 0 != $? ] ; then
267
273
echo " coverage no_functions failed"
268
274
if [ 0 == $KEEP_GOING ] ; then
@@ -279,7 +285,7 @@ if [ 0 != $COUNT ] ; then
279
285
fi
280
286
281
287
# run without extracting version
282
- eval ${PYCOV} ${PY2LCOV_TOOL} functions.dat -o no_version.info
288
+ eval ${PYCOV} ${PY2LCOV_TOOL} functions.dat --cmd $CMD - o no_version.info
283
289
if [ 0 != $? ] ; then
284
290
echo " coverage no_functions failed"
285
291
if [ 0 == $KEEP_GOING ] ; then
@@ -296,7 +302,7 @@ if [ 0 != $COUNT ] ; then
296
302
fi
297
303
298
304
# test exclusion
299
- eval ${PYCOV} ${PY2LCOV_TOOL} -o excl.info --exclude test.py functions.dat
305
+ eval ${PYCOV} ${PY2LCOV_TOOL} -o excl.info --cmd $CMD -- exclude test.py functions.dat
300
306
if [ 0 != $? ] ; then
301
307
echo " coverage no_functions failed"
302
308
if [ 0 == $KEEP_GOING ] ; then
@@ -330,7 +336,7 @@ if [ 0 != $? ] ; then
330
336
fi
331
337
332
338
# some usage errors
333
- eval ${PYCOV} ${PY2LCOV_TOOL} functions.dat -o paramErr.info ${VERSION} ,-x
339
+ eval ${PYCOV} ${PY2LCOV_TOOL} functions.dat -o paramErr.info --cmd $CMD ${VERSION} ,-x
334
340
if [ 0 == $? ] ; then
335
341
echo " coverage version did not see error"
336
342
if [ 0 == $KEEP_GOING ] ; then
@@ -339,7 +345,7 @@ if [ 0 == $? ] ; then
339
345
fi
340
346
341
347
# run again with --keep-going flag - should generate same result as we see without version script
342
- eval ${PYCOV} ${PY2LCOV_TOOL} functions.dat -o keepGoing.info ${VERSION} ,-x --keep-going --verbose
348
+ eval ${PYCOV} ${PY2LCOV_TOOL} functions.dat -o keepGoing.info --cmd $CMD ${VERSION} ,-x --keep-going --verbose
343
349
if [ 0 != $? ] ; then
344
350
echo " keepGoing version saw error"
345
351
if [ 0 == $KEEP_GOING ] ; then
359
365
# can't run this unless we have a new enough 'coverage' version
360
366
# to support the --data-file input
361
367
if [[ " ${PYCOV} " =~ " COVERAGE_FILE=" || " ${PY2LCOV_TOOL} " =~ " COVERAGE_FILE=" ]] ; then
362
- ${LCOV_HOME} /bin/py2lcov -o missing.info
368
+ ${LCOV_HOME} /bin/py2lcov -o missing.info --cmd $CMD
363
369
else
364
- eval ${PYCOV} ${PY2LCOV_TOOL} -o missing.info
370
+ eval ${PYCOV} ${PY2LCOV_TOOL} -o missing.info --cmd $CMD
365
371
fi
366
372
if [ 0 == $? ] ; then
367
373
echo " did not see error with missing input data"
@@ -371,7 +377,7 @@ if [ 0 == $? ] ; then
371
377
fi
372
378
373
379
# usage error:
374
- eval ${PYCOV} ${PY2LCOV_TOOL} -o noFile.info run.dat y.xml
380
+ eval ${PYCOV} ${PY2LCOV_TOOL} -o noFile.info run.dat y.xml --cmd $CMD
375
381
if [ 0 == $? ] ; then
376
382
echo " did not see error with missing input file"
377
383
if [ 0 == $KEEP_GOING ] ; then
@@ -380,7 +386,7 @@ if [ 0 == $? ] ; then
380
386
fi
381
387
382
388
# usage error:
383
- eval ${PYCOV} ${PY2LCOV_TOOL} -o badArg.info --noSuchParam run_help.dat
389
+ eval ${PYCOV} ${PY2LCOV_TOOL} -o badArg.info --noSuchParam run_help.dat --cmd $CMD
384
390
if [ 0 == $? ] ; then
385
391
echo " did not see error with unsupported param"
386
392
if [ 0 == $KEEP_GOING ] ; then
392
398
# to support the --data-file input
393
399
if [[ " ${PYCOV} " =~ " COVERAGE_FILE=" || " ${PY2LCOV_TOOL} " =~ " COVERAGE_FILE=" ]] ; then
394
400
# can't generate coverage report for this feature...
395
- COVERAGE_FILE=functions.dat ${LCOV_HOME} /bin/py2lcov -o fromEnv.info
401
+ COVERAGE_FILE=functions.dat ${LCOV_HOME} /bin/py2lcov -o fromEnv.info --cmd $CMD
396
402
else
397
403
# get input from environment var:
398
- eval COVERAGE_FILE=functions.dat ${PYCOV} ${PY2LCOV_TOOL} -o fromEnv.info
404
+ eval COVERAGE_FILE=functions.dat ${PYCOV} ${PY2LCOV_TOOL} -o fromEnv.info --cmd $CMD
399
405
fi
400
406
401
407
if [ 0 != $? ] ; then
@@ -480,6 +486,6 @@ echo "Tests passed"
480
486
if [[ " x$COVER " != " x" && $LOCAL_COVERAGE == 1 ]] ; then
481
487
cover
482
488
${LCOV_HOME} /bin/perl2lcov -o perlcov.info --testname py2lcov $VERSION ./cover_db
483
- ${PY2LCOV_TOOL} -o pycov.info --testname py2lcov $VERSION ${PYCOV_DB}
489
+ ${PY2LCOV_TOOL} -o pycov.info --testname py2lcov --cmd $CMD $VERSION ${PYCOV_DB}
484
490
${GENHTML_TOOL} -o pycov pycov.info perlcov.info --flat --show-navigation --show-proportion --branch $VERSION $ANNOTATE --ignore inconsistent,version
485
491
fi
0 commit comments