author Wes Kocher <>
Wed, 09 Sep 2015 15:15:08 -0700
changeset 289179 ada03589e5eae255a91c33611b0f5a11e7e81df3
parent 282388 a7a6d91116abb5c244b46793301d0e0271056603
child 294164 80c1a6e8dd5c4e933d05f5da5fd8ab8db6329c8c
permissions -rw-r--r--
Backed out 3 changesets (bug 1181907) for marionette bustage a=backout Backed out changeset 77513059a6e4 (bug 1181907) Backed out changeset 97526d372199 (bug 1181907) Backed out changeset 4929041d9806 (bug 1181907)

# 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

import json

from argparse import ArgumentParser

    'common', # Harnesses without a specific package will look here.


def parse_args():
    parser = ArgumentParser(description='Generate a test_packages.json file to tell automation which harnesses require which test packages.')
    parser.add_argument("--common", required=True,
                        action="store", dest="tests_common",
                        help="Name of the \"common\" archive, a package to be used by all harnesses.")
    parser.add_argument("--jsshell", required=True,
                        action="store", dest="jsshell",
                        help="Name of the jsshell zip.")
    parser.add_argument("--use-short-names", action="store_true",
                        help="Use short names for packages (target.$ "
                             "instead of $(PACKAGE_BASENAME).$")
        parser.add_argument("--%s" % harness, required=True,
                            action="store", dest=harness,
                            help="Name of the %s zip." % harness)
    parser.add_argument("--dest-file", required=True,
                        action="store", dest="destfile",
                        help="Path to the output file to be written.")
    return parser.parse_args()

def generate_package_data(args):
    # Generate a dictionary mapping test harness names (exactly as they're known to
    # mozharness and, ideally) to the set of archive names that
    # harness depends on to run.
    # mozharness will use this file to determine what test zips to download,
    # which will be an optimization once parts of the main zip are split to harness
    # specific zips.
    tests_common = args.tests_common
    if args.use_short_names:
        tests_common = ''

    jsshell = args.jsshell

    harness_requirements = dict([(k, [tests_common]) for k in ALL_HARNESSES])
        pkg_name = getattr(args, harness)
        if args.use_short_names:
            pkg_name = '' % harness
    return harness_requirements

if __name__ == '__main__':
    args = parse_args()
    packages_data = generate_package_data(args)
    with open(args.destfile, 'w') as of:
        json.dump(packages_data, of, indent=4)