Bug 1690340 - Part 2: Use the new naming for the developer tools menu items. r=jdescottes
[gecko.git] / build / gen_test_packages_manifest.py
blobafaae8c56ac3a694fb9fbd33506406c252bc425a
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 "condprof",
14 "mochitest",
15 "reftest",
16 "xpcshell",
17 "cppunittest",
18 "jittest",
19 "mozbase",
20 "web-platform",
21 "talos",
22 "raptor",
23 "awsy",
24 "gtest",
25 "updater-dep",
26 "jsreftest",
27 "perftests",
28 "fuzztest",
31 PACKAGE_SPECIFIED_HARNESSES = [
32 "condprof",
33 "cppunittest",
34 "mochitest",
35 "reftest",
36 "xpcshell",
37 "web-platform",
38 "talos",
39 "raptor",
40 "awsy",
41 "updater-dep",
42 "jittest",
43 "jsreftest",
44 "perftests",
45 "fuzztest",
48 # These packages are not present for every build configuration.
49 OPTIONAL_PACKAGES = [
50 "gtest",
54 def parse_args():
55 parser = ArgumentParser(
56 description="Generate a test_packages.json file to tell automation which harnesses "
57 "require which test packages."
59 parser.add_argument(
60 "--common",
61 required=True,
62 action="store",
63 dest="tests_common",
64 help='Name of the "common" archive, a package to be used by all ' "harnesses.",
66 parser.add_argument(
67 "--jsshell",
68 required=True,
69 action="store",
70 dest="jsshell",
71 help="Name of the jsshell zip.",
73 for harness in PACKAGE_SPECIFIED_HARNESSES:
74 parser.add_argument(
75 "--%s" % harness,
76 required=True,
77 action="store",
78 dest=harness,
79 help="Name of the %s zip." % harness,
81 for harness in OPTIONAL_PACKAGES:
82 parser.add_argument(
83 "--%s" % harness,
84 required=False,
85 action="store",
86 dest=harness,
87 help="Name of the %s zip." % harness,
89 parser.add_argument(
90 "--dest-file",
91 required=True,
92 action="store",
93 dest="destfile",
94 help="Path to the output file to be written.",
96 return parser.parse_args()
99 def generate_package_data(args):
100 # Generate a dictionary mapping test harness names (exactly as they're known to
101 # mozharness and testsuite-targets.mk, ideally) to the set of archive names that
102 # harness depends on to run.
103 # mozharness will use this file to determine what test zips to download,
104 # which will be an optimization once parts of the main zip are split to harness
105 # specific zips.
106 tests_common = args.tests_common
107 jsshell = args.jsshell
109 harness_requirements = dict([(k, [tests_common]) for k in ALL_HARNESSES])
110 harness_requirements["jittest"].append(jsshell)
111 harness_requirements["jsreftest"].append(args.reftest)
112 for harness in PACKAGE_SPECIFIED_HARNESSES + OPTIONAL_PACKAGES:
113 pkg_name = getattr(args, harness, None)
114 if pkg_name is None:
115 continue
116 harness_requirements[harness].append(pkg_name)
117 return harness_requirements
120 if __name__ == "__main__":
121 args = parse_args()
122 packages_data = generate_package_data(args)
123 with open(args.destfile, "w") as of:
124 json.dump(packages_data, of, indent=4)