Bug 1091270 - Move isURL out of automationutils; r=jgriffin
authorPankaj Malhotra(:bitgeeky) <mozpankaj1994@gmail.com>
Tue, 04 Nov 2014 16:59:40 -0800
changeset 214038 585a22940ba75968087f66c291d331f3cc03982b
parent 214037 03416040f8b4f55dce530a3378653e98a943567a
child 214039 4bdc3391644e7200cb8419cdf59e502f36424498
push id27771
push userryanvm@gmail.com
push dateWed, 05 Nov 2014 19:04:24 +0000
treeherdermozilla-central@305b4fecce99 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjgriffin
bugs1091270
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 1091270 - Move isURL out of automationutils; r=jgriffin
build/automationutils.py
layout/tools/reftest/runreftest.py
testing/mochitest/mochitest_options.py
testing/mochitest/runtests.py
--- a/build/automationutils.py
+++ b/build/automationutils.py
@@ -8,25 +8,23 @@ import logging
 from operator import itemgetter
 import os
 import platform
 import re
 import signal
 import subprocess
 import sys
 import tempfile
-from urlparse import urlparse
 import zipfile
 import mozinfo
 
 __all__ = [
   "ZipFileReader",
   "addCommonOptions",
   "dumpLeakLog",
-  "isURL",
   "processLeakLog",
   'KeyValueParseError',
   'parseKeyValue',
   'systemMemory',
   'environment',
   'dumpScreen',
   "ShutdownLeaks",
   "setAutomationLog",
@@ -102,21 +100,16 @@ class ZipFileReader(object):
     if hasattr(self._zipfile, "extractall"):
       return self._zipfile.extractall(path)
 
     path = self._getnormalizedpath(path)
 
     for name in self._zipfile.namelist():
       self._extractname(name, path)
 
-def isURL(thing):
-  """Return True if |thing| looks like a URL."""
-  # We want to download URLs like http://... but not Windows paths like c:\...
-  return len(urlparse(thing).scheme) >= 2
-
 # Python does not provide strsignal() even in the very latest 3.x.
 # This is a reasonable fake.
 def strsig(n):
   # Signal numbers run 0 through NSIG-1; an array with NSIG members
   # has exactly that many slots
   _sigtbl = [None]*signal.NSIG
   for k in dir(signal):
     if k.startswith("SIG") and not k.startswith("SIG_") and k != "SIGCLD" and k != "SIGPOLL":
--- a/layout/tools/reftest/runreftest.py
+++ b/layout/tools/reftest/runreftest.py
@@ -2,16 +2,17 @@
 # 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/.
 
 """
 Runs the reftest test harness.
 """
 
 from optparse import OptionParser
+from urlparse import urlparse
 import collections
 import multiprocessing
 import os
 import re
 import shutil
 import signal
 import subprocess
 import sys
@@ -19,17 +20,16 @@ import threading
 
 SCRIPT_DIRECTORY = os.path.abspath(os.path.realpath(os.path.dirname(sys.argv[0])))
 sys.path.insert(0, SCRIPT_DIRECTORY)
 
 from automationutils import (
     addCommonOptions,
     dumpScreen,
     environment,
-    isURL,
     processLeakLog
 )
 import mozcrash
 import mozdebug
 import mozinfo
 import mozprocess
 import mozprofile
 import mozrunner
@@ -781,16 +781,16 @@ def main():
     print """Error: Path %(app)s doesn't exist.
 Are you executing $objdir/_tests/reftest/runreftest.py?""" \
             % {"app": options.app}
     sys.exit(1)
 
   if options.xrePath is None:
     options.xrePath = os.path.dirname(options.app)
 
-  if options.symbolsPath and not isURL(options.symbolsPath):
+  if options.symbolsPath and len(urlparse(options.symbolsPath).scheme) < 2:
     options.symbolsPath = reftest.getFullPath(options.symbolsPath)
   options.utilityPath = reftest.getFullPath(options.utilityPath)
 
   sys.exit(reftest.runTests(args[0], options))
 
 if __name__ == "__main__":
   main()
--- a/testing/mochitest/mochitest_options.py
+++ b/testing/mochitest/mochitest_options.py
@@ -1,19 +1,20 @@
 # 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/.
 
+from urlparse import urlparse
 import mozinfo
 import moznetwork
 import optparse
 import os
 import tempfile
 
-from automationutils import addCommonOptions, isURL
+from automationutils import addCommonOptions
 from mozprofile import DEFAULT_PORTS
 
 here = os.path.abspath(os.path.dirname(__file__))
 
 try:
     from mozbuild.base import MozbuildObject
     build_obj = MozbuildObject.from_environment(cwd=here)
 except ImportError:
@@ -499,17 +500,17 @@ class MochitestOptions(optparse.OptionPa
             return None
 
         if options.utilityPath:
             options.utilityPath = mochitest.getFullPath(options.utilityPath)
 
         if options.certPath:
             options.certPath = mochitest.getFullPath(options.certPath)
 
-        if options.symbolsPath and not isURL(options.symbolsPath):
+        if options.symbolsPath and len(urlparse(options.symbolsPath).scheme) < 2:
             options.symbolsPath = mochitest.getFullPath(options.symbolsPath)
 
         # Set server information on the options object
         options.webServer = '127.0.0.1'
         options.httpPort = DEFAULT_PORTS['http']
         options.sslPort = DEFAULT_PORTS['https']
         #        options.webSocketPort = DEFAULT_PORTS['ws']
         options.webSocketPort = str(9988) # <- http://hg.mozilla.org/mozilla-central/file/b871dfb2186f/build/automation.py.in#l30
--- a/testing/mochitest/runtests.py
+++ b/testing/mochitest/runtests.py
@@ -7,16 +7,17 @@ Runs the Mochitest test harness.
 """
 
 from __future__ import with_statement
 import os
 import sys
 SCRIPT_DIR = os.path.abspath(os.path.realpath(os.path.dirname(__file__)))
 sys.path.insert(0, SCRIPT_DIR);
 
+from urlparse import urlparse
 import ctypes
 import glob
 import json
 import mozcrash
 import mozdebug
 import mozinfo
 import mozprocess
 import mozrunner
@@ -30,17 +31,16 @@ import tempfile
 import time
 import traceback
 import urllib2
 import zipfile
 import bisection
 
 from automationutils import (
     environment,
-    isURL,
     KeyValueParseError,
     parseKeyValue,
     processLeakLog,
     dumpScreen,
     ShutdownLeaks,
     printstatus,
     LSANLeaks,
     setAutomationLog,
@@ -2120,17 +2120,17 @@ def main():
     # parsing error
     sys.exit(1)
   logger_options = {key: value for key, value in vars(options).iteritems() if key.startswith('log')}
   mochitest = Mochitest(logger_options)
   options = parser.verifyOptions(options, mochitest)
 
   options.utilityPath = mochitest.getFullPath(options.utilityPath)
   options.certPath = mochitest.getFullPath(options.certPath)
-  if options.symbolsPath and not isURL(options.symbolsPath):
+  if options.symbolsPath and len(urlparse(options.symbolsPath).scheme) < 2:
     options.symbolsPath = mochitest.getFullPath(options.symbolsPath)
 
   return_code = mochitest.runTests(options)
   mochitest.message_logger.finish()
 
   sys.exit(return_code)
 
 if __name__ == "__main__":