Bug 601243 - mochitest should clean up temporary directories and files r=ctalbert a=NPOTB
authorJoel Maher <jmaher@mozilla.com>
Thu, 21 Oct 2010 13:15:57 -0700
changeset 56326 54a73ef4d157ca5e9cf2d483607c44be0c0ce41b
parent 56325 79ea1fde1b529ecb93a6b2d67c3f4e3599a65564
child 56327 bb6dddf8ebdafc1e4d3e5460e8ced6c241f2aceb
push id16485
push userctalbert@mozilla.com
push dateThu, 21 Oct 2010 19:57:39 +0000
treeherdermozilla-central@29d2042e54aa [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersctalbert, NPOTB
bugs601243
milestone2.0b8pre
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 601243 - mochitest should clean up temporary directories and files r=ctalbert a=NPOTB
testing/mochitest/runtests.py.in
--- a/testing/mochitest/runtests.py.in
+++ b/testing/mochitest/runtests.py.in
@@ -670,43 +670,42 @@ toolbar#nav-bar {
     chromeFile.close()
 
 
     # register our chrome dir
     chrometestDir = os.path.abspath(".") + "/"
     if self.automation.IS_WIN32:
       chrometestDir = "file:///" + chrometestDir.replace("\\", "/")
 
-    temp_file = os.path.join(tempfile.mkdtemp(), "mochikit.manifest")
-    manifestFile = open(temp_file, "w")
+    manifest = os.path.join(options.profilePath, 'tests.manifest')
 
     browser_chrome = ""
     if options.browserChrome:
       browser_chrome = """overlay chrome://navigator/content/navigator.xul chrome://mochikit/content/browser-test-overlay.xul
 overlay chrome://browser/content/browser.xul chrome://mochikit/content/browser-test-overlay.xul
 """
     elif (options.chrome == False) and (options.a11y == False):
       #only do the ipc-overlay.xul for mochitest-plain.  
       #Currently there are focus issues in chrome tests and issues with new windows and dialogs when using ipc
       browser_chrome += "overlay chrome://browser/content/browser.xul chrome://mochikit/content/ipc-overlay.xul\n"
 
     jarDir = 'mochijar'
     if not os.path.exists(os.path.join(self.SCRIPT_DIRECTORY, jarDir)):
       print "TEST-UNEXPECTED-FAIL | invalid setup: missing mochikit extension"
       return None
 
+    manifestFile = open(manifest, "w")
     if self.installTestsJar(options):
       manifestFile.write("content mochitests jar:tests.jar!/content/\n");
     else:
       manifestFile.write("content mochitests %s contentaccessible=yes\n" % chrometestDir)
-    self.installChromeJar(jarDir, browser_chrome, options)
-      
     manifestFile.close()
 
-    return self.installChromeFile(temp_file, options)
+    self.installChromeJar(jarDir, browser_chrome, options)
+    return manifest
 
   def installChromeJar(self, jarDirName, browser_chrome, options):
     """
       copy mochijar directory to profile as an extension so we have chrome://mochikit for all harness code
     """
     jarDir = os.path.join(options.profilePath, 'extensions', 'mochikit@mozilla.org')
     shutil.copytree(os.path.join(self.SCRIPT_DIRECTORY, jarDirName), jarDir)
     with open(os.path.join(jarDir, "chrome.manifest"), 'a') as mfile:
@@ -716,22 +715,16 @@ overlay chrome://browser/content/browser
 
   def installTestsJar(self, options):
     """ copy tests.jar to the profile directory so we can auto register it in the .xul harness """
     if os.path.exists(os.path.join(self.SCRIPT_DIRECTORY, 'tests.jar')):
       shutil.copy(os.path.join(self.SCRIPT_DIRECTORY, 'tests.jar'), options.profilePath)
       return True
     return False
 
-  def installChromeFile(self, filename, options):
-    """ copy tests.manifest to the profile directory so we can auto register with tests.jar """
-    manifest = os.path.join(options.profilePath, 'tests.manifest')
-    shutil.copy(filename, manifest)
-    return manifest
-
   def copyExtraFilesToProfile(self, options):
     "Copy extra files or dirs specified on the command line to the testing profile."
     for f in options.extraProfileFiles:
       abspath = self.getFullPath(f)
       dest = os.path.join(options.profilePath, os.path.basename(abspath))
       if os.path.isdir(abspath):
         shutil.copytree(abspath, dest)
       else: