[go: nahoru, domu]

[orderfile] Generate an .arm orderfile on other archs.

Chrome build files assume that all orderfiles have a ".arm" extension,
meaning that the orderfile generator doesn't pick up the right one on
other architectures. Use the right filename, but make sure that we don't
run this on bots.

See the "default_chrome_orderfile" variable in internal code's build
files.

Bug: 1186598
Change-Id: I53a1a4f0777ae9daf30e27c4902af675089173c1
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3124675
Commit-Queue: Benoit L <lizeb@chromium.org>
Reviewed-by: Peter Kotwicz <pkotwicz@chromium.org>
Cr-Commit-Position: refs/heads/main@{#916381}
diff --git a/tools/cygprofile/orderfile_generator_backend.py b/tools/cygprofile/orderfile_generator_backend.py
index c66963e6..8a030e60 100755
--- a/tools/cygprofile/orderfile_generator_backend.py
+++ b/tools/cygprofile/orderfile_generator_backend.py
@@ -484,7 +484,11 @@
 
   def _GetPathToOrderfile(self):
     """Gets the path to the architecture-specific orderfile."""
-    return self._path_to_orderfile % self._options.arch
+    # Build GN files use the ".arm" orderfile irrespective of the actual
+    # architecture. Fake it, otherwise the orderfile we generate here is not
+    # going to be picked up by builds.
+    orderfile_fake_arch = 'arm'
+    return self._path_to_orderfile % orderfile_fake_arch
 
   def _GetUnpatchedOrderfileFilename(self):
     """Gets the path to the architecture-specific unpatched orderfile."""
@@ -1137,6 +1141,14 @@
   logging.basicConfig(level=logging.INFO)
   devil_chromium.Initialize(adb_path=options.adb_path)
 
+  # Since we generate a ".arm" orderfile irrespective of the architecture (see
+  # comment in _GetPathToOrderfile()), make sure that we don't commit it.
+  if options.arch != 'arm':
+    assert not options.buildbot, (
+        'ARM is the only supported architecture on bots')
+    assert not options.upload_ready_orderfiles, (
+        'ARM is the only supported architecture on bots')
+
   generator = OrderfileGenerator(options, orderfile_updater_class)
   try:
     if options.verify: