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/.
9 from argparse
import ArgumentParser
12 "common", # Harnesses without a specific package will look here.
31 PACKAGE_SPECIFIED_HARNESSES
= [
48 # These packages are not present for every build configuration.
55 parser
= ArgumentParser(
56 description
="Generate a test_packages.json file to tell automation which harnesses "
57 "require which test packages."
64 help='Name of the "common" archive, a package to be used by all ' "harnesses.",
71 help="Name of the jsshell zip.",
73 for harness
in PACKAGE_SPECIFIED_HARNESSES
:
79 help="Name of the %s zip." % harness
,
81 for harness
in OPTIONAL_PACKAGES
:
87 help="Name of the %s zip." % harness
,
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
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)
116 harness_requirements
[harness
].append(pkg_name
)
117 return harness_requirements
120 if __name__
== "__main__":
122 packages_data
= generate_package_data(args
)
123 with
open(args
.destfile
, "w") as of
:
124 json
.dump(packages_data
, of
, indent
=4)