Commit 7b446743 authored by Kazuhiko Shiozaki's avatar Kazuhiko Shiozaki

* explicitly use python2.4

* calculate instance home from the script's directory
* specify working_copy_list explicitly


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@15210 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent db10c0d7
#!/usr/bin/env python #!/usr/bin/env python2.4
import os import os
import re import re
import signal import signal
...@@ -12,8 +11,18 @@ import pysvn ...@@ -12,8 +11,18 @@ import pysvn
host = 'localhost' host = 'localhost'
port = 8080 port = 8080
portal_name = 'erp5_portal' portal_name = 'erp5_portal'
instance_home = '/var/lib/zope/unit_test'
profile_dir = '%s/profile' % instance_home tests_framework_home = os.path.dirname(os.path.abspath(__file__))
# handle 'system global' instance
if tests_framework_home.startswith('/usr/lib'):
real_instance_home = '/var/lib/erp5'
else:
real_instance_home = os.path.sep.join(
tests_framework_home.split(os.path.sep)[:-3])
instance_home = os.path.join(real_instance_home, 'unit_test')
profile_dir = os.path.join(instance_home, 'profile')
bt5_dir_list = ','.join([os.path.join(instance_home, 'Products/ERP5/bootstrap'), os.path.join(instance_home, 'bt5')])
def main(): def main():
setPreference() setPreference()
...@@ -29,7 +38,6 @@ def main(): ...@@ -29,7 +38,6 @@ def main():
cur_status = getStatus() cur_status = getStatus()
if status != cur_status: if status != cur_status:
break break
print cur_status
finally: finally:
if xvfb_pid: if xvfb_pid:
os.kill(xvfb_pid, signal.SIGTERM) os.kill(xvfb_pid, signal.SIGTERM)
...@@ -48,7 +56,9 @@ def runXvfb(): ...@@ -48,7 +56,9 @@ def runXvfb():
pid = os.spawnlp(os.P_NOWAIT, 'Xvfb', 'Xvfb', ':123') pid = os.spawnlp(os.P_NOWAIT, 'Xvfb', 'Xvfb', ':123')
display = os.environ['DISPLAY'] display = os.environ['DISPLAY']
if display: if display:
(displayname, protocolname, hexkey) = Popen(['xauth', 'list', display], stdout=PIPE).communicate()[0].split() auth = Popen(['xauth', 'list', display], stdout=PIPE).communicate()[0]
if auth:
(displayname, protocolname, hexkey) = auth.split()
Popen(['xauth', 'add', 'localhost/unix:123', protocolname, hexkey]) Popen(['xauth', 'add', 'localhost/unix:123', protocolname, hexkey])
print 'Xvfb : %d' % pid print 'Xvfb : %d' % pid
return pid return pid
...@@ -82,7 +92,7 @@ def getStatus(): ...@@ -82,7 +92,7 @@ def getStatus():
return status return status
def setPreference(): def setPreference():
urllib2.urlopen('http://%s:%d/%s/BTZuite_setPreference?__ac_name=ERP5TypeTestCase&__ac_password=' % (host, port, portal_name)) urllib2.urlopen('http://%s:%d/%s/BTZuite_setPreference?__ac_name=ERP5TypeTestCase&__ac_password=&working_copy_list=%s' % (host, port, portal_name, bt5_dir_list))
def unsubscribeFromTimerService(): def unsubscribeFromTimerService():
urllib2.urlopen('http://%s:%d/%s/portal_activities/?unsubscribe:method=&__ac_name=ERP5TypeTestCase&__ac_password=' % (host, port, portal_name)) urllib2.urlopen('http://%s:%d/%s/portal_activities/?unsubscribe:method=&__ac_name=ERP5TypeTestCase&__ac_password=' % (host, port, portal_name))
...@@ -120,7 +130,8 @@ Following tests failed: ...@@ -120,7 +130,8 @@ Following tests failed:
file_content = error_re.sub('<span style="color: red">FAIL</span>', file_content) file_content = error_re.sub('<span style="color: red">FAIL</span>', file_content)
status = (not failures) status = (not failures)
sendMail(subject = subject, body = summary, status = status, sendMail(subject = subject, body = summary, status = status,
attachments = [file_content]) attachments = [file_content], from_mail = 'kazuhiko@nexedi.com',
to_mail = ['erp5-report@erp5.org'])
if __name__ == "__main__": if __name__ == "__main__":
startZope() startZope()
......
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