updates to support --test-path for chrome/browser-chrome tests.
authorJoel Maher <jmaher@mozilla.com>
Tue, 28 Sep 2010 16:05:28 -0400
changeset 17 7c024b56a19f79a0bb1fab8b2fcc0a6fb6cfc61b
parent 16 a20c3f30e6efa13705942d1c52bd2f57005028b0
child 18 537ef0432a1d803122d85c0d06404ac360af6500
push id18
push userjmaher@mozilla.com
push dateTue, 28 Sep 2010 20:07:24 +0000
updates to support --test-path for chrome/browser-chrome tests.
chromedriver.py
maemkit-maemo.cfg
--- a/chromedriver.py
+++ b/chromedriver.py
@@ -16,63 +16,48 @@ class ChromeDriver(maemkit.MaemKit):
 
   def addOptions(self, input):
     for option in input: self.options[option] = input[option]
     #TODO: figure out if we are doing a splitdirs here (might be required for wince or symbian)
     #TODO: figure out if we are going to support a test-path for chrome
     self.options["backupdir"] = os.path.normpath(os.path.join(self.options["testroot"], self.options["backupdir"]))
 
   def getTests(self):
-    fromdir = os.path.normpath(self.options["backupdir"])
-    todir = os.path.normpath(os.path.join(self.options["testroot"], self.testdir))
-
-    if (os.path.exists(fromdir)):
-      self.rmdir(todir)
-    self.copytree(fromdir, todir)
-
     myre = re.compile(".*([a-zA-Z0-9\-\_]+).*")
-    for dir in os.listdir(todir):
+    testdirectory = os.path.normpath(os.path.join(self.options["testroot"], self.testdir))
+    for dir in os.listdir(testdirectory):
       if (myre.match(dir)): self.directories.append(dir)
 
     self.directories.sort()
 
   def prepTests(self):
     #TODO: figure out a method for setting these user_pref in the profile (automation.py?)
     #set user_pref("browser.sessionhistory.max_total_viewers", -1)
     #set user_pref("dom.storage.default_quota", 640)
-
-    todir = os.path.normpath(self.options["backupdir"])
-    fromdir = os.path.normpath(os.path.join(self.options["testroot"], self.testname))
-
-    self.rmdir(todir)
-    self.copytree(fromdir, todir)
-    self.rmdir(fromdir)
-    self.mkdir(fromdir)
-
     self.directories = self.splitListParallel(self.directories, self.options)
 
   def runTests(self):
     self.mkLogDir(self.options["logdir"])
 
     #TODO: this block is the same as MochiDriver except for the --chrome flag
     #TODO: figure out a method for utilizing all the other config/cli options available
     cmd = os.path.normpath(os.path.join(self.options["testroot"], "runtests.py"))
     self.mochitestCommand = ["python " + cmd + " --autorun --close-when-done --%s" % self.testname]
     for option in ["utility-path","appname","xre-path","certificate-path"]:
       self.mochitestCommand.append("--" + option + "=" + os.path.normpath(self.options[option]))
     mCommand = " ".join(self.mochitestCommand)
 
+    if self.options["test-path"]:
+      self.directories = [self.options["test-path"]]
+
     for directory in self.directories:
-      targetdir = os.path.normpath(os.path.join(self.options["testroot"], self.testname))
-      self.rmdir(targetdir)
-      self.copytree(os.path.normpath(os.path.join(self.options["backupdir"], str(directory))), targetdir)
       logfile = os.path.normpath(os.path.join(self.options["logdir"],
                                  self.getLogFileName(directory)))
-      self.addCommand("%s --log-file=%s" % (mCommand, logfile))
+      self.addCommand("%s --log-file=%s --test-path=%s" % (mCommand, logfile, directory))
       if self.options['verbose'] and os.path.exists(logfile):
-          print ''.join(open(logfile).readlines())
+        print ''.join(open(logfile).readlines())
 
   def parseLogs(self):
     self.stitchLogs()
 
 class BrowserChromeDriver(ChromeDriver):
   def __init__(self, mkit):
     ChromeDriver.__init__(self, mkit, testname="browser-chrome")
--- a/maemkit-maemo.cfg
+++ b/maemkit-maemo.cfg
@@ -34,16 +34,17 @@ verbose = 1
 [browser-chrome]
 autorun = True
 close-when-done = True
 utility-path = /builds/fennec/bin
 certificate-path = /builds/fennec/certs
 backupdir = browser.bak
 testroot = /builds/fennec/mochitest
 log-file = /builds/fennec/log_browser-chrome.txt
+test-path = mobile
 verbose = 1
 
 [reftest]
 split-directories = "layout/reftests/bugs/reftest.list","modules/libpr0n/test/reftest/reftest.list"
 split-percentage = 100
 testroot = /builds/fennec/reftest/tests
 utility-path = /builds/fennec/reftest
 manifest = /builds/fennec/reftest/tests/layout/reftests/reftest.list