| OLD | NEW |
| 1 # Copyright 2012 the V8 project authors. All rights reserved. | 1 # Copyright 2012 the V8 project authors. All rights reserved. |
| 2 # Redistribution and use in source and binary forms, with or without | 2 # Redistribution and use in source and binary forms, with or without |
| 3 # modification, are permitted provided that the following conditions are | 3 # modification, are permitted provided that the following conditions are |
| 4 # met: | 4 # met: |
| 5 # | 5 # |
| 6 # * Redistributions of source code must retain the above copyright | 6 # * Redistributions of source code must retain the above copyright |
| 7 # notice, this list of conditions and the following disclaimer. | 7 # notice, this list of conditions and the following disclaimer. |
| 8 # * Redistributions in binary form must reproduce the above | 8 # * Redistributions in binary form must reproduce the above |
| 9 # copyright notice, this list of conditions and the following | 9 # copyright notice, this list of conditions and the following |
| 10 # disclaimer in the documentation and/or other materials provided | 10 # disclaimer in the documentation and/or other materials provided |
| (...skipping 13 matching lines...) Expand all Loading... |
| 24 # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 24 # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 25 # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 25 # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 26 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 26 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 27 | 27 |
| 28 | 28 |
| 29 import os | 29 import os |
| 30 from os.path import exists | 30 from os.path import exists |
| 31 from os.path import isdir | 31 from os.path import isdir |
| 32 from os.path import join | 32 from os.path import join |
| 33 import platform | 33 import platform |
| 34 import random |
| 34 import re | 35 import re |
| 35 import subprocess | 36 import subprocess |
| 36 import urllib2 | 37 import urllib2 |
| 37 | 38 |
| 38 | 39 |
| 39 def GetSuitePaths(test_root): | 40 def GetSuitePaths(test_root): |
| 40 return [ f for f in os.listdir(test_root) if isdir(join(test_root, f)) ] | 41 return [ f for f in os.listdir(test_root) if isdir(join(test_root, f)) ] |
| 41 | 42 |
| 42 | 43 |
| 44 def RandomSeed(): |
| 45 seed = 0 |
| 46 while not seed: |
| 47 seed = random.SystemRandom().randint(-2147483648, 2147483647) |
| 48 return seed |
| 49 |
| 50 |
| 43 # Reads a file into an array of strings | 51 # Reads a file into an array of strings |
| 44 def ReadLinesFrom(name): | 52 def ReadLinesFrom(name): |
| 45 lines = [] | 53 lines = [] |
| 46 with open(name) as f: | 54 with open(name) as f: |
| 47 for line in f: | 55 for line in f: |
| 48 if line.startswith('#'): continue | 56 if line.startswith('#'): continue |
| 49 if '#' in line: | 57 if '#' in line: |
| 50 line = line[:line.find('#')] | 58 line = line[:line.find('#')] |
| 51 line = line.strip() | 59 line = line.strip() |
| 52 if not line: continue | 60 if not line: continue |
| (...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 150 if isinstance(obj, dict): | 158 if isinstance(obj, dict): |
| 151 return FrozenDict((k, Freeze(v)) for k, v in obj.iteritems()) | 159 return FrozenDict((k, Freeze(v)) for k, v in obj.iteritems()) |
| 152 elif isinstance(obj, set): | 160 elif isinstance(obj, set): |
| 153 return frozenset(obj) | 161 return frozenset(obj) |
| 154 elif isinstance(obj, list): | 162 elif isinstance(obj, list): |
| 155 return tuple(Freeze(item) for item in obj) | 163 return tuple(Freeze(item) for item in obj) |
| 156 else: | 164 else: |
| 157 # Make sure object is hashable. | 165 # Make sure object is hashable. |
| 158 hash(obj) | 166 hash(obj) |
| 159 return obj | 167 return obj |
| OLD | NEW |