Bug 1523562 [wpt PR 14930] - Sync Mozilla CSS tests as of 2019-01-17, a=testonly
[gecko.git] / build / gen_test_packages_manifest.py
blob54814f634dba629e5d6c62db49e727311d0c3734
1 #!/usr/bin/python
3 # This Source Code Form is subject to the terms of the Mozilla Public
4 # License, v. 2.0. If a copy of the MPL was not distributed with this
5 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
7 import json
9 from argparse import ArgumentParser
11 ALL_HARNESSES = [
12 'common', # Harnesses without a specific package will look here.
13 'mochitest',
14 'reftest',
15 'xpcshell',
16 'cppunittest',
17 'jittest',
18 'mozbase',
19 'web-platform',
20 'talos',
21 'raptor',
22 'awsy',
23 'gtest',
24 'updater-dep'
27 PACKAGE_SPECIFIED_HARNESSES = [
28 'cppunittest',
29 'mochitest',
30 'reftest',
31 'xpcshell',
32 'web-platform',
33 'talos',
34 'raptor',
35 'awsy',
36 'updater-dep',
39 # These packages are not present for every build configuration.
40 OPTIONAL_PACKAGES = [
41 'gtest',
45 def parse_args():
46 parser = ArgumentParser(
47 description="Generate a test_packages.json file to tell automation which harnesses "
48 "require which test packages.")
49 parser.add_argument("--common", required=True,
50 action="store", dest="tests_common",
51 help="Name of the \"common\" archive, a package to be used by all "
52 "harnesses.")
53 parser.add_argument("--jsshell", required=True,
54 action="store", dest="jsshell",
55 help="Name of the jsshell zip.")
56 for harness in PACKAGE_SPECIFIED_HARNESSES:
57 parser.add_argument("--%s" % harness, required=True,
58 action="store", dest=harness,
59 help="Name of the %s zip." % harness)
60 for harness in OPTIONAL_PACKAGES:
61 parser.add_argument("--%s" % harness, required=False,
62 action="store", dest=harness,
63 help="Name of the %s zip." % harness)
64 parser.add_argument("--dest-file", required=True,
65 action="store", dest="destfile",
66 help="Path to the output file to be written.")
67 return parser.parse_args()
70 def generate_package_data(args):
71 # Generate a dictionary mapping test harness names (exactly as they're known to
72 # mozharness and testsuite-targets.mk, ideally) to the set of archive names that
73 # harness depends on to run.
74 # mozharness will use this file to determine what test zips to download,
75 # which will be an optimization once parts of the main zip are split to harness
76 # specific zips.
77 tests_common = args.tests_common
78 jsshell = args.jsshell
80 harness_requirements = dict([(k, [tests_common]) for k in ALL_HARNESSES])
81 harness_requirements['jittest'].append(jsshell)
82 for harness in PACKAGE_SPECIFIED_HARNESSES + OPTIONAL_PACKAGES:
83 pkg_name = getattr(args, harness, None)
84 if pkg_name is None:
85 continue
86 harness_requirements[harness].append(pkg_name)
87 return harness_requirements
90 if __name__ == '__main__':
91 args = parse_args()
92 packages_data = generate_package_data(args)
93 with open(args.destfile, 'w') as of:
94 json.dump(packages_data, of, indent=4)