Skip to content

Commit 09a8050

Browse files
jasnellexinfinitum
authored andcommitted
test: run v8 tests
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. 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.
1 parent 8182ec0 commit 09a8050

File tree

6 files changed

+2750
-0
lines changed

6 files changed

+2750
-0
lines changed

Makefile

Lines changed: 58 additions & 0 deletions
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_NO_I18N := 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,33 @@ 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+
#cd deps/v8
112+
ifneq (,$(filter $(DESTCPU),x86))
113+
+make -C deps/v8 $(V8_BUILD_NO_I18N);
114+
else
115+
ifneq (,$(filter $(ARCH),x86))
116+
+make -C deps/v8 $(V8_BUILD_NO_I18N);
117+
else
118+
ifeq ($(ARCH)$(DESTCPU),)
119+
+make -C deps/v8 $(V8_BUILD_NO_I18N);
120+
else
121+
+make -C deps/v8 $(ARCH) $(V8_BUILD_NO_I18N);
122+
endif
123+
+make -C deps/v8 $(ARCH) $(V8_BUILD_NO_I18N);
124+
endif
125+
+make -C deps/v8 $(ARCH) $(V8_BUILD_NO_I18N);
126+
endif
127+
90128
test: | cctest # Depends on 'all'.
91129
$(PYTHON) tools/test.py --mode=release message parallel sequential -J
92130
$(MAKE) jslint
@@ -184,6 +222,26 @@ test-timers:
184222
test-timers-clean:
185223
$(MAKE) --directory=tools clean
186224

225+
test-v8:
226+
# note: performs full test unless QUICKCHECK is specified
227+
deps/v8/tools/run-tests.py --arch=$(ARCH) --mode=$(BUILDTYPE_LOWER) $(V8_TEST_NO_I18N) \
228+
$(QUICKCHECK_ARG) --no-presubmit --shell-dir=deps/v8/out/$(ARCH).$(BUILDTYPE_LOWER) \
229+
$(TAP_V8)
230+
231+
test-v8-intl:
232+
# note: performs full test unless QUICKCHECK is specified
233+
deps/v8/tools/run-tests.py --arch=$(ARCH) --mode=$(BUILDTYPE_LOWER) --no-presubmit \
234+
$(QUICKCHECK_ARG) --shell-dir=deps/v8/out/$(ARCH).$(BUILDTYPE_LOWER) intl $(TAP_V8_INTL)
235+
236+
test-v8-benchmarks:
237+
# note: this runs with --download-data so it'll go out and
238+
deps/v8/tools/run-tests.py --arch=$(ARCH) --mode=$(BUILDTYPE_LOWER) --download-data \
239+
$(QUICKCHECK_ARG) --no-presubmit --shell-dir=deps/v8/out/$(ARCH).$(BUILDTYPE_LOWER) benchmarks \
240+
$(TAP_V8_BENCHMARKS)
241+
242+
test-v8-all: test-v8 test-v8-intl test-v8-benchmarks
243+
# runs all v8 tests
244+
187245
apidoc_sources = $(wildcard doc/api/*.markdown)
188246
apidocs = $(addprefix out/,$(apidoc_sources:.markdown=.html)) \
189247
$(addprefix out/,$(apidoc_sources:.markdown=.json))

configure

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -375,6 +375,11 @@ parser.add_option('--enable-static',
375375
dest='enable_static',
376376
help='build as static library')
377377

378+
parser.add_option('--with-v8-tests',
379+
action='store_true',
380+
dest='with_v8_tests',
381+
help='Build v8 test suite')
382+
378383
(options, args) = parser.parse_args()
379384

380385
# Expand ~ in the install prefix now, it gets written to multiple files.
@@ -796,6 +801,8 @@ def configure_v8(o):
796801
o['variables']['v8_optimized_debug'] = 0 # Compile with -O0 in debug builds.
797802
o['variables']['v8_random_seed'] = 0 # Use a random seed for hash tables.
798803
o['variables']['v8_use_snapshot'] = 'false' if options.without_snapshot else 'true'
804+
if options.with_v8_tests:
805+
o['variables']['with_v8_tests'] = 1
799806

800807
def configure_openssl(o):
801808
o['variables']['node_use_openssl'] = b(not options.without_ssl)

0 commit comments

Comments
 (0)