From 76166f027fdf4af9d2f8d73814ced4381a34ad68 Mon Sep 17 00:00:00 2001 From: Andrew Halberstadt Date: Thu, 19 Oct 2017 14:34:59 -0400 Subject: [PATCH] Bug 1410250 - Use transform for appending --mochitest-suite= et al, r=dustin Every task that uses the desktop_unittest.py or android_emulator_unittest.py mozharness scripts needs to pass in either ---suite=, or --test-suite= respectively. In almost all cases, and are identical to the value that is already specified under the test['suite'] key. This means we can use a transform to append these command line arguments and reduce the complexity of the yaml files. MozReview-Commit-ID: EaPlOzsESQ3 --HG-- extra : rebase_source : 1fc5523323774ab429f1377880204df51d53ccef --- taskcluster/ci/test/compiled.yml | 8 ---- taskcluster/ci/test/mochitest.yml | 35 ------------------ taskcluster/ci/test/reftest.yml | 18 --------- taskcluster/ci/test/xpcshell.yml | 10 +---- taskcluster/taskgraph/transforms/tests.py | 45 +++++++++++++++++------ 5 files changed, 34 insertions(+), 82 deletions(-) diff --git a/taskcluster/ci/test/compiled.yml b/taskcluster/ci/test/compiled.yml index 9d092c431d5a..0637432d45ac 100644 --- a/taskcluster/ci/test/compiled.yml +++ b/taskcluster/ci/test/compiled.yml @@ -17,8 +17,6 @@ cppunit: no-read-buildbot-config: true config: - android/androidarm_4_3.py - extra-options: - - --test-suite=cppunittest default: script: desktop_unittest.py no-read-buildbot-config: true @@ -31,8 +29,6 @@ cppunit: linux.*: - unittests/linux_unittest.py - remove_executables.py - extra-options: - - --cppunittest-suite=cppunittest tier: by-test-platform: windows10-64-asan.*: 3 @@ -62,8 +58,6 @@ gtest: linux.*: - unittests/linux_unittest.py - remove_executables.py - extra-options: - - --gtest-suite=gtest tier: by-test-platform: windows7-32-pgo.*: 3 @@ -101,8 +95,6 @@ jittest: linux.*: - unittests/linux_unittest.py - remove_executables.py - extra-options: - - --jittest-suite=jittest-chunked tier: by-test-platform: windows10-64-asan.*: 3 diff --git a/taskcluster/ci/test/mochitest.yml b/taskcluster/ci/test/mochitest.yml index 458911339a36..588ef802e676 100644 --- a/taskcluster/ci/test/mochitest.yml +++ b/taskcluster/ci/test/mochitest.yml @@ -59,12 +59,6 @@ mochitest: linux.*: - unittests/linux_unittest.py - remove_executables.py - extra-options: - by-test-platform: - linux64-jsdcov/opt: - - --mochitest-suite=plain-chunked-coverage - default: - - --mochitest-suite=plain-chunked mochitest-a11y: description: "Mochitest a11y run" @@ -90,8 +84,6 @@ mochitest-a11y: linux.*: - unittests/linux_unittest.py - remove_executables.py - extra-options: - - --mochitest-suite=a11y tier: by-test-platform: windows10-64-asan.*: 3 @@ -142,12 +134,6 @@ mochitest-browser-chrome: linux.*: - unittests/linux_unittest.py - remove_executables.py - extra-options: - by-test-platform: - linux64-jsdcov/opt: - - --mochitest-suite=browser-chrome-coverage - default: - - --mochitest-suite=browser-chrome-chunked # Bug 1281241: migrating to m3.large instances instance-size: by-test-platform: @@ -186,8 +172,6 @@ mochitest-browser-screenshots: linux.*: - unittests/linux_unittest.py - remove_executables.py - extra-options: - - --mochitest-suite=browser-chrome-screenshots allow-software-gl-layers: false mochitest-chrome: @@ -235,8 +219,6 @@ mochitest-chrome: linux.*: - unittests/linux_unittest.py - remove_executables.py - extra-options: - - --mochitest-suite=chrome tier: by-test-platform: windows10-64-asan.*: 3 @@ -320,12 +302,6 @@ mochitest-devtools-chrome: linux.*: - unittests/linux_unittest.py - remove_executables.py - extra-options: - by-test-platform: - linux64-jsdcov/opt: - - --mochitest-suite=mochitest-devtools-chrome-coverage - default: - - --mochitest-suite=mochitest-devtools-chrome-chunked instance-size: by-test-platform: # Bug 1281241: migrating to m3.large instances @@ -405,8 +381,6 @@ mochitest-media: no-read-buildbot-config: true config: - android/androidarm_4_3.py - extra-options: - - --test-suite=mochitest-media default: mochitest-flavor: plain script: desktop_unittest.py @@ -425,8 +399,6 @@ mochitest-media: linux.*: - unittests/linux_unittest.py - remove_executables.py - extra-options: - - --mochitest-suite=mochitest-media tier: by-test-platform: linux64-qr/.*: 1 @@ -462,7 +434,6 @@ mochitest-plain-headless: - unittests/linux_unittest.py - remove_executables.py extra-options: - - --mochitest-suite=plain-chunked - --headless mochitest-valgrind: @@ -492,8 +463,6 @@ mochitest-valgrind: linux.*: - unittests/linux_unittest.py - remove_executables.py - extra-options: - - --mochitest-suite=valgrind-plain mochitest-webgl: description: "Mochitest webgl run" @@ -529,8 +498,6 @@ mochitest-webgl: no-read-buildbot-config: true config: - android/androidarm_4_3.py - extra-options: - - --test-suite=mochitest-gl default: mochitest-flavor: plain script: desktop_unittest.py @@ -545,8 +512,6 @@ mochitest-webgl: linux.*: - unittests/linux_unittest.py - remove_executables.py - extra-options: - - --mochitest-suite=mochitest-gl tier: by-test-platform: linux64-qr/.*: 1 diff --git a/taskcluster/ci/test/reftest.yml b/taskcluster/ci/test/reftest.yml index 269d12be37b2..3ca33872d372 100644 --- a/taskcluster/ci/test/reftest.yml +++ b/taskcluster/ci/test/reftest.yml @@ -22,8 +22,6 @@ crashtest: no-read-buildbot-config: true config: - android/androidarm_4_3.py - extra-options: - - --test-suite=crashtest default: script: desktop_unittest.py chunked: false @@ -37,8 +35,6 @@ crashtest: linux.*: - unittests/linux_unittest.py - remove_executables.py - extra-options: - - --reftest-suite=crashtest tier: by-test-platform: linux64-qr/.*: 1 @@ -78,8 +74,6 @@ jsreftest: no-read-buildbot-config: true config: - android/androidarm_4_3.py - extra-options: - - --test-suite=jsreftest default: script: desktop_unittest.py no-read-buildbot-config: true @@ -93,8 +87,6 @@ jsreftest: linux.*: - unittests/linux_unittest.py - remove_executables.py - extra-options: - - --reftest-suite=jsreftest when: schedules: ['jsreftest'] tier: @@ -140,8 +132,6 @@ reftest: no-read-buildbot-config: true config: - android/androidarm_4_3.py - extra-options: - - --test-suite=reftest default: script: desktop_unittest.py no-read-buildbot-config: true @@ -160,8 +150,6 @@ reftest: linux.*: - unittests/linux_unittest.py - remove_executables.py - extra-options: - - --reftest-suite=reftest tier: by-test-platform: linux64-qr/.*: 1 @@ -194,8 +182,6 @@ reftest-gpu: linux.*: - unittests/linux_unittest.py - remove_executables.py - extra-options: - - --reftest-suite=reftest-gpu tier: default reftest-no-accel: @@ -235,8 +221,6 @@ reftest-no-accel: linux.*: - unittests/linux_unittest.py - remove_executables.py - extra-options: - - --reftest-suite=reftest-no-accel tier: by-test-platform: windows10-64-asan.*: 3 @@ -260,5 +244,3 @@ reftest-stylo: default: - unittests/linux_unittest.py - remove_executables.py - extra-options: - - --reftest-suite=reftest-stylo diff --git a/taskcluster/ci/test/xpcshell.yml b/taskcluster/ci/test/xpcshell.yml index 412e69b40084..6f091a38f77c 100644 --- a/taskcluster/ci/test/xpcshell.yml +++ b/taskcluster/ci/test/xpcshell.yml @@ -2,7 +2,7 @@ xpcshell: description: "xpcshell test run" suite: by-test-platform: - linux64-jsdcov/opt: xpcshell-coverage + linux64-jsdcov/opt: xpcshell/xpcshell-coverage default: xpcshell treeherder-symbol: tc-X(X) run-on-projects: @@ -30,8 +30,6 @@ xpcshell: android.*: script: android_emulator_unittest.py no-read-buildbot-config: true - extra-options: - - --test-suite=xpcshell config: by-test-platform: android-4.2-x86/opt: @@ -50,12 +48,6 @@ xpcshell: linux.*: - unittests/linux_unittest.py - remove_executables.py - extra-options: - by-test-platform: - linux64-jsdcov/opt: - - --xpcshell-suite=xpcshell-coverage - default: - - --xpcshell-suite=xpcshell requires-signed-builds: by-test-platform: windows10-64-asan/opt: false # No XPCShell on ASAN yet diff --git a/taskcluster/taskgraph/transforms/tests.py b/taskcluster/taskgraph/transforms/tests.py index bc7f9ba30f92..997d1b3deb89 100644 --- a/taskcluster/taskgraph/transforms/tests.py +++ b/taskcluster/taskgraph/transforms/tests.py @@ -625,6 +625,36 @@ def handle_keyed_by(config, tests): yield test +@transforms.add +def handle_suite_category(config, tests): + for test in tests: + if '/' in test['suite']: + suite, flavor = test['suite'].split('/', 1) + else: + suite = flavor = test['suite'] + + test.setdefault('attributes', {}) + test['attributes']['unittest_suite'] = suite + test['attributes']['unittest_flavor'] = flavor + + script = test['mozharness']['script'] + category_arg = None + if suite == 'test-verification': + pass + elif script == 'android_emulator_unittest.py': + category_arg = '--test-suite' + elif script == 'desktop_unittest.py': + category_arg = '--{}-suite'.format(suite) + + if category_arg: + test['mozharness'].setdefault('extra-options', []) + extra = test['mozharness']['extra-options'] + if not any(arg.startswith(category_arg) for arg in extra): + extra.append('{}={}'.format(category_arg, flavor)) + + yield test + + @transforms.add def enable_code_coverage(config, tests): """Enable code coverage for the linux64-ccov/opt & linux64-jsdcov/opt build-platforms""" @@ -667,7 +697,6 @@ def split_e10s(config, tests): for test in tests: e10s = test['e10s'] - test.setdefault('attributes', {}) test['e10s'] = False test['attributes']['e10s'] = False @@ -895,20 +924,12 @@ def make_job_description(config, tests): attr_build_platform, attr_build_type = test['build-platform'].split('/', 1) - suite = test['suite'] - if '/' in suite: - suite, flavor = suite.split('/', 1) - else: - flavor = suite - attributes = test.get('attributes', {}) attributes.update({ 'build_platform': attr_build_platform, 'build_type': attr_build_type, 'test_platform': test['test-platform'], 'test_chunk': str(test['this-chunk']), - 'unittest_suite': suite, - 'unittest_flavor': flavor, attr_try_name: try_name, }) @@ -934,8 +955,8 @@ def make_job_description(config, tests): 'total': test['chunks'], }, 'suite': { - 'name': suite, - 'flavor': flavor, + 'name': attributes['unittest_suite'], + 'flavor': attributes['unittest_flavor'], }, } jobdesc['treeherder'] = { @@ -945,7 +966,7 @@ def make_job_description(config, tests): 'platform': test.get('treeherder-machine-platform', test['build-platform']), } - schedules = [suite, platform_family(test['build-platform'])] + schedules = [attributes['unittest_suite'], platform_family(test['build-platform'])] when = test.get('when') if when and 'schedules' in when: schedules.extend(when['schedules'])