| Index: tools/testrunner/local/utils.py
|
| diff --git a/tools/utils.py b/tools/testrunner/local/utils.py
|
| similarity index 64%
|
| copy from tools/utils.py
|
| copy to tools/testrunner/local/utils.py
|
| index 232314cdee10769ee0e2b7b274150245e5776f51..b7caa121f3a603cc8a65d321546af9b2420905a4 100644
|
| --- a/tools/utils.py
|
| +++ b/tools/testrunner/local/utils.py
|
| @@ -1,4 +1,4 @@
|
| -# Copyright 2008 the V8 project authors. All rights reserved.
|
| +# Copyright 2012 the V8 project authors. All rights reserved.
|
| # Redistribution and use in source and binary forms, with or without
|
| # modification, are permitted provided that the following conditions are
|
| # met:
|
| @@ -26,62 +26,72 @@
|
| # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
|
|
|
| +import os
|
| +from os.path import exists
|
| +from os.path import isdir
|
| +from os.path import join
|
| import platform
|
| import re
|
|
|
|
|
| -# Reads a .list file into an array of strings
|
| +def GetSuitePaths(test_root):
|
| + def IsSuite(path):
|
| + return isdir(path) and exists(join(path, 'testcfg.py'))
|
| + return [ f for f in os.listdir(test_root) if IsSuite(join(test_root, f)) ]
|
| +
|
| +
|
| +# Reads a file into an array of strings
|
| def ReadLinesFrom(name):
|
| - list = []
|
| - for line in open(name):
|
| - if '#' in line:
|
| - line = line[:line.find('#')]
|
| - line = line.strip()
|
| - if len(line) == 0:
|
| - continue
|
| - list.append(line)
|
| - return list
|
| + lines = []
|
| + with open(name) as f:
|
| + for line in f:
|
| + if line.startswith('#'): continue
|
| + if '#' in line:
|
| + line = line[:line.find('#')]
|
| + line = line.strip()
|
| + if not line: continue
|
| + lines.append(line)
|
| + return lines
|
|
|
|
|
| def GuessOS():
|
| - id = platform.system()
|
| - if id == 'Linux':
|
| + system = platform.system()
|
| + if system == 'Linux':
|
| return 'linux'
|
| - elif id == 'Darwin':
|
| + elif system == 'Darwin':
|
| return 'macos'
|
| - elif id.find('CYGWIN') >= 0:
|
| + elif system.find('CYGWIN') >= 0:
|
| return 'cygwin'
|
| - elif id == 'Windows' or id == 'Microsoft':
|
| + elif system == 'Windows' or system == 'Microsoft':
|
| # On Windows Vista platform.system() can return 'Microsoft' with some
|
| # versions of Python, see http://bugs.python.org/issue1082
|
| return 'win32'
|
| - elif id == 'FreeBSD':
|
| + elif system == 'FreeBSD':
|
| return 'freebsd'
|
| - elif id == 'OpenBSD':
|
| + elif system == 'OpenBSD':
|
| return 'openbsd'
|
| - elif id == 'SunOS':
|
| + elif system == 'SunOS':
|
| return 'solaris'
|
| - elif id == 'NetBSD':
|
| + elif system == 'NetBSD':
|
| return 'netbsd'
|
| else:
|
| return None
|
|
|
|
|
| -# This will default to building the 32 bit VM even on machines that are capable
|
| -# of running the 64 bit VM. Use the scons option --arch=x64 to force it to build
|
| -# the 64 bit VM.
|
| -def GuessArchitecture():
|
| - id = platform.machine()
|
| - id = id.lower() # Windows 7 capitalizes 'AMD64'.
|
| - if id.startswith('arm'):
|
| +# This will default to building the 32 bit VM even on machines that are
|
| +# capable of running the 64 bit VM.
|
| +def DefaultArch():
|
| + machine = platform.machine()
|
| + machine = machine.lower() # Windows 7 capitalizes 'AMD64'.
|
| + if machine.startswith('arm'):
|
| return 'arm'
|
| - elif (not id) or (not re.match('(x|i[3-6])86$', id) is None):
|
| + elif (not machine) or (not re.match('(x|i[3-6])86$', machine) is None):
|
| return 'ia32'
|
| - elif id == 'i86pc':
|
| + elif machine == 'i86pc':
|
| return 'ia32'
|
| - elif id == 'x86_64':
|
| + elif machine == 'x86_64':
|
| return 'ia32'
|
| - elif id == 'amd64':
|
| + elif machine == 'amd64':
|
| return 'ia32'
|
| else:
|
| return None
|
|
|