Exemplo n.º 1
0
  def testChromiumRollUpToDate(self):
    TEST_CONFIG["CHROMIUM"] = self.MakeEmptyTempDirectory()
    json_output_file = os.path.join(TEST_CONFIG["CHROMIUM"], "out.json")
    TextToFile(self.FAKE_DEPS, os.path.join(TEST_CONFIG["CHROMIUM"], "DEPS"))
    chrome_dir = TEST_CONFIG["CHROMIUM"]
    self.Expect([
      Cmd("git fetch origin", ""),
      Cmd("git fetch origin +refs/tags/*:refs/tags/*", ""),
      Cmd("gclient getdep -r src/v8", "last_roll_hsh", cwd=chrome_dir),
      Cmd("git describe --tags last_roll_hsh", "3.22.4"),
      Cmd("git fetch origin +refs/tags/*:refs/tags/*", ""),
      Cmd("git rev-list --max-age=395200 --tags",
          "bad_tag\nroll_hsh\nhash_123"),
      Cmd("git describe --tags bad_tag", ""),
      Cmd("git describe --tags roll_hsh", "3.22.4"),
      Cmd("git describe --tags hash_123", "3.22.3"),
      Cmd("git describe --tags roll_hsh", "3.22.4"),
      Cmd("git describe --tags hash_123", "3.22.3"),
    ])

    result = auto_roll.AutoRoll(TEST_CONFIG, self).Run(
        AUTO_PUSH_ARGS + [
          "-c", TEST_CONFIG["CHROMIUM"],
          "--json-output", json_output_file])
    self.assertEquals(0, result)
    json_output = json.loads(FileToText(json_output_file))
    self.assertEquals("up_to_date", json_output["monitoring_state"])
Exemplo n.º 2
0
  def testChromiumRoll(self):
    # Setup fake directory structures.
    TEST_CONFIG["CHROMIUM"] = self.MakeEmptyTempDirectory()
    json_output_file = os.path.join(TEST_CONFIG["CHROMIUM"], "out.json")
    TextToFile(self.FAKE_DEPS, os.path.join(TEST_CONFIG["CHROMIUM"], "DEPS"))
    TextToFile("", os.path.join(TEST_CONFIG["CHROMIUM"], ".git"))
    chrome_dir = TEST_CONFIG["CHROMIUM"]
    os.makedirs(os.path.join(chrome_dir, "v8"))

    def WriteDeps():
      TextToFile("Some line\n   \"v8_revision\": \"22624\",\n  some line",
                 os.path.join(chrome_dir, "DEPS"))

    expectations = [
      Cmd("git fetch origin", ""),
      Cmd("git fetch origin +refs/tags/*:refs/tags/*", ""),
      Cmd("gclient getdep -r src/v8", "last_roll_hsh", cwd=chrome_dir),
      Cmd("git describe --tags last_roll_hsh", "3.22.3.1"),
      Cmd("git fetch origin +refs/tags/*:refs/tags/*", ""),
      Cmd("git rev-list --max-age=395200 --tags",
          "bad_tag\nroll_hsh\nhash_123"),
      Cmd("git describe --tags bad_tag", ""),
      Cmd("git describe --tags roll_hsh", "3.22.4"),
      Cmd("git describe --tags hash_123", "3.22.3"),
      Cmd("git describe --tags roll_hsh", "3.22.4"),
      Cmd("git log -1 --format=%s roll_hsh", "Version 3.22.4\n"),
      Cmd("git describe --tags roll_hsh", "3.22.4"),
      Cmd("git describe --tags last_roll_hsh", "3.22.2.1"),
      Cmd("git status -s -uno", "", cwd=chrome_dir),
      Cmd("git checkout -f main", "", cwd=chrome_dir),
      Cmd("git branch", "", cwd=chrome_dir),
      Cmd("git pull", "", cwd=chrome_dir),
      Cmd("git fetch origin", ""),
      Cmd("git new-branch work-branch", "", cwd=chrome_dir),
      Cmd("gclient setdep -r src/v8@roll_hsh", "", cb=WriteDeps,
          cwd=chrome_dir),
      Cmd(("git commit -am \"%s\" "
           "--author \"[email protected] <*****@*****.**>\"" %
           self.ROLL_COMMIT_MSG),
          "", cwd=chrome_dir),
      Cmd("git cl upload --send-mail -f "
          "--cq-dry-run --set-bot-commit --bypass-hooks", "",
          cwd=chrome_dir),
      Cmd("git checkout -f main", "", cwd=chrome_dir),
      Cmd("git branch -D work-branch", "", cwd=chrome_dir),
    ]
    self.Expect(expectations)

    args = ["-a", "*****@*****.**", "-c", chrome_dir,
            "-r", "*****@*****.**", "--json-output", json_output_file]
    auto_roll.AutoRoll(TEST_CONFIG, self).Run(args)

    deps = FileToText(os.path.join(chrome_dir, "DEPS"))
    self.assertTrue(re.search("\"v8_revision\": \"22624\"", deps))

    json_output = json.loads(FileToText(json_output_file))
    self.assertEquals("success", json_output["monitoring_state"])
Exemplo n.º 3
0
  def testAutoRollExistingRoll(self):
    self.ExpectReadURL([
      URL("https://codereview.chromium.org/search",
          "owner=author%40chromium.org&limit=30&closed=3&format=json",
          ("{\"results\": [{\"subject\": \"different\"},"
           "{\"subject\": \"Update V8 to Version...\"}]}")),
    ])

    result = auto_roll.AutoRoll(TEST_CONFIG, self).Run(
        AUTO_PUSH_ARGS + ["-c", TEST_CONFIG[CHROMIUM]])
    self.assertEquals(1, result)
Exemplo n.º 4
0
    def testAutoRoll(self):
        password = self.MakeEmptyTempFile()
        TextToFile("PW", password)
        TEST_CONFIG[DOT_GIT_LOCATION] = self.MakeEmptyTempFile()
        TEST_CONFIG[SETTINGS_LOCATION] = "~/.doesnotexist"

        self.ExpectReadURL([
            [
                "https://v8-status.appspot.com/current?format=json",
                "{\"message\": \"Tree is throttled\"}"
            ],
            [
                "https://v8-status.appspot.com/lkgr",
                Exception("Network problem")
            ],
            ["https://v8-status.appspot.com/lkgr", "100"],
            [
                "https://v8-status.appspot.com/status",
                ("username=v8-auto-roll%40chromium.org&"
                 "message=Tree+is+closed+%28preparing+to+push%29&password=PW"),
                ""
            ],
            [
                "https://v8-status.appspot.com/status",
                ("username=v8-auto-roll%40chromium.org&"
                 "message=Tree+is+throttled&password=PW"), ""
            ],
        ])

        self.ExpectGit([
            ["status -s -uno", ""],
            ["status -s -b -uno", "## some_branch\n"],
            ["svn fetch", ""],
            ["svn log -1 --oneline", "r100 | Text"],
            [("log -1 --format=%H --grep=\""
              "^Version [[:digit:]]*\.[[:digit:]]*\.[[:digit:]]* (based\""
              " svn/trunk"), "push_hash\n"],
            ["svn find-rev push_hash", "65"],
        ])

        auto_roll.AutoRoll(TEST_CONFIG,
                           self).Run(AUTO_ROLL_ARGS +
                                     ["--status-password", password])

        state = json.loads(
            FileToText("%s-state.json" % TEST_CONFIG[PERSISTFILE_BASENAME]))

        self.assertEquals("100", state["lkgr"])
        self.assertEquals("100", state["latest"])
Exemplo n.º 5
0
  def testAutoRoll(self):
    self.ExpectReadURL([
      URL("https://codereview.chromium.org/search",
          "owner=author%40chromium.org&limit=30&closed=3&format=json",
          ("{\"results\": [{\"subject\": \"different\"}]}")),
      URL("http://src.chromium.org/svn/trunk/src/DEPS",
          self.FAKE_DEPS),
    ])

    self.ExpectGit([
      Git(("log -1 --format=%H --grep="
           "\"^Version [[:digit:]]*\.[[:digit:]]*\.[[:digit:]]*\" "
           "svn/trunk"), "push_hash\n"),
      Git("svn find-rev push_hash", "123456\n"),
    ])

    result = auto_roll.AutoRoll(TEST_CONFIG, self).Run(
        AUTO_PUSH_ARGS + ["-c", TEST_CONFIG[CHROMIUM], "--roll"])
    self.assertEquals(0, result)
Exemplo n.º 6
0
 def RunAutoRoll():
     auto_roll.AutoRoll(TEST_CONFIG, self).Run(AUTO_ROLL_ARGS)