зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1675740 - Add a script that can unify test artifacts. r=firefox-build-system-reviewers,rstewart
Differential Revision: https://phabricator.services.mozilla.com/D96689
This commit is contained in:
Родитель
377bf07175
Коммит
a251e85356
|
@ -0,0 +1,65 @@
|
|||
# This Source Code Form is subject to the terms of the Mozilla Public
|
||||
# License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
|
||||
import argparse
|
||||
import buildconfig
|
||||
import os
|
||||
import mozpack.path as mozpath
|
||||
from mozpack.files import FileFinder
|
||||
from mozpack.copier import FileCopier
|
||||
from mozpack.errors import errors
|
||||
from mozpack.unify import UnifiedFinder
|
||||
|
||||
|
||||
class UnifiedTestFinder(UnifiedFinder):
|
||||
def unify_file(self, path, file1, file2):
|
||||
unified = super(UnifiedTestFinder, self).unify_file(path, file1, file2)
|
||||
basename = mozpath.basename(path)
|
||||
if basename in ("mozinfo.json", "wptrunner.local.ini"):
|
||||
# The mozinfo.json files contain build-time paths that differ between
|
||||
# both ends, as well as processor and pgo status, which differ as well.
|
||||
# The wptrunner.local.ini file contains build-time paths that differ.
|
||||
# Remove the block or one of the conditions when this assert is hit.
|
||||
assert not unified
|
||||
errors.ignore_errors()
|
||||
self._report_difference(path, file1, file2)
|
||||
errors.ignore_errors(False)
|
||||
return file1
|
||||
elif basename == "dump_syms_mac":
|
||||
# At the moment, the dump_syms_mac executable is a x86_64 binary
|
||||
# on both ends. We can't create a universal executable from twice
|
||||
# the same executable.
|
||||
# When this assert hits, remove this block.
|
||||
assert file1.open().read() == file2.open().read()
|
||||
return file1
|
||||
return unified
|
||||
|
||||
|
||||
def main():
|
||||
parser = argparse.ArgumentParser(
|
||||
description="Merge two directories, creating Universal binaries for "
|
||||
"executables and libraries they contain."
|
||||
)
|
||||
parser.add_argument("dir1", help="Directory")
|
||||
parser.add_argument("dir2", help="Directory to merge")
|
||||
|
||||
options = parser.parse_args()
|
||||
|
||||
buildconfig.substs["OS_ARCH"] = "Darwin"
|
||||
buildconfig.substs["LIPO"] = os.environ.get("LIPO")
|
||||
|
||||
dir1_finder = FileFinder(options.dir1, find_executables=True, find_dotfiles=True)
|
||||
dir2_finder = FileFinder(options.dir2, find_executables=True, find_dotfiles=True)
|
||||
finder = UnifiedTestFinder(dir1_finder, dir2_finder)
|
||||
|
||||
copier = FileCopier()
|
||||
with errors.accumulate():
|
||||
for p, f in finder:
|
||||
copier.add(p, f)
|
||||
|
||||
copier.copy(options.dir1, skip_if_older=False)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
|
@ -35,6 +35,7 @@ py2:
|
|||
- config/create_rc.py
|
||||
- config/create_res.py
|
||||
- config/printconfigsetting.py
|
||||
- python/mozbuild/mozbuild/action/unify_tests.py
|
||||
- python/mozbuild/mozbuild/html_build_viewer.py
|
||||
- python/mozbuild/mozpack/unify.py
|
||||
- python/mozbuild/mozpack/test/test_unify.py
|
||||
|
|
Загрузка…
Ссылка в новой задаче