Skip to content

Commit 928a490

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 9c901a5 commit 928a490

File tree

2 files changed

+73
-10
lines changed

2 files changed

+73
-10
lines changed

Makefile

+47-6
Original file line numberDiff line numberDiff line change
@@ -292,7 +292,7 @@ v8:
292292
tools/make-v8.sh $(V8_ARCH).$(BUILDTYPE_LOWER) $(V8_BUILD_OPTIONS)
293293

294294
.PHONY: jstest
295-
jstest: build-addons build-js-native-api-tests build-node-api-tests ## Runs addon tests and JS tests
295+
jstest: build-addons build-abort-tests build-js-native-api-tests build-node-api-tests ## Runs addon tests and JS tests
296296
$(PYTHON) tools/test.py $(PARALLEL_ARGS) --mode=$(BUILDTYPE_LOWER) \
297297
--skip-tests=$(CI_SKIP_TESTS) \
298298
$(CI_JS_SUITES) \
@@ -316,6 +316,7 @@ test: all ## Runs default tests, linters, and builds docs.
316316
$(MAKE) -s tooltest
317317
$(MAKE) -s test-doc
318318
$(MAKE) -s build-addons
319+
$(MAKE) -s build-abort-tests
319320
$(MAKE) -s build-js-native-api-tests
320321
$(MAKE) -s build-node-api-tests
321322
$(MAKE) -s cctest
@@ -324,6 +325,7 @@ test: all ## Runs default tests, linters, and builds docs.
324325
.PHONY: test-only
325326
test-only: all ## For a quick test, does not run linter or build docs.
326327
$(MAKE) build-addons
328+
$(MAKE) build-abort-tests
327329
$(MAKE) build-js-native-api-tests
328330
$(MAKE) build-node-api-tests
329331
$(MAKE) cctest
@@ -333,6 +335,7 @@ test-only: all ## For a quick test, does not run linter or build docs.
333335
# Used by `make coverage-test`
334336
test-cov: all
335337
$(MAKE) build-addons
338+
$(MAKE) build-abort-tests
336339
$(MAKE) build-js-native-api-tests
337340
$(MAKE) build-node-api-tests
338341
$(MAKE) cctest
@@ -452,6 +455,31 @@ test/node-api/.buildstamp: $(ADDONS_PREREQS) \
452455
# TODO(bnoordhuis) Force rebuild after gyp or node-gyp update.
453456
build-node-api-tests: | $(NODE_EXE) test/node-api/.buildstamp
454457

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

457485
BENCHMARK_NAPI_BINDING_SOURCES := \
@@ -472,12 +500,14 @@ clear-stalled:
472500
echo $${PS_OUT} | xargs kill -9; \
473501
fi
474502

475-
test-build: | all build-addons build-js-native-api-tests build-node-api-tests
503+
test-build: | all build-addons build-abort-tests build-js-native-api-tests build-node-api-tests
476504

477505
test-build-js-native-api: all build-js-native-api-tests
478506

479507
test-build-node-api: all build-node-api-tests
480508

509+
test-build-abort: all build-abort-tests
510+
481511
.PHONY: test-all
482512
test-all: test-build ## Run default tests with both Debug and Release builds.
483513
$(PYTHON) tools/test.py $(PARALLEL_ARGS) --mode=debug,release
@@ -490,7 +520,7 @@ test-all-suites: | clear-stalled test-build bench-addons-build doc-only ## Run a
490520
$(PYTHON) tools/test.py $(PARALLEL_ARGS) --mode=$(BUILDTYPE_LOWER) test/*
491521

492522
# CI_* variables should be kept synchronized with the ones in vcbuild.bat
493-
CI_NATIVE_SUITES ?= addons js-native-api node-api
523+
CI_NATIVE_SUITES ?= addons js-native-api node-api abort
494524
CI_JS_SUITES ?= default
495525
ifeq ($(node_use_openssl), false)
496526
CI_DOC := doctool
@@ -502,7 +532,7 @@ endif
502532
# Build and test addons without building anything else
503533
# Related CI job: node-test-commit-arm-fanned
504534
test-ci-native: LOGLEVEL := info
505-
test-ci-native: | test/addons/.buildstamp test/js-native-api/.buildstamp test/node-api/.buildstamp
535+
test-ci-native: | test/addons/.buildstamp test/js-native-api/.buildstamp test/node-api/.buildstamp test/abort/.buildstamp
506536
$(PYTHON) tools/test.py $(PARALLEL_ARGS) -p tap --logfile test.tap \
507537
--mode=$(BUILDTYPE_LOWER) --flaky-tests=$(FLAKY_TESTS) \
508538
$(TEST_CI_ARGS) $(CI_NATIVE_SUITES)
@@ -524,7 +554,7 @@ test-ci-js: | clear-stalled
524554
.PHONY: test-ci
525555
# Related CI jobs: most CI tests, excluding node-test-commit-arm-fanned
526556
test-ci: LOGLEVEL := info
527-
test-ci: | clear-stalled build-addons build-js-native-api-tests build-node-api-tests doc-only
557+
test-ci: | clear-stalled build-addons build-abort-tests build-js-native-api-tests build-node-api-tests doc-only
528558
out/Release/cctest --gtest_output=xml:out/junit/cctest.xml
529559
$(PYTHON) tools/test.py $(PARALLEL_ARGS) -p tap --logfile test.tap \
530560
--mode=$(BUILDTYPE_LOWER) --flaky-tests=$(FLAKY_TESTS) \
@@ -628,8 +658,17 @@ test-node-api-clean:
628658
$(RM) -r test/node-api/*/build
629659
$(RM) test/node-api/.buildstamp
630660

661+
.PHONY: test-abort
662+
test-abort: test-build-abort
663+
$(PYTHON) tools/test.py $(PARALLEL_ARGS) --mode=$(BUILDTYPE_LOWER) test-abort
664+
665+
.PHONY: test-abort-clean
666+
test-abort-clean:
667+
$(RM) -r test/abort/*/build
668+
$(RM) test/abort/.buildstamp
669+
631670
.PHONY: test-addons
632-
test-addons: test-build test-js-native-api test-node-api
671+
test-addons: test-build test-js-native-api test-node-api test-abort
633672
$(PYTHON) tools/test.py $(PARALLEL_ARGS) --mode=$(BUILDTYPE_LOWER) addons
634673

635674
.PHONY: test-addons-clean
@@ -639,6 +678,7 @@ test-addons-clean:
639678
$(RM) test/addons/.buildstamp test/addons/.docbuildstamp
640679
$(MAKE) test-js-native-api-clean
641680
$(MAKE) test-node-api-clean
681+
$(MAKE) test-abort-clean
642682

643683
test-async-hooks:
644684
$(PYTHON) tools/test.py $(PARALLEL_ARGS) --mode=$(BUILDTYPE_LOWER) async-hooks
@@ -647,6 +687,7 @@ test-with-async-hooks:
647687
$(MAKE) build-addons
648688
$(MAKE) build-js-native-api-tests
649689
$(MAKE) build-node-api-tests
690+
$(MAKE) build-abort-tests
650691
$(MAKE) cctest
651692
NODE_TEST_WITH_ASYNC_HOOKS=1 $(PYTHON) tools/test.py $(PARALLEL_ARGS) --mode=$(BUILDTYPE_LOWER) \
652693
$(CI_JS_SUITES) \

vcbuild.bat

+26-4
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)