コード例 #1
0
  def _CommonMarkAsStableTest(self, chrome_rev, new_version, old_ebuild_path,
                              new_ebuild_path, commit_string_indicator):
    """Common function used for test functions for MarkChromeEBuildAsStable.

    This function stubs out others calls, and runs MarkChromeEBuildAsStable
    with the specified args.

    Args:
      chrome_rev: standard chrome_rev argument
      new_version: version we are revving up to
      old_ebuild_path: path to the stable ebuild
      new_ebuild_path: path to the to be created path
      commit_string_indicator: a string that the commit message must contain
    """
    self.mox.StubOutWithMock(cros_build_lib, 'RunCommand')
    self.mox.StubOutWithMock(portage_utilities.EBuild, 'CommitChange')
    stable_candidate = cros_mark_chrome_as_stable.ChromeEBuild(old_ebuild_path)
    unstable_ebuild = cros_mark_chrome_as_stable.ChromeEBuild(self.unstable)
    chrome_version = new_version
    commit = None
    overlay_dir = self.mock_chrome_dir

    cros_build_lib.RunCommand(['git', 'add', new_ebuild_path], cwd=overlay_dir)
    cros_build_lib.RunCommand(['git', 'rm', old_ebuild_path], cwd=overlay_dir)
    portage_utilities.EBuild.CommitChange(
        mox.StrContains(commit_string_indicator), overlay_dir)

    self.mox.ReplayAll()
    cros_mark_chrome_as_stable.MarkChromeEBuildAsStable(
        stable_candidate, unstable_ebuild, chrome_rev, chrome_version, commit,
        overlay_dir)
    self.mox.VerifyAll()
コード例 #2
0
 def _GetStableEBuilds(self):
   """Common helper to create a list of stable ebuilds."""
   return [
       cros_mark_chrome_as_stable.ChromeEBuild(self.sticky),
       cros_mark_chrome_as_stable.ChromeEBuild(self.sticky_rc),
       cros_mark_chrome_as_stable.ChromeEBuild(self.latest_stable),
       cros_mark_chrome_as_stable.ChromeEBuild(self.tot_stable),
   ]
コード例 #3
0
 def testLatestChromeRevisionListLink(self):
   """Tests that we can generate a link to the revision list between the
   latest Chromium release and the last one we successfully built."""
   _TouchAndWrite(self.latest_new, stable_data)
   expected = cros_mark_chrome_as_stable.GetChromeRevisionLinkFromVersions(
       self.latest_stable_version, self.latest_new_version)
   made = cros_mark_chrome_as_stable.GetChromeRevisionListLink(
       cros_mark_chrome_as_stable.ChromeEBuild(self.latest_stable),
       cros_mark_chrome_as_stable.ChromeEBuild(self.latest_new),
       constants.CHROME_REV_LATEST)
   self.assertEqual(expected, made)
コード例 #4
0
    def _CommonMarkAsStableTest(self, chrome_rev, new_version, old_ebuild_path,
                                new_ebuild_path, commit_string_indicator):
        """Common function used for test functions for MarkChromeEBuildAsStable.

    This function stubs out others calls, and runs MarkChromeEBuildAsStable
    with the specified args.

    Args:
      chrome_rev: standard chrome_rev argument
      new_version: version we are revving up to
      old_ebuild_path: path to the stable ebuild
      new_ebuild_path: path to the to be created path
      commit_string_indicator: a string that the commit message must contain
    """
        self.PatchObject(cros_build_lib,
                         'RunCommand',
                         side_effect=Exception('should not be called'))
        self.PatchObject(portage_util.EBuild,
                         'GetCrosWorkonVars',
                         return_value=None)
        git_mock = self.PatchObject(git, 'RunGit')
        commit_mock = self.PatchObject(portage_util.EBuild, 'CommitChange')
        stable_candidate = cros_mark_chrome_as_stable.ChromeEBuild(
            old_ebuild_path)
        unstable_ebuild = cros_mark_chrome_as_stable.ChromeEBuild(
            self.unstable)
        chrome_pn = 'chromeos-chrome'
        chrome_version = new_version
        commit = None
        package_dir = self.mock_chrome_dir

        cros_mark_chrome_as_stable.MarkChromeEBuildAsStable(
            stable_candidate, unstable_ebuild, chrome_pn, chrome_rev,
            chrome_version, commit, package_dir)

        git_mock.assert_has_calls([
            mock.call(package_dir, ['add', new_ebuild_path]),
            mock.call(package_dir, ['rm', old_ebuild_path]),
        ])
        commit_mock.assert_called_with(
            partial_mock.HasString(commit_string_indicator), package_dir)
コード例 #5
0
 def testChromeEBuildInit(self):
   """Tests if the chrome_version is set correctly in a ChromeEBuild."""
   ebuild = cros_mark_chrome_as_stable.ChromeEBuild(self.sticky)
   self.assertEqual(ebuild.chrome_version, self.sticky_version)