Commit 499142cc authored by Julien Muchembled's avatar Julien Muchembled

ERP5Type.tests: remove obsolete scripts

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@41822 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent cf192e9a
#!/bin/bash
DIRECTORY='/home/seb/zope/Products'
export USER=seb
rm -f $DIRECTORY/../unit_test/tests/zLOG.log
rm -f $DIRECTORY/test_output
touch $DIRECTORY/test_output
rm -f $DIRECTORY/test_full_output
touch $DIRECTORY/test_full_output
$DIRECTORY/update_cvs
if [ -d ${DIRECTORY}/ERP5/.svn ]
then
svn info ${DIRECTORY}/ERP5 | grep -e '^R.vision[ \t]*:' \
>> ${DIRECTORY}/test_output
fi
# Excluded tests must be separated by whitespaces
excluded_test_list="testCatalogSecurity"
test_list=`/bin/ls -1 $DIRECTORY/*/tests/test*.py`
for test in $test_list
do
skip_test=0
test_name=`basename $test .py`
for excluded_test_name in $excluded_test_list
do
[ $test_name = $excluded_test_name ] && skip_test=1 && break
done
[ $skip_test -eq 1 ] && continue
$DIRECTORY/ERP5Type/tests/runUnitTest.py $test_name \
>> $DIRECTORY/test_full_output 2>&1
done
cat $DIRECTORY/test_full_output | grep '\(^OK\|^FAILED\|^Ran\)' | \
sed "/^FAILED.*\|^OK.*/s/.*/\0\n/g" >> $DIRECTORY/test_output
$DIRECTORY/sendMailToList
#!/usr/bin/python
"""Parses the output of tests from test_output and test_full_output and sends
an email to a list.
Edit this script to change the recipients.
"""
import smtplib
import re
import os
from datetime import date
from email.MIMEText import MIMEText
from email.MIMEBase import MIMEBase
from email.MIMEImage import MIMEImage
from email.MIMEMultipart import MIMEMultipart
# configure this part if needed
from_mail = 'nobody@erp5.org'
to_mail = [ 'erp5-report@erp5.org' ]
INSTANCE_HOME = os.environ.get('INSTANCE_HOME', '/var/lib/zope')
test_msg = file(
os.path.join(INSTANCE_HOME, "Products", "test_output"), 'r').read()
test_msg = "Date : %s\n\n" % date.today().isoformat() + test_msg
# minimal parsing
revision_re = re.compile('Revision: (?P<revision>\d+)')
ran_test_re = re.compile('Ran (?P<tests>\d+) tests')
errors_re = re.compile('FAILED \((failures=(?P<failures>\d+))*[, ]*'\
'(errors=(?P<errors>\d+))*\)')
svn_revision = "?"
test_runs = 0
errors = 0
failures = 0
for test_line in test_msg.splitlines():
revision = revision_re.match(test_line)
if revision:
svn_revision = revision.groupdict()['revision']
ran = ran_test_re.match(test_line)
if ran:
test_runs += int(ran.groupdict()['tests'])
errors_or_failures = errors_re.match(test_line)
if errors_or_failures:
failures += int(errors_or_failures.groupdict()['failures'] or 0)
errors += int(errors_or_failures.groupdict()['errors'] or 0)
subject = "ERP5 r%s: %s Tests, %s Errors, %s Failures" % (
svn_revision, test_runs, errors, failures)
msg = MIMEMultipart()
msg['Subject'] = subject
msg['From'] = from_mail
msg['To'] = ', '.join(to_mail)
# Add custom headers for client side filtering
msg['X-ERP5-Tests'] = 'ERP5'
if not (failures + errors):
msg['X-ERP5-Tests-Status'] = 'OK'
# Guarantees the message ends in a newline
msg.preamble = subject
msg.epilogue = ''
file_content = file(
os.path.join(INSTANCE_HOME, "Products", "test_full_output"), 'r').read()
mime_text = MIMEText(test_msg)
mime_text.add_header('Content-Disposition', 'attachment',
filename='test_output.txt')
msg.attach(mime_text)
mime_text = MIMEText(file_content)
mime_text.add_header('Content-Disposition', 'attachment',
filename='test_full_output.txt')
msg.attach(mime_text)
# Send the email via our own SMTP server.
s = smtplib.SMTP()
s.connect()
s.sendmail(from_mail, to_mail, msg.as_string())
s.close()
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment