Bug 1115338 - ./mach mochitest-browser path/to/individual/test should always run test (despite skip-if/run-if conditions in manifest). r=jmaher
authorKaustabh Datta Choudhury <kaustabh93@gmail.com>
Tue, 06 Jan 2015 01:16:13 +0530
changeset 238997 3595d450fac19f74f8ba272f13ef66769611ed38
parent 238996 f3c7e9a00af88d87187eb2e8062fb3edaf684fcf
child 238998 ce30926721eb3fc88bf65ea9efc6b2331fcf5eda
push id7472
push userraliiev@mozilla.com
push dateMon, 12 Jan 2015 20:36:27 +0000
treeherdermozilla-aurora@300ca104f8fb [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjmaher
bugs1115338
milestone37.0a1
Bug 1115338 - ./mach mochitest-browser path/to/individual/test should always run test (despite skip-if/run-if conditions in manifest). r=jmaher
testing/mochitest/runtests.py
--- a/testing/mochitest/runtests.py
+++ b/testing/mochitest/runtests.py
@@ -1619,17 +1619,16 @@ class Mochitest(MochitestUtilsMixin):
     self.urlOpts = []
 
   def getActiveTests(self, options, disabled=True):
     """
       This method is used to parse the manifest and return active filtered tests.
     """
     self.setTestRoot(options)
     manifest = self.getTestManifest(options)
-
     if manifest:
       # Python 2.6 doesn't allow unicode keys to be used for keyword
       # arguments. This gross hack works around the problem until we
       # rid ourselves of 2.6.
       info = {}
       for k, v in mozinfo.info.items():
         if isinstance(k, unicode):
           k = k.encode('ascii')
@@ -1640,23 +1639,30 @@ class Mochitest(MochitestUtilsMixin):
       testPath = testPath.replace('\\', '/')
       if testPath.endswith('.html') or \
          testPath.endswith('.xhtml') or \
          testPath.endswith('.xul') or \
          testPath.endswith('.js'):
           # In the case where we have a single file, we don't want to filter based on options such as subsuite.
           tests = manifest.active_tests(disabled=disabled, options=None, **info)
           for test in tests:
-              if 'disabled' in test:
-                  del test['disabled']
+            if 'disabled' in test:
+              del test['disabled']
+
       else:
-          tests = manifest.active_tests(disabled=disabled, options=options, **info)
+        tests = manifest.active_tests(disabled=disabled, options=options, **info)
+        if len(tests) == 0:
+          tests = manifest.active_tests(disabled=True, options=options, **info)
+
     paths = []
 
     for test in tests:
+      if len(tests) == 1 and 'disabled' in test:
+        del test['disabled']
+
       pathAbs = os.path.abspath(test['path'])
       assert pathAbs.startswith(self.testRootAbs)
       tp = pathAbs[len(self.testRootAbs):].replace('\\', '/').strip('/')
 
       # Filter out tests if we are using --test-path
       if testPath and not tp.startswith(testPath):
         continue