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/.
8 from argparse
import ArgumentParser
11 "common", # Harnesses without a specific package will look here.
30 PACKAGE_SPECIFIED_HARNESSES
= [
47 # These packages are not present for every build configuration.
54 parser
= ArgumentParser(
55 description
="Generate a test_packages.json file to tell automation which harnesses "
56 "require which test packages."
63 help='Name of the "common" archive, a package to be used by all ' "harnesses.",
70 help="Name of the jsshell zip.",
72 for harness
in PACKAGE_SPECIFIED_HARNESSES
:
78 help="Name of the %s zip." % harness
,
80 for harness
in OPTIONAL_PACKAGES
:
86 help="Name of the %s zip." % harness
,
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
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)
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__":
123 packages_data
= generate_package_data(args
)
124 with
open(args
.destfile
, "w") as of
:
125 json
.dump(packages_data
, of
, indent
=4)