Bug 796998 - Use mozinstall instead of mozregression for TPS, r=jgriffin, DONTBUILD(NPOTB)
--- a/testing/tps/setup.py
+++ b/testing/tps/setup.py
@@ -2,19 +2,19 @@
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
import sys
from setuptools import setup, find_packages
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
assert sys.version_info[1] >= 6
setup(name='tps',
version=version,
description='run automated multi-profile sync tests',
--- a/testing/tps/tps/firefoxrunner.py
+++ b/testing/tps/tps/firefoxrunner.py
@@ -1,21 +1,22 @@
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# 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):
PROCESS_TIMEOUT = 240
def __init__(self, binary):
if binary is not None and ('http://' in binary or 'ftp://' in binary):
@@ -26,51 +27,49 @@ class TPSFirefoxRunner(object):
self.binary = binary
self.runner = None
self.installdir = None
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__)),
buildName)
# delete the build if it already exists
if os.access(pathToBuild, os.F_OK):
os.remove(pathToBuild)
# 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):
"""Runs the given FirefoxRunner with the given Profile, waits
for completion, then returns the process exit code
"""
if profile is None:
profile = Profile()