root/mail-onna-stick/trunk/support/buildbot/buildslave/bot_scripts/run-selenium.py

Revision 316, 1.3 kB (checked in by grig, 11 years ago)

Selenium tests have been failing for a while....trying to remedy the situation.

Line 
1 #! /usr/bin/env python
2 import os, time, sys
3
4 PORT = int(sys.argv[1])
5
6 def get_vnc_display(filename):
7     dispname = ''
8     lines = open(filename).readlines()
9     for line in lines:
10         if line[:4] == 'New ':
11             pos = line.find('desktop is ') + 11
12             servername = line[pos:].strip()
13             dispname = servername[servername.find(':'):]
14             break
15
16     return dispname
17
18 ### start VNC.
19
20 print 'STARTING VNC'
21 os.system('vncserver -geometry 1024x768 >& vncserver.log')
22 dispname = get_vnc_display('vncserver.log')
23
24 print '(on display %s)' % (dispname,)
25
26 ### fork; in the child process, sleep 10 and run firefox.   in the
27 ### parent process, run MailOnnaStick immediately.
28
29 if os.fork() == 0:
30     time.sleep(10)
31     print 'STARTING FIREFOX (in child) -- display %s' % (dispname,)
32     os.environ['DISPLAY'] = dispname
33     os.system("firefox \"http://localhost:%d/static/selenium/TestRunner.html?test=./tests/MOSTestSuite.html&auto=true&resultsUrl=/tests/post_selenium_results\"" % (PORT,))
34     sys.exit(0)
35
36 print 'STARTING MailOnnaStick'
37 os.system("rm .coverage*")
38 ret = os.system("%s lib/coverage.py -x bin/MailOnnaStick.py -p %d -d local.ddb" % (sys.executable, PORT,))
39
40 ### ... wait 'til it's done ...
41
42 print 'process EXITED: return code %d' % (ret,)
43
44 ### kill VNC
45
46 os.system('vncserver -kill %s' % (dispname,))
47
48 assert ret == 0
Note: See TracBrowser for help on using the browser.