Backed out changeset 2450366cf7ca (bug 1891629) for causing win msix mochitest failures
[gecko.git] / build / gen_test_packages_manifest.py
blob162f4e84209acfe581575c4ac7c65eb68cc1e83d
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
8 from argparse import ArgumentParser
10 ALL_HARNESSES = [
11 "common", # Harnesses without a specific package will look here.
12 "condprof",
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",
25 "jsreftest",
26 "perftests",
27 "fuzztest",
30 PACKAGE_SPECIFIED_HARNESSES = [
31 "condprof",
32 "cppunittest",
33 "mochitest",
34 "reftest",
35 "xpcshell",
36 "web-platform",
37 "talos",
38 "raptor",
39 "awsy",
40 "updater-dep",
41 "jittest",
42 "jsreftest",
43 "perftests",
44 "fuzztest",
47 # These packages are not present for every build configuration.
48 OPTIONAL_PACKAGES = [
49 "gtest",
53 def parse_args():
54 parser = ArgumentParser(
55 description="Generate a test_packages.json file to tell automation which harnesses "
56 "require which test packages."
58 parser.add_argument(
59 "--common",
60 required=True,
61 action="store",
62 dest="tests_common",
63 help='Name of the "common" archive, a package to be used by all ' "harnesses.",
65 parser.add_argument(
66 "--jsshell",
67 required=True,
68 action="store",
69 dest="jsshell",
70 help="Name of the jsshell zip.",
72 for harness in PACKAGE_SPECIFIED_HARNESSES:
73 parser.add_argument(
74 "--%s" % harness,
75 required=True,
76 action="store",
77 dest=harness,
78 help="Name of the %s zip." % harness,
80 for harness in OPTIONAL_PACKAGES:
81 parser.add_argument(
82 "--%s" % harness,
83 required=False,
84 action="store",
85 dest=harness,
86 help="Name of the %s zip." % harness,
88 parser.add_argument(
89 "--dest-file",
90 required=True,
91 action="store",
92 dest="destfile",
93 help="Path to the output file to be written.",
95 return parser.parse_args()
98 def generate_package_data(args):
99 # Generate a dictionary mapping test harness names (exactly as they're known to
100 # mozharness and testsuite-targets.mk, ideally) to the set of archive names that
101 # harness depends on to run.
102 # mozharness will use this file to determine what test zips to download,
103 # which will be an optimization once parts of the main zip are split to harness
104 # specific zips.
105 tests_common = args.tests_common
106 jsshell = args.jsshell
108 harness_requirements = dict([(k, [tests_common]) for k in ALL_HARNESSES])
109 harness_requirements["jittest"].append(jsshell)
110 harness_requirements["jsreftest"].append(args.reftest)
111 harness_requirements["common"].append("target.condprof.tests.tar.gz")
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 harness_requirements[harness].append("target.condprof.tests.tar.gz")
118 return harness_requirements
121 if __name__ == "__main__":
122 args = parse_args()
123 packages_data = generate_package_data(args)
124 with open(args.destfile, "w") as of:
125 json.dump(packages_data, of, indent=4)