Skip to content

Commit 98596a9

Browse files
exinfinitumrvagg
authored andcommitted
test: run v8 tests from node tree
Ported by exinfinitum from a PR by jasnell: see nodejs/node-v0.x-archive#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: #4704 Reviewed-By: James M Snell <[email protected]> Reviewed-By: Michael Dawson <[email protected]> Reviewed-By: Ben Noordhuis <[email protected]> Reviewed-By: targos - Michaël Zasso <[email protected]>
1 parent 7e82a56 commit 98596a9

File tree

5 files changed

+2745
-1
lines changed

5 files changed

+2745
-1
lines changed

Makefile

Lines changed: 58 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,23 @@ STAGINGSERVER ?= node-www
1111

1212
OSTYPE := $(shell uname -s | tr '[A-Z]' '[a-z]')
1313

14+
ifdef QUICKCHECK
15+
QUICKCHECK_ARG := --quickcheck
16+
endif
17+
18+
ifdef ENABLE_V8_TAP
19+
TAP_V8 := --junitout v8-tap.xml
20+
TAP_V8_INTL := --junitout v8-intl-tap.xml
21+
TAP_V8_BENCHMARKS := --junitout v8-benchmarks-tap.xml
22+
endif
23+
24+
ifdef DISABLE_V8_I18N
25+
V8_TEST_NO_I18N := --noi18n
26+
V8_BUILD_OPTIONS += i18nsupport=off
27+
endif
28+
29+
BUILDTYPE_LOWER := $(shell echo $(BUILDTYPE) | tr '[A-Z]' '[a-z]')
30+
1431
# Determine EXEEXT
1532
EXEEXT := $(shell $(PYTHON) -c \
1633
"import sys; print('.exe' if sys.platform == 'win32' else '')")
@@ -81,12 +98,18 @@ distclean:
8198
-rm -rf deps/icu
8299
-rm -rf deps/icu4c*.tgz deps/icu4c*.zip deps/icu-tmp
83100
-rm -f $(BINARYTAR).* $(TARBALL).*
101+
-rm -rf deps/v8/testing/gmock
102+
-rm -rf deps/v8/testing/gtest
84103

85104
check: test
86105

87106
cctest: all
88107
@out/$(BUILDTYPE)/$@
89108

109+
v8:
110+
tools/make-v8.sh v8
111+
$(MAKE) -C deps/v8 $(V8_ARCH) $(V8_BUILD_OPTIONS)
112+
90113
test: | cctest # Depends on 'all'.
91114
$(PYTHON) tools/test.py --mode=release message parallel sequential -J
92115
$(MAKE) jslint
@@ -184,6 +207,30 @@ test-timers:
184207
test-timers-clean:
185208
$(MAKE) --directory=tools clean
186209

210+
test-v8:
211+
# note: performs full test unless QUICKCHECK is specified
212+
deps/v8/tools/run-tests.py --arch=$(V8_ARCH) \
213+
--mode=$(BUILDTYPE_LOWER) $(V8_TEST_NO_I18N) $(QUICKCHECK_ARG) \
214+
--no-presubmit \
215+
--shell-dir=$(PWD)/deps/v8/out/$(V8_ARCH).$(BUILDTYPE_LOWER) \
216+
$(TAP_V8)
217+
218+
test-v8-intl:
219+
# note: performs full test unless QUICKCHECK is specified
220+
deps/v8/tools/run-tests.py --arch=$(V8_ARCH) \
221+
--mode=$(BUILDTYPE_LOWER) --no-presubmit $(QUICKCHECK_ARG) \
222+
--shell-dir=deps/v8/out/$(V8_ARCH).$(BUILDTYPE_LOWER) intl \
223+
$(TAP_V8_INTL)
224+
225+
test-v8-benchmarks:
226+
deps/v8/tools/run-tests.py --arch=$(V8_ARCH) --mode=$(BUILDTYPE_LOWER) \
227+
--download-data $(QUICKCHECK_ARG) --no-presubmit \
228+
--shell-dir=deps/v8/out/$(V8_ARCH).$(BUILDTYPE_LOWER) benchmarks \
229+
$(TAP_V8_BENCHMARKS)
230+
231+
test-v8-all: test-v8 test-v8-intl test-v8-benchmarks
232+
# runs all v8 tests
233+
187234
apidoc_sources = $(wildcard doc/api/*.markdown)
188235
apidocs = $(addprefix out/,$(apidoc_sources:.markdown=.html)) \
189236
$(addprefix out/,$(apidoc_sources:.markdown=.json))
@@ -288,6 +335,15 @@ endif
288335
endif
289336
endif
290337

338+
# node and v8 use different arch names (e.g. node 'x86' vs v8 'ia32').
339+
# pass the proper v8 arch name to $V8_ARCH based on user-specified $DESTCPU.
340+
ifeq ($(DESTCPU),x86)
341+
V8_ARCH=ia32
342+
else
343+
V8_ARCH ?= $(DESTCPU)
344+
345+
endif
346+
291347
# enforce "x86" over "ia32" as the generally accepted way of referring to 32-bit intel
292348
ifeq ($(ARCH),ia32)
293349
override ARCH=x86
@@ -556,4 +612,5 @@ lint: jslint cpplint
556612
dynamiclib test test-all test-addons build-addons website-upload pkg \
557613
blog blogclean tar binary release-only bench-http-simple bench-idle \
558614
bench-all bench bench-misc bench-array bench-buffer bench-net \
559-
bench-http bench-fs bench-tls cctest run-ci
615+
bench-http bench-fs bench-tls cctest run-ci test-v8 test-v8-intl \
616+
test-v8-benchmarks test-v8-all v8

0 commit comments

Comments
 (0)