Bug 844989 - Replace fedora-b2g slaves with ubuntu64-b2g for b2g emulator test. r=aki
authorRail Aliiev <rail@mozilla.com>
Tue, 26 Feb 2013 10:02:05 -0500
changeset 7962 8ef764230c91a559a5187d2e6ca56be6357cb09c
parent 7960 78425e60970821ad140d0cecff8d344912ea2061
child 7963 ae5b8462404b90410aed6682e1ea7aad4b1c0913
child 7964 885b7f8d66666dc24f90904d6e8688feca6e4278
push id1
push userroot
push dateWed, 17 Dec 2014 00:18:48 +0000
reviewersaki
bugs844989
Bug 844989 - Replace fedora-b2g slaves with ubuntu64-b2g for b2g emulator test. r=aki
mozilla-tests/b2g_config.py
mozilla-tests/config.py
mozilla-tests/config_common.py
--- a/mozilla-tests/b2g_config.py
+++ b/mozilla-tests/b2g_config.py
@@ -1,15 +1,18 @@
 from copy import deepcopy
 
 from config import MOZHARNESS_REBOOT_CMD
 from localconfig import SLAVES, TRY_SLAVES, GLOBAL_VARS
 
 import b2g_localconfig
 reload(b2g_localconfig)
+import config_common
+reload(config_common)
+from config_common import nested_haskey
 
 from buildbot.steps.shell import WithProperties
 
 GLOBAL_VARS = deepcopy(GLOBAL_VARS)
 
 GLOBAL_VARS['stage_username'] = 'ffxbld'
 GLOBAL_VARS.update(b2g_localconfig.GLOBAL_VARS.copy())
 
@@ -93,17 +96,17 @@ BRANCH_UNITTEST_VARS = {
         'ics_armv7a_gecko': {},
         'b2g_panda': {},
         'b2g_panda_gaia_central': {},
     },
 }
 
 SUITES = {}
 
-MOCHITEST_ONLY = [
+MOCHITEST = [
     ('mochitest-1', {'suite': 'mochitest-plain',
                      'use_mozharness': True,
                      'script_path': 'scripts/b2g_emulator_unittest.py',
                     },
     ),
     ('mochitest-2', {'suite': 'mochitest-plain',
                      'use_mozharness': True,
                      'script_path': 'scripts/b2g_emulator_unittest.py',
@@ -140,17 +143,17 @@ MOCHITEST_ONLY = [
                     },
     ),
     ('mochitest-9', {'suite': 'mochitest-plain',
                      'use_mozharness': True,
                      'script_path': 'scripts/b2g_emulator_unittest.py',
                     },
     ),
 ]
-REFTEST_ONLY = [
+REFTEST = [
     ('reftest-1', {'suite': 'reftest',
                    'use_mozharness': True,
                    'script_path': 'scripts/b2g_emulator_unittest.py',
                   },
     ),
     ('reftest-2', {'suite': 'reftest',
                    'use_mozharness': True,
                    'script_path': 'scripts/b2g_emulator_unittest.py',
@@ -193,25 +196,25 @@ REFTEST_ONLY = [
     ),
     ('reftest-10', {'suite': 'reftest',
                    'use_mozharness': True,
                    'script_path': 'scripts/b2g_emulator_unittest.py',
                   },
     ),
 ]
 
-REFTEST_SANITY_ONLY = [
+REFTEST_SANITY = [
     ('reftest', {'suite': 'reftest',
                  'use_mozharness': True,
                  'script_path': 'scripts/b2g_emulator_unittest.py',
                 },
     ),
 ]
 
-CRASHTEST_ONLY = [
+CRASHTEST = [
     ('crashtest-1', {'suite': 'crashtest',
                      'use_mozharness': True,
                      'script_path': 'scripts/b2g_emulator_unittest.py',
                     },
     ),
     ('crashtest-2', {'suite': 'crashtest',
                      'use_mozharness': True,
                      'script_path': 'scripts/b2g_emulator_unittest.py',
@@ -219,33 +222,33 @@ CRASHTEST_ONLY = [
     ),
     ('crashtest-3', {'suite': 'crashtest',
                      'use_mozharness': True,
                      'script_path': 'scripts/b2g_emulator_unittest.py',
                     },
     ),
 ]
 
-MARIONETTE_ONLY = [
+MARIONETTE = [
     ('marionette-webapi', {'suite': 'marionette-webapi',
                            'use_mozharness': True,
                            'script_path': 'scripts/marionette.py',
                           },
     ),
 ]
 
-XPCSHELL_ONLY = [
+XPCSHELL = [
     ('xpcshell', {'suite': 'xpcshell',
                   'use_mozharness': True,
                   'script_path': 'scripts/b2g_emulator_unittest.py',
                   },
     ),
 ]
 
-ALL_UNITTESTS = MOCHITEST_ONLY + REFTEST_ONLY + CRASHTEST_ONLY + MARIONETTE_ONLY + XPCSHELL_ONLY
+ALL_UNITTESTS = MOCHITEST + REFTEST + CRASHTEST + MARIONETTE + XPCSHELL
 
 # Default set of unit tests
 UNITTEST_SUITES = {
     'opt_unittest_suites': ALL_UNITTESTS[:],
     'debug_unittest_suites': [],
 }
 
 # You must define opt_unittest_suites when enable_opt_unittests is True for a
@@ -433,18 +436,18 @@ PLATFORM_UNITTEST_VARS = {
                     'extra_args': [
                         '--cfg', 'b2g/emulator_automation_config.py',
                         '--test-suite', 'xpcshell',
                     ],
                 },
             },
         },
         'ubuntu64-b2g': {
-            'opt_unittest_suites': MOCHITEST_ONLY + MARIONETTE_ONLY + XPCSHELL_ONLY,
-            'debug_unittest_suites': UNITTEST_SUITES['debug_unittest_suites'][:],
+            'opt_unittest_suites': MOCHITEST + MARIONETTE + XPCSHELL,
+            'debug_unittest_suites': MOCHITEST + MARIONETTE + XPCSHELL,
             'suite_config': {
                 'marionette-webapi': {
                     'extra_args': [
                         "--cfg", "marionette/automation_emulator_config.py"
                     ],
                 },
                 'mochitest-1': {
                     'extra_args': [
@@ -646,47 +649,63 @@ BRANCHES['ash']['repo_path'] = "projects
 BRANCHES['ash']['mozharness_repo'] = "http://hg.mozilla.org/users/asasaki_mozilla.com/ash-mozharness"
 BRANCHES['ash']['mozharness_tag'] = "default"
 BRANCHES['ash']['platforms']['ics_armv7a_gecko']['fedora-b2g']['debug_unittest_suites'] = ALL_UNITTESTS[:]
 BRANCHES['ash']['platforms']['ics_armv7a_gecko']['enable_debug_unittests'] = True
 BRANCHES['cedar']['branch_name'] = "Cedar"
 BRANCHES['cedar']['repo_path'] = "projects/cedar"
 BRANCHES['cedar']['mozharness_tag'] = "default"
 BRANCHES['cedar']['platforms']['ics_armv7a_gecko']['fedora-b2g']['debug_unittest_suites'] = ALL_UNITTESTS[:]
-BRANCHES['cedar']['platforms']['ics_armv7a_gecko']['ubuntu64-b2g']['debug_unittest_suites'] = [x for x in ALL_UNITTESTS if x not in CRASHTEST_ONLY + REFTEST_ONLY]
 BRANCHES['cedar']['platforms']['ics_armv7a_gecko']['enable_debug_unittests'] = True
 BRANCHES['cedar']['platforms']['ics_armv7a_gecko']['slave_platforms'] = ['fedora-b2g', 'ubuntu64-b2g']
 BRANCHES['fx-team']['repo_path'] = "integration/fx-team"
 BRANCHES['mozilla-b2g18']['repo_path'] = "releases/mozilla-b2g18"
-BRANCHES['mozilla-b2g18']['platforms']['ics_armv7a_gecko']['fedora-b2g']['opt_unittest_suites'] = [x for x in ALL_UNITTESTS if x not in REFTEST_ONLY] + REFTEST_SANITY_ONLY
-BRANCHES['mozilla-b2g18']['platforms']['ics_armv7a_gecko']['fedora-b2g']['debug_unittest_suites'] = MOCHITEST_ONLY + XPCSHELL_ONLY
+BRANCHES['mozilla-b2g18']['platforms']['ics_armv7a_gecko']['fedora-b2g']['opt_unittest_suites'] = [x for x in ALL_UNITTESTS if x not in REFTEST] + REFTEST_SANITY
+BRANCHES['mozilla-b2g18']['platforms']['ics_armv7a_gecko']['fedora-b2g']['debug_unittest_suites'] = MOCHITEST + XPCSHELL
 BRANCHES['mozilla-b2g18']['platforms']['ics_armv7a_gecko']['enable_debug_unittests'] = True
 BRANCHES['mozilla-b2g18_v1_0_1']['repo_path'] = "releases/mozilla-b2g18_v1_0_1"
-BRANCHES['mozilla-b2g18_v1_0_1']['platforms']['ics_armv7a_gecko']['fedora-b2g']['opt_unittest_suites'] = [x for x in ALL_UNITTESTS if x not in CRASHTEST_ONLY + REFTEST_ONLY] + REFTEST_SANITY_ONLY
-BRANCHES['mozilla-b2g18_v1_0_1']['platforms']['ics_armv7a_gecko']['fedora-b2g']['debug_unittest_suites'] = MOCHITEST_ONLY + XPCSHELL_ONLY
+BRANCHES['mozilla-b2g18_v1_0_1']['platforms']['ics_armv7a_gecko']['fedora-b2g']['opt_unittest_suites'] = [x for x in ALL_UNITTESTS if x not in CRASHTEST + REFTEST] + REFTEST_SANITY
+BRANCHES['mozilla-b2g18_v1_0_1']['platforms']['ics_armv7a_gecko']['fedora-b2g']['debug_unittest_suites'] = MOCHITEST + XPCSHELL
 BRANCHES['mozilla-b2g18_v1_0_1']['platforms']['ics_armv7a_gecko']['enable_debug_unittests'] = True
 BRANCHES['mozilla-central']['branch_name'] = "Firefox"
 BRANCHES['mozilla-inbound']['repo_path'] = "integration/mozilla-inbound"
 BRANCHES['services-central']['repo_path'] = "services/services-central"
 BRANCHES['try']['pgo_strategy'] = "try"
 BRANCHES['try']['enable_try'] = True
 
 # explicitly set slave platforms per branch
 for branch in BRANCHES.keys():
     for platform in BRANCHES[branch]['platforms']:
         if 'slave_platforms' not in BRANCHES[branch]['platforms'][platform]:
-            BRANCHES[branch]['platforms'][platform]['slave_platforms'] = PLATFORMS[platform]['slave_platforms']
+            BRANCHES[branch]['platforms'][platform]['slave_platforms'] = list(PLATFORMS[platform]['slave_platforms'])
 
-# Disable ubuntu on non cedar branches
+# MERGE DAY NOTE: remove v22 based branches from the list below
+NON_UBUNTU_BRANCHES = ("mozilla-b2g18", "mozilla-b2g18_v1_0_1")
+
+# use either Fedora or Ubuntu for other branches,
+# don't touch cedar
 for branch in set(BRANCHES.keys()) - set(['cedar']):
-    for platform in BRANCHES[branch]['platforms']:
-        if 'ubuntu64-b2g' in BRANCHES[branch]['platforms'][platform]['slave_platforms']:
-            BRANCHES[branch]['platforms'][platform]['slave_platforms'].remove('ubuntu64-b2g')
-        if 'ubuntu64-b2g' in BRANCHES[branch]['platforms'][platform]:
-            del BRANCHES[branch]['platforms'][platform]['ubuntu64-b2g']
+    if branch in NON_UBUNTU_BRANCHES:
+        # Remove Ubuntu completely
+        for platform in BRANCHES[branch]['platforms']:
+            if 'ubuntu64-b2g' in BRANCHES[branch]['platforms'][platform]['slave_platforms']:
+                BRANCHES[branch]['platforms'][platform]['slave_platforms'].remove('ubuntu64-b2g')
+            if 'ubuntu64-b2g' in BRANCHES[branch]['platforms'][platform]:
+                del BRANCHES[branch]['platforms'][platform]['ubuntu64-b2g']
+        continue
+
+    for suite_type in ('opt_unittest_suites', 'debug_unittest_suites'):
+        if nested_haskey(BRANCHES[branch]['platforms'], 'ics_armv7a_gecko',
+                         'ubuntu64-b2g', suite_type) and \
+           nested_haskey(BRANCHES[branch]['platforms'], 'ics_armv7a_gecko',
+                         'fedora-b2g', suite_type):
+            # Don't run tests on Fedora if they listed in Ubuntu
+            for suite in BRANCHES[branch]['platforms']['ics_armv7a_gecko']['ubuntu64-b2g'][suite_type]:
+                BRANCHES[branch]['platforms']['ics_armv7a_gecko']['fedora-b2g'][suite_type] = \
+                    [s for s in deepcopy(BRANCHES[branch]['platforms']['ics_armv7a_gecko']['fedora-b2g'][suite_type]) if s[0] != suite[0]]
 
 
 if __name__ == "__main__":
     import sys
     import pprint
 
     args = sys.argv[1:]
 
--- a/mozilla-tests/config.py
+++ b/mozilla-tests/config.py
@@ -1,13 +1,14 @@
 from copy import deepcopy
 
 import config_common
 reload(config_common)
-from config_common import TALOS_CMD, loadDefaultValues, loadCustomTalosSuites, loadTalosSuites
+from config_common import TALOS_CMD, loadDefaultValues, loadCustomTalosSuites, \
+    loadTalosSuites, nested_haskey
 
 import project_branches
 reload(project_branches)
 from project_branches import PROJECT_BRANCHES, ACTIVE_PROJECT_BRANCHES
 
 import localconfig
 reload(localconfig)
 from localconfig import SLAVES, TRY_SLAVES, GLOBAL_VARS, GRAPH_CONFIG
@@ -445,27 +446,16 @@ MARIONETTE = [
 ]
 
 UNITTEST_SUITES = {
     'opt_unittest_suites': MOCHITEST + REFTEST_NO_IPC + XPCSHELL,
     'debug_unittest_suites': MOCHITEST + REFTEST_NO_IPC + XPCSHELL + MARIONETTE,
 }
 
 
-def nested_haskey(dictionary, *keys):
-    if len(keys) == 1:
-        return keys[0] in dictionary
-    else:
-        #recurse
-        key, keys = keys[0], keys[1:]
-        if key in dictionary:
-            return nested_haskey(dictionary[key], *keys)
-        else:
-            return False
-
 # You must define opt_unittest_suites when enable_opt_unittests is True for a
 # platform. Likewise debug_unittest_suites for enable_debug_unittests
 PLATFORM_UNITTEST_VARS = {
     'linux': {
         'product_name': 'firefox',
         'app_name': 'browser',
         'brand_name': 'Minefield',
         'builds_before_reboot': 1,
--- a/mozilla-tests/config_common.py
+++ b/mozilla-tests/config_common.py
@@ -60,8 +60,20 @@ def loadTalosSuites(BRANCHES, SUITES, br
     coallesceJobs = BRANCHES[branch].get('coallesce_jobs', True)
     for suite in SUITES.keys():
         if not SUITES[suite]['enable_by_default']:
             # Suites that are turned off by default
             BRANCHES[branch][suite + '_tests'] = (0, coallesceJobs) + SUITES[suite]['options']
         else:
             # Suites that are turned on by default
             BRANCHES[branch][suite + '_tests'] = (1, coallesceJobs) + SUITES[suite]['options']
+
+
+def nested_haskey(dictionary, *keys):
+    if len(keys) == 1:
+        return keys[0] in dictionary
+    else:
+        #recurse
+        key, keys = keys[0], keys[1:]
+        if key in dictionary:
+            return nested_haskey(dictionary[key], *keys)
+        else:
+            return False