Runtest.sh improvements

This commit is contained in:
rocky
2020-05-05 22:18:15 -04:00
parent c5228dbdc4
commit ab54caae34

View File

@@ -131,6 +131,7 @@ fulldir=$(pwd)
# DECOMPILER=uncompyle2 # DECOMPILER=uncompyle2
DECOMPILER=${DECOMPILER:-"$fulldir/../../bin/uncompyle6"} DECOMPILER=${DECOMPILER:-"$fulldir/../../bin/uncompyle6"}
OPTS=${OPTS:-""}
TESTDIR=/tmp/test${PYVERSION} TESTDIR=/tmp/test${PYVERSION}
if [[ -e $TESTDIR ]] ; then if [[ -e $TESTDIR ]] ; then
rm -fr $TESTDIR rm -fr $TESTDIR
@@ -139,6 +140,8 @@ fi
PYENV_ROOT=${PYENV_ROOT:-$HOME/.pyenv} PYENV_ROOT=${PYENV_ROOT:-$HOME/.pyenv}
pyenv_local=$(pyenv local) pyenv_local=$(pyenv local)
echo Python version is $pyenv_local
# pyenv version update # pyenv version update
for dir in ../ ../../ ; do for dir in ../ ../../ ; do
cp -v .python-version $dir cp -v .python-version $dir
@@ -147,18 +150,25 @@ done
mkdir $TESTDIR || exit $? mkdir $TESTDIR || exit $?
cp -r ${PYENV_ROOT}/versions/${PYVERSION}.${MINOR}/lib/python${PYVERSION}/test $TESTDIR cp -r ${PYENV_ROOT}/versions/${PYVERSION}.${MINOR}/lib/python${PYVERSION}/test $TESTDIR
cd $TESTDIR/test if [[ $PYVERSION == 3.2 ]] ; then
cp ${PYENV_ROOT}/versions/${PYVERSION}.${MINOR}/lib/python${PYVERSION}/test/* $TESTDIR
cd $TESTDIR
else
cd $TESTDIR/test
fi
pyenv local $FULLVERSION pyenv local $FULLVERSION
export PYTHONPATH=$TESTDIR export PYTHONPATH=$TESTDIR
export PATH=${PYENV_ROOT}/shims:${PATH} export PATH=${PYENV_ROOT}/shims:${PATH}
DONT_SKIP_TESTS=${DONT_SKIP_TESTS:-0}
# Run tests # Run tests
typeset -i i=0 typeset -i i=0
typeset -i allerrs=0 typeset -i allerrs=0
if [[ -n $1 ]] ; then if [[ -n $1 ]] ; then
files=$1 files=$@
typeset -a files_ary=( $(echo $1) ) typeset -a files_ary=( $(echo $@) )
if (( ${#files_ary[@]} == 1 )) ; then if (( ${#files_ary[@]} == 1 || DONT_SKIP_TESTS == 1 )) ; then
SKIP_TESTS=() SKIP_TESTS=()
fi fi
else else
@@ -190,7 +200,7 @@ for file in $files; do
typeset -i ENDTIME=$(date +%s) typeset -i ENDTIME=$(date +%s)
typeset -i time_diff typeset -i time_diff
(( time_diff = ENDTIME - STARTTIME)) (( time_diff = ENDTIME - STARTTIME))
if (( time_diff > 10 )) ; then if (( time_diff > $timeout )) ; then
echo "Skipping test $file -- test takes too long to run: $time_diff seconds" echo "Skipping test $file -- test takes too long to run: $time_diff seconds"
continue continue
fi fi
@@ -202,7 +212,7 @@ for file in $files; do
$fulldir/compile-file.py $file && \ $fulldir/compile-file.py $file && \
mv $file{,.orig} && \ mv $file{,.orig} && \
echo ========== $(date +%X) Decompiling $file =========== echo ========== $(date +%X) Decompiling $file ===========
$DECOMPILER $decompiled_file > $file $DECOMPILER $OPTS $decompiled_file > $file
rc=$? rc=$?
if (( rc == 0 )) ; then if (( rc == 0 )) ; then
echo ========== $(date +%X) Running $file =========== echo ========== $(date +%X) Running $file ===========