Skip to content

Commit

Permalink
Prepare for using GYP build on buildbots
Browse files Browse the repository at this point in the history
  • Loading branch information
jkummerow@chromium.org committed May 11, 2012
1 parent 371c8c0 commit ef4c5ce
Show file tree
Hide file tree
Showing 12 changed files with 107 additions and 45 deletions.
27 changes: 27 additions & 0 deletions 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"],
},
]
6 changes: 6 additions & 0 deletions Makefile
Expand Up @@ -137,6 +137,12 @@ ENVFILE = $(OUTDIR)/environment
# Target definitions. "all" is the default. # Target definitions. "all" is the default.
all: $(MODES) 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. # Compile targets. MODES and ARCHES are convenience targets.
.SECONDEXPANSION: .SECONDEXPANSION:
$(MODES): $(addsuffix .$$@,$(DEFAULT_ARCHES)) $(MODES): $(addsuffix .$$@,$(DEFAULT_ARCHES))
Expand Down
13 changes: 13 additions & 0 deletions SConstruct
Expand Up @@ -1601,4 +1601,17 @@ except:
pass 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() Build()
16 changes: 7 additions & 9 deletions build/common.gypi
Expand Up @@ -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" \ ['OS=="linux" or OS=="freebsd" or OS=="openbsd" or OS=="solaris" \
or OS=="netbsd"', { or OS=="netbsd"', {
'conditions': [ 'conditions': [
Expand Down Expand Up @@ -322,10 +329,6 @@
}, },
'VCLinkerTool': { 'VCLinkerTool': {
'LinkIncremental': '2', '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': [ 'conditions': [
Expand Down Expand Up @@ -407,12 +410,7 @@
'VCLinkerTool': { 'VCLinkerTool': {
'LinkIncremental': '1', 'LinkIncremental': '1',
'OptimizeReferences': '2', 'OptimizeReferences': '2',
'OptimizeForWindows98': '1',
'EnableCOMDATFolding': '2', '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" }], # OS=="win"
Expand Down
36 changes: 11 additions & 25 deletions build/gyp_v8
Expand Up @@ -38,6 +38,11 @@ import sys
script_dir = os.path.dirname(__file__) script_dir = os.path.dirname(__file__)
v8_root = os.path.normpath(os.path.join(script_dir, os.pardir)) 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')) sys.path.insert(0, os.path.join(v8_root, 'tools'))
import utils import utils


Expand Down Expand Up @@ -93,7 +98,7 @@ def additional_include_files(args=[]):
result.append(path) result.append(path)


# Always include standalone.gypi # 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. # Optionally add supplemental .gypi files if present.
supplements = glob.glob(os.path.join(v8_root, '*', 'supplement.gypi')) supplements = glob.glob(os.path.join(v8_root, '*', 'supplement.gypi'))
Expand Down Expand Up @@ -135,7 +140,10 @@ if __name__ == '__main__':
# path separators even on Windows due to the use of shlex.split(). # path separators even on Windows due to the use of shlex.split().
args.extend(shlex.split(gyp_file)) args.extend(shlex.split(gyp_file))
else: 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)]) args.extend(['-I' + i for i in additional_include_files(args)])


Expand All @@ -156,28 +164,6 @@ if __name__ == '__main__':


# Generate for the architectures supported on the given platform. # Generate for the architectures supported on the given platform.
gyp_args = list(args) 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': if utils.GuessOS() == 'linux':
gyp_args.append('-S.ia32') gyp_args.append('--generator-output=out')
run_gyp(gyp_args) 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)
4 changes: 4 additions & 0 deletions build/standalone.gypi
Expand Up @@ -169,6 +169,9 @@
}, },
}], # OS=="win" }], # OS=="win"
['OS=="mac"', { ['OS=="mac"', {
'xcode_settings': {
'SYMROOT': '<(DEPTH)/xcodebuild',
},
'target_defaults': { 'target_defaults': {
'xcode_settings': { 'xcode_settings': {
'ALWAYS_SEARCH_USER_PATHS': 'NO', 'ALWAYS_SEARCH_USER_PATHS': 'NO',
Expand All @@ -188,6 +191,7 @@
'GCC_WARN_ABOUT_MISSING_NEWLINE': 'YES', # -Wnewline-eof 'GCC_WARN_ABOUT_MISSING_NEWLINE': 'YES', # -Wnewline-eof
'MACOSX_DEPLOYMENT_TARGET': '10.4', # -mmacosx-version-min=10.4 'MACOSX_DEPLOYMENT_TARGET': '10.4', # -mmacosx-version-min=10.4
'PREBINDING': 'NO', # No -Wl,-prebind 'PREBINDING': 'NO', # No -Wl,-prebind
'SYMROOT': '<(DEPTH)/xcodebuild',
'USE_HEADERMAP': 'NO', 'USE_HEADERMAP': 'NO',
'OTHER_CFLAGS': [ 'OTHER_CFLAGS': [
'-fno-strict-aliasing', '-fno-strict-aliasing',
Expand Down
2 changes: 2 additions & 0 deletions test/cctest/testcfg.py
Expand Up @@ -53,6 +53,8 @@ def BuildCommand(self, name):
serialization_file = join('obj', 'test', self.mode, 'serdes') serialization_file = join('obj', 'test', self.mode, 'serdes')
else: else:
serialization_file = join('obj', 'serdes') 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 += '_' + 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('-', '_')
Expand Down
3 changes: 3 additions & 0 deletions test/mjsunit/big-array-literal.js
Expand Up @@ -25,6 +25,9 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // 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. // Test that we can make large object literals that work.
// Also test that we can attempt to make even larger object literals without // Also test that we can attempt to make even larger object literals without
// crashing. // crashing.
Expand Down
7 changes: 6 additions & 1 deletion test/test262/testcfg.py
Expand Up @@ -31,6 +31,7 @@
from os.path import join, exists from os.path import join, exists
import urllib import urllib
import hashlib import hashlib
import sys
import tarfile import tarfile




Expand Down Expand Up @@ -120,7 +121,11 @@ def DownloadData(self):
os.remove(archive_name) os.remove(archive_name)
raise Exception("Hash mismatch of test data file") raise Exception("Hash mismatch of test data file")
archive = tarfile.open(archive_name, 'r:bz2') 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) os.rename(join(self.root, 'test262-%s' % revision), directory_name)


def GetBuildRequirements(self): def GetBuildRequirements(self):
Expand Down
14 changes: 11 additions & 3 deletions tools/check-static-initializers.sh
Expand Up @@ -37,19 +37,27 @@
expected_static_init_count=3 expected_static_init_count=3


v8_root=$(readlink -f $(dirname $BASH_SOURCE)/../) 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 if [ ! -f "$d8" ]; then
echo "Please build the project with SCons." echo "d8 binary not found: $d8"
exit 1 exit 1
fi 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) static_init_count=$(echo "$static_inits" | wc -l)


if [ $static_init_count -gt $expected_static_init_count ]; then if [ $static_init_count -gt $expected_static_init_count ]; then
echo "Too many static initializers." echo "Too many static initializers."
echo "$static_inits" echo "$static_inits"
exit 1 exit 1
else
echo "Static initializer check passed ($static_init_count initializers)."
exit 0
fi fi
3 changes: 2 additions & 1 deletion tools/presubmit.py
Expand Up @@ -303,7 +303,8 @@ def IgnoreDir(self, name):
or (name == 'third_party') or (name == 'third_party')
or (name == 'gyp') or (name == 'gyp')
or (name == 'out') or (name == 'out')
or (name == 'obj')) or (name == 'obj')
or (name == 'DerivedSources'))


IGNORE_COPYRIGHTS = ['cpplint.py', IGNORE_COPYRIGHTS = ['cpplint.py',
'earley-boyer.js', 'earley-boyer.js',
Expand Down
21 changes: 15 additions & 6 deletions tools/test-wrapper-gypbuild.py
@@ -1,6 +1,6 @@
#!/usr/bin/env python #!/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 # 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:
Expand Down Expand Up @@ -56,6 +56,9 @@ def BuildOptions():
result.add_option("--no-presubmit", result.add_option("--no-presubmit",
help='Skip presubmit checks', help='Skip presubmit checks',
default=False, action="store_true") 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: # Flags this wrapper script handles itself:
result.add_option("-m", "--mode", result.add_option("-m", "--mode",
Expand Down Expand Up @@ -144,14 +147,16 @@ def ProcessOptions(options):
options.mode = options.mode.split(',') options.mode = options.mode.split(',')
options.arch = options.arch.split(',') options.arch = options.arch.split(',')
for mode in options.mode: for mode in options.mode:
if not mode in ['debug', 'release']: if not mode.lower() in ['debug', 'release']:
print "Unknown mode %s" % mode print "Unknown mode %s" % mode
return False return False
for arch in options.arch: for arch in options.arch:
if not arch in ['ia32', 'x64', 'arm', 'mips']: if not arch in ['ia32', 'x64', 'arm', 'mips']:
print "Unknown architecture %s" % arch print "Unknown architecture %s" % arch
return False return False

if options.buildbot:
# Buildbots run presubmit tests as a separate step.
options.no_presubmit = True
return True return True




Expand Down Expand Up @@ -213,22 +218,26 @@ def Main():
return 1 return 1


workspace = abspath(join(dirname(sys.argv[0]), '..')) workspace = abspath(join(dirname(sys.argv[0]), '..'))
returncodes = 0


if not options.no_presubmit: if not options.no_presubmit:
print ">>> running presubmit tests" 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 = [workspace + '/tools/test.py'] + PassOnOptions(options)
args_for_children += ['--no-build', '--build-system=gyp'] args_for_children += ['--no-build', '--build-system=gyp']
for arg in args: for arg in args:
args_for_children += [arg] args_for_children += [arg]
returncodes = 0
env = os.environ env = os.environ


for mode in options.mode: for mode in options.mode:
for arch in options.arch: for arch in options.arch:
print ">>> running tests for %s.%s" % (arch, mode) 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' env['LD_LIBRARY_PATH'] = shellpath + '/lib.target'
shell = shellpath + "/d8" shell = shellpath + "/d8"
child = subprocess.Popen(' '.join(args_for_children + child = subprocess.Popen(' '.join(args_for_children +
Expand Down

0 comments on commit ef4c5ce

Please sign in to comment.