Skip to content

Commit 9606f76

Browse files
exinfinitumMyles Borins
authored and
Myles Borins
committed
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 13d0e46 commit 9606f76

File tree

5 files changed

+2744
-1
lines changed

5 files changed

+2744
-1
lines changed

Makefile

+57-1
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 doctool message parallel sequential -J
92115
$(MAKE) jslint
@@ -187,6 +210,30 @@ test-timers:
187210
test-timers-clean:
188211
$(MAKE) --directory=tools clean
189212

213+
test-v8:
214+
# note: performs full test unless QUICKCHECK is specified
215+
deps/v8/tools/run-tests.py --arch=$(V8_ARCH) \
216+
--mode=$(BUILDTYPE_LOWER) $(V8_TEST_NO_I18N) $(QUICKCHECK_ARG) \
217+
--no-presubmit \
218+
--shell-dir=$(PWD)/deps/v8/out/$(V8_ARCH).$(BUILDTYPE_LOWER) \
219+
$(TAP_V8)
220+
221+
test-v8-intl:
222+
# note: performs full test unless QUICKCHECK is specified
223+
deps/v8/tools/run-tests.py --arch=$(V8_ARCH) \
224+
--mode=$(BUILDTYPE_LOWER) --no-presubmit $(QUICKCHECK_ARG) \
225+
--shell-dir=deps/v8/out/$(V8_ARCH).$(BUILDTYPE_LOWER) intl \
226+
$(TAP_V8_INTL)
227+
228+
test-v8-benchmarks:
229+
deps/v8/tools/run-tests.py --arch=$(V8_ARCH) --mode=$(BUILDTYPE_LOWER) \
230+
--download-data $(QUICKCHECK_ARG) --no-presubmit \
231+
--shell-dir=deps/v8/out/$(V8_ARCH).$(BUILDTYPE_LOWER) benchmarks \
232+
$(TAP_V8_BENCHMARKS)
233+
234+
test-v8-all: test-v8 test-v8-intl test-v8-benchmarks
235+
# runs all v8 tests
236+
190237
apidoc_sources = $(wildcard doc/api/*.markdown)
191238
apidocs = $(addprefix out/,$(apidoc_sources:.markdown=.html)) \
192239
$(addprefix out/,$(apidoc_sources:.markdown=.json))
@@ -328,6 +375,15 @@ endif
328375
endif
329376
endif
330377

378+
# node and v8 use different arch names (e.g. node 'x86' vs v8 'ia32').
379+
# pass the proper v8 arch name to $V8_ARCH based on user-specified $DESTCPU.
380+
ifeq ($(DESTCPU),x86)
381+
V8_ARCH=ia32
382+
else
383+
V8_ARCH ?= $(DESTCPU)
384+
385+
endif
386+
331387
# enforce "x86" over "ia32" as the generally accepted way of referring to 32-bit intel
332388
ifeq ($(ARCH),ia32)
333389
override ARCH=x86
@@ -594,4 +650,4 @@ lint-ci: lint
594650
blog blogclean tar binary release-only bench-http-simple bench-idle \
595651
bench-all bench bench-misc bench-array bench-buffer bench-net \
596652
bench-http bench-fs bench-tls cctest run-ci lint-ci bench-ci \
597-
$(TARBALL)-headers
653+
test-v8 test-v8-intl test-v8-benchmarks test-v8-all v8 $(TARBALL)-headers

0 commit comments

Comments
 (0)