Skip to content

Commit

Permalink
Bug 796998 - Use mozinstall instead of mozregression for TPS, r=jgrif…
Browse files Browse the repository at this point in the history
…fin, DONTBUILD(NPOTB)
  • Loading branch information
sinemetu1 committed Oct 24, 2012
1 parent 84910ae commit 0543968
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 21 deletions.
6 changes: 3 additions & 3 deletions testing/tps/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@

version = '0.3'

deps = ['mozinfo == 0.3.3', 'mozprofile == 0.4',
'mozprocess == 0.4', 'mozrunner == 5.8', 'mozregression == 0.6.3',
'mozautolog == 0.2.4', 'mozautoeslib == 0.1.1']
deps = ['mozinfo >= 0.3.3', 'mozprofile >= 0.4',
'mozprocess >= 0.4', 'mozrunner >= 5.8', 'mozinstall >= 1.4',
'mozautolog >= 0.2.4', 'mozautoeslib >= 0.1.1', 'httplib2 >= 0.7.3']

# we only support python 2.6+ right now
assert sys.version_info[0] == 2
Expand Down
35 changes: 17 additions & 18 deletions testing/tps/tps/firefoxrunner.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,15 @@
# file, You can obtain one at http://mozilla.org/MPL/2.0/.

import copy
import httplib2
import os
import shutil
import sys

import mozinstall

from mozprocess.pid import get_pids
from mozprofile import Profile
from mozregression.mozInstall import MozInstaller
from mozregression.utils import download_url, get_platform
from mozrunner import FirefoxRunner

class TPSFirefoxRunner(object):
Expand All @@ -31,8 +32,18 @@ def __del__(self):
if self.installdir:
shutil.rmtree(self.installdir, True)

def download_build(self, installdir='downloadedbuild',
appname='firefox', macAppName='Minefield.app'):
def download_url(self, url, dest=None):
h = httplib2.Http()
resp, content = h.request(url, "GET")
if dest == None:
dest = os.path.basename(url)

local = open(dest, 'wb')
local.write(content)
local.close()
return dest

def download_build(self, installdir='downloadedbuild', appname='firefox'):
self.installdir = os.path.abspath(installdir)
buildName = os.path.basename(self.url)
pathToBuild = os.path.join(os.path.dirname(os.path.abspath(__file__)),
Expand All @@ -44,28 +55,16 @@ def download_build(self, installdir='downloadedbuild',

# download the build
print "downloading build"
download_url(self.url, pathToBuild)
self.download_url(self.url, pathToBuild)

# install the build
print "installing %s" % pathToBuild
shutil.rmtree(self.installdir, True)
MozInstaller(src=pathToBuild, dest=self.installdir, dest_app=macAppName)
binary = mozinstall.install(src=pathToBuild, dest=self.installdir)

# remove the downloaded archive
os.remove(pathToBuild)

# calculate path to binary
platform = get_platform()
if platform['name'] == 'Mac':
binary = '%s/%s/Contents/MacOS/%s-bin' % (installdir,
macAppName,
appname)
else:
binary = '%s/%s/%s%s' % (installdir,
appname,
appname,
'.exe' if platform['name'] == 'Windows' else '')

return binary

def run(self, profile=None, timeout=PROCESS_TIMEOUT, env=None, args=None):
Expand Down

0 comments on commit 0543968

Please sign in to comment.