Commit 135f281e authored by Kazuhiko Shiozaki's avatar Kazuhiko Shiozaki

always store results under portal_tests/. code clean up.

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@26273 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 59d87a1d
...@@ -77,6 +77,7 @@ def parseArgs(): ...@@ -77,6 +77,7 @@ def parseArgs():
global host global host
global port global port
global portal_name global portal_name
global portal_url
global run_only global run_only
try: try:
opts, args = getopt.getopt(sys.argv[1:], opts, args = getopt.getopt(sys.argv[1:],
...@@ -109,6 +110,8 @@ def parseArgs(): ...@@ -109,6 +110,8 @@ def parseArgs():
if not stdout: if not stdout:
send_mail = 1 send_mail = 1
portal_url = "http://%s:%d/%s" % (host, port, portal_name)
def main(): def main():
setPreference() setPreference()
unsubscribeFromTimerService() unsubscribeFromTimerService()
...@@ -196,26 +199,25 @@ def runFirefox(): ...@@ -196,26 +199,25 @@ def runFirefox():
prepareFirefox() prepareFirefox()
# check if old zelenium or new zelenium # check if old zelenium or new zelenium
try: try:
urllib2.urlopen("http://%s:%d/%s/portal_tests/core/scripts/selenium-version.js" % \ urllib2.urlopen("%s/portal_tests/core/scripts/selenium-version.js" % portal_url)
(host, port, portal_name))
except urllib2.HTTPError: except urllib2.HTTPError:
# Zelenium 0.8 # Zelenium 0.8
url_string = "http://%s:%d/%s/portal_tests/?auto=true&__ac_name=%s&__ac_password=%s" url_string = "%s/portal_tests/?auto=true&__ac_name=%s&__ac_password=%s" % (portal_url, user, password)
else: else:
# Zelenium 0.8+ or later # Zelenium 0.8+ or later
url_string = "http://%s:%d/%s/portal_tests/core/TestRunner.html?test=..%%2Ftest_suite_html&auto=on&__ac_name=%s&__ac_password=%s" url_string = "%s/portal_tests/core/TestRunner.html?test=../test_suite_html&auto=on&resultsUrl=%s/portal_tests/postResults&__ac_name=%s&__ac_password=%s" % (portal_url, portal_url, user, password)
if run_only: if run_only:
url_string = url_string.replace('/portal_tests/', '/portal_tests/%s/' % run_only) url_string = url_string.replace('/portal_tests/', '/portal_tests/%s/' % run_only, 1)
pid = os.spawnlp(os.P_NOWAIT, "firefox", "firefox", "-profile", profile_dir, pid = os.spawnlp(os.P_NOWAIT, "firefox", "firefox", "-profile", profile_dir,
url_string % (host, port, portal_name, user, password)) url_string)
os.environ['MOZ_NO_REMOTE'] = '0' os.environ['MOZ_NO_REMOTE'] = '0'
print 'firefox : %d' % pid print 'firefox : %d' % pid
return pid return pid
def getStatus(): def getStatus():
try: try:
status = urllib2.urlopen('http://%s:%d/%s/TestTool_getResults?test_zuite_relative_url=%s' status = urllib2.urlopen('%s/portal_tests/TestTool_getResults'
% (host, port, portal_name, run_only)).read() % portal_url).read()
except urllib2.HTTPError, e: except urllib2.HTTPError, e:
if e.msg == "No Content" : if e.msg == "No Content" :
status = "" status = ""
...@@ -224,18 +226,17 @@ def getStatus(): ...@@ -224,18 +226,17 @@ def getStatus():
return status return status
def setPreference(): def setPreference():
urllib2.urlopen('http://%s:%d/%s/BTZuite_setPreference?__ac_name=' urllib2.urlopen('%s/BTZuite_setPreference?__ac_name='
'%s&__ac_password=%s&working_copy_list=%s' % '%s&__ac_password=%s&working_copy_list=%s' %
(host, port, portal_name, user, password, bt5_dir_list)) (portal_url, user, password, bt5_dir_list))
def unsubscribeFromTimerService(): def unsubscribeFromTimerService():
urllib2.urlopen('http://%s:%d/%s/portal_activities/?unsubscribe:method=' urllib2.urlopen('%s/portal_activities/?unsubscribe:method='
'&__ac_name=%s&__ac_password=%s' % '&__ac_name=%s&__ac_password=%s' %
(host, port, portal_name, user, password)) (portal_url, user, password))
def sendResult(): def sendResult():
result_uri = urllib2.urlopen('http://%s:%d/%s/TestTool_getResults?test_zuite_relative_url=%s' % result_uri = urllib2.urlopen('%s/portal_tests/TestTool_getResults' % portal_url).readline()
(host, port, portal_name, run_only)).readline()
print result_uri print result_uri
file_content = urllib2.urlopen(result_uri).read() file_content = urllib2.urlopen(result_uri).read()
passes_re = re.compile('<th[^>]*>Tests passed</th>\n\s*<td[^>]*>([^<]*)') passes_re = re.compile('<th[^>]*>Tests passed</th>\n\s*<td[^>]*>([^<]*)')
......
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