diff options
Diffstat (limited to 'src/3rdparty/v8/tools/testrunner/local')
-rw-r--r-- | src/3rdparty/v8/tools/testrunner/local/__init__.py | 26 | ||||
-rw-r--r-- | src/3rdparty/v8/tools/testrunner/local/commands.py | 153 | ||||
-rw-r--r-- | src/3rdparty/v8/tools/testrunner/local/execution.py | 182 | ||||
-rw-r--r-- | src/3rdparty/v8/tools/testrunner/local/old_statusfile.py | 460 | ||||
-rw-r--r-- | src/3rdparty/v8/tools/testrunner/local/progress.py | 238 | ||||
-rw-r--r-- | src/3rdparty/v8/tools/testrunner/local/statusfile.py | 145 | ||||
-rw-r--r-- | src/3rdparty/v8/tools/testrunner/local/testsuite.py | 187 | ||||
-rw-r--r-- | src/3rdparty/v8/tools/testrunner/local/utils.py | 108 | ||||
-rw-r--r-- | src/3rdparty/v8/tools/testrunner/local/verbose.py | 99 |
9 files changed, 0 insertions, 1598 deletions
diff --git a/src/3rdparty/v8/tools/testrunner/local/__init__.py b/src/3rdparty/v8/tools/testrunner/local/__init__.py deleted file mode 100644 index 202a262..0000000 --- a/src/3rdparty/v8/tools/testrunner/local/__init__.py +++ /dev/null @@ -1,26 +0,0 @@ -# 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: -# -# * Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. -# * Redistributions in binary form must reproduce the above -# copyright notice, this list of conditions and the following -# disclaimer in the documentation and/or other materials provided -# with the distribution. -# * Neither the name of Google Inc. nor the names of its -# contributors may be used to endorse or promote products derived -# from this software without specific prior written permission. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/src/3rdparty/v8/tools/testrunner/local/commands.py b/src/3rdparty/v8/tools/testrunner/local/commands.py deleted file mode 100644 index 01f170d..0000000 --- a/src/3rdparty/v8/tools/testrunner/local/commands.py +++ /dev/null @@ -1,153 +0,0 @@ -# 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: -# -# * Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. -# * Redistributions in binary form must reproduce the above -# copyright notice, this list of conditions and the following -# disclaimer in the documentation and/or other materials provided -# with the distribution. -# * Neither the name of Google Inc. nor the names of its -# contributors may be used to endorse or promote products derived -# from this software without specific prior written permission. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - - -import os -import signal -import subprocess -import sys -import tempfile -import time - -from ..local import utils -from ..objects import output - - -def KillProcessWithID(pid): - if utils.IsWindows(): - os.popen('taskkill /T /F /PID %d' % pid) - else: - os.kill(pid, signal.SIGTERM) - - -MAX_SLEEP_TIME = 0.1 -INITIAL_SLEEP_TIME = 0.0001 -SLEEP_TIME_FACTOR = 1.25 - -SEM_INVALID_VALUE = -1 -SEM_NOGPFAULTERRORBOX = 0x0002 # Microsoft Platform SDK WinBase.h - - -def Win32SetErrorMode(mode): - prev_error_mode = SEM_INVALID_VALUE - try: - import ctypes - prev_error_mode = \ - ctypes.windll.kernel32.SetErrorMode(mode) #@UndefinedVariable - except ImportError: - pass - return prev_error_mode - - -def RunProcess(verbose, timeout, args, **rest): - if verbose: print "#", " ".join(args) - popen_args = args - prev_error_mode = SEM_INVALID_VALUE - if utils.IsWindows(): - popen_args = subprocess.list2cmdline(args) - # Try to change the error mode to avoid dialogs on fatal errors. Don't - # touch any existing error mode flags by merging the existing error mode. - # See http://blogs.msdn.com/oldnewthing/archive/2004/07/27/198410.aspx. - error_mode = SEM_NOGPFAULTERRORBOX - prev_error_mode = Win32SetErrorMode(error_mode) - Win32SetErrorMode(error_mode | prev_error_mode) - process = subprocess.Popen( - shell=utils.IsWindows(), - args=popen_args, - **rest - ) - if (utils.IsWindows() and prev_error_mode != SEM_INVALID_VALUE): - Win32SetErrorMode(prev_error_mode) - # Compute the end time - if the process crosses this limit we - # consider it timed out. - if timeout is None: end_time = None - else: end_time = time.time() + timeout - timed_out = False - # Repeatedly check the exit code from the process in a - # loop and keep track of whether or not it times out. - exit_code = None - sleep_time = INITIAL_SLEEP_TIME - try: - while exit_code is None: - if (not end_time is None) and (time.time() >= end_time): - # Kill the process and wait for it to exit. - KillProcessWithID(process.pid) - exit_code = process.wait() - timed_out = True - else: - exit_code = process.poll() - time.sleep(sleep_time) - sleep_time = sleep_time * SLEEP_TIME_FACTOR - if sleep_time > MAX_SLEEP_TIME: - sleep_time = MAX_SLEEP_TIME - return (exit_code, timed_out) - except KeyboardInterrupt: - raise - - -def PrintError(string): - sys.stderr.write(string) - sys.stderr.write("\n") - - -def CheckedUnlink(name): - # On Windows, when run with -jN in parallel processes, - # OS often fails to unlink the temp file. Not sure why. - # Need to retry. - # Idea from https://bugs.webkit.org/attachment.cgi?id=75982&action=prettypatch - retry_count = 0 - while retry_count < 30: - try: - os.unlink(name) - return - except OSError, e: - retry_count += 1 - time.sleep(retry_count * 0.1) - PrintError("os.unlink() " + str(e)) - - -def Execute(args, verbose=False, timeout=None): - args = [ c for c in args if c != "" ] - (fd_out, outname) = tempfile.mkstemp() - (fd_err, errname) = tempfile.mkstemp() - try: - (exit_code, timed_out) = RunProcess( - verbose, - timeout, - args=args, - stdout=fd_out, - stderr=fd_err - ) - except: - raise - os.close(fd_out) - os.close(fd_err) - out = file(outname).read() - errors = file(errname).read() - CheckedUnlink(outname) - CheckedUnlink(errname) - return output.Output(exit_code, timed_out, out, errors) diff --git a/src/3rdparty/v8/tools/testrunner/local/execution.py b/src/3rdparty/v8/tools/testrunner/local/execution.py deleted file mode 100644 index 0f52616..0000000 --- a/src/3rdparty/v8/tools/testrunner/local/execution.py +++ /dev/null @@ -1,182 +0,0 @@ -# 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: -# -# * Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. -# * Redistributions in binary form must reproduce the above -# copyright notice, this list of conditions and the following -# disclaimer in the documentation and/or other materials provided -# with the distribution. -# * Neither the name of Google Inc. nor the names of its -# contributors may be used to endorse or promote products derived -# from this software without specific prior written permission. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - - -import multiprocessing -import os -import threading -import time - -from . import commands -from . import utils - - -BREAK_NOW = -1 -EXCEPTION = -2 - - -class Job(object): - def __init__(self, command, dep_command, test_id, timeout, verbose): - self.command = command - self.dep_command = dep_command - self.id = test_id - self.timeout = timeout - self.verbose = verbose - - -def RunTest(job): - try: - start_time = time.time() - if job.dep_command is not None: - dep_output = commands.Execute(job.dep_command, job.verbose, job.timeout) - # TODO(jkummerow): We approximate the test suite specific function - # IsFailureOutput() by just checking the exit code here. Currently - # only cctests define dependencies, for which this simplification is - # correct. - if dep_output.exit_code != 0: - return (job.id, dep_output, time.time() - start_time) - output = commands.Execute(job.command, job.verbose, job.timeout) - return (job.id, output, time.time() - start_time) - except KeyboardInterrupt: - return (-1, BREAK_NOW, 0) - except Exception, e: - print(">>> EXCEPTION: %s" % e) - return (-1, EXCEPTION, 0) - - -class Runner(object): - - def __init__(self, suites, progress_indicator, context): - self.tests = [ t for s in suites for t in s.tests ] - self._CommonInit(len(self.tests), progress_indicator, context) - - def _CommonInit(self, num_tests, progress_indicator, context): - self.indicator = progress_indicator - progress_indicator.runner = self - self.context = context - self.succeeded = 0 - self.total = num_tests - self.remaining = num_tests - self.failed = [] - self.crashed = 0 - self.terminate = False - self.lock = threading.Lock() - - def Run(self, jobs): - self.indicator.Starting() - self._RunInternal(jobs) - self.indicator.Done() - if self.failed or self.remaining: - return 1 - return 0 - - def _RunInternal(self, jobs): - pool = multiprocessing.Pool(processes=jobs) - test_map = {} - queue = [] - queued_exception = None - for test in self.tests: - assert test.id >= 0 - test_map[test.id] = test - try: - command = self.GetCommand(test) - except Exception, e: - # If this failed, save the exception and re-raise it later (after - # all other tests have had a chance to run). - queued_exception = e - continue - timeout = self.context.timeout - if ("--stress-opt" in test.flags or - "--stress-opt" in self.context.mode_flags or - "--stress-opt" in self.context.extra_flags): - timeout *= 4 - if test.dependency is not None: - dep_command = [ c.replace(test.path, test.dependency) for c in command ] - else: - dep_command = None - job = Job(command, dep_command, test.id, timeout, self.context.verbose) - queue.append(job) - try: - kChunkSize = 1 - it = pool.imap_unordered(RunTest, queue, kChunkSize) - for result in it: - test_id = result[0] - if test_id < 0: - if result[1] == BREAK_NOW: - self.terminate = True - else: - continue - if self.terminate: - pool.terminate() - pool.join() - raise BreakNowException("User pressed Ctrl+C or IO went wrong") - test = test_map[test_id] - self.indicator.AboutToRun(test) - test.output = result[1] - test.duration = result[2] - if test.suite.HasUnexpectedOutput(test): - self.failed.append(test) - if test.output.HasCrashed(): - self.crashed += 1 - else: - self.succeeded += 1 - self.remaining -= 1 - self.indicator.HasRun(test) - except KeyboardInterrupt: - pool.terminate() - pool.join() - raise - except Exception, e: - print("Exception: %s" % e) - pool.terminate() - pool.join() - raise - if queued_exception: - raise queued_exception - return - - - def GetCommand(self, test): - d8testflag = [] - shell = test.suite.shell() - if shell == "d8": - d8testflag = ["--test"] - if utils.IsWindows(): - shell += ".exe" - cmd = (self.context.command_prefix + - [os.path.abspath(os.path.join(self.context.shell_dir, shell))] + - d8testflag + - test.suite.GetFlagsForTestCase(test, self.context) + - self.context.extra_flags) - return cmd - - -class BreakNowException(Exception): - def __init__(self, value): - self.value = value - def __str__(self): - return repr(self.value) diff --git a/src/3rdparty/v8/tools/testrunner/local/old_statusfile.py b/src/3rdparty/v8/tools/testrunner/local/old_statusfile.py deleted file mode 100644 index a16941b..0000000 --- a/src/3rdparty/v8/tools/testrunner/local/old_statusfile.py +++ /dev/null @@ -1,460 +0,0 @@ -# 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: -# -# * Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. -# * Redistributions in binary form must reproduce the above -# copyright notice, this list of conditions and the following -# disclaimer in the documentation and/or other materials provided -# with the distribution. -# * Neither the name of Google Inc. nor the names of its -# contributors may be used to endorse or promote products derived -# from this software without specific prior written permission. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - - -import cStringIO -import re - -# These outcomes can occur in a TestCase's outcomes list: -SKIP = 'SKIP' -FAIL = 'FAIL' -PASS = 'PASS' -OKAY = 'OKAY' -TIMEOUT = 'TIMEOUT' -CRASH = 'CRASH' -SLOW = 'SLOW' -# These are just for the status files and are mapped below in DEFS: -FAIL_OK = 'FAIL_OK' -PASS_OR_FAIL = 'PASS_OR_FAIL' - -KEYWORDS = {SKIP: SKIP, - FAIL: FAIL, - PASS: PASS, - OKAY: OKAY, - TIMEOUT: TIMEOUT, - CRASH: CRASH, - SLOW: SLOW, - FAIL_OK: FAIL_OK, - PASS_OR_FAIL: PASS_OR_FAIL} - -class Expression(object): - pass - - -class Constant(Expression): - - def __init__(self, value): - self.value = value - - def Evaluate(self, env, defs): - return self.value - - -class Variable(Expression): - - def __init__(self, name): - self.name = name - - def GetOutcomes(self, env, defs): - if self.name in env: return set([env[self.name]]) - else: return set([]) - - def Evaluate(self, env, defs): - return env[self.name] - - def __str__(self): - return self.name - - def string(self, logical): - return self.__str__() - - -class Outcome(Expression): - - def __init__(self, name): - self.name = name - - def GetOutcomes(self, env, defs): - if self.name in defs: - return defs[self.name].GetOutcomes(env, defs) - else: - return set([self.name]) - - def __str__(self): - if self.name in KEYWORDS: - return "%s" % KEYWORDS[self.name] - return "'%s'" % self.name - - def string(self, logical): - if logical: - return "%s" % self.name - return self.__str__() - - -class Operation(Expression): - - def __init__(self, left, op, right): - self.left = left - self.op = op - self.right = right - - def Evaluate(self, env, defs): - if self.op == '||' or self.op == ',': - return self.left.Evaluate(env, defs) or self.right.Evaluate(env, defs) - elif self.op == 'if': - return False - elif self.op == '==': - return not self.left.GetOutcomes(env, defs).isdisjoint(self.right.GetOutcomes(env, defs)) - elif self.op == '!=': - return self.left.GetOutcomes(env, defs).isdisjoint(self.right.GetOutcomes(env, defs)) - else: - assert self.op == '&&' - return self.left.Evaluate(env, defs) and self.right.Evaluate(env, defs) - - def GetOutcomes(self, env, defs): - if self.op == '||' or self.op == ',': - return self.left.GetOutcomes(env, defs) | self.right.GetOutcomes(env, defs) - elif self.op == 'if': - if self.right.Evaluate(env, defs): return self.left.GetOutcomes(env, defs) - else: return set([]) - else: - assert self.op == '&&' - return self.left.GetOutcomes(env, defs) & self.right.GetOutcomes(env, defs) - - def __str__(self): - return self.string(False) - - def string(self, logical=False): - if self.op == 'if': - return "['%s', %s]" % (self.right.string(True), self.left.string(logical)) - elif self.op == "||" or self.op == ",": - if logical: - return "%s or %s" % (self.left.string(True), self.right.string(True)) - else: - return "%s, %s" % (self.left, self.right) - elif self.op == "&&": - return "%s and %s" % (self.left.string(True), self.right.string(True)) - return "%s %s %s" % (self.left.string(logical), self.op, - self.right.string(logical)) - - -def IsAlpha(string): - for char in string: - if not (char.isalpha() or char.isdigit() or char == '_'): - return False - return True - - -class Tokenizer(object): - """A simple string tokenizer that chops expressions into variables, - parens and operators""" - - def __init__(self, expr): - self.index = 0 - self.expr = expr - self.length = len(expr) - self.tokens = None - - def Current(self, length=1): - if not self.HasMore(length): return "" - return self.expr[self.index:self.index + length] - - def HasMore(self, length=1): - return self.index < self.length + (length - 1) - - def Advance(self, count=1): - self.index = self.index + count - - def AddToken(self, token): - self.tokens.append(token) - - def SkipSpaces(self): - while self.HasMore() and self.Current().isspace(): - self.Advance() - - def Tokenize(self): - self.tokens = [ ] - while self.HasMore(): - self.SkipSpaces() - if not self.HasMore(): - return None - if self.Current() == '(': - self.AddToken('(') - self.Advance() - elif self.Current() == ')': - self.AddToken(')') - self.Advance() - elif self.Current() == '$': - self.AddToken('$') - self.Advance() - elif self.Current() == ',': - self.AddToken(',') - self.Advance() - elif IsAlpha(self.Current()): - buf = "" - while self.HasMore() and IsAlpha(self.Current()): - buf += self.Current() - self.Advance() - self.AddToken(buf) - elif self.Current(2) == '&&': - self.AddToken('&&') - self.Advance(2) - elif self.Current(2) == '||': - self.AddToken('||') - self.Advance(2) - elif self.Current(2) == '==': - self.AddToken('==') - self.Advance(2) - elif self.Current(2) == '!=': - self.AddToken('!=') - self.Advance(2) - else: - return None - return self.tokens - - -class Scanner(object): - """A simple scanner that can serve out tokens from a given list""" - - def __init__(self, tokens): - self.tokens = tokens - self.length = len(tokens) - self.index = 0 - - def HasMore(self): - return self.index < self.length - - def Current(self): - return self.tokens[self.index] - - def Advance(self): - self.index = self.index + 1 - - -def ParseAtomicExpression(scan): - if scan.Current() == "true": - scan.Advance() - return Constant(True) - elif scan.Current() == "false": - scan.Advance() - return Constant(False) - elif IsAlpha(scan.Current()): - name = scan.Current() - scan.Advance() - return Outcome(name) - elif scan.Current() == '$': - scan.Advance() - if not IsAlpha(scan.Current()): - return None - name = scan.Current() - scan.Advance() - return Variable(name.lower()) - elif scan.Current() == '(': - scan.Advance() - result = ParseLogicalExpression(scan) - if (not result) or (scan.Current() != ')'): - return None - scan.Advance() - return result - else: - return None - - -BINARIES = ['==', '!='] -def ParseOperatorExpression(scan): - left = ParseAtomicExpression(scan) - if not left: return None - while scan.HasMore() and (scan.Current() in BINARIES): - op = scan.Current() - scan.Advance() - right = ParseOperatorExpression(scan) - if not right: - return None - left = Operation(left, op, right) - return left - - -def ParseConditionalExpression(scan): - left = ParseOperatorExpression(scan) - if not left: return None - while scan.HasMore() and (scan.Current() == 'if'): - scan.Advance() - right = ParseOperatorExpression(scan) - if not right: - return None - left = Operation(left, 'if', right) - return left - - -LOGICALS = ["&&", "||", ","] -def ParseLogicalExpression(scan): - left = ParseConditionalExpression(scan) - if not left: return None - while scan.HasMore() and (scan.Current() in LOGICALS): - op = scan.Current() - scan.Advance() - right = ParseConditionalExpression(scan) - if not right: - return None - left = Operation(left, op, right) - return left - - -def ParseCondition(expr): - """Parses a logical expression into an Expression object""" - tokens = Tokenizer(expr).Tokenize() - if not tokens: - print "Malformed expression: '%s'" % expr - return None - scan = Scanner(tokens) - ast = ParseLogicalExpression(scan) - if not ast: - print "Malformed expression: '%s'" % expr - return None - if scan.HasMore(): - print "Malformed expression: '%s'" % expr - return None - return ast - - -class Section(object): - """A section of the configuration file. Sections are enabled or - disabled prior to running the tests, based on their conditions""" - - def __init__(self, condition): - self.condition = condition - self.rules = [ ] - - def AddRule(self, rule): - self.rules.append(rule) - - -class Rule(object): - """A single rule that specifies the expected outcome for a single - test.""" - - def __init__(self, raw_path, path, value): - self.raw_path = raw_path - self.path = path - self.value = value - - def GetOutcomes(self, env, defs): - return self.value.GetOutcomes(env, defs) - - def Contains(self, path): - if len(self.path) > len(path): - return False - for i in xrange(len(self.path)): - if not self.path[i].match(path[i]): - return False - return True - - -HEADER_PATTERN = re.compile(r'\[([^]]+)\]') -RULE_PATTERN = re.compile(r'\s*([^: ]*)\s*:(.*)') -DEF_PATTERN = re.compile(r'^def\s*(\w+)\s*=(.*)$') -PREFIX_PATTERN = re.compile(r'^\s*prefix\s+([\w\_\.\-\/]+)$') - - -class ConvertNotation(object): - def __init__(self, path): - self.path = path - self.indent = "" - self.comment = [] - self.init = False - self.section = False - self.out = cStringIO.StringIO() - - def OpenGlobal(self): - if self.init: return - self.WriteComment() - print >> self.out, "[" - self.init = True - - def CloseGlobal(self): - if not self.init: return - print >> self.out, "]" - self.init = False - - def OpenSection(self, condition="ALWAYS"): - if self.section: return - self.OpenGlobal() - if type(condition) != str: - condition = "'%s'" % condition.string(True) - print >> self.out, "%s[%s, {" % (self.indent, condition) - self.indent += " " * 2 - self.section = condition - - def CloseSection(self): - if not self.section: return - self.indent = self.indent[:-2] - print >> self.out, "%s}], # %s" % (self.indent, self.section) - self.section = False - - def WriteComment(self): - if not self.comment: return - for c in self.comment: - if len(c.strip()) == 0: - print >> self.out, "" - else: - print >> self.out, "%s%s" % (self.indent, c), - self.comment = [] - - def GetOutput(self): - with open(self.path) as f: - for line in f: - if line[0] == '#': - self.comment += [line] - continue - if len(line.strip()) == 0: - self.comment += [line] - continue - header_match = HEADER_PATTERN.match(line) - if header_match: - condition = ParseCondition(header_match.group(1).strip()) - self.CloseSection() - self.WriteComment() - self.OpenSection(condition) - continue - rule_match = RULE_PATTERN.match(line) - if rule_match: - self.OpenSection() - self.WriteComment() - path = rule_match.group(1).strip() - value_str = rule_match.group(2).strip() - comment = "" - if '#' in value_str: - pos = value_str.find('#') - comment = " %s" % value_str[pos:].strip() - value_str = value_str[:pos].strip() - value = ParseCondition(value_str) - print >> self.out, ("%s'%s': [%s],%s" % - (self.indent, path, value, comment)) - continue - def_match = DEF_PATTERN.match(line) - if def_match: - # Custom definitions are deprecated. - continue - prefix_match = PREFIX_PATTERN.match(line) - if prefix_match: - continue - print "Malformed line: '%s'." % line - self.CloseSection() - self.CloseGlobal() - result = self.out.getvalue() - self.out.close() - return result diff --git a/src/3rdparty/v8/tools/testrunner/local/progress.py b/src/3rdparty/v8/tools/testrunner/local/progress.py deleted file mode 100644 index 9075a95..0000000 --- a/src/3rdparty/v8/tools/testrunner/local/progress.py +++ /dev/null @@ -1,238 +0,0 @@ -# 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: -# -# * Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. -# * Redistributions in binary form must reproduce the above -# copyright notice, this list of conditions and the following -# disclaimer in the documentation and/or other materials provided -# with the distribution. -# * Neither the name of Google Inc. nor the names of its -# contributors may be used to endorse or promote products derived -# from this software without specific prior written permission. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - - -import sys -import time - -def EscapeCommand(command): - parts = [] - for part in command: - if ' ' in part: - # Escape spaces. We may need to escape more characters for this - # to work properly. - parts.append('"%s"' % part) - else: - parts.append(part) - return " ".join(parts) - - -class ProgressIndicator(object): - - def __init__(self): - self.runner = None - - def Starting(self): - pass - - def Done(self): - pass - - def AboutToRun(self, test): - pass - - def HasRun(self, test): - pass - - def PrintFailureHeader(self, test): - if test.suite.IsNegativeTest(test): - negative_marker = '[negative] ' - else: - negative_marker = '' - print "=== %(label)s %(negative)s===" % { - 'label': test.GetLabel(), - 'negative': negative_marker - } - - -class SimpleProgressIndicator(ProgressIndicator): - """Abstract base class for {Verbose,Dots}ProgressIndicator""" - - def Starting(self): - print 'Running %i tests' % self.runner.total - - def Done(self): - print - for failed in self.runner.failed: - self.PrintFailureHeader(failed) - if failed.output.stderr: - print "--- stderr ---" - print failed.output.stderr.strip() - if failed.output.stdout: - print "--- stdout ---" - print failed.output.stdout.strip() - print "Command: %s" % EscapeCommand(self.runner.GetCommand(failed)) - if failed.output.HasCrashed(): - print "--- CRASHED ---" - if failed.output.HasTimedOut(): - print "--- TIMEOUT ---" - if len(self.runner.failed) == 0: - print "===" - print "=== All tests succeeded" - print "===" - else: - print - print "===" - print "=== %i tests failed" % len(self.runner.failed) - if self.runner.crashed > 0: - print "=== %i tests CRASHED" % self.runner.crashed - print "===" - - -class VerboseProgressIndicator(SimpleProgressIndicator): - - def AboutToRun(self, test): - print 'Starting %s...' % test.GetLabel() - sys.stdout.flush() - - def HasRun(self, test): - if test.suite.HasUnexpectedOutput(test): - if test.output.HasCrashed(): - outcome = 'CRASH' - else: - outcome = 'FAIL' - else: - outcome = 'pass' - print 'Done running %s: %s' % (test.GetLabel(), outcome) - - -class DotsProgressIndicator(SimpleProgressIndicator): - - def HasRun(self, test): - total = self.runner.succeeded + len(self.runner.failed) - if (total > 1) and (total % 50 == 1): - sys.stdout.write('\n') - if test.suite.HasUnexpectedOutput(test): - if test.output.HasCrashed(): - sys.stdout.write('C') - sys.stdout.flush() - elif test.output.HasTimedOut(): - sys.stdout.write('T') - sys.stdout.flush() - else: - sys.stdout.write('F') - sys.stdout.flush() - else: - sys.stdout.write('.') - sys.stdout.flush() - - -class CompactProgressIndicator(ProgressIndicator): - """Abstract base class for {Color,Monochrome}ProgressIndicator""" - - def __init__(self, templates): - super(CompactProgressIndicator, self).__init__() - self.templates = templates - self.last_status_length = 0 - self.start_time = time.time() - - def Done(self): - self.PrintProgress('Done') - print "" # Line break. - - def AboutToRun(self, test): - self.PrintProgress(test.GetLabel()) - - def HasRun(self, test): - if test.suite.HasUnexpectedOutput(test): - self.ClearLine(self.last_status_length) - self.PrintFailureHeader(test) - stdout = test.output.stdout.strip() - if len(stdout): - print self.templates['stdout'] % stdout - stderr = test.output.stderr.strip() - if len(stderr): - print self.templates['stderr'] % stderr - print "Command: %s" % EscapeCommand(self.runner.GetCommand(test)) - if test.output.HasCrashed(): - print "exit code: %d" % test.output.exit_code - print "--- CRASHED ---" - if test.output.HasTimedOut(): - print "--- TIMEOUT ---" - - def Truncate(self, string, length): - if length and (len(string) > (length - 3)): - return string[:(length - 3)] + "..." - else: - return string - - def PrintProgress(self, name): - self.ClearLine(self.last_status_length) - elapsed = time.time() - self.start_time - status = self.templates['status_line'] % { - 'passed': self.runner.succeeded, - 'remaining': (((self.runner.total - self.runner.remaining) * 100) // - self.runner.total), - 'failed': len(self.runner.failed), - 'test': name, - 'mins': int(elapsed) / 60, - 'secs': int(elapsed) % 60 - } - status = self.Truncate(status, 78) - self.last_status_length = len(status) - print status, - sys.stdout.flush() - - -class ColorProgressIndicator(CompactProgressIndicator): - - def __init__(self): - templates = { - 'status_line': ("[%(mins)02i:%(secs)02i|" - "\033[34m%%%(remaining) 4d\033[0m|" - "\033[32m+%(passed) 4d\033[0m|" - "\033[31m-%(failed) 4d\033[0m]: %(test)s"), - 'stdout': "\033[1m%s\033[0m", - 'stderr': "\033[31m%s\033[0m", - } - super(ColorProgressIndicator, self).__init__(templates) - - def ClearLine(self, last_line_length): - print "\033[1K\r", - - -class MonochromeProgressIndicator(CompactProgressIndicator): - - def __init__(self): - templates = { - 'status_line': ("[%(mins)02i:%(secs)02i|%%%(remaining) 4d|" - "+%(passed) 4d|-%(failed) 4d]: %(test)s"), - 'stdout': '%s', - 'stderr': '%s', - } - super(MonochromeProgressIndicator, self).__init__(templates) - - def ClearLine(self, last_line_length): - print ("\r" + (" " * last_line_length) + "\r"), - - -PROGRESS_INDICATORS = { - 'verbose': VerboseProgressIndicator, - 'dots': DotsProgressIndicator, - 'color': ColorProgressIndicator, - 'mono': MonochromeProgressIndicator -} diff --git a/src/3rdparty/v8/tools/testrunner/local/statusfile.py b/src/3rdparty/v8/tools/testrunner/local/statusfile.py deleted file mode 100644 index bf1de45..0000000 --- a/src/3rdparty/v8/tools/testrunner/local/statusfile.py +++ /dev/null @@ -1,145 +0,0 @@ -# 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: -# -# * Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. -# * Redistributions in binary form must reproduce the above -# copyright notice, this list of conditions and the following -# disclaimer in the documentation and/or other materials provided -# with the distribution. -# * Neither the name of Google Inc. nor the names of its -# contributors may be used to endorse or promote products derived -# from this software without specific prior written permission. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - - -# These imports are required for the on-demand conversion from -# old to new status file format. -from os.path import exists -from os.path import getmtime - -from . import old_statusfile - - -# These outcomes can occur in a TestCase's outcomes list: -SKIP = "SKIP" -FAIL = "FAIL" -PASS = "PASS" -OKAY = "OKAY" -TIMEOUT = "TIMEOUT" -CRASH = "CRASH" -SLOW = "SLOW" -# These are just for the status files and are mapped below in DEFS: -FAIL_OK = "FAIL_OK" -PASS_OR_FAIL = "PASS_OR_FAIL" - -ALWAYS = "ALWAYS" - -KEYWORDS = {} -for key in [SKIP, FAIL, PASS, OKAY, TIMEOUT, CRASH, SLOW, FAIL_OK, - PASS_OR_FAIL, ALWAYS]: - KEYWORDS[key] = key - -DEFS = {FAIL_OK: [FAIL, OKAY], - PASS_OR_FAIL: [PASS, FAIL]} - -# Support arches, modes to be written as keywords instead of strings. -VARIABLES = {ALWAYS: True} -for var in ["debug", "release", "android_arm", "android_ia32", "arm", "ia32", - "mipsel", "x64"]: - VARIABLES[var] = var - - -def DoSkip(outcomes): - return SKIP in outcomes or SLOW in outcomes - - -def IsFlaky(outcomes): - return ((PASS in outcomes) and (FAIL in outcomes) and - (not CRASH in outcomes) and (not OKAY in outcomes)) - - -def IsFailOk(outcomes): - return (FAIL in outcomes) and (OKAY in outcomes) - - -def _AddOutcome(result, new): - global DEFS - if new in DEFS: - mapped = DEFS[new] - if type(mapped) == list: - for m in mapped: - _AddOutcome(result, m) - elif type(mapped) == str: - _AddOutcome(result, mapped) - else: - result.add(new) - - -def _ParseOutcomeList(rule, outcomes, target_dict, variables): - result = set([]) - if type(outcomes) == str: - outcomes = [outcomes] - for item in outcomes: - if type(item) == str: - _AddOutcome(result, item) - elif type(item) == list: - if not eval(item[0], variables): continue - for outcome in item[1:]: - assert type(outcome) == str - _AddOutcome(result, outcome) - else: - assert False - if len(result) == 0: return - if rule in target_dict: - target_dict[rule] |= result - else: - target_dict[rule] = result - - -def ReadStatusFile(path, variables): - # As long as the old-format .status files are authoritative, just - # create the converted version on demand and cache it to speed up - # subsequent runs. - if path.endswith(".status"): - newpath = path + "2" - if not exists(newpath) or getmtime(newpath) < getmtime(path): - print "Converting status file." - converted = old_statusfile.ConvertNotation(path).GetOutput() - with open(newpath, 'w') as f: - f.write(converted) - path = newpath - - with open(path) as f: - global KEYWORDS - contents = eval(f.read(), KEYWORDS) - - rules = {} - wildcards = {} - variables.update(VARIABLES) - for section in contents: - assert type(section) == list - assert len(section) == 2 - if not eval(section[0], variables): continue - section = section[1] - assert type(section) == dict - for rule in section: - assert type(rule) == str - if rule[-1] == '*': - _ParseOutcomeList(rule, section[rule], wildcards, variables) - else: - _ParseOutcomeList(rule, section[rule], rules, variables) - return rules, wildcards diff --git a/src/3rdparty/v8/tools/testrunner/local/testsuite.py b/src/3rdparty/v8/tools/testrunner/local/testsuite.py deleted file mode 100644 index 473e8b1..0000000 --- a/src/3rdparty/v8/tools/testrunner/local/testsuite.py +++ /dev/null @@ -1,187 +0,0 @@ -# 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: -# -# * Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. -# * Redistributions in binary form must reproduce the above -# copyright notice, this list of conditions and the following -# disclaimer in the documentation and/or other materials provided -# with the distribution. -# * Neither the name of Google Inc. nor the names of its -# contributors may be used to endorse or promote products derived -# from this software without specific prior written permission. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - - -import imp -import os - -from . import statusfile -from . import utils - -class TestSuite(object): - - @staticmethod - def LoadTestSuite(root): - name = root.split(os.path.sep)[-1] - f = None - try: - (f, pathname, description) = imp.find_module("testcfg", [root]) - module = imp.load_module("testcfg", f, pathname, description) - suite = module.GetSuite(name, root) - finally: - if f: - f.close() - return suite - - def __init__(self, name, root): - self.name = name # string - self.root = root # string containing path - self.tests = None # list of TestCase objects - self.rules = None # dictionary mapping test path to list of outcomes - self.wildcards = None # dictionary mapping test paths to list of outcomes - self.total_duration = None # float, assigned on demand - - def shell(self): - return "d8" - - def suffix(self): - return ".js" - - def status_file(self): - return "%s/%s.status" % (self.root, self.name) - - # Used in the status file and for stdout printing. - def CommonTestName(self, testcase): - return testcase.path - - def ListTests(self, context): - raise NotImplementedError - - def VariantFlags(self): - return None - - def DownloadData(self): - pass - - def ReadStatusFile(self, variables): - (self.rules, self.wildcards) = \ - statusfile.ReadStatusFile(self.status_file(), variables) - - def ReadTestCases(self, context): - self.tests = self.ListTests(context) - - def FilterTestCasesByStatus(self, warn_unused_rules): - filtered = [] - used_rules = set() - for t in self.tests: - testname = self.CommonTestName(t) - if utils.IsWindows(): - testname = testname.replace("\\", "/") - if testname in self.rules: - used_rules.add(testname) - outcomes = self.rules[testname] - t.outcomes = outcomes # Even for skipped tests, as the TestCase - # object stays around and PrintReport() uses it. - if statusfile.DoSkip(outcomes): - continue # Don't add skipped tests to |filtered|. - if len(self.wildcards) != 0: - skip = False - for rule in self.wildcards: - assert rule[-1] == '*' - if testname.startswith(rule[:-1]): - used_rules.add(rule) - outcomes = self.wildcards[rule] - t.outcomes = outcomes - if statusfile.DoSkip(outcomes): - skip = True - break # "for rule in self.wildcards" - if skip: continue # "for t in self.tests" - filtered.append(t) - self.tests = filtered - - if not warn_unused_rules: - return - - for rule in self.rules: - if rule not in used_rules: - print("Unused rule: %s -> %s" % (rule, self.rules[rule])) - for rule in self.wildcards: - if rule not in used_rules: - print("Unused rule: %s -> %s" % (rule, self.wildcards[rule])) - - def FilterTestCasesByArgs(self, args): - filtered = [] - filtered_args = [] - for a in args: - argpath = a.split(os.path.sep) - if argpath[0] != self.name: - continue - if len(argpath) == 1 or (len(argpath) == 2 and argpath[1] == '*'): - return # Don't filter, run all tests in this suite. - path = os.path.sep.join(argpath[1:]) - if path[-1] == '*': - path = path[:-1] - filtered_args.append(path) - for t in self.tests: - for a in filtered_args: - if t.path.startswith(a): - filtered.append(t) - break - self.tests = filtered - - def GetFlagsForTestCase(self, testcase, context): - raise NotImplementedError - - def GetSourceForTest(self, testcase): - return "(no source available)" - - def IsFailureOutput(self, output, testpath): - return output.exit_code != 0 - - def IsNegativeTest(self, testcase): - return False - - def HasFailed(self, testcase): - execution_failed = self.IsFailureOutput(testcase.output, testcase.path) - if self.IsNegativeTest(testcase): - return not execution_failed - else: - return execution_failed - - def HasUnexpectedOutput(self, testcase): - if testcase.output.HasCrashed(): - outcome = statusfile.CRASH - elif testcase.output.HasTimedOut(): - outcome = statusfile.TIMEOUT - elif self.HasFailed(testcase): - outcome = statusfile.FAIL - else: - outcome = statusfile.PASS - if not testcase.outcomes: - return outcome != statusfile.PASS - return not outcome in testcase.outcomes - - def StripOutputForTransmit(self, testcase): - if not self.HasUnexpectedOutput(testcase): - testcase.output.stdout = "" - testcase.output.stderr = "" - - def CalculateTotalDuration(self): - self.total_duration = 0.0 - for t in self.tests: - self.total_duration += t.duration - return self.total_duration diff --git a/src/3rdparty/v8/tools/testrunner/local/utils.py b/src/3rdparty/v8/tools/testrunner/local/utils.py deleted file mode 100644 index b7caa12..0000000 --- a/src/3rdparty/v8/tools/testrunner/local/utils.py +++ /dev/null @@ -1,108 +0,0 @@ -# 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: -# -# * Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. -# * Redistributions in binary form must reproduce the above -# copyright notice, this list of conditions and the following -# disclaimer in the documentation and/or other materials provided -# with the distribution. -# * Neither the name of Google Inc. nor the names of its -# contributors may be used to endorse or promote products derived -# from this software without specific prior written permission. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -# 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 - - -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): - 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(): - system = platform.system() - if system == 'Linux': - return 'linux' - elif system == 'Darwin': - return 'macos' - elif system.find('CYGWIN') >= 0: - return 'cygwin' - 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 system == 'FreeBSD': - return 'freebsd' - elif system == 'OpenBSD': - return 'openbsd' - elif system == 'SunOS': - return 'solaris' - 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. -def DefaultArch(): - machine = platform.machine() - machine = machine.lower() # Windows 7 capitalizes 'AMD64'. - if machine.startswith('arm'): - return 'arm' - elif (not machine) or (not re.match('(x|i[3-6])86$', machine) is None): - return 'ia32' - elif machine == 'i86pc': - return 'ia32' - elif machine == 'x86_64': - return 'ia32' - elif machine == 'amd64': - return 'ia32' - else: - return None - - -def GuessWordsize(): - if '64' in platform.machine(): - return '64' - else: - return '32' - - -def IsWindows(): - return GuessOS() == 'win32' diff --git a/src/3rdparty/v8/tools/testrunner/local/verbose.py b/src/3rdparty/v8/tools/testrunner/local/verbose.py deleted file mode 100644 index f693467..0000000 --- a/src/3rdparty/v8/tools/testrunner/local/verbose.py +++ /dev/null @@ -1,99 +0,0 @@ -# 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: -# -# * Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. -# * Redistributions in binary form must reproduce the above -# copyright notice, this list of conditions and the following -# disclaimer in the documentation and/or other materials provided -# with the distribution. -# * Neither the name of Google Inc. nor the names of its -# contributors may be used to endorse or promote products derived -# from this software without specific prior written permission. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - - -import sys -import time - -from . import statusfile - - -REPORT_TEMPLATE = ( -"""Total: %(total)i tests - * %(skipped)4d tests will be skipped - * %(timeout)4d tests are expected to timeout sometimes - * %(nocrash)4d tests are expected to be flaky but not crash - * %(pass)4d tests are expected to pass - * %(fail_ok)4d tests are expected to fail that we won't fix - * %(fail)4d tests are expected to fail that we should fix""") - - -def PrintReport(tests): - total = len(tests) - skipped = timeout = nocrash = passes = fail_ok = fail = 0 - for t in tests: - if "outcomes" not in dir(t) or not t.outcomes: - passes += 1 - continue - o = t.outcomes - if statusfile.DoSkip(o): - skipped += 1 - continue - if statusfile.TIMEOUT in o: timeout += 1 - if statusfile.IsFlaky(o): nocrash += 1 - if list(o) == [statusfile.PASS]: passes += 1 - if statusfile.IsFailOk(o): fail_ok += 1 - if list(o) == [statusfile.FAIL]: fail += 1 - print REPORT_TEMPLATE % { - "total": total, - "skipped": skipped, - "timeout": timeout, - "nocrash": nocrash, - "pass": passes, - "fail_ok": fail_ok, - "fail": fail - } - - -def PrintTestSource(tests): - for test in tests: - suite = test.suite - source = suite.GetSourceForTest(test).strip() - if len(source) > 0: - print "--- begin source: %s/%s ---" % (suite.name, test.path) - print source - print "--- end source: %s/%s ---" % (suite.name, test.path) - - -def FormatTime(d): - millis = round(d * 1000) % 1000 - return time.strftime("%M:%S.", time.gmtime(d)) + ("%03i" % millis) - - -def PrintTestDurations(suites, overall_time): - # Write the times to stderr to make it easy to separate from the - # test output. - print - sys.stderr.write("--- Total time: %s ---\n" % FormatTime(overall_time)) - timed_tests = [ t for s in suites for t in s.tests - if t.duration is not None ] - timed_tests.sort(lambda a, b: cmp(b.duration, a.duration)) - index = 1 - for entry in timed_tests[:20]: - t = FormatTime(entry.duration) - sys.stderr.write("%4i (%s) %s\n" % (index, t, entry.GetLabel())) - index += 1 |