OLD | NEW |
1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
2 # Copyright 2013 the V8 project authors. All rights reserved. | 2 # Copyright 2013 the V8 project authors. All rights reserved. |
3 # Redistribution and use in source and binary forms, with or without | 3 # Redistribution and use in source and binary forms, with or without |
4 # modification, are permitted provided that the following conditions are | 4 # modification, are permitted provided that the following conditions are |
5 # met: | 5 # met: |
6 # | 6 # |
7 # * Redistributions of source code must retain the above copyright | 7 # * Redistributions of source code must retain the above copyright |
8 # notice, this list of conditions and the following disclaimer. | 8 # notice, this list of conditions and the following disclaimer. |
9 # * Redistributions in binary form must reproduce the above | 9 # * Redistributions in binary form must reproduce the above |
10 # copyright notice, this list of conditions and the following | 10 # copyright notice, this list of conditions and the following |
(...skipping 10 matching lines...) Expand all Loading... |
21 # OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | 21 # OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
22 # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | 22 # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
23 # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | 23 # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
24 # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | 24 # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
25 # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 25 # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
26 # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 26 # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
27 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 27 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
28 | 28 |
29 import argparse | 29 import argparse |
30 import datetime | 30 import datetime |
| 31 import httplib |
31 import imp | 32 import imp |
32 import json | 33 import json |
33 import os | 34 import os |
34 import re | 35 import re |
35 import subprocess | 36 import subprocess |
36 import sys | 37 import sys |
37 import textwrap | 38 import textwrap |
38 import time | 39 import time |
39 import urllib2 | 40 import urllib2 |
40 | 41 |
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
200 return sys.stdin.readline().strip() | 201 return sys.stdin.readline().strip() |
201 | 202 |
202 def ReadURL(self, url, params=None): | 203 def ReadURL(self, url, params=None): |
203 # pylint: disable=E1121 | 204 # pylint: disable=E1121 |
204 url_fh = urllib2.urlopen(url, params, 60) | 205 url_fh = urllib2.urlopen(url, params, 60) |
205 try: | 206 try: |
206 return url_fh.read() | 207 return url_fh.read() |
207 finally: | 208 finally: |
208 url_fh.close() | 209 url_fh.close() |
209 | 210 |
| 211 def ReadClusterFuzzAPI(self, api_key, **params): |
| 212 params["api_key"] = api_key |
| 213 params = urllib.urlencode(params) |
| 214 |
| 215 headers = {"Content-type": "application/x-www-form-urlencoded"} |
| 216 |
| 217 conn = httplib.HTTPSConnection("backend-dot-cluster-fuzz.appspot.com") |
| 218 conn.request("POST", "/_api/", params, headers) |
| 219 |
| 220 response = conn.getresponse() |
| 221 data = response.read() |
| 222 |
| 223 try: |
| 224 return json.loads(data) |
| 225 except: |
| 226 print data |
| 227 print "ERROR: Could not read response. Is your key valid?" |
| 228 raise |
| 229 |
210 def Sleep(self, seconds): | 230 def Sleep(self, seconds): |
211 time.sleep(seconds) | 231 time.sleep(seconds) |
212 | 232 |
213 def GetDate(self): | 233 def GetDate(self): |
214 return datetime.date.today().strftime("%Y-%m-%d") | 234 return datetime.date.today().strftime("%Y-%m-%d") |
215 | 235 |
216 DEFAULT_SIDE_EFFECT_HANDLER = SideEffectHandler() | 236 DEFAULT_SIDE_EFFECT_HANDLER = SideEffectHandler() |
217 | 237 |
218 | 238 |
219 class NoRetryException(Exception): | 239 class NoRetryException(Exception): |
(...skipping 377 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
597 for (number, step_class) in enumerate(step_classes): | 617 for (number, step_class) in enumerate(step_classes): |
598 steps.append(MakeStep(step_class, number, self._state, self._config, | 618 steps.append(MakeStep(step_class, number, self._state, self._config, |
599 options, self._side_effect_handler)) | 619 options, self._side_effect_handler)) |
600 for step in steps[options.step:]: | 620 for step in steps[options.step:]: |
601 if step.Run(): | 621 if step.Run(): |
602 return 1 | 622 return 1 |
603 return 0 | 623 return 0 |
604 | 624 |
605 def Run(self, args=None): | 625 def Run(self, args=None): |
606 return self.RunSteps(self._Steps(), args) | 626 return self.RunSteps(self._Steps(), args) |
OLD | NEW |