Something went wrong on our end
-
Vincent Hatakeyama authoredVincent Hatakeyama authored
run_tests 1.53 KiB
#!/bin/zsh
# vim: set shiftwidth=4 softtabstop=4:
#
# This script is used to run tests on a database with demo data installed.
#
# Either provide the name of the database (first argument) or it will default to <project>_test
# Version 2.6
here=$(dirname $0)
project_home=$(cd $here && cd .. && echo $PWD)
tested_modules=$(python -B -c "import ConfigParser ; c = ConfigParser.ConfigParser() ; c.read('${project_home}/setup.cfg') ; print ','.join(c.get('odoo_scripts', 'module_list_tests', '').split())")
if [[ "$tested_modules" != "" ]];
then
update="-u $tested_modules"
fi
dbname=$1
if [[ -z "$dbname" ]];
then
dbname=$(basename $(readlink -f $project_home))_test
else
shift
fi
echo "Using database $dbname for tests"
ODOO_TYPE=$(python -B -c "import ConfigParser ; c = ConfigParser.ConfigParser() ; c.read('${project_home}/setup.cfg') ; print c.get('odoo_scripts', 'odoo_type', 'odoo8')")
if [ "$ODOO_TYPE" = "odoo8" ];
then
loglevel="--log-level=info"
else
loglevel="--log-level=test"
fi
logfile=$(tempfile --suffix=.log)
$here/start $update -d $dbname --test-enable $loglevel --max-cron=0 --stop-after-init $* | tee $logfile
ok=$(grep ' OK' $logfile -c)
# TODO detect yaml tests failures
failed=$(grep ' FAILED' $logfile -c)
echo ''
echo '***** Test results *****'
echo "$ok modules passing, $failed modules failing"
echo ''
if [[ $ok -gt 0 ]];
then
echo '\tOK:'
grep ' OK' $logfile || true
fi
if [[ $failed -gt 0 ]];
then
echo '\tFAILED:'
grep FAILED $logfile
fi
echo ''
rm $logfile
if [[ $failed -gt 0 ]];
then
exit 1
fi