Skip to content
Browse files

Bug 850438 - Delete existing results before running tests. r=bc

  • Loading branch information...
1 parent 63933d5 commit d57e29a2ffe28d7b7f3ff0021c3f1d12c815dbee @markrcote markrcote committed Mar 22, 2013
Showing with 26 additions and 10 deletions.
  1. +5 −5 configs/s1s2_settings.ini.example
  2. +21 −5 tests/s1s2test.py
View
10 configs/s1s2_settings.ini.example
@@ -1,20 +1,20 @@
[htmlfiles]
-file3 = configs/Twitter_files
file1 = configs/startup6.html
file2 = configs/Twitter2.html
+file3 = configs/Twitter_files
file4 = configs/initialize_profile.html
[urls]
# These must resolve, so ensure this matches what is in the code for
# the testroot
local-twitter = file://mnt/sdcard/s1test/Twitter2.html
local-blank = file://mnt/sdcard/s1test/startup6.html
-remote-twitter = http://10.250.50.162/Twitter2.html
-remote-blank = http://10.250.50.162/startup6.html
+remote-twitter = http://static_server/Twitter2.html
+remote-blank = http://static_server/startup6.html
[settings]
-iterations = 20
-resulturl = http://10.250.2.223:8100/api/s1s2_add/
+iterations = 5
+resulturl = http://phonedash_server/api/s1s2/
# initialize_url is loaded prior to the other urls in order to
# initialize the profile.
initialize_url = file://mnt/sdcard/s1test/initialize_profile.html
View
26 tests/s1s2test.py
@@ -20,6 +20,14 @@ class S1S2Test(PhoneTest):
def runjob(self, build_metadata, worker_subprocess):
# Read our config file which gives us our number of
# iterations and urls that we will be testing
+ cfg = ConfigParser.RawConfigParser()
+ cfg.read(self.config_file)
+ self._iterations = cfg.getint('settings', 'iterations')
+ self._resulturl = cfg.get('settings', 'resulturl')
+ if self._resulturl[-1] != '/':
+ self._resulturl += '/'
+ self._initialize_url = cfg.get('settings', 'initialize_url')
+ self.clear_results(build_metadata)
for cache_enabled in (False, True):
self.runtest(build_metadata, worker_subprocess, cache_enabled)
@@ -174,10 +182,6 @@ def prepare_phone(self, build_metadata, cache_enabled):
self.dm.pushFile(h[1], posixpath.join(testroot,
os.path.basename(h[1])))
- self._iterations = cfg.getint('settings', 'iterations')
- self._resulturl = cfg.get('settings', 'resulturl')
- self._initialize_url = cfg.get('settings', 'initialize_url')
-
def analyze_logcat(self, build_metadata):
self.logger.debug('analyzing logcat')
throbberstartRE = re.compile('.*Throbber start$')
@@ -219,6 +223,18 @@ def analyze_logcat(self, build_metadata):
return (int(throbstart), int(throbstop))
+ def clear_results(self, build_metadata):
+ data = json.dumps({'revision': build_metadata['revision'],
+ 'bldtype': build_metadata['bldtype'],
+ 'phoneid': self.phone_cfg['phoneid']})
+ req = urllib2.Request(self._resulturl + 'delete/', data,
+ {'Content-Type': 'application/json'})
+ try:
+ urllib2.urlopen(req)
+ except urllib2.URLError, e:
+ self.logger.error('Could not clear previous results on server: %s'
+ % e)
+
def publish_results(self, starttime=0, tstrt=0, tstop=0,
build_metadata=None, testname='', cache_enabled=True):
msg = 'Start Time: %s Throbber Start: %s Throbber Stop: %s' % (
@@ -251,7 +267,7 @@ def publish_results(self, starttime=0, tstrt=0, tstop=0,
# Upload
result = json.dumps({'data': resultdata})
- req = urllib2.Request(self._resulturl, result,
+ req = urllib2.Request(self._resulturl + 'add/', result,
{'Content-Type': 'application/json'})
try:
f = urllib2.urlopen(req)

0 comments on commit d57e29a

Please sign in to comment.
Something went wrong with that request. Please try again.