def resolve_keyed_by(config, tests): """Resolve fields that can be keyed by platform, etc.""" fields = [ 'instance-size', 'max-run-time', 'chunks', 'e10s', 'suite', 'run-on-projects', 'tier', ] for test in tests: for field in fields: test[field] = get_keyed_by(item=test, field=field, item_name=test['test-name']) test['mozharness']['config'] = get_keyed_by( item=test, field='mozharness', subfield='config', item_name=test['test-name']) test['mozharness']['extra-options'] = get_keyed_by( item=test, field='mozharness', subfield='extra-options', item_name=test['test-name']) yield test
def split_e10s(config, tests): for test in tests: e10s = get_keyed_by(item=test, field='e10s', item_name=test['test-name']) test.setdefault('attributes', {}) test['e10s'] = False test['attributes']['e10s'] = False if e10s == 'both': yield copy.deepcopy(test) e10s = True if e10s: test['test-name'] += '-e10s' test['e10s'] = True test['attributes']['e10s'] = True group, symbol = split_symbol(test['treeherder-symbol']) if group != '?': group += '-e10s' test['treeherder-symbol'] = join_symbol(group, symbol) test['mozharness']['extra-options'] = get_keyed_by( item=test, field='mozharness', subfield='extra-options', item_name=test['test-name']) test['mozharness']['extra-options'].append('--e10s') yield test
def resolve_keyed_by(config, tests): """Resolve fields that can be keyed by platform, etc.""" fields = [ 'instance-size', 'max-run-time', 'chunks', ] for test in tests: for field in fields: test[field] = get_keyed_by(item=test, field=field, item_name=test['test-name']) test['mozharness']['config'] = get_keyed_by(item=test, field='mozharness', subfield='config', item_name=test['test-name']) yield test
def add_os_groups(config, tests): for test in tests: if test['test-platform'].startswith('win'): groups = get_keyed_by(item=test, field='os-groups', item_name=test['test-name']) if groups: test['os-groups'] = groups yield test
def add_os_groups(config, tests): for test in tests: if test["test-platform"].startswith("win"): groups = get_keyed_by(item=test, field="os-groups", item_name=test["test-name"]) if groups: test["os-groups"] = groups yield test
def test_by_value_no_by(self): test = { 'test-name': 'tname', 'option': { 'other-value': {}, }, } self.assertEqual(get_keyed_by(test, 'option', 'x'), test['option'])
def test_by_value_dict(self): test = { 'test-name': 'tname', 'option': { 'by-something-else': {}, 'by-other-value': {}, }, } self.assertEqual(get_keyed_by(test, 'option', 'x'), test['option'])
def resolve_keyed_by(config, jobs): fields = [ 'worker-type', 'worker', ] for job in jobs: for field in fields: job[field] = get_keyed_by(item=job, field=field, item_name=job['name']) yield job
def test_by_value_default(self): test = { 'test-name': 'tname', 'option': { 'by-other-value': { 'a': 10, 'default': 30, }, }, 'other-value': 'xxx', } self.assertEqual(get_keyed_by(test, 'option', 'x'), 30)
def test_by_value(self): test = { 'test-name': 'tname', 'option': { 'by-other-value': { 'a': 10, 'b': 20, }, }, 'other-value': 'b', } self.assertEqual(get_keyed_by(test, 'option', 'x'), 20)
def test_by_value_regex(self): test = { 'test-name': 'tname', 'option': { 'by-test-platform': { 'macosx64/.*': 10, 'linux64/debug': 20, 'default': 5, }, }, 'test-platform': 'macosx64/debug', } self.assertEqual(get_keyed_by(test, 'option', 'x'), 10)
def allow_software_gl_layers(config, tests): for test in tests: allow = get_keyed_by(item=test, field='allow-software-gl-layers', item_name=test['test-name']) if allow: assert test['instance-size'] != 'legacy',\ 'Software GL layers on a legacy instance is disallowed (bug 1296086).' # This should be set always once bug 1296086 is resolved. test['mozharness'].setdefault('extra-options', [])\ .append("--allow-software-gl-layers") yield test
def resolve_keyed_by(config, tests): """Resolve fields that can be keyed by platform, etc.""" fields = [ 'instance-size', 'max-run-time', 'chunks', ] for test in tests: for field in fields: test[field] = get_keyed_by(item=test, field=field, item_name=test['test-name']) yield test
def allow_software_gl_layers(config, tests): for test in tests: # since this value defaults to true, but is not applicable on non-linux, # it's overriden for that platform here. allow = test['test-platform'].startswith('linux') \ and get_keyed_by(item=test, field='allow-software-gl-layers', item_name=test['test-name']) if allow: assert test['instance-size'] != 'legacy',\ 'Software GL layers on a legacy instance is disallowed (bug 1296086).' # This should be set always once bug 1296086 is resolved. test['mozharness'].setdefault('extra-options', [])\ .append("--allow-software-gl-layers") yield test
def allow_software_gl_layers(config, tests): for test in tests: # since this value defaults to true, but is not applicable on windows, # it's overriden for that platform here. allow = not test["test-platform"].startswith("win") and get_keyed_by( item=test, field="allow-software-gl-layers", item_name=test["test-name"] ) if allow: assert ( test["instance-size"] != "legacy" ), "Software GL layers on a legacy instance is disallowed (bug 1296086)." # This should be set always once bug 1296086 is resolved. test["mozharness"].setdefault("extra-options", []).append("--allow-software-gl-layers") yield test
def allow_software_gl_layers(config, tests): for test in tests: # since this value defaults to true, but is not applicable on windows, # it's overriden for that platform here. allow = not test['test-platform'].startswith('win') \ and get_keyed_by(item=test, field='allow-software-gl-layers', item_name=test['test-name']) if allow: assert test['instance-size'] != 'legacy',\ 'Software GL layers on a legacy instance is disallowed (bug 1296086).' # This should be set always once bug 1296086 is resolved. test['mozharness'].setdefault('extra-options', [])\ .append("--allow-software-gl-layers") yield test
def split_e10s(config, tests): for test in tests: e10s = get_keyed_by(item=test, field="e10s", item_name=test["test-name"]) test.setdefault("attributes", {}) test["e10s"] = False test["attributes"]["e10s"] = False if e10s == "both": yield test test = copy.deepcopy(test) e10s = True if e10s: test["test-name"] += "-e10s" test["e10s"] = True test["attributes"]["e10s"] = True group, symbol = split_symbol(test["treeherder-symbol"]) if group != "?": group += "-e10s" test["treeherder-symbol"] = join_symbol(group, symbol) test["mozharness"].setdefault("extra-options", []).append("--e10s") yield test
def split_e10s(config, tests): for test in tests: e10s = get_keyed_by(item=test, field='e10s', item_name=test['test-name']) test.setdefault('attributes', {}) test['e10s'] = False test['attributes']['e10s'] = False if e10s == 'both': yield test test = copy.deepcopy(test) e10s = True if e10s: test['test-name'] += '-e10s' test['e10s'] = True test['attributes']['e10s'] = True group, symbol = split_symbol(test['treeherder-symbol']) if group != '?': group += '-e10s' test['treeherder-symbol'] = join_symbol(group, symbol) test['mozharness'].setdefault('extra-options', []).append('--e10s') yield test
def test_simple_value(self): test = { 'test-name': 'tname', 'option': 10, } self.assertEqual(get_keyed_by(test, 'option', 'x'), 10)