Add clusterfuzz check to v8 auto-roll script and use CQ.

This adds a check step that makes sure there are no new issues when rolling into chromium.

It also checks the cq bit on roll upload.

BUG=
R=jarin@chromium.org

Review URL: https://codereview.chromium.org/315133003

git-svn-id: https://v8.googlecode.com/svn/branches/bleeding_edge@21996 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent 4fa6a27a
...@@ -12,8 +12,11 @@ import urllib ...@@ -12,8 +12,11 @@ import urllib
from common_includes import * from common_includes import *
import chromium_roll import chromium_roll
CLUSTERFUZZ_API_KEY_FILE = "CLUSTERFUZZ_API_KEY_FILE"
CONFIG = { CONFIG = {
PERSISTFILE_BASENAME: "/tmp/v8-auto-roll-tempfile", PERSISTFILE_BASENAME: "/tmp/v8-auto-roll-tempfile",
CLUSTERFUZZ_API_KEY_FILE: ".cf_api_key",
} }
CR_DEPS_URL = 'http://src.chromium.org/svn/trunk/src/DEPS' CR_DEPS_URL = 'http://src.chromium.org/svn/trunk/src/DEPS'
...@@ -65,6 +68,24 @@ class DetectLastRoll(Step): ...@@ -65,6 +68,24 @@ class DetectLastRoll(Step):
return True return True
class CheckClusterFuzz(Step):
MESSAGE = "Check ClusterFuzz api for new problems."
def RunStep(self):
if not os.path.exists(self.Config(CLUSTERFUZZ_API_KEY_FILE)):
print "Skipping ClusterFuzz check. No api key file found."
return False
api_key = FileToText(self.Config(CLUSTERFUZZ_API_KEY_FILE))
# Check for open, reproducible issues that have no associated bug.
result = self._side_effect_handler.ReadClusterFuzzAPI(
api_key, job_type="linux_asan_d8_dbg", reproducible="True",
open="True", bug_information="",
revision_greater_or_equal=self["last_push"])
if result:
print "Stop due to pending ClusterFuzz issues."
return True
class RollChromium(Step): class RollChromium(Step):
MESSAGE = "Roll V8 into Chromium." MESSAGE = "Roll V8 into Chromium."
...@@ -75,6 +96,7 @@ class RollChromium(Step): ...@@ -75,6 +96,7 @@ class RollChromium(Step):
"--reviewer", self._options.reviewer, "--reviewer", self._options.reviewer,
"--chromium", self._options.chromium, "--chromium", self._options.chromium,
"--force", "--force",
"--use-commit-queue",
] ]
if self._options.sheriff: if self._options.sheriff:
args.extend([ args.extend([
...@@ -108,6 +130,7 @@ class AutoRoll(ScriptsBase): ...@@ -108,6 +130,7 @@ class AutoRoll(ScriptsBase):
CheckActiveRoll, CheckActiveRoll,
DetectLastPush, DetectLastPush,
DetectLastRoll, DetectLastRoll,
CheckClusterFuzz,
RollChromium, RollChromium,
] ]
......
...@@ -105,7 +105,8 @@ class UploadCL(Step): ...@@ -105,7 +105,8 @@ class UploadCL(Step):
% self["sheriff"]) % self["sheriff"])
self.GitCommit("%s%s\n\nTBR=%s" % (commit_title, sheriff, rev)) self.GitCommit("%s%s\n\nTBR=%s" % (commit_title, sheriff, rev))
self.GitUpload(author=self._options.author, self.GitUpload(author=self._options.author,
force=self._options.force_upload) force=self._options.force_upload,
cq=self._options.use_commit_queue)
print "CL uploaded." print "CL uploaded."
...@@ -143,6 +144,9 @@ class ChromiumRoll(ScriptsBase): ...@@ -143,6 +144,9 @@ class ChromiumRoll(ScriptsBase):
"directory to automate the V8 roll.")) "directory to automate the V8 roll."))
parser.add_argument("-l", "--last-push", parser.add_argument("-l", "--last-push",
help="The git commit ID of the last push to trunk.") help="The git commit ID of the last push to trunk.")
parser.add_argument("--use-commit-queue",
help="Check the CQ bit on upload.",
default=False, action="store_true")
def _ProcessOptions(self, options): # pragma: no cover def _ProcessOptions(self, options): # pragma: no cover
if not options.manual and not options.reviewer: if not options.manual and not options.reviewer:
......
...@@ -28,6 +28,7 @@ ...@@ -28,6 +28,7 @@
import argparse import argparse
import datetime import datetime
import httplib
import imp import imp
import json import json
import os import os
...@@ -207,6 +208,25 @@ class SideEffectHandler(object): # pragma: no cover ...@@ -207,6 +208,25 @@ class SideEffectHandler(object): # pragma: no cover
finally: finally:
url_fh.close() url_fh.close()
def ReadClusterFuzzAPI(self, api_key, **params):
params["api_key"] = api_key
params = urllib.urlencode(params)
headers = {"Content-type": "application/x-www-form-urlencoded"}
conn = httplib.HTTPSConnection("backend-dot-cluster-fuzz.appspot.com")
conn.request("POST", "/_api/", params, headers)
response = conn.getresponse()
data = response.read()
try:
return json.loads(data)
except:
print data
print "ERROR: Could not read response. Is your key valid?"
raise
def Sleep(self, seconds): def Sleep(self, seconds):
time.sleep(seconds) time.sleep(seconds)
......
...@@ -144,7 +144,7 @@ class GitRecipesMixin(object): ...@@ -144,7 +144,7 @@ class GitRecipesMixin(object):
args.append(Quoted(patch_file)) args.append(Quoted(patch_file))
self.Git(MakeArgs(args)) self.Git(MakeArgs(args))
def GitUpload(self, reviewer="", author="", force=False): def GitUpload(self, reviewer="", author="", force=False, cq=False):
args = ["cl upload --send-mail"] args = ["cl upload --send-mail"]
if author: if author:
args += ["--email", Quoted(author)] args += ["--email", Quoted(author)]
...@@ -152,6 +152,8 @@ class GitRecipesMixin(object): ...@@ -152,6 +152,8 @@ class GitRecipesMixin(object):
args += ["-r", Quoted(reviewer)] args += ["-r", Quoted(reviewer)]
if force: if force:
args.append("-f") args.append("-f")
if cq:
args.append("--use-commit-queue")
# TODO(machenbach): Check output in forced mode. Verify that all required # TODO(machenbach): Check output in forced mode. Verify that all required
# base files were uploaded, if not retry. # base files were uploaded, if not retry.
self.Git(MakeArgs(args), pipe=False) self.Git(MakeArgs(args), pipe=False)
......
...@@ -35,6 +35,7 @@ import auto_push ...@@ -35,6 +35,7 @@ import auto_push
from auto_push import CheckLastPush from auto_push import CheckLastPush
from auto_push import SETTINGS_LOCATION from auto_push import SETTINGS_LOCATION
import auto_roll import auto_roll
from auto_roll import CLUSTERFUZZ_API_KEY_FILE
import common_includes import common_includes
from common_includes import * from common_includes import *
import merge_to_branch import merge_to_branch
...@@ -66,6 +67,7 @@ TEST_CONFIG = { ...@@ -66,6 +67,7 @@ TEST_CONFIG = {
"/tmp/test-merge-to-branch-tempfile-already-merging", "/tmp/test-merge-to-branch-tempfile-already-merging",
COMMIT_HASHES_FILE: "/tmp/test-merge-to-branch-tempfile-PATCH_COMMIT_HASHES", COMMIT_HASHES_FILE: "/tmp/test-merge-to-branch-tempfile-PATCH_COMMIT_HASHES",
TEMPORARY_PATCH_FILE: "/tmp/test-merge-to-branch-tempfile-temporary-patch", TEMPORARY_PATCH_FILE: "/tmp/test-merge-to-branch-tempfile-temporary-patch",
CLUSTERFUZZ_API_KEY_FILE: "/tmp/test-fake-cf-api-key",
} }
...@@ -384,6 +386,11 @@ class ScriptTest(unittest.TestCase): ...@@ -384,6 +386,11 @@ class ScriptTest(unittest.TestCase):
else: else:
return self._url_mock.Call("readurl", url) return self._url_mock.Call("readurl", url)
def ReadClusterFuzzAPI(self, api_key, **params):
# TODO(machenbach): Use a mock for this and add a test that stops rolling
# due to clustefuzz results.
return []
def Sleep(self, seconds): def Sleep(self, seconds):
pass pass
...@@ -996,6 +1003,8 @@ deps = { ...@@ -996,6 +1003,8 @@ deps = {
self.assertEquals(1, result) self.assertEquals(1, result)
def testAutoRoll(self): def testAutoRoll(self):
TEST_CONFIG[CLUSTERFUZZ_API_KEY_FILE] = self.MakeEmptyTempFile()
TextToFile("fake key", TEST_CONFIG[CLUSTERFUZZ_API_KEY_FILE])
self.ExpectReadURL([ self.ExpectReadURL([
URL("https://codereview.chromium.org/search", URL("https://codereview.chromium.org/search",
"owner=author%40chromium.org&limit=30&closed=3&format=json", "owner=author%40chromium.org&limit=30&closed=3&format=json",
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment