Chromium Code Reviews| 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 18 matching lines...) Expand all Loading... | |
| 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 re | 34 import re |
| 35 import subprocess | 35 import subprocess |
| 36 import urllib2 | 36 import urllib2 |
| 37 | 37 |
| 38 | 38 |
| 39 ARCHS_WITH_SIMULATOR = [ | |
| 40 "arm", | |
| 41 "arm64", | |
| 42 "mipsel", | |
| 43 "mips64el", | |
| 44 "ppc", | |
| 45 "ppc64", | |
| 46 "s390", | |
| 47 "s390x", | |
| 48 "x87", | |
| 49 ] | |
| 50 | |
| 39 def GetSuitePaths(test_root): | 51 def GetSuitePaths(test_root): |
| 40 return [ f for f in os.listdir(test_root) if isdir(join(test_root, f)) ] | 52 return [ f for f in os.listdir(test_root) if isdir(join(test_root, f)) ] |
| 41 | 53 |
| 42 | 54 |
| 43 # Reads a file into an array of strings | 55 # Reads a file into an array of strings |
| 44 def ReadLinesFrom(name): | 56 def ReadLinesFrom(name): |
| 45 lines = [] | 57 lines = [] |
| 46 with open(name) as f: | 58 with open(name) as f: |
| 47 for line in f: | 59 for line in f: |
| 48 if line.startswith('#'): continue | 60 if line.startswith('#'): continue |
| (...skipping 27 matching lines...) Expand all Loading... | |
| 76 return 'netbsd' | 88 return 'netbsd' |
| 77 elif system == 'AIX': | 89 elif system == 'AIX': |
| 78 return 'aix' | 90 return 'aix' |
| 79 else: | 91 else: |
| 80 return None | 92 return None |
| 81 | 93 |
| 82 | 94 |
| 83 def UseSimulator(arch): | 95 def UseSimulator(arch): |
| 84 machine = platform.machine() | 96 machine = platform.machine() |
| 85 return (machine and | 97 return (machine and |
| 86 (arch == "mipsel" or arch == "arm" or arch == "arm64") and | 98 arch in ARCHS_WITH_SIMULATOR and |
| 87 not arch.startswith(machine)) | 99 not arch.startswith(machine)) |
|
Michael Achenbach
2016/04/08 14:09:22
I have no idea if arch.startswith(machine) == True
| |
| 88 | 100 |
| 89 | 101 |
| 90 # This will default to building the 32 bit VM even on machines that are | 102 # This will default to building the 32 bit VM even on machines that are |
| 91 # capable of running the 64 bit VM. | 103 # capable of running the 64 bit VM. |
| 92 def DefaultArch(): | 104 def DefaultArch(): |
| 93 machine = platform.machine() | 105 machine = platform.machine() |
| 94 machine = machine.lower() # Windows 7 capitalizes 'AMD64'. | 106 machine = machine.lower() # Windows 7 capitalizes 'AMD64'. |
| 95 if machine.startswith('arm'): | 107 if machine.startswith('arm'): |
| 96 return 'arm' | 108 return 'arm' |
| 97 elif (not machine) or (not re.match('(x|i[3-6])86$', machine) is None): | 109 elif (not machine) or (not re.match('(x|i[3-6])86$', machine) is None): |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 129 # In python 2.7.6 on windows, urlopen has a problem with redirects. | 141 # In python 2.7.6 on windows, urlopen has a problem with redirects. |
| 130 # Try using curl instead. Note, this is fixed in 2.7.8. | 142 # Try using curl instead. Note, this is fixed in 2.7.8. |
| 131 subprocess.check_call(["curl", source, '-k', '-L', '-o', destination]) | 143 subprocess.check_call(["curl", source, '-k', '-L', '-o', destination]) |
| 132 return | 144 return |
| 133 except: | 145 except: |
| 134 # If there's no curl, fall back to urlopen. | 146 # If there's no curl, fall back to urlopen. |
| 135 print "Curl is currently not installed. Falling back to python." | 147 print "Curl is currently not installed. Falling back to python." |
| 136 pass | 148 pass |
| 137 with open(destination, 'w') as f: | 149 with open(destination, 'w') as f: |
| 138 f.write(urllib2.urlopen(source).read()) | 150 f.write(urllib2.urlopen(source).read()) |
| OLD | NEW |