test: run v8 tests from node tree

Ported by exinfinitum from a PR by jasnell:
see https://github.com/nodejs/node-v0.x-archive/pull/14185

Allows the running of v8 tests on node's packaged v8 source code.

Note that the limited win32 support added by jasnell has NOT been ported,
and so these tests are currently UNIX ONLY.

Note that gclient depot tools
(see https://commondatastorage.googleapis.com/
chrome-infra-docs/flat/depot_tools/docs/html/
depot_tools_tutorial.html#_setting_up) and subversion are required
to run tests.

To perform tests, run the following commands:

make v8 DESTCPU=(ARCH)
make test-v8 DESTCPU=(ARCH)

where (ARCH) is your CPU architecture, e.g. x64, ia32.
DESTCPU MUST be specified for this to work properly.

Can also do tests on debug build by using "make test-v8 DESTCPU=(ARCH)
BUILDTYPE=Debug", or perform intl or benchmark tests via make
test-v8-intl or test-v8-benchmarks respectively.

Note that by default, quickcheck and TAP output are disabled, and i18n
is enabled. To activate these options, use options"QUICKCHECK=True" and
"ENABLE_V8_TAP=True" respectively.

Use "DISABLE_V8_I18N" to disable i18n.

Use V8_BUILD_OPTIONS to allow custom user-defined flags to be
appended onto "make v8".

Any tests performed after changes to the packaged v8 file will require
recompiling of v8, which can be done using "make v8 DESTCPU=(ARCH)".

Finally, two additional files necessary for one of the v8 tests have
been added to the v8 folder.

PR-URL: https://github.com/nodejs/node/pull/4704
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: targos - Michaël Zasso <mic.besace@gmail.com>
This commit is contained in:
Bryon Leung 2015-03-27 21:39:06 -07:00 committed by Michael Dawson
parent 9bee03aaf2
commit cd720f816a
5 changed files with 2745 additions and 1 deletions

View File

@ -11,6 +11,23 @@ STAGINGSERVER ?= node-www
OSTYPE := $(shell uname -s | tr '[A-Z]' '[a-z]')
ifdef QUICKCHECK
QUICKCHECK_ARG := --quickcheck
endif
ifdef ENABLE_V8_TAP
TAP_V8 := --junitout v8-tap.xml
TAP_V8_INTL := --junitout v8-intl-tap.xml
TAP_V8_BENCHMARKS := --junitout v8-benchmarks-tap.xml
endif
ifdef DISABLE_V8_I18N
V8_TEST_NO_I18N := --noi18n
V8_BUILD_OPTIONS += i18nsupport=off
endif
BUILDTYPE_LOWER := $(shell echo $(BUILDTYPE) | tr '[A-Z]' '[a-z]')
# Determine EXEEXT
EXEEXT := $(shell $(PYTHON) -c \
"import sys; print('.exe' if sys.platform == 'win32' else '')")
@ -81,12 +98,18 @@ distclean:
-rm -rf deps/icu
-rm -rf deps/icu4c*.tgz deps/icu4c*.zip deps/icu-tmp
-rm -f $(BINARYTAR).* $(TARBALL).*
-rm -rf deps/v8/testing/gmock
-rm -rf deps/v8/testing/gtest
check: test
cctest: all
@out/$(BUILDTYPE)/$@
v8:
tools/make-v8.sh v8
$(MAKE) -C deps/v8 $(V8_ARCH) $(V8_BUILD_OPTIONS)
test: | cctest # Depends on 'all'.
$(PYTHON) tools/test.py --mode=release message parallel sequential -J
$(MAKE) jslint
@ -184,6 +207,30 @@ test-timers:
test-timers-clean:
$(MAKE) --directory=tools clean
test-v8:
# note: performs full test unless QUICKCHECK is specified
deps/v8/tools/run-tests.py --arch=$(V8_ARCH) \
--mode=$(BUILDTYPE_LOWER) $(V8_TEST_NO_I18N) $(QUICKCHECK_ARG) \
--no-presubmit \
--shell-dir=$(PWD)/deps/v8/out/$(V8_ARCH).$(BUILDTYPE_LOWER) \
$(TAP_V8)
test-v8-intl:
# note: performs full test unless QUICKCHECK is specified
deps/v8/tools/run-tests.py --arch=$(V8_ARCH) \
--mode=$(BUILDTYPE_LOWER) --no-presubmit $(QUICKCHECK_ARG) \
--shell-dir=deps/v8/out/$(V8_ARCH).$(BUILDTYPE_LOWER) intl \
$(TAP_V8_INTL)
test-v8-benchmarks:
deps/v8/tools/run-tests.py --arch=$(V8_ARCH) --mode=$(BUILDTYPE_LOWER) \
--download-data $(QUICKCHECK_ARG) --no-presubmit \
--shell-dir=deps/v8/out/$(V8_ARCH).$(BUILDTYPE_LOWER) benchmarks \
$(TAP_V8_BENCHMARKS)
test-v8-all: test-v8 test-v8-intl test-v8-benchmarks
# runs all v8 tests
apidoc_sources = $(wildcard doc/api/*.markdown)
apidocs = $(addprefix out/,$(apidoc_sources:.markdown=.html)) \
$(addprefix out/,$(apidoc_sources:.markdown=.json))
@ -288,6 +335,15 @@ endif
endif
endif
# node and v8 use different arch names (e.g. node 'x86' vs v8 'ia32').
# pass the proper v8 arch name to $V8_ARCH based on user-specified $DESTCPU.
ifeq ($(DESTCPU),x86)
V8_ARCH=ia32
else
V8_ARCH ?= $(DESTCPU)
endif
# enforce "x86" over "ia32" as the generally accepted way of referring to 32-bit intel
ifeq ($(ARCH),ia32)
override ARCH=x86
@ -556,4 +612,5 @@ lint: jslint cpplint
dynamiclib test test-all test-addons build-addons website-upload pkg \
blog blogclean tar binary release-only bench-http-simple bench-idle \
bench-all bench bench-misc bench-array bench-buffer bench-net \
bench-http bench-fs bench-tls cctest run-ci
bench-http bench-fs bench-tls cctest run-ci test-v8 test-v8-intl \
test-v8-benchmarks test-v8-all v8

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,11 @@
shared-library,"shell",0x08048000,0x081ee000
shared-library,"/lib32/libm-2.7.so",0xf7db6000,0xf7dd9000
shared-library,"ffffe000-fffff000",0xffffe000,0xfffff000
profiler,"begin",1
code-creation,Stub,0,0x424260,348,"CompareStub_GE"
code-creation,LazyCompile,0,0x2a8100,18535,"DrawQube 3d-cube.js:188",0xf43abcac,
code-creation,LazyCompile,0,0x480100,3908,"DrawLine 3d-cube.js:17",0xf43abc50,
tick,0x424284,0,0,0x480600,0,0x2aaaa5
tick,0x42429f,0,0,0x480600,0,0x2aacb4
tick,0x48063d,0,0,0x2d0f7c,0,0x2aaec6
profiler,"end"

View File

@ -0,0 +1,25 @@
shared-library,"shell",0x08048000,0x081ee000
shared-library,"/lib32/libm-2.7.so",0xf7db6000,0xf7dd9000
shared-library,"ffffe000-fffff000",0xffffe000,0xfffff000
profiler,"begin",1
code-creation,Stub,0,0xf540a100,474,"CEntryStub"
code-creation,Script,0,0xf541cd80,736,"exp.js"
code-creation,Stub,0,0xf541d0e0,47,"RuntimeStub_Math_exp"
code-creation,LazyCompile,0,0xf541d120,145,"exp native math.js:41"
function-creation,0xf441d280,0xf541d120
code-creation,LoadIC,0,0xf541d280,117,"j"
code-creation,LoadIC,0,0xf541d360,63,"i"
tick,0x80f82d1,0,0,0,0,0xf541ce5c
tick,0x80f89a1,0,0,0,0,0xf541ce5c
tick,0x8123b5c,0,0,0,0,0xf541d1a1,0xf541ceea
tick,0x8123b65,0,0,0,0,0xf541d1a1,0xf541ceea
tick,0xf541d2be,0,0,0,0
tick,0xf541d320,0,0,0,0
tick,0xf541d384,0,0,0,0
tick,0xf7db94da,0,0,0,0,0xf541d1a1,0xf541ceea
tick,0xf7db951c,0,0,0,0,0xf541d1a1,0xf541ceea
tick,0xf7dbc508,0,0,0,0,0xf541d1a1,0xf541ceea
tick,0xf7dbff21,0,0,0,0,0xf541d1a1,0xf541ceea
tick,0xf7edec90,0,0,0,0,0xf541d1a1,0xf541ceea
tick,0xffffe402,0,0,0,0
profiler,"end"

38
tools/make-v8.sh Executable file
View File

@ -0,0 +1,38 @@
#!/bin/bash
git_origin=$(git config --get remote.origin.url | sed 's/.\+[\/:]\([^\/]\+\/[^\/]\+\)$/\1/')
git_branch=$(git rev-parse --abbrev-ref HEAD)
v8ver=${1:-v8} #default v8
svn_prefix=https://github.com
svn_path="$svn_prefix/$git_origin/branches/$git_branch/deps/$v8ver"
#svn_path="$git_origin/branches/$git_branch/deps/$v8ver"
gclient_string="solutions = [{'name': 'v8', 'url': '$svn_path', 'managed': False}]"
# clean up if someone presses ctrl-c
trap cleanup INT
function cleanup() {
trap - INT
rm .gclient || true
rm .gclient_entries || true
rm -rf _bad_scm/ || true
#if v8ver isn't v8, move the v8 folders
#back to what they were
if [ "$v8ver" != "v8" ]; then
mv v8 $v8ver
mv .v8old v8
fi
exit 0
}
cd deps
echo $gclient_string > .gclient
if [ "$v8ver" != "v8" ]; then
mv v8 .v8old
mv $v8ver v8
fi
gclient sync
cleanup