diff options
author | Adrian Dole <adriandole@google.com> | 2022-08-23 21:52:30 +0000 |
---|---|---|
committer | Chromeos LUCI <chromeos-scoped@luci-project-accounts.iam.gserviceaccount.com> | 2022-08-25 21:31:05 +0000 |
commit | 0abb0b34ef29c06f20208f7bc28040868169b0c1 (patch) | |
tree | 59464327c55ff38a81f83d625ba3ec8fa74d79f1 /llvm_tools/update_chromeos_llvm_hash_unittest.py | |
parent | c06ff64d26f90e7bb8047358d2d4c6c25619c6d3 (diff) | |
download | toolchain-utils-0abb0b34ef29c06f20208f7bc28040868169b0c1.tar.gz |
toolchain-utils: update manifest when updating LLVM
BUG=b:234635394
TEST=./update_chromeos_llvm_hash_unittest.py
Change-Id: Iff52984a44b41b230a74ebef7b5f8dd25b581237
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/toolchain-utils/+/3852368
Tested-by: Adrian Dole <adriandole@google.com>
Commit-Queue: Adrian Dole <adriandole@google.com>
Reviewed-by: Jordan Abrahams-Whitehead <ajordanr@google.com>
Auto-Submit: Adrian Dole <adriandole@google.com>
Reviewed-by: Adrian Dole <adriandole@google.com>
Diffstat (limited to 'llvm_tools/update_chromeos_llvm_hash_unittest.py')
-rwxr-xr-x | llvm_tools/update_chromeos_llvm_hash_unittest.py | 41 |
1 files changed, 35 insertions, 6 deletions
diff --git a/llvm_tools/update_chromeos_llvm_hash_unittest.py b/llvm_tools/update_chromeos_llvm_hash_unittest.py index d4fbfb21..9a51b62a 100755 --- a/llvm_tools/update_chromeos_llvm_hash_unittest.py +++ b/llvm_tools/update_chromeos_llvm_hash_unittest.py @@ -20,10 +20,10 @@ import chroot import failure_modes import get_llvm_hash import git +import subprocess_helpers import test_helpers import update_chromeos_llvm_hash - # These are unittests; protected access is OK to a point. # pylint: disable=protected-access @@ -311,6 +311,22 @@ class UpdateLLVMHashTest(unittest.TestCase): self.assertEqual(mock_command_output.call_args_list[3], mock.call(expected_cmd)) + @mock.patch.object(chroot, + 'GetChrootEbuildPaths', + return_value=['/chroot/path/test.ebuild']) + @mock.patch.object(subprocess, 'check_output', return_value='') + def testManifestUpdate(self, mock_subprocess, mock_ebuild_paths): + manifest_packages = ['sys-devel/llvm'] + chroot_path = '/path/to/chroot' + update_chromeos_llvm_hash.UpdateManifests(manifest_packages, chroot_path) + + args = mock_subprocess.call_args[0][-1] + manifest_cmd = [ + 'cros_sdk', '--', 'ebuild', '/chroot/path/test.ebuild', 'manifest' + ] + self.assertEqual(args, manifest_cmd) + mock_ebuild_paths.assert_called_once() + @mock.patch.object(get_llvm_hash, 'GetLLVMMajorVersion') @mock.patch.object(os.path, 'islink', return_value=True) @mock.patch.object(os.path, 'realpath') @@ -662,8 +678,15 @@ class UpdateLLVMHashTest(unittest.TestCase): # the 'try' block by UprevEbuildSymlink function. with self.assertRaises(ValueError) as err: update_chromeos_llvm_hash.UpdatePackages( - packages_to_update, llvm_variant, git_hash, svn_version, chroot_path, - failure_modes.FailureModes.FAIL, git_hash_source, extra_commit_msg) + packages=packages_to_update, + manifest_packages=[], + llvm_variant=llvm_variant, + git_hash=git_hash, + svn_version=svn_version, + chroot_path=chroot_path, + mode=failure_modes.FailureModes.FAIL, + git_hash_source=git_hash_source, + extra_commit_msg=extra_commit_msg) self.assertEqual(str(err.exception), 'Failed to uprev the ebuild.') @@ -790,9 +813,15 @@ class UpdateLLVMHashTest(unittest.TestCase): extra_commit_msg = '\ncommit-message-end' change_list = update_chromeos_llvm_hash.UpdatePackages( - packages_to_update, llvm_variant, git_hash, svn_version, chroot_path, - failure_modes.FailureModes.DISABLE_PATCHES, git_hash_source, - extra_commit_msg) + packages=packages_to_update, + manifest_packages=[], + llvm_variant=llvm_variant, + git_hash=git_hash, + svn_version=svn_version, + chroot_path=chroot_path, + mode=failure_modes.FailureModes.DISABLE_PATCHES, + git_hash_source=git_hash_source, + extra_commit_msg=extra_commit_msg) self.assertEqual(change_list.url, 'https://some_name/path/to/commit/+/12345') |