Skip to content

Commit e08ac09

Browse files
amdokuaddaleax
authored andcommitted
src: add test/abort build tasks
The Aliased*Array overflow check test introduced a dependency to a compiled artifact. Add this artifact to the build process in a similar fashion as test/addons and test/js-native-api do. PR-URL: #31740 Reviewed-By: James M Snell <[email protected]> Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: David Carlier <[email protected]> Reviewed-By: Colin Ihrig <[email protected]>
1 parent babeb58 commit e08ac09

File tree

2 files changed

+73
-10
lines changed

2 files changed

+73
-10
lines changed

Makefile

Lines changed: 47 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -295,7 +295,7 @@ v8:
295295
tools/make-v8.sh $(V8_ARCH).$(BUILDTYPE_LOWER) $(V8_BUILD_OPTIONS)
296296

297297
.PHONY: jstest
298-
jstest: build-addons build-js-native-api-tests build-node-api-tests ## Runs addon tests and JS tests
298+
jstest: build-addons build-abort-tests build-js-native-api-tests build-node-api-tests ## Runs addon tests and JS tests
299299
$(PYTHON) tools/test.py $(PARALLEL_ARGS) --mode=$(BUILDTYPE_LOWER) \
300300
--skip-tests=$(CI_SKIP_TESTS) \
301301
$(CI_JS_SUITES) \
@@ -319,6 +319,7 @@ test: all ## Runs default tests, linters, and builds docs.
319319
$(MAKE) -s tooltest
320320
$(MAKE) -s test-doc
321321
$(MAKE) -s build-addons
322+
$(MAKE) -s build-abort-tests
322323
$(MAKE) -s build-js-native-api-tests
323324
$(MAKE) -s build-node-api-tests
324325
$(MAKE) -s cctest
@@ -327,6 +328,7 @@ test: all ## Runs default tests, linters, and builds docs.
327328
.PHONY: test-only
328329
test-only: all ## For a quick test, does not run linter or build docs.
329330
$(MAKE) build-addons
331+
$(MAKE) build-abort-tests
330332
$(MAKE) build-js-native-api-tests
331333
$(MAKE) build-node-api-tests
332334
$(MAKE) cctest
@@ -336,6 +338,7 @@ test-only: all ## For a quick test, does not run linter or build docs.
336338
# Used by `make coverage-test`
337339
test-cov: all
338340
$(MAKE) build-addons
341+
$(MAKE) build-abort-tests
339342
$(MAKE) build-js-native-api-tests
340343
$(MAKE) build-node-api-tests
341344
$(MAKE) cctest
@@ -455,6 +458,31 @@ test/node-api/.buildstamp: $(ADDONS_PREREQS) \
455458
# TODO(bnoordhuis) Force rebuild after gyp or node-gyp update.
456459
build-node-api-tests: | $(NODE_EXE) test/node-api/.buildstamp
457460

461+
ABORT_BINDING_GYPS := \
462+
$(filter-out test/abort/??_*/binding.gyp, \
463+
$(wildcard test/abort/*/binding.gyp))
464+
465+
ABORT_BINDING_SOURCES := \
466+
$(filter-out test/abort/??_*/*.c, $(wildcard test/abort/*/*.c)) \
467+
$(filter-out test/abort/??_*/*.cc, $(wildcard test/abort/*/*.cc)) \
468+
$(filter-out test/abort/??_*/*.h, $(wildcard test/abort/*/*.h))
469+
470+
# Implicitly depends on $(NODE_EXE), see the build-node-api-tests rule for rationale.
471+
test/abort/.buildstamp: $(ADDONS_PREREQS) \
472+
$(ABORT_BINDING_GYPS) $(ABORT_BINDING_SOURCES) \
473+
src/node_api.h src/node_api_types.h src/js_native_api.h \
474+
src/js_native_api_types.h src/js_native_api_v8.h src/js_native_api_v8_internals.h
475+
@$(call run_build_addons,"$$PWD/test/abort",$@)
476+
477+
.PHONY: build-abort-tests
478+
# .buildstamp needs $(NODE_EXE) but cannot depend on it
479+
# directly because it calls make recursively. The parent make cannot know
480+
# if the subprocess touched anything so it pessimistically assumes that
481+
# .buildstamp is out of date and need a rebuild.
482+
# Just goes to show that recursive make really is harmful...
483+
# TODO(bnoordhuis) Force rebuild after gyp or node-gyp update.
484+
build-abort-tests: | $(NODE_EXE) test/abort/.buildstamp
485+
458486
BENCHMARK_NAPI_BINDING_GYPS := $(wildcard benchmark/napi/*/binding.gyp)
459487

460488
BENCHMARK_NAPI_BINDING_SOURCES := \
@@ -475,12 +503,14 @@ clear-stalled:
475503
echo $${PS_OUT} | xargs kill -9; \
476504
fi
477505

478-
test-build: | all build-addons build-js-native-api-tests build-node-api-tests
506+
test-build: | all build-addons build-abort-tests build-js-native-api-tests build-node-api-tests
479507

480508
test-build-js-native-api: all build-js-native-api-tests
481509

482510
test-build-node-api: all build-node-api-tests
483511

512+
test-build-abort: all build-abort-tests
513+
484514
.PHONY: test-all
485515
test-all: test-build ## Run default tests with both Debug and Release builds.
486516
$(PYTHON) tools/test.py $(PARALLEL_ARGS) --mode=debug,release
@@ -493,7 +523,7 @@ test-all-suites: | clear-stalled test-build bench-addons-build doc-only ## Run a
493523
$(PYTHON) tools/test.py $(PARALLEL_ARGS) --mode=$(BUILDTYPE_LOWER) test/*
494524

495525
# CI_* variables should be kept synchronized with the ones in vcbuild.bat
496-
CI_NATIVE_SUITES ?= addons js-native-api node-api
526+
CI_NATIVE_SUITES ?= addons js-native-api node-api abort
497527
CI_JS_SUITES ?= default
498528
ifeq ($(node_use_openssl), false)
499529
CI_DOC := doctool
@@ -505,7 +535,7 @@ endif
505535
# Build and test addons without building anything else
506536
# Related CI job: node-test-commit-arm-fanned
507537
test-ci-native: LOGLEVEL := info
508-
test-ci-native: | test/addons/.buildstamp test/js-native-api/.buildstamp test/node-api/.buildstamp
538+
test-ci-native: | test/addons/.buildstamp test/js-native-api/.buildstamp test/node-api/.buildstamp test/abort/.buildstamp
509539
$(PYTHON) tools/test.py $(PARALLEL_ARGS) -p tap --logfile test.tap \
510540
--mode=$(BUILDTYPE_LOWER) --flaky-tests=$(FLAKY_TESTS) \
511541
$(TEST_CI_ARGS) $(CI_NATIVE_SUITES)
@@ -527,7 +557,7 @@ test-ci-js: | clear-stalled
527557
.PHONY: test-ci
528558
# Related CI jobs: most CI tests, excluding node-test-commit-arm-fanned
529559
test-ci: LOGLEVEL := info
530-
test-ci: | clear-stalled build-addons build-js-native-api-tests build-node-api-tests doc-only
560+
test-ci: | clear-stalled build-addons build-abort-tests build-js-native-api-tests build-node-api-tests doc-only
531561
out/Release/cctest --gtest_output=xml:out/junit/cctest.xml
532562
$(PYTHON) tools/test.py $(PARALLEL_ARGS) -p tap --logfile test.tap \
533563
--mode=$(BUILDTYPE_LOWER) --flaky-tests=$(FLAKY_TESTS) \
@@ -632,8 +662,17 @@ test-node-api-clean:
632662
$(RM) -r test/node-api/*/build
633663
$(RM) test/node-api/.buildstamp
634664

665+
.PHONY: test-abort
666+
test-abort: test-build-abort
667+
$(PYTHON) tools/test.py $(PARALLEL_ARGS) --mode=$(BUILDTYPE_LOWER) test-abort
668+
669+
.PHONY: test-abort-clean
670+
test-abort-clean:
671+
$(RM) -r test/abort/*/build
672+
$(RM) test/abort/.buildstamp
673+
635674
.PHONY: test-addons
636-
test-addons: test-build test-js-native-api test-node-api
675+
test-addons: test-build test-js-native-api test-node-api test-abort
637676
$(PYTHON) tools/test.py $(PARALLEL_ARGS) --mode=$(BUILDTYPE_LOWER) addons
638677

639678
.PHONY: test-addons-clean
@@ -643,6 +682,7 @@ test-addons-clean:
643682
$(RM) test/addons/.buildstamp test/addons/.docbuildstamp
644683
$(MAKE) test-js-native-api-clean
645684
$(MAKE) test-node-api-clean
685+
$(MAKE) test-abort-clean
646686

647687
test-async-hooks:
648688
$(PYTHON) tools/test.py $(PARALLEL_ARGS) --mode=$(BUILDTYPE_LOWER) async-hooks
@@ -651,6 +691,7 @@ test-with-async-hooks:
651691
$(MAKE) build-addons
652692
$(MAKE) build-js-native-api-tests
653693
$(MAKE) build-node-api-tests
694+
$(MAKE) build-abort-tests
654695
$(MAKE) cctest
655696
NODE_TEST_WITH_ASYNC_HOOKS=1 $(PYTHON) tools/test.py $(PARALLEL_ARGS) --mode=$(BUILDTYPE_LOWER) \
656697
$(CI_JS_SUITES) \

vcbuild.bat

Lines changed: 26 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,11 @@ if /i "%1"=="/?" goto help
1616
cd %~dp0
1717

1818
@rem CI_* variables should be kept synchronized with the ones in Makefile
19-
set CI_NATIVE_SUITES=addons js-native-api node-api
19+
set CI_NATIVE_SUITES=addons js-native-api node-api abort
2020
set CI_JS_SUITES=default
2121
set CI_DOC=doctool
2222
@rem Same as the test-ci target in Makefile
23-
set "common_test_suites=%CI_JS_SUITES% %CI_NATIVE_SUITES% %CI_DOC%&set build_addons=1&set build_js_native_api_tests=1&set build_node_api_tests=1"
23+
set "common_test_suites=%CI_JS_SUITES% %CI_NATIVE_SUITES% %CI_DOC%&set build_addons=1&set build_js_native_api_tests=1&set build_node_api_tests=1&set build_aborts_tests=1"
2424

2525
@rem Process arguments.
2626
set config=Release
@@ -68,6 +68,7 @@ set openssl_no_asm=
6868
set doc=
6969
set extra_msbuild_args=
7070
set exit_code=0
71+
set build_aborts_tests=
7172

7273
:next-arg
7374
if "%1"=="" goto args-done
@@ -96,6 +97,8 @@ if /i "%1"=="test-ci-js" set test_args=%test_args% %test_ci_args% -J -p tap -
9697
if /i "%1"=="build-addons" set build_addons=1&goto arg-ok
9798
if /i "%1"=="build-js-native-api-tests" set build_js_native_api_tests=1&goto arg-ok
9899
if /i "%1"=="build-node-api-tests" set build_node_api_tests=1&goto arg-ok
100+
if /i "%1"=="build-abort-tests" set build_abort_tests=1&goto arg-ok
101+
if /i "%1"=="test-abort" set test_args=%test_args% abort&set build_abort_tests=1&goto arg-ok
99102
if /i "%1"=="test-addons" set test_args=%test_args% addons&set build_addons=1&goto arg-ok
100103
if /i "%1"=="test-js-native-api" set test_args=%test_args% js-native-api&set build_js_native_api_tests=1&goto arg-ok
101104
if /i "%1"=="test-node-api" set test_args=%test_args% node-api&set build_node_api_tests=1&goto arg-ok
@@ -585,10 +588,10 @@ endlocal
585588
goto build-node-api-tests
586589

587590
:build-node-api-tests
588-
if not defined build_node_api_tests goto run-tests
591+
if not defined build_node_api_tests goto build-abort-tests
589592
if not exist "%node_exe%" (
590593
echo Failed to find node.exe
591-
goto run-tests
594+
goto build-abort-tests
592595
)
593596
echo Building node-api
594597
:: clear
@@ -601,6 +604,25 @@ set npm_config_nodedir=%~dp0
601604
"%node_exe%" "%~dp0tools\build-addons.js" "%~dp0deps\npm\node_modules\node-gyp\bin\node-gyp.js" "%~dp0test\node-api"
602605
if errorlevel 1 exit /b 1
603606
endlocal
607+
goto build-abort-tests
608+
609+
:build-abort-tests
610+
if not defined build_abort_tests goto run-tests
611+
if not exist "%node_exe%" (
612+
echo Failed to find node.exe
613+
goto run-tests
614+
)
615+
echo Building abort
616+
:: clear
617+
for /d %%F in (test\abort\??_*) do (
618+
rd /s /q %%F
619+
)
620+
:: building abort
621+
setlocal
622+
set npm_config_nodedir=%~dp0
623+
"%node_exe%" "%~dp0tools\build-addons.js" "%~dp0deps\npm\node_modules\node-gyp\bin\node-gyp.js" "%~dp0test\abort"
624+
if errorlevel 1 exit /b 1
625+
endlocal
604626
goto run-tests
605627

606628
:run-tests

0 commit comments

Comments
 (0)