Make GYP build usable for day-to-day work (second attempt)

- Introduce a global Makefile that triggers GYP-based building
- Some fixes to .gyp[i] files to make everything work
- tools/test-wrapper-gypbuild.py as a temporary solution for easy testing

Original review URL: http://codereview.chromium.org/7383006/

Review URL: http://codereview.chromium.org/7550030

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@8840 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent 3e28347d
...@@ -31,5 +31,4 @@ shell_g ...@@ -31,5 +31,4 @@ shell_g
/tools/visual_studio/Release /tools/visual_studio/Release
/xcodebuild/ /xcodebuild/
TAGS TAGS
Makefile
*.Makefile *.Makefile
# 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.
# Variable default definitions. Override them by exporting them in your shell.
CXX ?= "g++" # For distcc: export CXX="distcc g++"
LINK ?= "g++"
OUTDIR ?= out
TESTJOBS ?= -j16
GYPFLAGS ?= -Dv8_can_use_vfp_instructions=true
# Architectures and modes to be compiled.
ARCHES = ia32 x64 arm
MODES = release debug
# List of files that trigger Makefile regeneration:
GYPFILES = build/all.gyp build/common.gypi build/v8-features.gypi \
preparser/preparser.gyp samples/samples.gyp src/d8.gyp \
test/cctest/cctest.gyp tools/gyp/v8.gyp
# Generates all combinations of ARCHES and MODES, e.g. "ia32.release".
BUILDS = $(foreach mode,$(MODES),$(addsuffix .$(mode),$(ARCHES)))
CHECKS = $(addsuffix .check,$(BUILDS))
# Generates corresponding test targets, e.g. "ia32.release.check".
.PHONY: all release debug ia32 x64 arm $(BUILDS)
# Target definitions. "all" is the default, you can specify any others on the
# command line, e.g. "make ia32". Targets defined in $(BUILDS), e.g.
# "ia32.debug", can also be specified.
all: release debug
release: $(addsuffix .release,$(ARCHES))
debug: $(addsuffix .debug,$(ARCHES))
ia32: $(addprefix ia32.,$(MODES))
x64: $(addprefix x64.,$(MODES))
arm: $(addprefix arm.,$(MODES))
.SECONDEXPANSION:
$(BUILDS): $(OUTDIR)/Makefile-$$(basename $$@)
@$(MAKE) -C "$(OUTDIR)" -f Makefile-$(basename $@) \
CXX="$(CXX)" LINK="$(LINK)" \
BUILDTYPE=$(shell echo $(subst .,,$(suffix $@)) | \
python -c "print raw_input().capitalize()") \
builddir="$(shell pwd)/$(OUTDIR)/$@"
# Test targets.
check: all
@tools/test-wrapper-gypbuild.py $(TESTJOBS)
debug.check: debug
@tools/test-wrapper-gypbuild.py $(TESTJOBS) --mode=debug
release.check: release
@tools/test-wrapper-gypbuild.py $(TESTJOBS) --mode=release
$(addsuffix .check,$(ARCHES)): $$(basename $$@)
@tools/test-wrapper-gypbuild.py $(TESTJOBS) --arch=$(basename $@)
$(CHECKS): $$(basename $$@)
@tools/test-wrapper-gypbuild.py $(TESTJOBS) --arch-and-mode=$(basename $@)
# Clean targets. You can clean each architecture individually, or everything.
$(addsuffix .clean,$(ARCHES)):
rm -f $(OUTDIR)/Makefile-$(basename $@)
rm -rf $(OUTDIR)/$(basename $@).release
rm -rf $(OUTDIR)/$(basename $@).debug
clean: $(addsuffix .clean,$(ARCHES))
# GYP file generation targets.
$(OUTDIR)/Makefile-ia32: $(GYPFILES)
build/gyp/gyp --generator-output="$(OUTDIR)" build/all.gyp \
-Ibuild/common.gypi --depth=. -Dtarget_arch=ia32 -S-ia32 \
$(GYPFLAGS)
$(OUTDIR)/Makefile-x64: $(GYPFILES)
build/gyp/gyp --generator-output="$(OUTDIR)" build/all.gyp \
-Ibuild/common.gypi --depth=. -Dtarget_arch=x64 -S-x64 \
$(GYPFLAGS)
$(OUTDIR)/Makefile-arm: $(GYPFILES) build/armu.gypi
build/gyp/gyp --generator-output="$(OUTDIR)" build/all.gyp \
-Ibuild/common.gypi --depth=. -Ibuild/armu.gypi -S-arm \
$(GYPFLAGS)
# Copyright (c) 2010 The Chromium Authors. All rights reserved. # Copyright (c) 2011 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be # Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file. # found in the LICENSE file.
...@@ -8,6 +8,7 @@ ...@@ -8,6 +8,7 @@
'target_name': 'All', 'target_name': 'All',
'type': 'none', 'type': 'none',
'dependencies': [ 'dependencies': [
'../preparser/preparser.gyp:*',
'../samples/samples.gyp:*', '../samples/samples.gyp:*',
'../src/d8.gyp:d8', '../src/d8.gyp:d8',
], ],
......
...@@ -32,5 +32,5 @@ ...@@ -32,5 +32,5 @@
'armv7': 1, 'armv7': 1,
'arm_neon': 0, 'arm_neon': 0,
'arm_fpu': 'vfpv3', 'arm_fpu': 'vfpv3',
} },
} }
# Copyright 2010 the V8 project authors. All rights reserved. # Copyright 2011 the V8 project authors. All rights reserved.
# Redistribution and use in source and binary forms, with or without # Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are # modification, are permitted provided that the following conditions are
# met: # met:
...@@ -46,23 +46,41 @@ ...@@ -46,23 +46,41 @@
'host_arch%': '<(host_arch)', 'host_arch%': '<(host_arch)',
'target_arch%': '<(host_arch)', 'target_arch%': '<(host_arch)',
'v8_target_arch%': '<(target_arch)', 'v8_target_arch%': '<(target_arch)',
'v8_enable_debugger_support%': 1,
'conditions': [
['(target_arch=="arm" and host_arch!="arm") or \
(target_arch=="x64" and host_arch!="x64")', {
'want_separate_host_toolset': 1,
}, {
'want_separate_host_toolset': 0,
}],
],
}, },
'target_defaults': { 'target_defaults': {
'default_configuration': 'Debug', 'default_configuration': 'Debug',
'conditions': [
['v8_enable_debugger_support==1', {
'defines': ['ENABLE_DEBUGGER_SUPPORT',],
},
],
],
'configurations': { 'configurations': {
'Debug': { 'Debug': {
'cflags': [ '-g', '-O0' ], 'cflags': [ '-g', '-O0' ],
'defines': [ 'ENABLE_DISASSEMBLER', 'DEBUG' ], 'defines': [ 'ENABLE_DISASSEMBLER', 'DEBUG', 'V8_ENABLE_CHECKS',
'OBJECT_PRINT' ],
}, },
'Release': { 'Release': {
'cflags': [ '-O3', '-fomit-frame-pointer', '-fdata-sections', '-ffunction-sections' ], 'cflags': [ '-O3', '-fomit-frame-pointer', '-fdata-sections',
'-ffunction-sections' ],
}, },
}, },
}, },
'conditions': [ 'conditions': [
[ 'OS=="linux" or OS=="freebsd" or OS=="openbsd" or OS=="solaris"', { [ 'OS=="linux" or OS=="freebsd" or OS=="openbsd" or OS=="solaris"', {
'target_defaults': { 'target_defaults': {
'cflags': [ '-Wall', '-pthread', '-fno-rtti', '-fno-exceptions' ], 'cflags': [ '-Wall', '-pthread', '-fno-rtti', '-fno-exceptions',
'-pedantic' ],
'ldflags': [ '-pthread', ], 'ldflags': [ '-pthread', ],
'conditions': [ 'conditions': [
[ 'target_arch=="ia32"', { [ 'target_arch=="ia32"', {
......
...@@ -89,6 +89,19 @@ ...@@ -89,6 +89,19 @@
'USE_EABI_HARDFLOAT=1', 'USE_EABI_HARDFLOAT=1',
'CAN_USE_VFP_INSTRUCTIONS', 'CAN_USE_VFP_INSTRUCTIONS',
], ],
'cflags': [
'-mfloat-abi=hard',
],
}, {
'defines': [
'USE_EABI_HARDFLOAT=0',
],
}],
# The ARM assembler assumes the host is 32 bits,
# so force building 32-bit host tools.
[ 'host_arch=="x64"', {
'cflags': ['-m32'],
'ldflags': ['-m32'],
}], }],
], ],
}], }],
......
# 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.
{
'targets': [
{
'target_name': 'preparser',
'type': 'executable',
'dependencies': [
'../tools/gyp/v8.gyp:preparser_lib',
],
'sources': [
'preparser-process.cc',
],
},
],
}
# Copyright 2010 the V8 project authors. All rights reserved. # Copyright 2011 the V8 project authors. All rights reserved.
# Redistribution and use in source and binary forms, with or without # Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are # modification, are permitted provided that the following conditions are
# met: # met:
...@@ -26,23 +26,24 @@ ...@@ -26,23 +26,24 @@
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
{ {
'target_defaults': {
'type': 'executable',
'dependencies': [
'../tools/gyp/v8.gyp:v8',
],
'include_dirs': [
'../include',
],
},
'targets': [ 'targets': [
{ {
'target_name': 'shell', 'target_name': 'shell',
'type': 'executable',
'dependencies': [
'../tools/gyp/v8.gyp:v8',
],
'sources': [ 'sources': [
'shell.cc', 'shell.cc',
], ],
}, },
{ {
'target_name': 'process', 'target_name': 'process',
'type': 'executable',
'dependencies': [
'../tools/gyp/v8.gyp:v8',
],
'sources': [ 'sources': [
'process.cc', 'process.cc',
], ],
......
...@@ -47,9 +47,17 @@ ...@@ -47,9 +47,17 @@
], ],
'conditions': [ 'conditions': [
[ 'component!="shared_library"', { [ 'component!="shared_library"', {
'dependencies': [ 'd8_js2c#host', ],
'sources': [ 'd8-debug.cc', '<(SHARED_INTERMEDIATE_DIR)/d8-js.cc', ], 'sources': [ 'd8-debug.cc', '<(SHARED_INTERMEDIATE_DIR)/d8-js.cc', ],
'conditions': [ 'conditions': [
[ 'want_separate_host_toolset==1', {
'dependencies': [
'd8_js2c#host',
],
}, {
'dependencies': [
'd8_js2c',
],
}],
[ 'console=="readline"', { [ 'console=="readline"', {
'libraries': [ '-lreadline', ], 'libraries': [ '-lreadline', ],
'sources': [ 'd8-readline.cc' ], 'sources': [ 'd8-readline.cc' ],
...@@ -68,13 +76,19 @@ ...@@ -68,13 +76,19 @@
{ {
'target_name': 'd8_js2c', 'target_name': 'd8_js2c',
'type': 'none', 'type': 'none',
'toolsets': ['host'],
'variables': { 'variables': {
'js_files': [ 'js_files': [
'd8.js', 'd8.js',
'macros.py', 'macros.py',
], ],
}, },
'conditions': [
[ 'want_separate_host_toolset==1', {
'toolsets': ['host'],
}, {
'toolsets': ['target'],
}]
],
'actions': [ 'actions': [
{ {
'action_name': 'd8_js2c', 'action_name': 'd8_js2c',
...@@ -90,6 +104,7 @@ ...@@ -90,6 +104,7 @@
'../tools/js2c.py', '../tools/js2c.py',
'<@(_outputs)', '<@(_outputs)',
'D8', 'D8',
'off', # compress startup data
'<@(js_files)' '<@(js_files)'
], ],
}, },
......
...@@ -1438,6 +1438,7 @@ void SlotRef::ComputeSlotMappingForArguments(JavaScriptFrame* frame, ...@@ -1438,6 +1438,7 @@ void SlotRef::ComputeSlotMappingForArguments(JavaScriptFrame* frame,
UNREACHABLE(); UNREACHABLE();
} }
#ifdef ENABLE_DEBUGGER_SUPPORT
DeoptimizedFrameInfo::DeoptimizedFrameInfo( DeoptimizedFrameInfo::DeoptimizedFrameInfo(
Deoptimizer* deoptimizer, int frame_index) { Deoptimizer* deoptimizer, int frame_index) {
...@@ -1467,5 +1468,6 @@ void DeoptimizedFrameInfo::Iterate(ObjectVisitor* v) { ...@@ -1467,5 +1468,6 @@ void DeoptimizedFrameInfo::Iterate(ObjectVisitor* v) {
v->VisitPointers(expression_stack_, expression_stack_ + expression_count_); v->VisitPointers(expression_stack_, expression_stack_ + expression_count_);
} }
#endif // ENABLE_DEBUGGER_SUPPORT
} } // namespace v8::internal } } // namespace v8::internal
...@@ -438,7 +438,9 @@ void Heap::GarbageCollectionEpilogue() { ...@@ -438,7 +438,9 @@ void Heap::GarbageCollectionEpilogue() {
#if defined(DEBUG) #if defined(DEBUG)
ReportStatisticsAfterGC(); ReportStatisticsAfterGC();
#endif // DEBUG #endif // DEBUG
#ifdef ENABLE_DEBUGGER_SUPPORT
isolate_->debug()->AfterGarbageCollection(); isolate_->debug()->AfterGarbageCollection();
#endif // ENABLE_DEBUGGER_SUPPORT
} }
......
...@@ -79,6 +79,7 @@ ...@@ -79,6 +79,7 @@
'test-log.cc', 'test-log.cc',
'test-mark-compact.cc', 'test-mark-compact.cc',
'test-parsing.cc', 'test-parsing.cc',
'test-platform-tls.cc',
'test-profile-generator.cc', 'test-profile-generator.cc',
'test-regexp.cc', 'test-regexp.cc',
'test-reloc-info.cc', 'test-reloc-info.cc',
......
...@@ -48,7 +48,11 @@ class CcTestCase(test.TestCase): ...@@ -48,7 +48,11 @@ class CcTestCase(test.TestCase):
return self.path[-1] return self.path[-1]
def BuildCommand(self, name): def BuildCommand(self, name):
serialization_file = join('obj', 'test', self.mode, 'serdes') 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')
serialization_file += '_' + self.GetName() serialization_file += '_' + self.GetName()
serialization_file = join(self.context.buildspace, serialization_file) serialization_file = join(self.context.buildspace, serialization_file)
serialization_file += ''.join(self.variant_flags).replace('-', '_') serialization_file += ''.join(self.variant_flags).replace('-', '_')
...@@ -78,10 +82,15 @@ class CcTestConfiguration(test.TestConfiguration): ...@@ -78,10 +82,15 @@ class CcTestConfiguration(test.TestConfiguration):
return ['cctests'] return ['cctests']
def ListTests(self, current_path, path, mode, variant_flags): def ListTests(self, current_path, path, mode, variant_flags):
executable = join('obj', 'test', mode, 'cctest') executable = 'cctest'
if utils.IsWindows(): if utils.IsWindows():
executable += '.exe' executable += '.exe'
executable = join(self.context.buildspace, executable) 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)
output = test.Execute([executable, '--list'], self.context) output = test.Execute([executable, '--list'], self.context)
if output.exit_code != 0: if output.exit_code != 0:
print output.stdout print output.stdout
......
...@@ -27,7 +27,7 @@ ...@@ -27,7 +27,7 @@
import test import test
import os import os
from os.path import join, dirname, exists from os.path import join, dirname, exists, isfile
import platform import platform
import utils import utils
import re import re
...@@ -122,10 +122,15 @@ class PreparserTestConfiguration(test.TestConfiguration): ...@@ -122,10 +122,15 @@ class PreparserTestConfiguration(test.TestConfiguration):
{"Test": Test, "Template": Template}, {}) {"Test": Test, "Template": Template}, {})
def ListTests(self, current_path, path, mode, variant_flags): def ListTests(self, current_path, path, mode, variant_flags):
executable = join('obj', 'preparser', mode, 'preparser') executable = 'preparser'
if utils.IsWindows(): if utils.IsWindows():
executable += '.exe' executable += '.exe'
executable = join(self.context.buildspace, executable) 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() expectations = self.GetExpectations()
result = [] result = []
# Find all .js files in tests/preparser directory. # Find all .js files in tests/preparser directory.
......
This diff is collapsed.
#!/usr/bin/env python
#
# 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.
# This is a convenience script to run the existing tools/test.py script
# when using the gyp/make based build.
# It is intended as a stop-gap rather than a long-term solution.
import optparse
import os
from os.path import join, dirname, abspath
import subprocess
import sys
PROGRESS_INDICATORS = ['verbose', 'dots', 'color', 'mono']
def BuildOptions():
result = optparse.OptionParser()
# Flags specific to this wrapper script:
result.add_option("--arch-and-mode",
help='Architecture and mode in the format "arch.mode"',
default=None)
# Flags this wrapper script handles itself:
result.add_option("-m", "--mode",
help="The test modes in which to run (comma-separated)",
default='release,debug')
result.add_option("--arch",
help='The architectures to run tests for (comma-separated)',
default='ia32,x64,arm')
# Flags that are passed on to the wrapped test.py script:
result.add_option("-v", "--verbose", help="Verbose output",
default=False, action="store_true")
result.add_option("-p", "--progress",
help="The style of progress indicator (verbose, dots, color, mono)",
choices=PROGRESS_INDICATORS, default="mono")
result.add_option("--report", help="Print a summary of the tests to be run",
default=False, action="store_true")
result.add_option("-s", "--suite", help="A test suite",
default=[], action="append")
result.add_option("-t", "--timeout", help="Timeout in seconds",
default=60, type="int")
result.add_option("--snapshot", help="Run the tests with snapshot turned on",
default=False, action="store_true")
result.add_option("--special-command", default=None)
result.add_option("--valgrind", help="Run tests through valgrind",
default=False, action="store_true")
result.add_option("--cat", help="Print the source of the tests",
default=False, action="store_true")
result.add_option("--warn-unused", help="Report unused rules",
default=False, action="store_true")
result.add_option("-j", help="The number of parallel tasks to run",
default=1, type="int")
result.add_option("--time", help="Print timing information after running",
default=False, action="store_true")
result.add_option("--suppress-dialogs", help="Suppress Windows dialogs for crashing tests",
dest="suppress_dialogs", default=True, action="store_true")
result.add_option("--no-suppress-dialogs", help="Display Windows dialogs for crashing tests",
dest="suppress_dialogs", action="store_false")
result.add_option("--isolates", help="Whether to test isolates", default=False, action="store_true")
result.add_option("--store-unexpected-output",
help="Store the temporary JS files from tests that fails",
dest="store_unexpected_output", default=True, action="store_true")
result.add_option("--no-store-unexpected-output",
help="Deletes the temporary JS files from tests that fails",
dest="store_unexpected_output", action="store_false")
result.add_option("--stress-only",
help="Only run tests with --always-opt --stress-opt",
default=False, action="store_true")
result.add_option("--nostress",
help="Don't run crankshaft --always-opt --stress-op test",
default=False, action="store_true")
result.add_option("--crankshaft",
help="Run with the --crankshaft flag",
default=False, action="store_true")
result.add_option("--shard-count",
help="Split testsuites into this number of shards",
default=1, type="int")
result.add_option("--shard-run",
help="Run this shard from the split up tests.",
default=1, type="int")
result.add_option("--noprof", help="Disable profiling support",
default=False)
# Flags present in the original test.py that are unsupported in this wrapper:
# -S [-> scons_flags] (we build with gyp/make, not scons)
# --no-build (always true)
# --build-only (always false)
# --build-system (always 'gyp')
# --simulator (always true if arch==arm, always false otherwise)
# --shell (automatically chosen depending on arch and mode)
return result
def ProcessOptions(options):
if options.arch_and_mode != None and options.arch_and_mode != "":
tokens = options.arch_and_mode.split(".")
options.arch = tokens[0]
options.mode = tokens[1]
options.mode = options.mode.split(',')
for mode in options.mode:
if not mode in ['debug', 'release']:
print "Unknown mode %s" % mode
return False
options.arch = options.arch.split(',')
for arch in options.arch:
if not arch in ['ia32', 'x64', 'arm']:
print "Unknown architecture %s" % arch
return False
return True
def PassOnOptions(options):
result = []
if options.verbose:
result += ['--verbose']
if options.progress != 'mono':
result += ['--progress=' + options.progress]
if options.report:
result += ['--report']
if options.suite != []:
for suite in options.suite:
result += ['--suite=../../test/' + suite]
if options.timeout != 60:
result += ['--timeout=%s' % options.timeout]
if options.snapshot:
result += ['--snapshot']
if options.special_command:
result += ['--special-command=' + options.special_command]
if options.valgrind:
result += ['--valgrind']
if options.cat:
result += ['--cat']
if options.warn_unused:
result += ['--warn-unused']
if options.j != 1:
result += ['-j%s' % options.j]
if options.time:
result += ['--time']
if not options.suppress_dialogs:
result += ['--no-suppress-dialogs']
if options.isolates:
result += ['--isolates']
if not options.store_unexpected_output:
result += ['--no-store-unexpected_output']
if options.stress_only:
result += ['--stress-only']
if options.nostress:
result += ['--nostress']
if options.crankshaft:
result += ['--crankshaft']
if options.shard_count != 1:
result += ['--shard_count=%s' % options.shard_count]
if options.shard_run != 1:
result += ['--shard_run=%s' % options.shard_run]
if options.noprof:
result += ['--noprof']
return result
def Main():
parser = BuildOptions()
(options, args) = parser.parse_args()
if not ProcessOptions(options):
parser.print_help()
return 1
workspace = abspath(join(dirname(sys.argv[0]), '..'))
args_for_children = [workspace + '/tools/test.py'] + PassOnOptions(options)
args_for_children += ['--no-build', '--build-system=gyp']
for arg in args:
args_for_children += [arg]
returncodes = 0
for mode in options.mode:
for arch in options.arch:
print ">>> running tests for %s.%s" % (arch, mode)
shell = workspace + '/out/' + arch + '.' + mode + "/shell"
child = subprocess.Popen(' '.join(args_for_children +
['--mode=' + mode] +
['--shell=' + shell]),
shell=True,
cwd=workspace)
returncodes += child.wait()
return returncodes
if __name__ == '__main__':
sys.exit(Main())
...@@ -1181,6 +1181,8 @@ def BuildOptions(): ...@@ -1181,6 +1181,8 @@ def BuildOptions():
default=False, action="store_true") default=False, action="store_true")
result.add_option("--build-only", help="Only build requirements, don't run the tests", result.add_option("--build-only", help="Only build requirements, don't run the tests",
default=False, action="store_true") default=False, action="store_true")
result.add_option("--build-system", help="Build system in use (scons or gyp)",
default='scons')
result.add_option("--report", help="Print a summary of the tests to be run", result.add_option("--report", help="Print a summary of the tests to be run",
default=False, action="store_true") default=False, action="store_true")
result.add_option("-s", "--suite", help="A test suite", result.add_option("-s", "--suite", help="A test suite",
...@@ -1280,6 +1282,10 @@ def ProcessOptions(options): ...@@ -1280,6 +1282,10 @@ def ProcessOptions(options):
if options.noprof: if options.noprof:
options.scons_flags.append("prof=off") options.scons_flags.append("prof=off")
options.scons_flags.append("profilingsupport=off") options.scons_flags.append("profilingsupport=off")
if options.build_system == 'gyp':
if options.build_only:
print "--build-only not supported for gyp, please build manually."
options.build_only = False
return True return True
...@@ -1405,6 +1411,9 @@ def Main(): ...@@ -1405,6 +1411,9 @@ def Main():
run_valgrind = join(workspace, "tools", "run-valgrind.py") run_valgrind = join(workspace, "tools", "run-valgrind.py")
options.special_command = "python -u " + run_valgrind + " @" options.special_command = "python -u " + run_valgrind + " @"
if options.build_system == 'gyp':
SUFFIX['debug'] = ''
shell = abspath(options.shell) shell = abspath(options.shell)
buildspace = dirname(shell) buildspace = dirname(shell)
......
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