Bug 1091277 - Move replaceBackSlashes out of automationutils, r=jgriffin
authorDavid Lubin <lubin.davidg@gmail.com>
Thu, 30 Oct 2014 14:57:38 -0700
changeset 237760 9e70fe4a4a98a0b37df18516759d302cd48c623c
parent 237759 c3624a3708406844f3dbdc46a1a61937d162f197
child 237761 347dcfc5d36e43daf1a2b4528b11dec86c515052
push id4311
push userraliiev@mozilla.com
push dateMon, 12 Jan 2015 19:37:41 +0000
treeherdermozilla-beta@150c9fed433b [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjgriffin
bugs1091277
milestone36.0a1
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 1091277 - Move replaceBackSlashes out of automationutils, r=jgriffin
build/automationutils.py
testing/xpcshell/remotexpcshelltests.py
testing/xpcshell/runxpcshelltests.py
--- a/build/automationutils.py
+++ b/build/automationutils.py
@@ -18,17 +18,16 @@ import zipfile
 import mozinfo
 
 __all__ = [
   "ZipFileReader",
   "addCommonOptions",
   "dumpLeakLog",
   "isURL",
   "processLeakLog",
-  "replaceBackSlashes",
   'KeyValueParseError',
   'parseKeyValue',
   'systemMemory',
   'environment',
   'dumpScreen',
   "ShutdownLeaks",
   "setAutomationLog",
   ]
@@ -374,19 +373,16 @@ def processLeakLog(leakLogFile, options)
         processType = "default"
       if not processType in knownProcessTypes:
         log.info("TEST-UNEXPECTED-FAIL | leakcheck | Leak log with unknown process type %s"
                  % processType)
       leakThreshold = leakThresholds.get(processType, 0)
       processSingleLeakFile(thisFile, processType, leakThreshold,
                             processType in ignoreMissingLeaks)
 
-def replaceBackSlashes(input):
-  return input.replace('\\', '/')
-
 class KeyValueParseError(Exception):
   """error when parsing strings of serialized key-values"""
   def __init__(self, msg, errors=()):
     self.errors = errors
     Exception.__init__(self, msg)
 
 def parseKeyValue(strings, separator='=', context='key, value: '):
   """
--- a/testing/xpcshell/remotexpcshelltests.py
+++ b/testing/xpcshell/remotexpcshelltests.py
@@ -4,17 +4,16 @@
 # 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 posixpath
 import sys, os
 import subprocess
 import runxpcshelltests as xpcshell
 import tempfile
-from automationutils import replaceBackSlashes
 from zipfile import ZipFile
 from mozlog import structured
 from mozlog.structured import commandline
 import shutil
 import mozdevice
 import mozfile
 import mozinfo
 
@@ -34,17 +33,17 @@ class RemoteXPCShellTestThread(xpcshell.
 
     def buildCmdTestFile(self, name):
         remoteDir = self.remoteForLocal(os.path.dirname(name))
         if remoteDir == self.remoteHere:
             remoteName = os.path.basename(name)
         else:
             remoteName = remoteJoin(remoteDir, os.path.basename(name))
         return ['-e', 'const _TEST_FILE = ["%s"];' %
-                 replaceBackSlashes(remoteName)]
+                 remoteName.replace('\\', '/')]
 
     def remoteForLocal(self, local):
         for mapping in self.pathMapping:
             if (os.path.abspath(mapping.local) == os.path.abspath(local)):
                 return mapping.remote
         return local
 
 
--- a/testing/xpcshell/runxpcshelltests.py
+++ b/testing/xpcshell/runxpcshelltests.py
@@ -34,17 +34,17 @@ from threading import (
 
 try:
     import psutil
     HAVE_PSUTIL = True
 except ImportError:
     HAVE_PSUTIL = False
 
 from automation import Automation
-from automationutils import replaceBackSlashes, addCommonOptions
+from automationutils import addCommonOptions
 
 HARNESS_TIMEOUT = 5 * 60
 
 # benchmarking on tbpl revealed that this works best for now
 NUM_THREADS = int(cpu_count() * 4)
 
 EXPECTED_LOG_ACTIONS = set([
     "test_status",
@@ -306,17 +306,17 @@ class XPCShellTestThread(Thread):
         self.clean_temp_dirs(self.test_object['path'])
 
     def buildCmdTestFile(self, name):
         """
           Build the command line arguments for the test file.
           On a remote system, this may be overloaded to use a remote path structure.
         """
         return ['-e', 'const _TEST_FILE = ["%s"];' %
-                  replaceBackSlashes(name)]
+                  name.replace('\\', '/')]
 
     def setupTempDir(self):
         tempDir = mkdtemp()
         self.env["XPCSHELL_TEST_TEMP_DIR"] = tempDir
         if self.interactive:
             self.log.info("temp dir is %s" % tempDir)
         return tempDir
 
@@ -358,19 +358,19 @@ class XPCShellTestThread(Thread):
 
     def buildCmdHead(self, headfiles, tailfiles, xpcscmd):
         """
           Build the command line arguments for the head and tail files,
           along with the address of the webserver which some tests require.
 
           On a remote system, this is overloaded to resolve quoting issues over a secondary command line.
         """
-        cmdH = ", ".join(['"' + replaceBackSlashes(f) + '"'
+        cmdH = ", ".join(['"' + f.replace('\\', '/') + '"'
                        for f in headfiles])
-        cmdT = ", ".join(['"' + replaceBackSlashes(f) + '"'
+        cmdT = ", ".join(['"' + f.replace('\\', '/') + '"'
                        for f in tailfiles])
         return xpcscmd + \
                 ['-e', 'const _SERVER_ADDR = "localhost"',
                  '-e', 'const _HEAD_FILES = [%s];' % cmdH,
                  '-e', 'const _TAIL_FILES = [%s];' % cmdT]
 
     def getHeadAndTailFiles(self, test_object):
         """Obtain the list of head and tail files.
@@ -796,20 +796,20 @@ class XPCShellTests(object):
           This function is overloaded for a remote solution as os.path* won't work remotely.
         """
         self.testharnessdir = os.path.dirname(os.path.abspath(__file__))
         self.headJSPath = self.testharnessdir.replace("\\", "/") + "/head.js"
         self.xpcshell = os.path.abspath(self.xpcshell)
 
         # we assume that httpd.js lives in components/ relative to xpcshell
         self.httpdJSPath = os.path.join(os.path.dirname(self.xpcshell), 'components', 'httpd.js')
-        self.httpdJSPath = replaceBackSlashes(self.httpdJSPath)
+        self.httpdJSPath = self.httpdJSPath.replace('\\', '/')
 
         self.httpdManifest = os.path.join(os.path.dirname(self.xpcshell), 'components', 'httpd.manifest')
-        self.httpdManifest = replaceBackSlashes(self.httpdManifest)
+        self.httpdManifest = self.httpdManifest.replace('\\', '/')
 
         if self.xrePath is None:
             self.xrePath = os.path.dirname(self.xpcshell)
             if mozinfo.isMac:
                 # Check if we're run from an OSX app bundle and override
                 # self.xrePath if we are.
                 appBundlePath = os.path.join(os.path.dirname(os.path.dirname(self.xpcshell)), 'Resources')
                 if os.path.exists(os.path.join(appBundlePath, 'application.ini')):
@@ -987,17 +987,17 @@ class XPCShellTests(object):
     def addTestResults(self, test):
         self.passCount += test.passCount
         self.failCount += test.failCount
         self.todoCount += test.todoCount
 
     def makeTestId(self, test_object):
         """Calculate an identifier for a test based on its path or a combination of
         its path and the source manifest."""
-        path = replaceBackSlashes(test_object['path']);
+        path = test_object['path'].replace('\\', '/');
         if 'dupe-manifest' in test_object and 'ancestor-manifest' in test_object:
             return '%s:%s' % (os.path.basename(test_object['ancestor-manifest']), path)
         return path
 
     def runTests(self, xpcshell, xrePath=None, appPath=None, symbolsPath=None,
                  manifest=None, testdirs=None, testPath=None, mobileArgs=None,
                  interactive=False, verbose=False, keepGoing=False, logfiles=True,
                  thisChunk=1, totalChunks=1, debugger=None,