2015-05-15 21:30:24 +03:00
|
|
|
#!/usr/bin/python
|
|
|
|
#
|
|
|
|
# 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 http://mozilla.org/MPL/2.0/.
|
|
|
|
|
|
|
|
import json
|
|
|
|
|
|
|
|
from argparse import ArgumentParser
|
|
|
|
|
|
|
|
ALL_HARNESSES = [
|
2017-10-07 17:45:22 +03:00
|
|
|
'common', # Harnesses without a specific package will look here.
|
2015-05-15 21:30:24 +03:00
|
|
|
'mochitest',
|
|
|
|
'reftest',
|
|
|
|
'xpcshell',
|
|
|
|
'cppunittest',
|
|
|
|
'jittest',
|
|
|
|
'mozbase',
|
2016-10-05 03:17:07 +03:00
|
|
|
'web-platform',
|
2015-08-27 11:51:32 +03:00
|
|
|
'talos',
|
2018-05-02 23:42:41 +03:00
|
|
|
'raptor',
|
2017-03-10 21:33:19 +03:00
|
|
|
'awsy',
|
2015-07-17 02:52:31 +03:00
|
|
|
'gtest',
|
2018-09-21 13:07:27 +03:00
|
|
|
'updater-dep'
|
2015-05-15 21:30:24 +03:00
|
|
|
]
|
|
|
|
|
|
|
|
PACKAGE_SPECIFIED_HARNESSES = [
|
2015-06-29 21:16:50 +03:00
|
|
|
'cppunittest',
|
|
|
|
'mochitest',
|
|
|
|
'reftest',
|
|
|
|
'xpcshell',
|
2016-10-05 03:17:07 +03:00
|
|
|
'web-platform',
|
2015-08-27 11:51:32 +03:00
|
|
|
'talos',
|
2018-05-02 23:42:41 +03:00
|
|
|
'raptor',
|
2017-03-10 21:33:19 +03:00
|
|
|
'awsy',
|
2018-09-21 13:07:27 +03:00
|
|
|
'updater-dep',
|
2015-05-15 21:30:24 +03:00
|
|
|
]
|
|
|
|
|
2015-07-17 02:52:31 +03:00
|
|
|
# These packages are not present for every build configuration.
|
|
|
|
OPTIONAL_PACKAGES = [
|
|
|
|
'gtest',
|
|
|
|
]
|
|
|
|
|
2015-05-15 21:30:24 +03:00
|
|
|
|
|
|
|
def parse_args():
|
2017-10-07 17:45:22 +03:00
|
|
|
parser = ArgumentParser(
|
|
|
|
description="Generate a test_packages.json file to tell automation which harnesses "
|
|
|
|
"require which test packages.")
|
2015-05-15 21:30:24 +03:00
|
|
|
parser.add_argument("--common", required=True,
|
|
|
|
action="store", dest="tests_common",
|
2017-10-07 17:45:22 +03:00
|
|
|
help="Name of the \"common\" archive, a package to be used by all "
|
|
|
|
"harnesses.")
|
2015-05-15 21:30:24 +03:00
|
|
|
parser.add_argument("--jsshell", required=True,
|
|
|
|
action="store", dest="jsshell",
|
|
|
|
help="Name of the jsshell zip.")
|
|
|
|
for harness in PACKAGE_SPECIFIED_HARNESSES:
|
|
|
|
parser.add_argument("--%s" % harness, required=True,
|
|
|
|
action="store", dest=harness,
|
|
|
|
help="Name of the %s zip." % harness)
|
2015-07-17 02:52:31 +03:00
|
|
|
for harness in OPTIONAL_PACKAGES:
|
|
|
|
parser.add_argument("--%s" % harness, required=False,
|
|
|
|
action="store", dest=harness,
|
|
|
|
help="Name of the %s zip." % harness)
|
2015-05-15 21:30:24 +03:00
|
|
|
parser.add_argument("--dest-file", required=True,
|
|
|
|
action="store", dest="destfile",
|
|
|
|
help="Path to the output file to be written.")
|
|
|
|
return parser.parse_args()
|
|
|
|
|
2016-02-25 23:37:47 +03:00
|
|
|
|
2015-05-15 21:30:24 +03:00
|
|
|
def generate_package_data(args):
|
|
|
|
# Generate a dictionary mapping test harness names (exactly as they're known to
|
|
|
|
# mozharness and testsuite-targets.mk, 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
|
|
|
|
jsshell = args.jsshell
|
|
|
|
|
|
|
|
harness_requirements = dict([(k, [tests_common]) for k in ALL_HARNESSES])
|
|
|
|
harness_requirements['jittest'].append(jsshell)
|
2015-07-17 02:52:31 +03:00
|
|
|
for harness in PACKAGE_SPECIFIED_HARNESSES + OPTIONAL_PACKAGES:
|
|
|
|
pkg_name = getattr(args, harness, None)
|
|
|
|
if pkg_name is None:
|
|
|
|
continue
|
2015-06-29 21:16:51 +03:00
|
|
|
harness_requirements[harness].append(pkg_name)
|
2015-05-15 21:30:24 +03:00
|
|
|
return harness_requirements
|
|
|
|
|
2017-10-07 17:45:22 +03:00
|
|
|
|
2015-05-15 21:30:24 +03:00
|
|
|
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)
|