From 18191055598502e3ef7eadc9b3cf316c7ebccc8b Mon Sep 17 00:00:00 2001 From: "jkummerow@chromium.org" Date: Fri, 11 May 2012 12:18:09 +0000 Subject: [PATCH] Prepare for using GYP build on buildbots Review URL: https://chromiumcodereview.appspot.com/10383128 git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@11546 ce2b1a6d-e550-0410-aec6-3dcde31c8c00 --- DEPS | 27 ++++++++++++++++++++++ Makefile | 6 +++++ SConstruct | 13 +++++++++++ build/common.gypi | 16 ++++++------- build/gyp_v8 | 36 +++++++++--------------------- build/standalone.gypi | 4 ++++ test/cctest/testcfg.py | 2 ++ test/mjsunit/big-array-literal.js | 3 +++ test/test262/testcfg.py | 7 +++++- tools/check-static-initializers.sh | 14 +++++++++--- tools/presubmit.py | 3 ++- tools/test-wrapper-gypbuild.py | 21 ++++++++++++----- 12 files changed, 107 insertions(+), 45 deletions(-) create mode 100644 DEPS diff --git a/DEPS b/DEPS new file mode 100644 index 0000000000..e50d1d20f6 --- /dev/null +++ b/DEPS @@ -0,0 +1,27 @@ +# Note: The buildbots evaluate this file with CWD set to the parent +# directory and assume that the root of the checkout is in ./v8/, so +# all paths in here must match this assumption. + +deps = { + # Remember to keep the revision in sync with the Makefile. + "v8/build/gyp": + "http://gyp.googlecode.com/svn/trunk@1282", +} + +deps_os = { + "win": { + "v8/third_party/cygwin": + "http://src.chromium.org/svn/trunk/deps/third_party/cygwin@66844", + + "v8/third_party/python_26": + "http://src.chromium.org/svn/trunk/tools/third_party/python_26@89111", + } +} + +hooks = [ + { + # A change to a .gyp, .gypi, or to GYP itself should run the generator. + "pattern": ".", + "action": ["python", "v8/build/gyp_v8"], + }, +] diff --git a/Makefile b/Makefile index 277c1f786d..fbca56644c 100644 --- a/Makefile +++ b/Makefile @@ -137,6 +137,12 @@ ENVFILE = $(OUTDIR)/environment # Target definitions. "all" is the default. all: $(MODES) +# Special target for the buildbots to use. Depends on $(OUTDIR)/Makefile +# having been created before. +buildbot: + $(MAKE) -C "$(OUTDIR)" BUILDTYPE=$(BUILDTYPE) \ + builddir="$(abspath $(OUTDIR))/$(BUILDTYPE)" + # Compile targets. MODES and ARCHES are convenience targets. .SECONDEXPANSION: $(MODES): $(addsuffix .$$@,$(DEFAULT_ARCHES)) diff --git a/SConstruct b/SConstruct index 34d0efc5ff..b0d1344700 100644 --- a/SConstruct +++ b/SConstruct @@ -1601,4 +1601,17 @@ except: pass +def WarnAboutDeprecation(): + print """ +####################################################### +# WARNING: Building V8 with SCons is deprecated and # +# will not work much longer. Please switch to using # +# the GYP-based build now. Instructions are at # +# http://code.google.com/p/v8/wiki/BuildingWithGYP. # +####################################################### + """ + +WarnAboutDeprecation() +import atexit +atexit.register(WarnAboutDeprecation) Build() diff --git a/build/common.gypi b/build/common.gypi index 45195f12d1..4a9d45dd14 100644 --- a/build/common.gypi +++ b/build/common.gypi @@ -280,6 +280,13 @@ }, }, }], + ['OS=="win" and v8_target_arch=="x64"', { + 'msvs_settings': { + 'VCLinkerTool': { + 'StackReserveSize': '2097152', + }, + }, + }], ['OS=="linux" or OS=="freebsd" or OS=="openbsd" or OS=="solaris" \ or OS=="netbsd"', { 'conditions': [ @@ -322,10 +329,6 @@ }, 'VCLinkerTool': { 'LinkIncremental': '2', - # For future reference, the stack size needs to be increased - # when building for Windows 64-bit, otherwise some test cases - # can cause stack overflow. - # 'StackReserveSize': '297152', }, }, 'conditions': [ @@ -407,12 +410,7 @@ 'VCLinkerTool': { 'LinkIncremental': '1', 'OptimizeReferences': '2', - 'OptimizeForWindows98': '1', 'EnableCOMDATFolding': '2', - # For future reference, the stack size needs to be - # increased when building for Windows 64-bit, otherwise - # some test cases can cause stack overflow. - # 'StackReserveSize': '297152', }, }, }], # OS=="win" diff --git a/build/gyp_v8 b/build/gyp_v8 index a926fe8ca3..345f777d79 100755 --- a/build/gyp_v8 +++ b/build/gyp_v8 @@ -38,6 +38,11 @@ import sys script_dir = os.path.dirname(__file__) v8_root = os.path.normpath(os.path.join(script_dir, os.pardir)) +if __name__ == '__main__': + os.chdir(v8_root) + script_dir = os.path.dirname(__file__) + v8_root = '.' + sys.path.insert(0, os.path.join(v8_root, 'tools')) import utils @@ -93,7 +98,7 @@ def additional_include_files(args=[]): result.append(path) # Always include standalone.gypi - AddInclude(os.path.join(script_dir, 'standalone.gypi')) + AddInclude(os.path.join(v8_root, 'build', 'standalone.gypi')) # Optionally add supplemental .gypi files if present. supplements = glob.glob(os.path.join(v8_root, '*', 'supplement.gypi')) @@ -135,7 +140,10 @@ if __name__ == '__main__': # path separators even on Windows due to the use of shlex.split(). args.extend(shlex.split(gyp_file)) else: - args.append(os.path.join(script_dir, 'all.gyp')) + # Note that this must not start with "./" or things break. + # So we rely on having done os.chdir(v8_root) above and use the + # relative path. + args.append(os.path.join('build', 'all.gyp')) args.extend(['-I' + i for i in additional_include_files(args)]) @@ -156,28 +164,6 @@ if __name__ == '__main__': # Generate for the architectures supported on the given platform. gyp_args = list(args) - target_arch = None - for p in gyp_args: - if p.find('-Dtarget_arch=') == 0: - target_arch = p - if target_arch is None: - gyp_args.append('-Dtarget_arch=ia32') if utils.GuessOS() == 'linux': - gyp_args.append('-S.ia32') + gyp_args.append('--generator-output=out') run_gyp(gyp_args) - - if utils.GuessOS() == 'linux': - gyp_args = list(args) - gyp_args.append('-Dtarget_arch=x64') - gyp_args.append('-S.x64') - run_gyp(gyp_args) - - gyp_args = list(args) - gyp_args.append('-Dv8_target_arch=arm') - gyp_args.append('-S.arm') - run_gyp(gyp_args) - - gyp_args = list(args) - gyp_args.append('-Dv8_target_arch=mips') - gyp_args.append('-S.mips') - run_gyp(gyp_args) diff --git a/build/standalone.gypi b/build/standalone.gypi index dad05ae962..f104d08c19 100644 --- a/build/standalone.gypi +++ b/build/standalone.gypi @@ -169,6 +169,9 @@ }, }], # OS=="win" ['OS=="mac"', { + 'xcode_settings': { + 'SYMROOT': '<(DEPTH)/xcodebuild', + }, 'target_defaults': { 'xcode_settings': { 'ALWAYS_SEARCH_USER_PATHS': 'NO', @@ -188,6 +191,7 @@ 'GCC_WARN_ABOUT_MISSING_NEWLINE': 'YES', # -Wnewline-eof 'MACOSX_DEPLOYMENT_TARGET': '10.4', # -mmacosx-version-min=10.4 'PREBINDING': 'NO', # No -Wl,-prebind + 'SYMROOT': '<(DEPTH)/xcodebuild', 'USE_HEADERMAP': 'NO', 'OTHER_CFLAGS': [ '-fno-strict-aliasing', diff --git a/test/cctest/testcfg.py b/test/cctest/testcfg.py index b2eabc44eb..f1387e8a4f 100644 --- a/test/cctest/testcfg.py +++ b/test/cctest/testcfg.py @@ -53,6 +53,8 @@ class CcTestCase(test.TestCase): 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('-', '_') diff --git a/test/mjsunit/big-array-literal.js b/test/mjsunit/big-array-literal.js index a0fad7c2ee..8e0ff87277 100644 --- a/test/mjsunit/big-array-literal.js +++ b/test/mjsunit/big-array-literal.js @@ -25,6 +25,9 @@ // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// On MacOS, this test needs a stack size of at least 538 kBytes. +// Flags: --stack-size=600 + // Test that we can make large object literals that work. // Also test that we can attempt to make even larger object literals without // crashing. diff --git a/test/test262/testcfg.py b/test/test262/testcfg.py index 2c9bf06f14..07f760c8d7 100644 --- a/test/test262/testcfg.py +++ b/test/test262/testcfg.py @@ -31,6 +31,7 @@ import os from os.path import join, exists import urllib import hashlib +import sys import tarfile @@ -120,7 +121,11 @@ class Test262TestConfiguration(test.TestConfiguration): os.remove(archive_name) raise Exception("Hash mismatch of test data file") archive = tarfile.open(archive_name, 'r:bz2') - archive.extractall(join(self.root)) + 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): diff --git a/tools/check-static-initializers.sh b/tools/check-static-initializers.sh index e6da828765..1103a97787 100755 --- a/tools/check-static-initializers.sh +++ b/tools/check-static-initializers.sh @@ -37,14 +37,19 @@ expected_static_init_count=3 v8_root=$(readlink -f $(dirname $BASH_SOURCE)/../) -d8="${v8_root}/d8" + +if [ -n "$1" ] ; then + d8="${v8_root}/$1" +else + d8="${v8_root}/d8" +fi if [ ! -f "$d8" ]; then - echo "Please build the project with SCons." + echo "d8 binary not found: $d8" exit 1 fi -static_inits=$(nm "$d8" | grep _GLOBAL__I | awk '{ print $NF; }') +static_inits=$(nm "$d8" | grep _GLOBAL_ | grep _I_ | awk '{ print $NF; }') static_init_count=$(echo "$static_inits" | wc -l) @@ -52,4 +57,7 @@ if [ $static_init_count -gt $expected_static_init_count ]; then echo "Too many static initializers." echo "$static_inits" exit 1 +else + echo "Static initializer check passed ($static_init_count initializers)." + exit 0 fi diff --git a/tools/presubmit.py b/tools/presubmit.py index c606e42e69..a0b81e85f4 100755 --- a/tools/presubmit.py +++ b/tools/presubmit.py @@ -303,7 +303,8 @@ class SourceProcessor(SourceFileProcessor): or (name == 'third_party') or (name == 'gyp') or (name == 'out') - or (name == 'obj')) + or (name == 'obj') + or (name == 'DerivedSources')) IGNORE_COPYRIGHTS = ['cpplint.py', 'earley-boyer.js', diff --git a/tools/test-wrapper-gypbuild.py b/tools/test-wrapper-gypbuild.py index fda4105a98..eda2459173 100755 --- a/tools/test-wrapper-gypbuild.py +++ b/tools/test-wrapper-gypbuild.py @@ -1,6 +1,6 @@ #!/usr/bin/env python # -# Copyright 2011 the V8 project authors. All rights reserved. +# Copyright 2012 the V8 project authors. All rights reserved. # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are # met: @@ -56,6 +56,9 @@ def BuildOptions(): result.add_option("--no-presubmit", help='Skip presubmit checks', default=False, action="store_true") + result.add_option("--buildbot", + help='Adapt to path structure used on buildbots', + default=False, action="store_true") # Flags this wrapper script handles itself: result.add_option("-m", "--mode", @@ -144,14 +147,16 @@ def ProcessOptions(options): options.mode = options.mode.split(',') options.arch = options.arch.split(',') for mode in options.mode: - if not mode in ['debug', 'release']: + if not mode.lower() in ['debug', 'release']: print "Unknown mode %s" % mode return False for arch in options.arch: if not arch in ['ia32', 'x64', 'arm', 'mips']: print "Unknown architecture %s" % arch return False - + if options.buildbot: + # Buildbots run presubmit tests as a separate step. + options.no_presubmit = True return True @@ -213,22 +218,26 @@ def Main(): return 1 workspace = abspath(join(dirname(sys.argv[0]), '..')) + returncodes = 0 if not options.no_presubmit: print ">>> running presubmit tests" - subprocess.call([workspace + '/tools/presubmit.py']) + returncodes += subprocess.call([workspace + '/tools/presubmit.py']) 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 env = os.environ for mode in options.mode: for arch in options.arch: print ">>> running tests for %s.%s" % (arch, mode) - shellpath = workspace + '/' + options.outdir + '/' + arch + '.' + mode + if options.buildbot: + shellpath = workspace + '/' + options.outdir + '/' + mode + mode = mode.lower() + else: + shellpath = workspace + '/' + options.outdir + '/' + arch + '.' + mode env['LD_LIBRARY_PATH'] = shellpath + '/lib.target' shell = shellpath + "/d8" child = subprocess.Popen(' '.join(args_for_children +