8000 test: partition N-API tests · nodejs/node@c227b1b · GitHub
[go: up one dir, main page]

Skip to content

Commit c227b1b

Browse files
Gabriel SchulhofBridgeAR
authored andcommitted
test: partition N-API tests
Partition test/addons-napi into test/js-native-api and test/node-api to isolate the Node.js-agnostic portion of the N-API tests from the Node.js-specific portion. PR-URL: #24557 Reviewed-By: Refael Ackermann <refack@gmail.com> Reviewed-By: Daniel Bevenius <daniel.bevenius@gmail.com>
1 parent 566046c commit c227b1b

File tree

178 files changed

+654
-436
lines changed
  • test_error
  • test_exception
  • test_function
  • test_general
  • test_handle_scope
  • test_new_target
  • test_number
  • test_object
  • test_promise
  • test_properties
  • test_reference
  • test_string
  • test_symbol
  • test_typedarray
  • node-api
  • tools
  • Some content is hidden

    Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

    178 files changed

    +654
    -436
    lines changed

    Makefile

    Lines changed: 78 additions & 35 deletions
    Original file line numberDiff line numberDiff line change
    @@ -270,7 +270,7 @@ v8:
    270270
    tools/make-v8.sh $(V8_ARCH).$(BUILDTYPE_LOWER) $(V8_BUILD_OPTIONS)
    271271

    272272
    .PHONY: jstest
    273-
    jstest: build-addons build-addons-napi ## Runs addon tests and JS tests
    273+
    jstest: build-addons build-js-native-api-tests build-node-api-tests ## Runs addon tests and JS tests
    274274
    $(PYTHON) tools/test.py $(PARALLEL_ARGS) --mode=$(BUILDTYPE_LOWER) \
    275275
    --skip-tests=$(CI_SKIP_TESTS) \
    276276
    $(CI_JS_SUITES) \
    @@ -281,21 +281,24 @@ jstest: build-addons build-addons-napi ## Runs addon tests and JS tests
    281281
    test: all ## Runs default tests, linters, and builds docs.
    282282
    $(MAKE) -s test-doc
    283283
    $(MAKE) -s build-addons
    284-
    $(MAKE) -s build-addons-napi
    284+
    $(MAKE) -s build-js-native-api-tests
    285+
    $(MAKE) -s build-node-api-tests
    285286
    $(MAKE) -s cctest
    286287
    $(MAKE) -s jstest
    287288

    288289
    .PHONY: test-only
    289290
    test-only: all ## For a quick test, does not run linter or build docs.
    290291
    $(MAKE) build-addons
    291-
    $(MAKE) build-addons-napi
    292+
    $(MAKE) build-js-native-api-tests
    293+
    $(MAKE) build-node-api-tests
    292294
    $(MAKE) cctest
    293295
    $(MAKE) jstest
    294296

    295297
    # Used by `make coverage-test`
    296298
    test-cov: all
    297299
    $(MAKE) build-addons
    298-
    $(MAKE) build-addons-napi
    300+
    $(MAKE) build-js-native-api-tests
    301+
    $(MAKE) build-node-api-tests
    299302
    # $(MAKE) cctest
    300303
    CI_SKIP_TESTS=core_line_numbers.js $(MAKE) jstest
    301304

    @@ -381,30 +384,55 @@ test/addons/.buildstamp: $(ADDONS_PREREQS) \
    381384
    # TODO(bnoordhuis) Force rebuild after gyp update.
    382385
    build-addons: | $(NODE_EXE) test/addons/.buildstamp
    383386

    384-
    ADDONS_NAPI_BINDING_GYPS := \
    385-
    $(filter-out test/addons-napi/??_*/binding.gyp, \
    386-
    $(wildcard test/addons-napi/*/binding.gyp))
    387+
    JS_NATIVE_API_BINDING_GYPS := \
    388+
    $(filter-out test/js-native-api/??_*/binding.gyp, \
    389+
    $(wildcard test/js-native-api/*/binding.gyp))
    387390

    388-
    ADDONS_NAPI_BINDING_SOURCES := \
    389-
    $(filter-out test/addons-napi/??_*/*.c, $(wildcard test/addons-napi/*/*.c)) \
    390-
    $(filter-out test/addons-napi/??_*/*.cc, $(wildcard test/addons-napi/*/*.cc)) \
    391-
    $(filter-out test/addons-napi/??_*/*.h, $(wildcard test/addons-napi/*/*.h))
    391+
    JS_NATIVE_API_BINDING_SOURCES := \
    392+
    $(filter-out test/js-native-api/??_*/*.c, $(wildcard test/js-native-api/*/*.c)) \
    393+
    $(filter-out test/js-native-api/??_*/*.cc, $(wildcard test/js-native-api/*/*.cc)) \
    394+
    $(filter-out test/js-native-api/??_*/*.h, $(wildcard test/js-native-api/*/*.h))
    392395

    393-
    # Implicitly depends on $(NODE_EXE), see the build-addons-napi rule for rationale.
    394-
    test/addons-napi/.buildstamp: $(ADDONS_PREREQS) \
    395-
    $(ADDONS_NAPI_BINDING_GYPS) $(ADDONS_NAPI_BINDING_SOURCES) \
    396+
    # Implicitly depends on $(NODE_EXE), see the build-js-native-api-tests rule for rationale.
    397+
    test/js-native-api/.buildstamp: $(ADDONS_PREREQS) \
    398+
    $(JS_NATIVE_API_BINDING_GYPS) $(JS_NATIVE_API_BINDING_SOURCES) \
    396399
    src/node_api.h src/node_api_types.h src/js_native_api.h \
    397400
    src/js_native_api_types.h src/js_native_api_v8.h src/js_native_api_v8_internals.h
    398-
    @$(call run_build_addons,"$$PWD/test/addons-napi",$@)
    401+
    @$(call run_build_addons,"$$PWD/test/js-native-api",$@)
    399402

    400-
    .PHONY: build-addons-napi
    403+
    .PHONY: build-js-native-api-tests
    401404
    # .buildstamp needs $(NODE_EXE) but cannot depend on it
    402405
    # directly because it calls make recursively. The parent make cannot know
    403406
    # if the subprocess touched anything so it pessimistically assumes that
    404407
    # .buildstamp is out of date and need a rebuild.
    405408
    # Just goes to show that recursive make really is harmful...
    406409
    # TODO(bnoordhuis) Force rebuild after gyp or node-gyp update.
    407-
    build-addons-napi: | $(NODE_EXE) test/addons-napi/.buildstamp
    410+
    build-js-native-api-tests: | $(NODE_EXE) test/js-native-api/.buildstamp
    411+
    412+
    NODE_API_BINDING_GYPS := \
    413+
    $(filter-out test/node-api/??_*/binding.gyp, \
    414+
    $(wildcard test/node-api/*/binding.gyp))
    415+
    416+
    NODE_API_BINDING_SOURCES := \
    417+
    $(filter-out test/node-api/??_*/*.c, $(wildcard test/node-api/*/*.c)) \
    418+
    $(filter-out test/node-api/??_*/*.cc, $(wildcard test/node-api/*/*.cc)) \
    419+
    $(filter-out test/node-api/??_*/*.h, $(wildcard test/node-api/*/*.h))
    420+
    421+
    # Implicitly depends on $(NODE_EXE), see the build-node-api-tests rule for rationale.
    422+
    test/node-api/.buildstamp: $(ADDONS_PREREQS) \
    423+
    $(NODE_API_BINDING_GYPS) $(NODE_API_BINDING_SOURCES) \
    424+
    src/node_api.h src/node_api_types.h src/js_native_api.h \
    425+
    src/js_native_api_types.h src/js_native_api_v8.h src/js_native_api_v8_internals.h
    426+
    @$(call run_build_addons,"$$PWD/test/node-api",$@)
    427+
    428+
    .PHONY: build-node-api-tests
    429+
    # .buildstamp needs $(NODE_EXE) but cannot depend on it
    430+
    # directly because it calls make recursively. The parent make cannot know
    431+
    # if the subprocess touched anything so it pessimistically assumes that
    432+
    # .buildstamp is out of date and need a rebuild.
    433+
    # Just goes to show that recursive make really is harmful...
    434+
    # TODO(bnoordhuis) Force rebuild after gyp or node-gyp update.
    435+
    build-node-api-tests: | $(NODE_EXE) test/node-api/.buildstamp
    408436

    409437
    .PHONY: clear-stalled
    410438
    clear-stalled:
    @@ -415,9 +443,11 @@ clear-stalled:
    415443
    echo $${PS_OUT} | xargs kill -9; \
    416444
    fi
    417445

    418-
    test-build: | all build-addons build-addons-napi
    446+
    test-build: | all build-addons build-js-native-api-tests build-node-api-tests
    419447

    420-
    test-build-addons-napi: all build-addons-napi
    448+
    test-build-js-native-api: all build-js-native-api-tests
    449+
    450+
    test-build-node-api: all build-node-api-tests
    421451

    422452
    .PHONY: test-all
    423453
    test-all: test-build ## Run everything in test/.
    @@ -426,15 +456,15 @@ test-all: test-build ## Run everything in test/.
    426456
    test-all-valgrind: test-build
    427457
    $(PYTHON) tools/test.py $(PARALLEL_ARGS) --mode=debug,release --valgrind
    428458

    429-
    CI_NATIVE_SUITES ?= addons addons-napi
    459+
    CI_NATIVE_SUITES ?= addons js-native-api node-api
    430460
    CI_JS_SUITES ?= default
    431461
    CI_DOC := doctool
    432462

    433463
    .PHONY: test-ci-native
    434464
    # Build and test addons without building anything else
    435465
    # Related CI job: node-test-commit-arm-fanned
    436466
    test-ci-native: LOGLEVEL := info
    437-
    test-ci-native: | test/addons/.buildstamp test/addons-napi/.buildstamp
    467+
    test-ci-native: | test/addons/.buildstamp test/js-native-api/.buildstamp test/node-api/.buildstamp
    438468
    $(PYTHON) tools/test.py $(PARALLEL_ARGS) -p tap --logfile test.tap \
    439469
    --mode=$(BUILDTYPE_LOWER) --flaky-tests=$(FLAKY_TESTS) \
    440470
    $(TEST_CI_ARGS) $(CI_NATIVE_SUITES)
    @@ -456,7 +486,7 @@ test-ci-js: | clear-stalled
    456486
    .PHONY: test-ci
    457487
    # Related CI jobs: most CI tests, excluding node-test-commit-arm-fanned
    458488
    test-ci: LOGLEVEL := info
    459-
    test-ci: | clear-stalled build-addons build-addons-napi doc-only
    489+
    test-ci: | clear-stalled build-addons build-js-native-api-tests build-node-api-tests doc-only
    460490
    out/Release/cctest --gtest_output=tap:cctest.tap
    461491
    $(PYTHON) tools/test.py $(PARALLEL_ARGS) -p tap --logfile test.tap \
    462492
    --mode=$(BUILDTYPE_LOWER) --flaky-tests=$(FLAKY_TESTS) \
    @@ -539,32 +569,43 @@ test-npm: $(NODE_EXE) ## Run the npm test suite on deps/npm.
    539569
    test-npm-publish: $(NODE_EXE)
    540570
    npm_package_config_publishtest=true $(NODE) deps/npm/test/run.js
    541571

    542-
    .PHONY: test-addons-napi
    543-
    test-addons-napi: test-build-addons-napi
    544-
    $(PYTHON) tools/test.py $(PARALLEL_ARGS) --mode=$(BUILDTYPE_LOWER) addons-napi
    572+
    .PHONY: test-js-native-api
    573+
    test-js-native-api: test-build-js-native-api
    574+
    $(PYTHON) tools/test.py $(PARALLEL_ARGS) --mode=$(BUILDTYPE_LOWER) js-native-api
    575+
    576+
    .PHONY: test-js-native-api-clean
    577+
    test-js-native-api-clean:
    578+
    $(RM) -r test/js-native-api/*/build
    579+
    $(RM) test/js-native-api/.buildstamp
    580+
    581+
    .PHONY: test-node-api
    582+
    test-node-api: test-build-node-api
    583+
    $(PYTHON) tools/test.py $(PARALLEL_ARGS) --mode=$(BUILDTYPE_LOWER) node-api
    545584

    546-
    .PHONY: test-addons-napi-clean
    547-
    test-addons-napi-clean:
    548-
    $(RM) -r test/addons-napi/*/build
    549-
    $(RM) test/addons-napi/.buildstamp
    585+
    .PHONY: test-node-api-clean
    586+
    test-node-api-clean:
    587+
    $(RM) -r test/node-api/*/build
    < AEFA /td>588+
    $(RM) test/node-api/.buildstamp
    550589

    551590
    .PHONY: test-addons
    552-
    test-addons: test-build test-addons-napi
    591+
    test-addons: test-build test-js-native-api test-node-api
    553592
    $(PYTHON) tools/test.py $(PARALLEL_ARGS) --mode=$(BUILDTYPE_LOWER) addons
    554593

    555594
    .PHONY: test-addons-clean
    556595
    test-addons-clean:
    557596
    $(RM) -r test/addons/??_*/
    558597
    $(RM) -r test/addons/*/build
    559598
    $(RM) test/addons/.buildstamp test/addons/.docbuildstamp
    560-
    $(MAKE) test-addons-napi-clean
    599+
    $(MAKE) test-js-native-api-clean
    600+
    $(MAKE) test-node-api-clean
    561601

    562602
    test-async-hooks:
    563603
    $(PYTHON) tools/test.py $(PARALLEL_ARGS) --mode=$(BUILDTYPE_LOWER) async-hooks
    564604

    565605
    test-with-async-hooks:
    566606
    $(MAKE) build-addons
    567-
    $(MAKE) build-addons-napi
    607+
    $(MAKE) build-js-native-api-tests
    608+
    $(MAKE) build-node-api-tests
    568609
    $(MAKE) cctest
    569610
    NODE_TEST_WITH_ASYNC_HOOKS=1 $(PYTHON) tools/test.py $(PARALLEL_ARGS) --mode=$(BUILDTYPE_LOWER) \
    570611
    $(CI_JS_SUITES) \
    @@ -1136,7 +1177,7 @@ LINT_CPP_ADDON_DOC_FILES = $(wildcard $(LINT_CPP_ADDON_DOC_FILES_GLOB))
    11361177
    LINT_CPP_EXCLUDE ?=
    11371178
    LINT_CPP_EXCLUDE += src/node_root_certs.h
    11381179
    LINT_CPP_EXCLUDE += $(LINT_CPP_ADDON_DOC_FILES)
    1139-
    LINT_CPP_EXCLUDE += $(wildcard test/addons-napi/??_*/*.cc test/addons-napi/??_*/*.h)
    1180+
    LINT_CPP_EXCLUDE += $(wildcard test/js-native-api/??_*/*.cc test/js-native-api/??_*/*.h test/node-api/??_*/*.cc test/node-api/??_*/*.h)
    11401181
    # These files were copied more or less verbatim from V8.
    11411182
    LINT_CPP_EXCLUDE += src/tracing/trace_event.h src/tracing/trace_event_common.h
    11421183

    @@ -1152,8 +1193,10 @@ LINT_CPP_FILES = $(filter-out $(LINT_CPP_EXCLUDE), $(wildcard \
    11521193
    test/addons/*/*.h \
    11531194
    test/cctest/*.cc \
    11541195
    test/cctest/*.h \
    1155-
    test/addons-napi/*/*.cc \
    1156-
    test/addons-napi/*/*.h \
    1196+
    test/js-native-api/*/*.cc \
    1197+
    test/js-native-api/*/*.h \
    1198+
    test/node-api/*/*.cc \
    1199+
    test/node-api/*/*.h \
    11571200
    tools/icu/*.cc \
    11581201
    tools/icu/*.h \
    11591202
    ))

    test/README.md

    Lines changed: 2 additions & 1 deletion
    Original file line numberDiff line numberDiff line change
    @@ -17,7 +17,6 @@ GitHub with the `autocrlf` git config flag set to true.
    1717
    | ------------------- | --------------- | --------------- |
    1818
    | `abort` | Yes | Tests for when the ``` --abort-on-uncaught-exception ``` flag is used. |
    1919
    | `addons` | Yes | Tests for [addon](https://nodejs.org/api/addons.html) functionality along with some tests that require an addon to function properly. |
    20-
    | `addons-napi` | Yes | Tests for [n-api](https://nodejs.org/api/n-api.html) functionality. |
    2120
    | `async-hooks` | Yes | Tests for [async_hooks](https://nodejs.org/api/async_hooks.html) functionality. |
    2221
    | `benchmark` | No | Test minimal functionality of benchmarks. |
    2322
    | `cctest` | Yes | C++ tests that are run as part of the build process. |
    @@ -27,8 +26,10 @@ GitHub with the `autocrlf` git config flag set to true.
    2726
    | `es-module` | Yes | Test ESM module loading. |
    2827
    | `fixtures` | | Test fixtures used in various tests throughout the test suite. |
    2928
    | `internet` | No | Tests that make real outbound connections (mainly networking related modules). Tests for networking related modules may also be present in other directories, but those tests do not make outbound connections. |
    29+
    | `js-native-api` | Yes | Tests for Node.js-agnostic [n-api](https://nodejs.org/api/n-api.html) functionality. |
    3030
    | `known_issues` | Yes | Tests reproducing known issues within the system. All tests inside of this directory are expected to fail consistently. If a test doesn't fail on certain platforms, those should be skipped via `known_issues.status`. |
    3131
    | `message` | Yes | Tests for messages that are output for various conditions (```console.log```, error messages etc.) |
    32+
    | `node-api` | Yes | Tests for Node.js-specific [n-api](https://nodejs.org/api/n-api.html) functionality. |
    3233
    | `parallel` | Yes | Various tests that are able to be run in parallel. |
    3334
    | `pseudo-tty` | Yes | Tests that require stdin/stdout/stderr to be a TTY. |
    3435
    | `pummel` | No | Various tests for various modules / system functionality operating under load. |

    test/addons-napi/2_function_arguments/binding.gyp

    Lines changed: 0 additions & 8 deletions
    This file was deleted.

    test/addons-napi/3_callbacks/binding.gyp

    Lines changed: 0 additions & 8 deletions
    This file was deleted.

    test/addons-napi/4_object_factory/binding.gyp

    Lines changed: 0 additions & 8 deletions
    This file was deleted.

    test/addons-napi/5_function_factory/binding.gyp

    Lines changed: 0 additions & 8 deletions
    This file was deleted.

    test/addons-napi/6_object_wrap/binding.cc

    Lines changed: 0 additions & 10 deletions
    This file was deleted.

    test/addons-napi/6_object_wrap/binding.gyp

    Lines changed: 0 additions & 8 deletions
    This file was deleted.

    test/addons-napi/7_factory_wrap/binding.gyp

    Lines changed: 0 additions & 8 deletions
    This file was deleted.

    test/addons-napi/8_passing_wrapped/binding.gyp

    Lines changed: 0 additions & 8 deletions
    This file was deleted.

    0 commit comments

    Comments
     (0)
    0