Change the test status file parser to fail if the line contains unparsed tokens.
Refactor the platform.system() tests and use macos when running on Mac. Review URL: http://codereview.chromium.org/8763 git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@672 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
This commit is contained in:
parent
67ae89e417
commit
84170eeb99
23
SConstruct
23
SConstruct
@ -238,25 +238,6 @@ def Abort(message):
|
|||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
|
|
||||||
def GuessOS():
|
|
||||||
id = platform.system()
|
|
||||||
if id == 'Linux':
|
|
||||||
return 'linux'
|
|
||||||
elif id == 'Darwin':
|
|
||||||
return 'macos'
|
|
||||||
elif id == 'Windows':
|
|
||||||
return 'win32'
|
|
||||||
else:
|
|
||||||
return None
|
|
||||||
|
|
||||||
|
|
||||||
def GuessWordsize():
|
|
||||||
if '64' in platform.machine():
|
|
||||||
return '64'
|
|
||||||
else:
|
|
||||||
return '32'
|
|
||||||
|
|
||||||
|
|
||||||
def GuessToolchain(os):
|
def GuessToolchain(os):
|
||||||
tools = Environment()['TOOLS']
|
tools = Environment()['TOOLS']
|
||||||
if 'gcc' in tools:
|
if 'gcc' in tools:
|
||||||
@ -267,10 +248,10 @@ def GuessToolchain(os):
|
|||||||
return None
|
return None
|
||||||
|
|
||||||
|
|
||||||
OS_GUESS = GuessOS()
|
OS_GUESS = utils.GuessOS()
|
||||||
TOOLCHAIN_GUESS = GuessToolchain(OS_GUESS)
|
TOOLCHAIN_GUESS = GuessToolchain(OS_GUESS)
|
||||||
ARCH_GUESS = utils.GuessArchitecture()
|
ARCH_GUESS = utils.GuessArchitecture()
|
||||||
WORDSIZE_GUESS = GuessWordsize()
|
WORDSIZE_GUESS = utils.GuessWordsize()
|
||||||
|
|
||||||
|
|
||||||
SIMPLE_OPTIONS = {
|
SIMPLE_OPTIONS = {
|
||||||
|
@ -29,7 +29,7 @@ import test
|
|||||||
import os
|
import os
|
||||||
from os.path import join, dirname, exists
|
from os.path import join, dirname, exists
|
||||||
import platform
|
import platform
|
||||||
|
import utils
|
||||||
|
|
||||||
DEBUG_FLAGS = ['--enable-slow-asserts', '--debug-code', '--verify-heap']
|
DEBUG_FLAGS = ['--enable-slow-asserts', '--debug-code', '--verify-heap']
|
||||||
|
|
||||||
@ -65,7 +65,7 @@ class CcTestConfiguration(test.TestConfiguration):
|
|||||||
|
|
||||||
def ListTests(self, current_path, path, mode):
|
def ListTests(self, current_path, path, mode):
|
||||||
executable = join('obj', 'test', mode, 'cctest')
|
executable = join('obj', 'test', mode, 'cctest')
|
||||||
if (platform.system() == 'Windows'):
|
if utils.IsWindows():
|
||||||
executable += '.exe'
|
executable += '.exe'
|
||||||
output = test.Execute([executable, '--list'], self.context)
|
output = test.Execute([executable, '--list'], self.context)
|
||||||
if output.exit_code != 0:
|
if output.exit_code != 0:
|
||||||
|
@ -370,7 +370,7 @@ class TestOutput(object):
|
|||||||
return not outcome in self.test.outcomes
|
return not outcome in self.test.outcomes
|
||||||
|
|
||||||
def HasCrashed(self):
|
def HasCrashed(self):
|
||||||
if platform.system() == 'Windows':
|
if utils.IsWindows():
|
||||||
return 0x80000000 & self.output.exit_code and not (0x3FFFFF00 & self.output.exit_code)
|
return 0x80000000 & self.output.exit_code and not (0x3FFFFF00 & self.output.exit_code)
|
||||||
else:
|
else:
|
||||||
# Timed out tests will have exit_code -signal.SIGTERM.
|
# Timed out tests will have exit_code -signal.SIGTERM.
|
||||||
@ -388,7 +388,7 @@ class TestOutput(object):
|
|||||||
|
|
||||||
|
|
||||||
def KillProcessWithID(pid):
|
def KillProcessWithID(pid):
|
||||||
if platform.system() == 'Windows':
|
if utils.IsWindows():
|
||||||
os.popen('taskkill /T /F /PID %d' % pid)
|
os.popen('taskkill /T /F /PID %d' % pid)
|
||||||
else:
|
else:
|
||||||
os.kill(pid, signal.SIGTERM)
|
os.kill(pid, signal.SIGTERM)
|
||||||
@ -414,17 +414,17 @@ def RunProcess(context, timeout, args, **rest):
|
|||||||
if context.verbose: print "#", " ".join(args)
|
if context.verbose: print "#", " ".join(args)
|
||||||
popen_args = args
|
popen_args = args
|
||||||
prev_error_mode = SEM_INVALID_VALUE;
|
prev_error_mode = SEM_INVALID_VALUE;
|
||||||
if platform.system() == 'Windows':
|
if utils.IsWindows():
|
||||||
popen_args = '"' + subprocess.list2cmdline(args) + '"'
|
popen_args = '"' + subprocess.list2cmdline(args) + '"'
|
||||||
if context.suppress_dialogs:
|
if context.suppress_dialogs:
|
||||||
# Try to change the error mode to avoid dialogs on fatal errors.
|
# Try to change the error mode to avoid dialogs on fatal errors.
|
||||||
Win32SetErrorMode(SEM_NOGPFAULTERRORBOX)
|
Win32SetErrorMode(SEM_NOGPFAULTERRORBOX)
|
||||||
process = subprocess.Popen(
|
process = subprocess.Popen(
|
||||||
shell = (platform.system() == 'Windows'),
|
shell = utils.IsWindows(),
|
||||||
args = popen_args,
|
args = popen_args,
|
||||||
**rest
|
**rest
|
||||||
)
|
)
|
||||||
if platform.system() == 'Windows' and context.suppress_dialogs and prev_error_mode != SEM_INVALID_VALUE:
|
if utils.IsWindows() and context.suppress_dialogs and prev_error_mode != SEM_INVALID_VALUE:
|
||||||
Win32SetErrorMode(prev_error_mode)
|
Win32SetErrorMode(prev_error_mode)
|
||||||
# Compute the end time - if the process crosses this limit we
|
# Compute the end time - if the process crosses this limit we
|
||||||
# consider it timed out.
|
# consider it timed out.
|
||||||
@ -600,7 +600,7 @@ class Context(object):
|
|||||||
|
|
||||||
def GetVm(self, mode):
|
def GetVm(self, mode):
|
||||||
name = self.vm_root + PREFIX[mode]
|
name = self.vm_root + PREFIX[mode]
|
||||||
if platform.system() == 'Windows':
|
if utils.IsWindows():
|
||||||
return name + '.exe'
|
return name + '.exe'
|
||||||
else:
|
else:
|
||||||
return name
|
return name
|
||||||
@ -920,6 +920,9 @@ def ParseCondition(expr):
|
|||||||
if not ast:
|
if not ast:
|
||||||
print "Malformed expression: '%s'" % expr
|
print "Malformed expression: '%s'" % expr
|
||||||
return None
|
return None
|
||||||
|
if scan.HasMore():
|
||||||
|
print "Malformed expression: '%s'" % expr
|
||||||
|
return None
|
||||||
return ast
|
return ast
|
||||||
|
|
||||||
|
|
||||||
@ -1238,7 +1241,7 @@ def Main():
|
|||||||
for mode in options.mode:
|
for mode in options.mode:
|
||||||
env = {
|
env = {
|
||||||
'mode': mode,
|
'mode': mode,
|
||||||
'system': platform.system().lower(),
|
'system': utils.GuessOS(),
|
||||||
'arch': options.arch
|
'arch': options.arch
|
||||||
}
|
}
|
||||||
test_list = root.ListTests([], path, context, mode)
|
test_list = root.ListTests([], path, context, mode)
|
||||||
|
@ -43,6 +43,20 @@ def ReadLinesFrom(name):
|
|||||||
return list
|
return list
|
||||||
|
|
||||||
|
|
||||||
|
def GuessOS():
|
||||||
|
id = platform.system()
|
||||||
|
if id == 'Linux':
|
||||||
|
return 'linux'
|
||||||
|
elif id == 'Darwin':
|
||||||
|
return 'macos'
|
||||||
|
elif id == 'Windows' or id == 'Microsoft':
|
||||||
|
# On Windows Vista platform.system() can return 'Microsoft' with some
|
||||||
|
# versions of Python, see http://bugs.python.org/issue1082
|
||||||
|
return 'win32'
|
||||||
|
else:
|
||||||
|
return None
|
||||||
|
|
||||||
|
|
||||||
def GuessArchitecture():
|
def GuessArchitecture():
|
||||||
id = platform.machine()
|
id = platform.machine()
|
||||||
if id.startswith('arm'):
|
if id.startswith('arm'):
|
||||||
@ -51,3 +65,14 @@ def GuessArchitecture():
|
|||||||
return 'ia32'
|
return 'ia32'
|
||||||
else:
|
else:
|
||||||
return None
|
return None
|
||||||
|
|
||||||
|
|
||||||
|
def GuessWordsize():
|
||||||
|
if '64' in platform.machine():
|
||||||
|
return '64'
|
||||||
|
else:
|
||||||
|
return '32'
|
||||||
|
|
||||||
|
|
||||||
|
def IsWindows():
|
||||||
|
return GuessOS() == 'win32'
|
||||||
|
Loading…
Reference in New Issue
Block a user