You've already forked python-uncompyle6
mirror of
https://github.com/rocky/python-uncompyle6.git
synced 2025-08-04 01:09:52 +08:00
Runtest.sh improvements; reduce CircleCI test time
runtests.sh: show total elapsed time. Be smart about when patterns are entered as a parameter
This commit is contained in:
@@ -1,6 +1,19 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
me=${BASH_SOURCE[0]}
|
me=${BASH_SOURCE[0]}
|
||||||
|
|
||||||
|
function displaytime {
|
||||||
|
local T=$1
|
||||||
|
local D=$((T/60/60/24))
|
||||||
|
local H=$((T/60/60%24))
|
||||||
|
local M=$((T/60%60))
|
||||||
|
local S=$((T%60))
|
||||||
|
(( $D > 0 )) && printf '%d days ' $D
|
||||||
|
(( $H > 0 )) && printf '%d hours ' $H
|
||||||
|
(( $M > 0 )) && printf '%d minutes ' $M
|
||||||
|
(( $D > 0 || $H > 0 || $M > 0 )) && printf 'and '
|
||||||
|
printf '%d seconds\n' $S
|
||||||
|
}
|
||||||
|
|
||||||
# Python version setup
|
# Python version setup
|
||||||
FULLVERSION=$(pyenv local)
|
FULLVERSION=$(pyenv local)
|
||||||
PYVERSION=${FULLVERSION%.*}
|
PYVERSION=${FULLVERSION%.*}
|
||||||
@@ -111,10 +124,16 @@ typeset -i i=0
|
|||||||
typeset -i allerrs=0
|
typeset -i allerrs=0
|
||||||
if [[ -n $1 ]] ; then
|
if [[ -n $1 ]] ; then
|
||||||
files=$1
|
files=$1
|
||||||
SKIP_TESTS=()
|
typeset -a files_ary=( $(echo $1) )
|
||||||
|
if (( ${#files_ary[@]} == 1 )) ; then
|
||||||
|
SKIP_TESTS=()
|
||||||
|
fi
|
||||||
else
|
else
|
||||||
files=test_*.py
|
files=test_*.py
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
typeset -i ALL_FILES_STARTTIME=$(date +%s)
|
||||||
|
|
||||||
for file in $files; do
|
for file in $files; do
|
||||||
# AIX bash doesn't grok [[ -v SKIP... ]]
|
# AIX bash doesn't grok [[ -v SKIP... ]]
|
||||||
[[ ${SKIP_TESTS[$file]} == 1 ]] && continue
|
[[ ${SKIP_TESTS[$file]} == 1 ]] && continue
|
||||||
@@ -155,5 +174,11 @@ for file in $files; do
|
|||||||
exit $allerrs
|
exit $allerrs
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
echo "Ran $i tests"
|
typeset -i ALL_FILES_ENDTIME=$(date +%s)
|
||||||
|
|
||||||
|
(( time_diff = ALL_FILES_ENDTIME - ALL_FILES_STARTTIME))
|
||||||
|
|
||||||
|
printf "Ran $i tests in "
|
||||||
|
displaytime $time_diff
|
||||||
|
|
||||||
exit $allerrs
|
exit $allerrs
|
||||||
|
Reference in New Issue
Block a user