summaryrefslogtreecommitdiff
path: root/chromium/weblayer/browser/android/javatests/skew/build_weblayer_instrumentation_test_cipd_pkg.py
diff options
context:
space:
mode:
authorAllan Sandfeld Jensen <allan.jensen@qt.io>2020-10-06 12:48:11 +0200
committerAllan Sandfeld Jensen <allan.jensen@qt.io>2020-10-13 09:33:43 +0000
commit7b5b123ac58f58ffde0f4f6e488bcd09aa4decd3 (patch)
treefa14ba0ca8d2683ba2efdabd246dc9b18a1229c6 /chromium/weblayer/browser/android/javatests/skew/build_weblayer_instrumentation_test_cipd_pkg.py
parent79b4f909db1049fca459c07cca55af56a9b54fe3 (diff)
downloadqtwebengine-chromium-7b5b123ac58f58ffde0f4f6e488bcd09aa4decd3.tar.gz
BASELINE: Update Chromium to 84.0.4147.141
Change-Id: Ib85eb4cfa1cbe2b2b81e5022c8cad5c493969535 Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
Diffstat (limited to 'chromium/weblayer/browser/android/javatests/skew/build_weblayer_instrumentation_test_cipd_pkg.py')
-rwxr-xr-xchromium/weblayer/browser/android/javatests/skew/build_weblayer_instrumentation_test_cipd_pkg.py105
1 files changed, 105 insertions, 0 deletions
diff --git a/chromium/weblayer/browser/android/javatests/skew/build_weblayer_instrumentation_test_cipd_pkg.py b/chromium/weblayer/browser/android/javatests/skew/build_weblayer_instrumentation_test_cipd_pkg.py
new file mode 100755
index 00000000000..612977d6020
--- /dev/null
+++ b/chromium/weblayer/browser/android/javatests/skew/build_weblayer_instrumentation_test_cipd_pkg.py
@@ -0,0 +1,105 @@
+#!/usr/bin/env python3
+#
+# Copyright 2020 The Chromium Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+#
+# Script to build a CIPD package for weblayer_instrumentation_test_apk from
+# the current Chromium checkout.
+#
+# This should be run from the src directory of a release branch. After the
+# package is built the user should run two cipd commands (printed at the end
+# of script execution) to upload the package to the CIPD server and to update
+# the ref for the corresponding milestone. Once the ref is updated, the version
+# skew test will pick up the new package in successive runs.
+
+import argparse
+import os
+import shutil
+import subprocess
+import sys
+import tempfile
+import zipfile
+
+
+# Run mb.py out of the current branch for simplicity.
+MB_PATH = './tools/mb/mb.py'
+
+# Get the config specifying the gn args from the location of this script.
+MB_CONFIG_PATH = os.path.join(os.path.dirname(os.path.abspath(__file__)),
+ 'mb_config.pyl')
+
+# CIPD package path.
+# https://chrome-infra-packages.appspot.com/p/chromium/testing/weblayer-x86/+/
+CIPD_PKG_PATH='chromium/testing/weblayer-x86'
+
+def zip_test_target(zip_filename):
+ """Create zip of all deps for weblayer_instrumentation_test_apk.
+
+ Args:
+ zip_filename: destination zip filename.
+ """
+ cmd = [MB_PATH,
+ 'zip',
+ '--master=dummy.master',
+ '--builder=dummy.builder',
+ '--config-file=%s' % MB_CONFIG_PATH,
+ 'out/Release',
+ 'weblayer_instrumentation_test_apk',
+ zip_filename]
+ print(' '.join(cmd))
+ subprocess.check_call(cmd)
+
+
+def build_cipd_pkg(input_path, cipd_filename):
+ """Create a CIPD package file from the given input path.
+
+ Args:
+ input_path: input directory from which to build the package.
+ cipd_filename: output filename for resulting cipd archive.
+ """
+ cmd = ['cipd',
+ 'pkg-build',
+ '--in=%s' % input_path,
+ '--install-mode=copy',
+ '--name=%s' % CIPD_PKG_PATH,
+ '--out=%s' % cipd_filename]
+ print(' '.join(cmd))
+ subprocess.check_call(cmd)
+
+
+def main():
+ parser = argparse.ArgumentParser(
+ description='Package weblayer instrumentation tests for CIPD.')
+ parser.add_argument(
+ '--cipd_out',
+ required=True,
+ help="Output filename for resulting .cipd file.")
+ args = parser.parse_args()
+
+ with tempfile.TemporaryDirectory() as tmp_dir:
+ # Create zip archive of test target.
+ zip_filename = os.path.join(tmp_dir, 'file.zip')
+ zip_test_target(zip_filename)
+
+ # Extract zip archive.
+ extracted = os.path.join(tmp_dir, 'extracted')
+ os.mkdir(extracted)
+ with zipfile.ZipFile(zip_filename) as zip_file:
+ zip_file.extractall(path=extracted)
+
+ # Create CIPD archive.
+ tmp_cipd_filename = os.path.join(tmp_dir, 'file.cipd')
+ build_cipd_pkg(extracted, tmp_cipd_filename)
+ shutil.move(tmp_cipd_filename, args.cipd_out)
+
+ print(('Use "cipd pkg-register %s -verbose -tag \'version:<branch>\'" ' +
+ 'to upload package to the cipd server.') % args.cipd_out)
+ print('Use "cipd set-ref chromium/testing/weblayer-x86 --version ' +
+ '<CIPD instance version> -ref m<milestone>" to update the ref.')
+ print('The CIPD instance version can be found on the "Instance" line ' +
+ 'above after "chromium/testing/weblayer-x86:".')
+
+
+if __name__ == '__main__':
+ sys.exit(main())