def test_determine_android_branch_64bit_targets(self): """Tests that a valid android branch is returned with only 64bit targets.""" self.PatchObject(osutils, 'SourceEnvironment', return_value={'ARM64_TARGET': '3-linux-target'}) branch = packages.determine_android_branch(self.board) self.assertEqual(branch, '3')
def test_determine_android_branch_when_not_present(self): """Tests that a None is returned for branch when android is not present.""" package_result = ['chromeos-base/update_engine-0.0.3-r3408'] self.PatchObject(portage_util, 'GetPackageDependencies', return_value=package_result) branch = packages.determine_android_branch(self.board) self.assertEqual(branch, None)
def test_determine_android_package_callers_handle_exception(self): """Tests handling RunCommandError by determine_android_package callers.""" # Mock what happens when portage returns that bubbles up (via RunCommand) # inside portage_util.GetPackageDependencies. self.PatchObject(portage_util, 'GetPackageDependencies', side_effect=cros_build_lib.RunCommandError('error')) # Verify that target is None, as expected. target = packages.determine_android_package(self.board) self.assertEqual(target, None) # determine_android_branch calls determine_android_package branch = packages.determine_android_branch(self.board) self.assertEqual(branch, None) # determine_android_target calls determine_android_package target = packages.determine_android_target(self.board) self.assertEqual(target, None)
def GetTargetVersions(input_proto, output_proto, _config): """Returns the target versions.""" build_target = controller_util.ParseBuildTarget(input_proto.build_target) android_version = packages.determine_android_version([build_target]) if android_version: output_proto.android_version = android_version android_branch_version = packages.determine_android_branch(build_target) if android_branch_version: output_proto.android_branch_version = android_branch_version android_target_version = packages.determine_android_target(build_target) if android_target_version: output_proto.android_target_version = android_target_version # TODO(crbug/1019770): Investigate cases where builds_chrome is true but # chrome_version is None. builds_chrome = packages.builds(constants.CHROME_CP, build_target) if builds_chrome: chrome_version = packages.determine_chrome_version(build_target) if chrome_version: output_proto.chrome_version = chrome_version output_proto.platform_version = packages.determine_platform_version() output_proto.milestone_version = packages.determine_milestone_version() output_proto.full_version = packages.determine_full_version()
def test_determine_android_branch(self): """Tests that a valid android branch is returned.""" branch = packages.determine_android_branch(self.board) self.assertEqual(branch, '3')