from common_includes import *
import chromium_roll
+CLUSTERFUZZ_API_KEY_FILE = "CLUSTERFUZZ_API_KEY_FILE"
+
CONFIG = {
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'
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):
MESSAGE = "Roll V8 into Chromium."
"--reviewer", self._options.reviewer,
"--chromium", self._options.chromium,
"--force",
+ "--use-commit-queue",
]
if self._options.sheriff:
args.extend([
CheckActiveRoll,
DetectLastPush,
DetectLastRoll,
+ CheckClusterFuzz,
RollChromium,
]
% self["sheriff"])
self.GitCommit("%s%s\n\nTBR=%s" % (commit_title, sheriff, rev))
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."
"directory to automate the V8 roll."))
parser.add_argument("-l", "--last-push",
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
if not options.manual and not options.reviewer:
import argparse
import datetime
+import httplib
import imp
import json
import os
finally:
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):
time.sleep(seconds)
args.append(Quoted(patch_file))
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"]
if author:
args += ["--email", Quoted(author)]
args += ["-r", Quoted(reviewer)]
if force:
args.append("-f")
+ if cq:
+ args.append("--use-commit-queue")
# TODO(machenbach): Check output in forced mode. Verify that all required
# base files were uploaded, if not retry.
self.Git(MakeArgs(args), pipe=False)
from auto_push import CheckLastPush
from auto_push import SETTINGS_LOCATION
import auto_roll
+from auto_roll import CLUSTERFUZZ_API_KEY_FILE
import common_includes
from common_includes import *
import merge_to_branch
"/tmp/test-merge-to-branch-tempfile-already-merging",
COMMIT_HASHES_FILE: "/tmp/test-merge-to-branch-tempfile-PATCH_COMMIT_HASHES",
TEMPORARY_PATCH_FILE: "/tmp/test-merge-to-branch-tempfile-temporary-patch",
+ CLUSTERFUZZ_API_KEY_FILE: "/tmp/test-fake-cf-api-key",
}
else:
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):
pass
self.assertEquals(1, result)
def testAutoRoll(self):
+ TEST_CONFIG[CLUSTERFUZZ_API_KEY_FILE] = self.MakeEmptyTempFile()
+ TextToFile("fake key", TEST_CONFIG[CLUSTERFUZZ_API_KEY_FILE])
self.ExpectReadURL([
URL("https://codereview.chromium.org/search",
"owner=author%40chromium.org&limit=30&closed=3&format=json",