Capture KeyboardInterrupt, and stop all tests.
And configurability of max test timeout git-svn-id: http://svn.openlayers.org/trunk/openlayers@8569 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
@@ -4,7 +4,6 @@ import sys
|
|||||||
from ConfigParser import ConfigParser
|
from ConfigParser import ConfigParser
|
||||||
|
|
||||||
MAX_TEST_LENGTH = 300
|
MAX_TEST_LENGTH = 300
|
||||||
|
|
||||||
if len(sys.argv) > 2:
|
if len(sys.argv) > 2:
|
||||||
filename = sys.argv[2]
|
filename = sys.argv[2]
|
||||||
else:
|
else:
|
||||||
@@ -17,6 +16,9 @@ targets = {}
|
|||||||
|
|
||||||
server = c.get('config', 'server')
|
server = c.get('config', 'server')
|
||||||
url= c.get('config', 'url')
|
url= c.get('config', 'url')
|
||||||
|
if c.has_option('config', 'timeout'):
|
||||||
|
MAX_TEST_LENGTH = int(c.get('config', 'timeout'))
|
||||||
|
|
||||||
|
|
||||||
sections = c.sections()
|
sections = c.sections()
|
||||||
for s in sections:
|
for s in sections:
|
||||||
@@ -33,14 +35,22 @@ elif sys.argv[1] not in targets:
|
|||||||
else:
|
else:
|
||||||
browsers = [targets[sys.argv[1]]]
|
browsers = [targets[sys.argv[1]]]
|
||||||
|
|
||||||
|
keep_going = True
|
||||||
|
|
||||||
if 1:
|
if 1:
|
||||||
for b in browsers:
|
for b in browsers:
|
||||||
|
if not keep_going:
|
||||||
|
continue
|
||||||
|
|
||||||
print "Running %s on %s" % (b['name'], b['host'])
|
print "Running %s on %s" % (b['name'], b['host'])
|
||||||
s = selenium(b['host'], 4444, "*%s" % b['browsercmd'], server)
|
s = selenium(b['host'], 4444, "*%s" % b['browsercmd'], server)
|
||||||
s.start()
|
s.start()
|
||||||
try:
|
try:
|
||||||
s.open(url)
|
s.open_window(url, "test_running")
|
||||||
|
time.sleep(2)
|
||||||
|
s.select_window("test_running")
|
||||||
|
time.sleep(2)
|
||||||
|
s.refresh()
|
||||||
|
|
||||||
count = 0
|
count = 0
|
||||||
while count == 0:
|
while count == 0:
|
||||||
@@ -76,6 +86,9 @@ if 1:
|
|||||||
f = open("fail.%s.%s.html" % (time.time(), b['name']), "w")
|
f = open("fail.%s.%s.html" % (time.time(), b['name']), "w")
|
||||||
f.write(all_html)
|
f.write(all_html)
|
||||||
f.close()
|
f.close()
|
||||||
|
except KeyboardInterrupt, E:
|
||||||
|
keep_going = False
|
||||||
|
print "Stopped by keyboard interrupt"
|
||||||
except Exception, E:
|
except Exception, E:
|
||||||
print "Error: ", E
|
print "Error: ", E
|
||||||
s.stop()
|
s.stop()
|
||||||
|
|||||||
Reference in New Issue
Block a user