Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(52)

Unified Diff: tools/push-to-trunk/check_clusterfuzz.py

Issue 868473004: External name changes of release scripts. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: tools/push-to-trunk/check_clusterfuzz.py
diff --git a/tools/push-to-trunk/check_clusterfuzz.py b/tools/push-to-trunk/check_clusterfuzz.py
deleted file mode 100755
index d4ba90ba481a2cfccb8f8a0f4dbb67ac22208a91..0000000000000000000000000000000000000000
--- a/tools/push-to-trunk/check_clusterfuzz.py
+++ /dev/null
@@ -1,174 +0,0 @@
-#!/usr/bin/env python
-# Copyright 2014 the V8 project authors. All rights reserved.
-# Use of this source code is governed by a BSD-style license that can be
-# found in the LICENSE file.
-
-"""
-Script to check for new clusterfuzz issues since the last rolled v8 revision.
-
-Returns a json list with test case IDs if any.
-
-Security considerations: The security key and request data must never be
-written to public logs. Public automated callers of this script should
-suppress stdout and stderr and only process contents of the results_file.
-"""
-
-
-import argparse
-import httplib
-import json
-import os
-import re
-import sys
-import urllib
-import urllib2
-
-
-# Constants to git repos.
-BASE_URL = "https://chromium.googlesource.com"
-DEPS_LOG = BASE_URL + "/chromium/src/+log/master/DEPS?format=JSON"
-
-# Constants for retrieving v8 rolls.
-CRREV = "https://cr-rev.appspot.com/_ah/api/crrev/v1/commit/%s"
-V8_COMMIT_RE = re.compile(
- r"^Update V8 to version \d+\.\d+\.\d+ \(based on ([a-fA-F0-9]+)\)\..*")
-
-# Constants for the clusterfuzz backend.
-HOSTNAME = "backend-dot-cluster-fuzz.appspot.com"
-
-# Crash patterns.
-V8_INTERNAL_RE = re.compile(r"^v8::internal.*")
-ANY_RE = re.compile(r".*")
-
-# List of all api requests.
-BUG_SPECS = [
- {
- "args": {
- "job_type": "linux_asan_chrome_v8",
- "reproducible": "True",
- "open": "True",
- "bug_information": "",
- },
- "crash_state": V8_INTERNAL_RE,
- },
- {
- "args": {
- "job_type": "linux_asan_d8_dbg",
- "reproducible": "True",
- "open": "True",
- "bug_information": "",
- },
- "crash_state": ANY_RE,
- },
-]
-
-
-def GetRequest(url):
- url_fh = urllib2.urlopen(url, None, 60)
- try:
- return url_fh.read()
- finally:
- url_fh.close()
-
-
-def GetLatestV8InChromium():
- """Returns the commit position number of the latest v8 roll in chromium."""
-
- # Check currently rolled v8 revision.
- result = GetRequest(DEPS_LOG)
- if not result:
- return None
-
- # Strip security header and load json.
- commits = json.loads(result[5:])
-
- git_revision = None
- for commit in commits["log"]:
- # Get latest commit that matches the v8 roll pattern. Ignore cherry-picks.
- match = re.match(V8_COMMIT_RE, commit["message"])
- if match:
- git_revision = match.group(1)
- break
- else:
- return None
-
- # Get commit position number for v8 revision.
- result = GetRequest(CRREV % git_revision)
- if not result:
- return None
-
- commit = json.loads(result)
- assert commit["repo"] == "v8/v8"
- return commit["number"]
-
-
-def APIRequest(key, **params):
- """Send a request to the clusterfuzz api.
-
- Returns a json dict of the response.
- """
-
- params["api_key"] = key
- params = urllib.urlencode(params)
-
- headers = {"Content-type": "application/x-www-form-urlencoded"}
-
- try:
- conn = httplib.HTTPSConnection(HOSTNAME)
- conn.request("POST", "/_api/", params, headers)
-
- response = conn.getresponse()
-
- # Never leak "data" into public logs.
- data = response.read()
- except:
- raise Exception("ERROR: Connection problem.")
-
- try:
- return json.loads(data)
- except:
- raise Exception("ERROR: Could not read response. Is your key valid?")
-
- return None
-
-
-def Main():
- parser = argparse.ArgumentParser()
- parser.add_argument("-k", "--key-file", required=True,
- help="A file with the clusterfuzz api key.")
- parser.add_argument("-r", "--results-file",
- help="A file to write the results to.")
- options = parser.parse_args()
-
- # Get api key. The key's content must never be logged.
- assert options.key_file
- with open(options.key_file) as f:
- key = f.read().strip()
- assert key
-
- revision_number = GetLatestV8InChromium()
-
- results = []
- for spec in BUG_SPECS:
- args = dict(spec["args"])
- # Use incremented revision as we're interested in all revision greater than
- # what's currently rolled into chromium.
- if revision_number:
- args["revision_greater_or_equal"] = str(int(revision_number) + 1)
-
- # Never print issue details in public logs.
- issues = APIRequest(key, **args)
- assert issues is not None
- for issue in issues:
- if re.match(spec["crash_state"], issue["crash_state"]):
- results.append(issue["id"])
-
- if options.results_file:
- with open(options.results_file, "w") as f:
- f.write(json.dumps(results))
- else:
- print results
-
-
-if __name__ == "__main__":
- sys.exit(Main())

Powered by Google App Engine
This is Rietveld 408576698