Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

build: make 'make test' run linter and build docs #22031

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 11 additions & 7 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -254,6 +254,10 @@ v8:

.PHONY: jstest
jstest: build-addons build-addons-napi ## Runs addon tests and JS tests
$(MAKE) -s test-js

.PHONY: test-js
test-js:
$(PYTHON) tools/test.py $(PARALLEL_ARGS) --mode=$(BUILDTYPE_LOWER) \
--skip-tests=$(CI_SKIP_TESTS) \
$(CI_JS_SUITES) \
Expand All @@ -267,7 +271,8 @@ test: all ## Runs default tests, linters, and builds docs.
$(MAKE) -s build-addons
$(MAKE) -s build-addons-napi
$(MAKE) -s cctest
$(MAKE) -s jstest
$(MAKE) -s test-js
$(MAKE) -s test-doc

.PHONY: test-only
test-only: all ## For a quick test, does not run linter or build docs.
Expand All @@ -276,7 +281,7 @@ test-only: all ## For a quick test, does not run linter or build docs.
$(MAKE) build-addons
$(MAKE) build-addons-napi
$(MAKE) cctest
$(MAKE) jstest
$(MAKE) test-js
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would it not be better to remove the addon parts from this task and keep jstest? Just the cctest would have to move below. The same for the other entries.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This make rule is designed to run a number of steps serially. Depending on jstest would enable make to run these commands in parallel; and in particular, before all is completed. Note that the definition of build-addons does not require $(NODE_EXE) to be present.

build-addons: | $(NODE_EXE) test/addons/.buildstamp


# Used by `make coverage-test`
test-cov: all
Expand All @@ -285,7 +290,7 @@ test-cov: all
$(MAKE) build-addons
$(MAKE) build-addons-napi
# $(MAKE) cctest
CI_SKIP_TESTS=core_line_numbers.js $(MAKE) jstest
CI_SKIP_TESTS=core_line_numbers.js $(MAKE) test-js

test-parallel: all
$(PYTHON) tools/test.py $(PARALLEL_ARGS) --mode=$(BUILDTYPE_LOWER) parallel
Expand Down Expand Up @@ -342,6 +347,7 @@ ADDONS_BINDING_SOURCES := \
$(filter-out test/addons/??_*/*.cc, $(wildcard test/addons/*/*.cc)) \
$(filter-out test/addons/??_*/*.h, $(wildcard test/addons/*/*.h))

.PHONY: test/addons/.buildstamp
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we're going to make this target .PHONY, I would remove the touch so it's no longer a file and probably rename the target so it doesn't look like a file either.

# Implicitly depends on $(NODE_EXE), see the build-addons rule for rationale.
# Depends on node-gyp package.json so that build-addons is (re)executed when
# node-gyp is updated as part of an npm update.
Expand All @@ -356,7 +362,6 @@ test/addons/.buildstamp: config.gypi \
"$$PWD/deps/npm/node_modules/node-gyp/bin/node-gyp.js" "$$PWD/test/addons"
touch $@

.PHONY: build-addons
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

build-addons should remain .PHONY as it does not refer to a file.

# .buildstamp needs $(NODE_EXE) but cannot depend on it
# directly because it calls make recursively. The parent make cannot know
# if the subprocess touched anything so it pessimistically assumes that
Expand All @@ -374,6 +379,7 @@ ADDONS_NAPI_BINDING_SOURCES := \
$(filter-out test/addons-napi/??_*/*.cc, $(wildcard test/addons-napi/*/*.cc)) \
$(filter-out test/addons-napi/??_*/*.h, $(wildcard test/addons-napi/*/*.h))

.PHONY: test/addons-napi/.buildstamp
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we're going to make this target .PHONY, I would remove the touch so it's no longer a file and probably rename the target so it doesn't look like a file either.

# Implicitly depends on $(NODE_EXE), see the build-addons-napi rule for rationale.
test/addons-napi/.buildstamp: config.gypi \
deps/npm/node_modules/node-gyp/package.json tools/build-addons.js \
Expand All @@ -387,7 +393,6 @@ test/addons-napi/.buildstamp: config.gypi \
"$$PWD/test/addons-napi"
touch $@

.PHONY: build-addons-napi
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

build-addons-napi should remain .PHONY as it does not refer to a file.

# .buildstamp needs $(NODE_EXE) but cannot depend on it
# directly because it calls make recursively. The parent make cannot know
# if the subprocess touched anything so it pessimistically assumes that
Expand Down Expand Up @@ -1077,8 +1082,7 @@ lint-md-build: tools/remark-cli/node_modules \
tools/doc/node_modules \
tools/remark-preset-lint-node/node_modules

.PHONY: tools/doc/node_modules
tools/doc/node_modules:
tools/doc/node_modules: tools/doc/package.json
@cd tools/doc && $(call available-node,$(run-npm-install))

.PHONY: lint-md
Expand Down