A suite of regression tests to help automate validation of new builds/features in j2ms2/tConvert/other tools
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

86 lines
2.5 KiB

#!/bin/sh
# This script should be executed from the directory that contains the script
if [ ! -f .run_main_from_here ]; then
echo "Please change working directory to where this script is located and run it from there."
exit 1
fi
# Loop over all defined tests and execute them
python="python"
live=
skip=
testopts=
for av; do
# check if we're supposed to skip the next arg
if [ -n "${skip}" -a "${skip}" != ".T." ]; then
eval "${skip}=${av}"
skip=
elif [ -z "${skip}" ]; then
case ${av} in
# hellup
-h)
bn=`basename $0`
echo "${bn} [-h] [-n] [--python=[path/to/]python]"
echo " -h show this message, exit succesfully"
echo " -n show which tests would be run in which order but do not run 'm"
echo " --python=.. provide path to different python version (default: ${python})"
exit 0
;;
# Strip out options for _this_ script
--python)
skip="python"
;;
--python=*)
python=`echo "${av}" | sed 's/^--python=//'`
;;
# Fake?
-n)
live="echo"
;;
# anything else passed on verbatim to test
*)
testopts="${testopts} ${av}"
;;
esac
fi
done
# OK that's the command line parsed
# If we got this far, we can do this - make sure the submodule(s) are
# initialized and updated
git submodule init
git submodule update
# If we're running from here it's us who set the tempdir
tempdir=`${python} -c 'from __future__ import print_function; import tempfile; print(tempfile.mkdtemp());'`
# now we can install cleanup routines for interrupted and normal process exit
trap 'cleanup_sig' 1 2 3 6 15
trap 'cleanup_normal' 0
cleanup_sig()
{
# we was interrupted - remove the whole tempdir
rm -rf ${tempdir}
exit 1
}
cleanup_normal()
{
# if cleanup_sig has run, the temp dir doesn't exist anymore
if [ ! -d ${tempdir} ]; then
exit 1;
fi
# If, after all tests have run, the tempdir is empty, it means all tests ran succesfully
if [ -z "$(ls -A ${tempdir})" ]; then
# empty == success
rm -rf ${tempdir};
exit 0;
fi
# not empty => #FAIL
exit 1
}
for f in `find . -type f -a -name test*.py`; do
${live} ${python} ${f} ${testopts} --tempdir ${tempdir}
done