Remove SCons related files

Review URL: https://codereview.chromium.org/14348002

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@14328 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent fded35e0
This diff is collapsed.
# Copyright 2011 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.
from os.path import join
Import('context tools')
def ConfigureObjectFiles():
env = Environment(tools=tools)
env.Replace(**context.flags['preparser'])
context.ApplyEnvOverrides(env)
return env.Object('preparser-process.cc')
preparser_object = ConfigureObjectFiles()
Return('preparser_object')
# Copyright 2008 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.
from os.path import join
Import('sample context tools')
def ConfigureObjectFiles():
env = Environment(tools=tools)
env.Replace(**context.flags['sample'])
context.ApplyEnvOverrides(env)
return env.Object(sample + '.cc')
sample_object = ConfigureObjectFiles()
Return('sample_object')
This diff is collapsed.
# 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
from os.path import join, dirname, abspath
root_dir = dirname(File('SConstruct').rfile().abspath)
sys.path.append(join(root_dir, 'tools'))
import js2c
Import('context object_files tools')
# Needed for test-log. Paths are relative to the cctest dir.
JS_FILES_FOR_TESTS = [
'../../../tools/splaytree.js',
'../../../tools/codemap.js',
'../../../tools/csvparser.js',
'../../../tools/consarray.js',
'../../../tools/profile.js',
'../../../tools/profile_view.js',
'../../../tools/logreader.js',
'log-eq-of-logging-and-traversal.js',
]
SOURCES = {
'all': [
'gay-fixed.cc',
'gay-precision.cc',
'gay-shortest.cc',
'test-accessors.cc',
'test-alloc.cc',
'test-api.cc',
'test-ast.cc',
'test-bignum-dtoa.cc',
'test-bignum.cc',
'test-circular-queue.cc',
'test-compiler.cc',
'test-conversions.cc',
'test-cpu-profiler.cc',
'test-dataflow.cc',
'test-date.cc',
'test-debug.cc',
'test-declarative-accessors.cc',
'test-decls.cc',
'test-deoptimization.cc',
'test-dictionary.cc',
'test-diy-fp.cc',
'test-double.cc',
'test-dtoa.cc',
'test-fast-dtoa.cc',
'test-fixed-dtoa.cc',
'test-flags.cc',
'test-func-name-inference.cc',
'test-hashing.cc',
'test-hashmap.cc',
'test-heap-profiler.cc',
'test-heap.cc',
'test-list.cc',
'test-liveedit.cc',
'test-lock.cc',
'test-lockers.cc',
'test-log.cc',
'test-mark-compact.cc',
'test-parsing.cc',
'test-platform-tls.cc',
'test-profile-generator.cc',
'test-random.cc',
'test-regexp.cc',
'test-reloc-info.cc',
'test-serialize.cc',
'test-sockets.cc',
'test-spaces.cc',
'test-strings.cc',
'test-symbols.cc',
'test-strtod.cc',
'test-thread-termination.cc',
'test-threads.cc',
'test-unbound-queue.cc',
'test-utils.cc',
'test-version.cc',
'test-weakmaps.cc'
],
'arch:arm': [
'test-assembler-arm.cc',
'test-disasm-arm.cc'
],
'arch:ia32': [
'test-assembler-ia32.cc',
'test-disasm-ia32.cc',
'test-log-stack-tracer.cc'
],
'arch:x64': ['test-assembler-x64.cc',
'test-macro-assembler-x64.cc',
'test-log-stack-tracer.cc',
'test-disasm-x64.cc'],
'arch:mips': ['test-assembler-mips.cc',
'test-disasm-mips.cc'],
'os:linux': ['test-platform-linux.cc'],
'os:macos': ['test-platform-macos.cc'],
'os:nullos': ['test-platform-nullos.cc'],
'os:win32': ['test-platform-win32.cc']
}
def Build():
cctest_files = context.GetRelevantSources(SOURCES)
env = Environment(tools=tools)
env.Replace(**context.flags['cctest'])
context.ApplyEnvOverrides(env)
env['BUILDERS']['JS2C'] = Builder(action=js2c.JS2C)
# Combine the JavaScript library files into a single C++ file and
# compile it.
js_files = [s for s in JS_FILES_FOR_TESTS]
js_files_src = env.JS2C(
['js-files-for-cctest.cc'], js_files, **{'TYPE': 'TEST', 'COMPRESSION': 'off'})
js_files_obj = context.ConfigureObject(env, js_files_src, CPPPATH=['.'])
# There seems to be a glitch in the way scons decides where to put
# PDB files when compiling using MSVC so we specify it manually.
# This should not affect any other platforms.
object_files.append(js_files_obj)
return env.Program('cctest', ['cctest.cc', cctest_files, object_files],
PDB='cctest.exe.pdb')
program = Build()
Return('program')
......@@ -84,100 +84,3 @@ class CcTestSuite(testsuite.TestSuite):
def GetSuite(name, root):
return CcTestSuite(name, root)
# Deprecated definitions below.
# TODO(jkummerow): Remove when SCons is no longer supported.
from os.path import exists, join, normpath
import test
class CcTestCase(test.TestCase):
def __init__(self, path, executable, mode, raw_name, dependency, context, variant_flags):
super(CcTestCase, self).__init__(context, path, mode)
self.executable = executable
self.raw_name = raw_name
self.dependency = dependency
self.variant_flags = variant_flags
def GetLabel(self):
return "%s %s %s" % (self.mode, self.path[-2], self.path[-1])
def GetName(self):
return self.path[-1]
def BuildCommand(self, name):
serialization_file = ''
if exists(join(self.context.buildspace, 'obj', 'test', self.mode)):
serialization_file = join('obj', 'test', self.mode, 'serdes')
else:
serialization_file = join('obj', 'serdes')
if not exists(join(self.context.buildspace, 'obj')):
os.makedirs(join(self.context.buildspace, 'obj'))
serialization_file += '_' + self.GetName()
serialization_file = join(self.context.buildspace, serialization_file)
serialization_file += ''.join(self.variant_flags).replace('-', '_')
serialization_option = '--testing_serialization_file=' + serialization_file
result = [ self.executable, name, serialization_option ]
result += self.context.GetVmFlags(self, self.mode)
return result
def GetCommand(self):
return self.BuildCommand(self.raw_name)
def Run(self):
if self.dependency != '':
dependent_command = self.BuildCommand(self.dependency)
output = self.RunCommand(dependent_command)
if output.HasFailed():
return output
return test.TestCase.Run(self)
class CcTestConfiguration(test.TestConfiguration):
def __init__(self, context, root):
super(CcTestConfiguration, self).__init__(context, root)
def GetBuildRequirements(self):
return ['cctests']
def ListTests(self, current_path, path, mode, variant_flags):
executable = 'cctest'
if utils.IsWindows():
executable += '.exe'
executable = join(self.context.buildspace, executable)
if not exists(executable):
executable = join('obj', 'test', mode, 'cctest')
if utils.IsWindows():
executable += '.exe'
executable = join(self.context.buildspace, executable)
full_command = self.context.processor([executable, '--list'])
output = test.Execute(full_command, self.context)
if output.exit_code != 0:
print output.stdout
print output.stderr
return []
result = []
for test_desc in output.stdout.strip().split():
raw_test, dependency = test_desc.split('<')
relative_path = raw_test.split('/')
full_path = current_path + relative_path
if dependency != '':
dependency = relative_path[0] + '/' + dependency
if self.Contains(path, full_path):
result.append(CcTestCase(full_path, executable, mode, raw_test, dependency, self.context, variant_flags))
result.sort()
return result
def GetTestStatus(self, sections, defs):
status_file = join(self.root, 'cctest.status')
if exists(status_file):
test.ReadConfigurationInto(status_file, sections, defs)
def GetConfiguration(context, root):
return CcTestConfiguration(context, root)
......@@ -50,7 +50,7 @@ class MessageTestSuite(testsuite.TestSuite):
files.sort()
for filename in files:
if filename.endswith(".js"):
testname = join(dirname[len(self.root) + 1:], filename[:-3])
testname = os.path.join(dirname[len(self.root) + 1:], filename[:-3])
test = testcase.TestCase(self, testname)
tests.append(test)
return tests
......@@ -109,116 +109,3 @@ class MessageTestSuite(testsuite.TestSuite):
def GetSuite(name, root):
return MessageTestSuite(name, root)
# Deprecated definitions below.
# TODO(jkummerow): Remove when SCons is no longer supported.
import test
from os.path import join, exists, basename, isdir
class MessageTestCase(test.TestCase):
def __init__(self, path, file, expected, mode, context, config):
super(MessageTestCase, self).__init__(context, path, mode)
self.file = file
self.expected = expected
self.config = config
def IgnoreLine(self, str):
"""Ignore empty lines, valgrind output and Android output."""
if not str: return True
return (str.startswith('==') or str.startswith('**') or
str.startswith('ANDROID'))
def IsFailureOutput(self, output):
f = file(self.expected)
# Skip initial '#' comment and spaces
for line in f:
if (not line.startswith('#')) and (not line.strip()):
break
# Convert output lines to regexps that we can match
env = { 'basename': basename(self.file) }
patterns = [ ]
for line in f:
if not line.strip():
continue
pattern = re.escape(line.rstrip() % env)
pattern = pattern.replace('\\*', '.*')
pattern = '^%s$' % pattern
patterns.append(pattern)
# Compare actual output with the expected
raw_lines = output.stdout.splitlines()
outlines = [ s for s in raw_lines if not self.IgnoreLine(s) ]
if len(outlines) != len(patterns):
return True
for i in xrange(len(patterns)):
if not re.match(patterns[i], outlines[i]):
return True
return False
def GetLabel(self):
return "%s %s" % (self.mode, self.GetName())
def GetName(self):
return self.path[-1]
def GetCommand(self):
result = self.config.context.GetVmCommand(self, self.mode)
source = open(self.file).read()
flags_match = re.findall(FLAGS_PATTERN, source)
for match in flags_match:
result += match.strip().split()
result.append(self.file)
return result
def GetSource(self):
return (open(self.file).read()
+ "\n--- expected output ---\n"
+ open(self.expected).read())
class MessageTestConfiguration(test.TestConfiguration):
def __init__(self, context, root):
super(MessageTestConfiguration, self).__init__(context, root)
def Ls(self, path):
if isdir(path):
return [f[:-3] for f in os.listdir(path) if f.endswith('.js')]
else:
return []
def ListTests(self, current_path, path, mode, variant_flags):
mjsunit = [current_path + [t] for t in self.Ls(self.root)]
regress = [current_path + ['regress', t] for t in self.Ls(join(self.root, 'regress'))]
bugs = [current_path + ['bugs', t] for t in self.Ls(join(self.root, 'bugs'))]
mjsunit.sort()
regress.sort()
bugs.sort()
all_tests = mjsunit + regress + bugs
result = []
for test in all_tests:
if self.Contains(path, test):
file_prefix = join(self.root, reduce(join, test[1:], ""))
file_path = file_prefix + ".js"
output_path = file_prefix + ".out"
if not exists(output_path):
print "Could not find %s" % output_path
continue
result.append(MessageTestCase(test, file_path, output_path, mode,
self.context, self))
return result
def GetBuildRequirements(self):
return ['d8']
def GetTestStatus(self, sections, defs):
status_file = join(self.root, 'message.status')
if exists(status_file):
test.ReadConfigurationInto(status_file, sections, defs)
def GetConfiguration(context, root):
return MessageTestConfiguration(context, root)
......@@ -50,7 +50,7 @@ class MjsunitTestSuite(testsuite.TestSuite):
files.sort()
for filename in files:
if filename.endswith(".js") and filename != "mjsunit.js":
testname = join(dirname[len(self.root) + 1:], filename[:-3])
testname = os.path.join(dirname[len(self.root) + 1:], filename[:-3])
test = testcase.TestCase(self, testname)
tests.append(test)
return tests
......@@ -95,134 +95,3 @@ class MjsunitTestSuite(testsuite.TestSuite):
def GetSuite(name, root):
return MjsunitTestSuite(name, root)
# Deprecated definitions below.
# TODO(jkummerow): Remove when SCons is no longer supported.
from os.path import dirname, exists, join, normpath
import tempfile
import test
class MjsunitTestCase(test.TestCase):
def __init__(self, path, file, mode, context, config, isolates):
super(MjsunitTestCase, self).__init__(context, path, mode)
self.file = file
self.config = config
self.self_script = False
self.isolates = isolates
def GetLabel(self):
return "%s %s" % (self.mode, self.GetName())
def GetName(self):
return self.path[-1] + ["", "-isolates"][self.isolates]
def TestsIsolates(self):
return self.isolates
def GetVmCommand(self, source):
result = self.config.context.GetVmCommand(self, self.mode)
flags_match = re.findall(FLAGS_PATTERN, source);
for match in flags_match:
result += match.strip().split()
return result
def GetVmArguments(self, source):
result = []
additional_files = []
files_match = FILES_PATTERN.search(source);
# Accept several lines of 'Files:'
while True:
if files_match:
additional_files += files_match.group(1).strip().split()
files_match = FILES_PATTERN.search(source, files_match.end())
else:
break
for a_file in additional_files:
result.append(join(dirname(self.config.root), '..', a_file))
framework = join(dirname(self.config.root), 'mjsunit', 'mjsunit.js')
if SELF_SCRIPT_PATTERN.search(source):
result.append(self.CreateSelfScript())
result += [framework, self.file]
return result
def GetCommand(self):
source = open(self.file).read()
result = self.GetVmCommand(source)
result += self.GetVmArguments(source)
if self.isolates:
result.append("--isolate")
result += self.GetVmArguments(source)
return result
def GetSource(self):
return open(self.file).read()
def CreateSelfScript(self):
(fd_self_script, self_script) = tempfile.mkstemp(suffix=".js")
def MakeJsConst(name, value):
return "var %(name)s=\'%(value)s\';\n" % \
{'name': name, \
'value': value.replace('\\', '\\\\').replace('\'', '\\\'') }
try:
os.write(fd_self_script, MakeJsConst('TEST_FILE_NAME', self.file))
except IOError, e:
test.PrintError("write() " + str(e))
os.close(fd_self_script)
self.self_script = self_script
return self_script
def AfterRun(self, result):
if self.self_script and (not result or (not result.HasPreciousOutput())):
test.CheckedUnlink(self.self_script)
class MjsunitTestConfiguration(test.TestConfiguration):
def __init__(self, context, root):
super(MjsunitTestConfiguration, self).__init__(context, root)
def Ls(self, path):
def SelectTest(name):
return name.endswith('.js') and name != 'mjsunit.js'
return [f[:-3] for f in os.listdir(path) if SelectTest(f)]
def ListTests(self, current_path, path, mode, variant_flags):
mjsunit = [current_path + [t] for t in self.Ls(self.root)]
regress = [current_path + ['regress', t] for t in self.Ls(join(self.root, 'regress'))]
bugs = [current_path + ['bugs', t] for t in self.Ls(join(self.root, 'bugs'))]
third_party = [current_path + ['third_party', t] for t in self.Ls(join(self.root, 'third_party'))]
tools = [current_path + ['tools', t] for t in self.Ls(join(self.root, 'tools'))]
compiler = [current_path + ['compiler', t] for t in self.Ls(join(self.root, 'compiler'))]
harmony = [current_path + ['harmony', t] for t in self.Ls(join(self.root, 'harmony'))]
mjsunit.sort()
regress.sort()
bugs.sort()
third_party.sort()
tools.sort()
compiler.sort()
harmony.sort()
all_tests = mjsunit + regress + bugs + third_party + tools + compiler + harmony
result = []
for test in all_tests:
if self.Contains(path, test):
file_path = join(self.root, reduce(join, test[1:], "") + ".js")
result.append(MjsunitTestCase(test, file_path, mode, self.context, self, False))
result.append(MjsunitTestCase(test, file_path, mode, self.context, self, True))
return result
def GetBuildRequirements(self):
return ['d8']
def GetTestStatus(self, sections, defs):
status_file = join(self.root, 'mjsunit.status')
if exists(status_file):
test.ReadConfigurationInto(status_file, sections, defs)
def GetConfiguration(context, root):
return MjsunitTestConfiguration(context, root)
......@@ -104,7 +104,7 @@ class MozillaTestSuite(testsuite.TestSuite):
return testcase.flags + result
def GetSourceForTest(self, testcase):
filename = join(self.testroot, testcase.path + ".js")
filename = os.path.join(self.testroot, testcase.path + ".js")
with open(filename) as f:
return f.read()
......@@ -150,7 +150,7 @@ class MozillaTestSuite(testsuite.TestSuite):
if code != 0:
os.chdir(old_cwd)
raise Exception("Error checking out Mozilla test suite!")
os.rename(join("mozilla", "js", "tests"), directory_name)
os.rename(os.path.join("mozilla", "js", "tests"), directory_name)
shutil.rmtree("mozilla")
with tarfile.open(archive_file, "w:gz") as tar:
tar.add("data")
......@@ -161,96 +161,3 @@ class MozillaTestSuite(testsuite.TestSuite):
def GetSuite(name, root):
return MozillaTestSuite(name, root)
# Deprecated definitions below.
# TODO(jkummerow): Remove when SCons is no longer supported.
from os.path import exists
from os.path import join
import test
class MozillaTestCase(test.TestCase):
def __init__(self, filename, path, context, root, mode, framework):
super(MozillaTestCase, self).__init__(context, path, mode)
self.filename = filename
self.framework = framework
self.root = root
def IsNegative(self):
return self.filename.endswith('-n.js')
def GetLabel(self):
return "%s mozilla %s" % (self.mode, self.GetName())
def IsFailureOutput(self, output):
if output.exit_code != 0:
return True
return 'FAILED!' in output.stdout
def GetCommand(self):
result = self.context.GetVmCommand(self, self.mode) + \
[ '--expose-gc', join(self.root, 'mozilla-shell-emulation.js') ]
result += [ '--es5_readonly' ] # Temporary hack until we can remove flag
result += self.framework
result.append(self.filename)
return result
def GetName(self):
return self.path[-1]
def GetSource(self):
return open(self.filename).read()
class MozillaTestConfiguration(test.TestConfiguration):
def __init__(self, context, root):
super(MozillaTestConfiguration, self).__init__(context, root)
def ListTests(self, current_path, path, mode, variant_flags):
tests = []
for test_dir in TEST_DIRS:
current_root = join(self.root, 'data', test_dir)
for root, dirs, files in os.walk(current_root):
for dotted in [x for x in dirs if x.startswith('.')]:
dirs.remove(dotted)
for excluded in EXCLUDED:
if excluded in dirs:
dirs.remove(excluded)
dirs.sort()
root_path = root[len(self.root):].split(os.path.sep)
root_path = current_path + [x for x in root_path if x]
framework = []
for i in xrange(len(root_path)):
if i == 0: dir = root_path[1:]
else: dir = root_path[1:-i]
script = join(self.root, reduce(join, dir, ''), 'shell.js')
if exists(script):
framework.append(script)
framework.reverse()
files.sort()
for file in files:
if (not file in FRAMEWORK) and file.endswith('.js'):
full_path = root_path + [file[:-3]]
full_path = [x for x in full_path if x != 'data']
if self.Contains(path, full_path):
test = MozillaTestCase(join(root, file), full_path, self.context,
self.root, mode, framework)
tests.append(test)
return tests
def GetBuildRequirements(self):
return ['d8']
def GetTestStatus(self, sections, defs):
status_file = join(self.root, 'mozilla.status')
if exists(status_file):
test.ReadConfigurationInto(status_file, sections, defs)
def GetConfiguration(context, root):
return MozillaTestConfiguration(context, root)
......@@ -42,7 +42,7 @@ class PreparserTestSuite(testsuite.TestSuite):
return "preparser"
def _GetExpectations(self):
expects_file = join(self.root, "preparser.expectation")
expects_file = os.path.join(self.root, "preparser.expectation")
expectations_map = {}
if not os.path.exists(expects_file): return expectations_map
rule_regex = re.compile("^([\w\-]+)(?::([\w\-]+))?(?::(\d+),(\d+))?$")
......@@ -58,7 +58,7 @@ class PreparserTestSuite(testsuite.TestSuite):
return expectations_map
def _ParsePythonTestTemplates(self, result, filename):
pathname = join(self.root, filename + ".pyt")
pathname = os.path.join(self.root, filename + ".pyt")
def Test(name, source, expectation):
source = source.replace("\n", " ")
testname = os.path.join(filename, name)
......@@ -118,143 +118,3 @@ class PreparserTestSuite(testsuite.TestSuite):
def GetSuite(name, root):
return PreparserTestSuite(name, root)
# Deprecated definitions below.
# TODO(jkummerow): Remove when SCons is no longer supported.
from os.path import join, exists, isfile
import test
class PreparserTestCase(test.TestCase):
def __init__(self, root, path, executable, mode, throws, context, source):
super(PreparserTestCase, self).__init__(context, path, mode)
self.executable = executable
self.root = root
self.throws = throws
self.source = source
def GetLabel(self):
return "%s %s %s" % (self.mode, self.path[-2], self.path[-1])
def GetName(self):
return self.path[-1]
def HasSource(self):
return self.source is not None
def GetSource(self):
return self.source
def BuildCommand(self, path):
if (self.source is not None):
result = [self.executable, "-e", self.source]
else:
testfile = join(self.root, self.GetName()) + ".js"
result = [self.executable, testfile]
if (self.throws):
result += ['throws'] + self.throws
return result
def GetCommand(self):
return self.BuildCommand(self.path)
def Run(self):
return test.TestCase.Run(self)
class PreparserTestConfiguration(test.TestConfiguration):
def __init__(self, context, root):
super(PreparserTestConfiguration, self).__init__(context, root)
def GetBuildRequirements(self):
return ['preparser']
def GetExpectations(self):
expects_file = join(self.root, 'preparser.expectation')
map = {}
if exists(expects_file):
rule_regex = re.compile("^([\w\-]+)(?::([\w\-]+))?(?::(\d+),(\d+))?$")
for line in utils.ReadLinesFrom(expects_file):
if (line[0] == '#'): continue
rule_match = rule_regex.match(line)
if rule_match:
expects = []
if (rule_match.group(2)):
expects = expects + [rule_match.group(2)]
if (rule_match.group(3)):
expects = expects + [rule_match.group(3), rule_match.group(4)]
map[rule_match.group(1)] = expects
return map;
def ParsePythonTestTemplates(self, result, filename,
executable, current_path, mode):
pathname = join(self.root, filename + ".pyt")
def Test(name, source, expectation):
throws = None
if (expectation is not None):
throws = [expectation]
test = PreparserTestCase(self.root,
current_path + [filename, name],
executable,
mode, throws, self.context,
source.replace("\n", " "))
result.append(test)
def Template(name, source):
def MkTest(replacement, expectation):
testname = name
testsource = source
for key in replacement.keys():
testname = testname.replace("$"+key, replacement[key]);
testsource = testsource.replace("$"+key, replacement[key]);
Test(testname, testsource, expectation)
return MkTest
execfile(pathname, {"Test": Test, "Template": Template})
def ListTests(self, current_path, path, mode, variant_flags):
executable = 'preparser'
if utils.IsWindows():
executable += '.exe'
executable = join(self.context.buildspace, executable)
if not isfile(executable):
executable = join('obj', 'preparser', mode, 'preparser')
if utils.IsWindows():
executable += '.exe'
executable = join(self.context.buildspace, executable)
expectations = self.GetExpectations()
result = []
# Find all .js files in tests/preparser directory.
filenames = [f[:-3] for f in os.listdir(self.root) if f.endswith(".js")]
filenames.sort()
for file in filenames:
throws = None;
if (file in expectations):
throws = expectations[file]
result.append(PreparserTestCase(self.root,
current_path + [file], executable,
mode, throws, self.context, None))
# Find all .pyt files in test/preparser directory.
filenames = [f[:-4] for f in os.listdir(self.root) if f.endswith(".pyt")]
filenames.sort()
for file in filenames:
# Each file as a python source file to be executed in a specially
# created environment (defining the Template and Test functions)
self.ParsePythonTestTemplates(result, file,
executable, current_path, mode)
return result
def GetTestStatus(self, sections, defs):
status_file = join(self.root, 'preparser.status')
if exists(status_file):
test.ReadConfigurationInto(status_file, sections, defs)
def VariantFlags(self):
return [[]];
def GetConfiguration(context, root):
return PreparserTestConfiguration(context, root)
......@@ -121,115 +121,3 @@ class Test262TestSuite(testsuite.TestSuite):
def GetSuite(name, root):
return Test262TestSuite(name, root)
# Deprecated definitions below.
# TODO(jkummerow): Remove when SCons is no longer supported.
from os.path import exists
from os.path import join
import test
class Test262TestCase(test.TestCase):
def __init__(self, filename, path, context, root, mode, framework):
super(Test262TestCase, self).__init__(context, path, mode)
self.filename = filename
self.framework = framework
self.root = root
def IsNegative(self):
return '@negative' in self.GetSource()
def GetLabel(self):
return "%s test262 %s" % (self.mode, self.GetName())
def IsFailureOutput(self, output):
if output.exit_code != 0:
return True
return 'FAILED!' in output.stdout
def GetCommand(self):
result = self.context.GetVmCommand(self, self.mode)
result += [ '--es5_readonly' ] # Temporary hack until we can remove flag
result += self.framework
result.append(self.filename)
return result
def GetName(self):
return self.path[-1]
def GetSource(self):
return open(self.filename).read()
class Test262TestConfiguration(test.TestConfiguration):
def __init__(self, context, root):
super(Test262TestConfiguration, self).__init__(context, root)
def ListTests(self, current_path, path, mode, variant_flags):
testroot = join(self.root, 'data', 'test', 'suite')
harness = [join(self.root, 'data', 'test', 'harness', f)
for f in TEST_262_HARNESS]
harness += [join(self.root, 'harness-adapt.js')]
tests = []
for root, dirs, files in os.walk(testroot):
for dotted in [x for x in dirs if x.startswith('.')]:
dirs.remove(dotted)
for skipped in [x for x in dirs if x in TEST_262_SKIP]:
dirs.remove(skipped)
dirs.sort()
root_path = root[len(self.root):].split(os.path.sep)
root_path = current_path + [x for x in root_path if x]
files.sort()
for file in files:
if file.endswith('.js'):
test_path = ['test262', file[:-3]]
if self.Contains(path, test_path):
test = Test262TestCase(join(root, file), test_path, self.context,
self.root, mode, harness)
tests.append(test)
return tests
def DownloadData(self):
revision = TEST_262_ARCHIVE_REVISION
archive_url = TEST_262_URL % revision
archive_name = join(self.root, 'test262-%s.tar.bz2' % revision)
directory_name = join(self.root, 'data')
directory_old_name = join(self.root, 'data.old')
if not exists(archive_name):
print "Downloading test data from %s ..." % archive_url
urllib.urlretrieve(archive_url, archive_name)
if exists(directory_name):
os.rename(directory_name, directory_old_name)
if not exists(directory_name):
print "Extracting test262-%s.tar.bz2 ..." % revision
md5 = hashlib.md5()
with open(archive_name,'rb') as f:
for chunk in iter(lambda: f.read(8192), ''):
md5.update(chunk)
if md5.hexdigest() != TEST_262_ARCHIVE_MD5:
os.remove(archive_name)
raise Exception("Hash mismatch of test data file")
archive = tarfile.open(archive_name, 'r:bz2')
if sys.platform in ('win32', 'cygwin'):
# Magic incantation to allow longer path names on Windows.
archive.extractall(u'\\\\?\\%s' % self.root)
else:
archive.extractall(self.root)
os.rename(join(self.root, 'test262-%s' % revision), directory_name)
def GetBuildRequirements(self):
return ['d8']
def GetTestStatus(self, sections, defs):
status_file = join(self.root, 'test262.status')
if exists(status_file):
test.ReadConfigurationInto(status_file, sections, defs)
def GetConfiguration(context, root):
return Test262TestConfiguration(context, root)
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment