Permalink
Browse files

Bug 759396 - jetperf.py should have a way of downloading testing addo…

…ns from a (hg) repository;r=aki
  • Loading branch information...
1 parent ea15a1c commit ace1bd2503ccc7775c627e495f141ef7e27508a1 @k0s k0s committed Jun 1, 2012
Showing with 32 additions and 19 deletions.
  1. +32 −19 scripts/jetperf.py
View
51 scripts/jetperf.py
@@ -11,14 +11,10 @@
import shutil
import sys
sys.path.insert(1, os.path.dirname(sys.path[0]))
-from mozharness.base.script import BaseScript
-from mozharness.base.vcs.mercurial import MercurialVCS
+from mozharness.base.vcs.vcsbase import MercurialScript
from mozharness.mozilla.testing.talos import Talos
-# globals
-repo = 'http://hg.mozilla.org/projects/addon-sdk' # addon-sdk repository
-
-class JetPerf(Talos, MercurialVCS):
+class JetPerf(Talos, MercurialScript):
"""
- Download the latest Add-on SDK
- Download the test add-on sources
@@ -28,12 +24,6 @@ class JetPerf(Talos, MercurialVCS):
"""
config_options = copy.deepcopy(Talos.config_options) + [
- [["--repo"],
- {'action': 'store',
- 'dest': 'repo',
- 'default': repo,
- 'help': 'url of (hg) jetpack addon-sdk repository'
- }],
[["--addon"],
{'action': 'extend',
'dest': 'addon-directories',
@@ -62,26 +52,36 @@ class JetPerf(Talos, MercurialVCS):
'test',
'baseline']
+ default_repos = [{
+ "repo": 'http://hg.mozilla.org/projects/addon-sdk',
+ "revision": "default",
+ "dest": "addon-sdk"
+ },{
+ "repo": 'http://hg.mozilla.org/projects/addon-sdk-jetperf-tests/',
+ "revision": "default",
+ "dest": "addons_clone"
+ }]
+
def __init__(self, require_config_file=False):
# initialize parent class
Talos.__init__(self,
- config={'tests': ['ts']},
+ config={'tests': ['ts'], 'repos': self.default_repos},
all_actions=self.actions,
default_actions=self.default_actions,
require_config_file=require_config_file)
# set instance defaults
self.addon_sdk = os.path.join(self.workdir, 'addon-sdk')
self.addonsdir = os.path.join(self.workdir, 'addons')
+ self.test_addons_clone = os.path.join(self.workdir, 'addons_clone')
# ensure we have tests
self.preflight_generate_config()
def pull(self):
- """clone the jetpack repository"""
-
- MercurialVCS.clone(self, self.config['repo'], self.addon_sdk)
+ """clone the needed repositories"""
+ self.vcs_checkout_repos(self.config['repos'])
def cfx(self):
"""returns path to cfx"""
@@ -90,6 +90,17 @@ def cfx(self):
return None
return path
+ def addons_from_directory(self, directory):
+ """scans a directory for jetpack addon sources and returns a list"""
+
+ self.info("Scanning %s for addon directories" % directory)
+ retval = [os.path.join(directory, i) for i in os.listdir(directory)
+ if not i.startswith('.')] # ignore dotfiles
+ retval = [addon for addon in retval
+ if os.path.isdir(addon)] # directories only
+ self.info("Found %s addon directories" % str(retval))
+ return retval
+
def build(self):
"""Build each test add-on with the add-ons SDK"""
@@ -98,10 +109,13 @@ def build(self):
# clone the addon-sdk if needed
self.fatal("%s not found; make sure you clone the addon-sdk repo first" % cfx)
- # TODO: pull from hg if specified
+ # get addons
addons = self.config['addon-directories']
+ if os.path.exists(self.test_addons_clone):
+ addons.extend(self.addons_from_directory(self.test_addons_clone))
if not addons:
self.error("No addons supplied")
+ self.info("Building addons: %s" % str(addons))
# ensure the addons are unique
basenames = set([os.path.basename(addon) for addon in addons])
@@ -179,7 +193,7 @@ def test(self):
continue
if len(_xpis) > 1:
self.warning("More than one addon found in %s: %s" % (path, _xpis))
- xpis.extend([os.path.join(directory, xpi) for xpi in _xpis])
+ xpis.extend([os.path.join(self.addonsdir, directory, xpi) for xpi in _xpis])
if not xpis:
self.fatal("No addons found in %s" % self.addonsdir)
@@ -200,7 +214,6 @@ def baseline_results_filename(self):
def baseline(self):
"""run baseline ts tests"""
- args = []
filename = self.baseline_results_filename()
if os.path.exists(filename):
self.rmtree(filename)

0 comments on commit ace1bd2

Please sign in to comment.