Merge pull request #591 from mklement0/fix_make_file
obsolete check for the urchin cross-shell test feature; fix for spurious...master
commit
5edf013127
16
Makefile
16
Makefile
|
@ -1,10 +1,14 @@
|
||||||
|
# Since we rely on paths relative to the makefile location, abort if make isn't being run from there.
|
||||||
|
$(if $(findstring /,$(MAKEFILE_LIST)),$(error Please only invoke this makefile from the directory it resides in))
|
||||||
# Note: With Travis CI:
|
# Note: With Travis CI:
|
||||||
# - the path to urchin is passed via the command line.
|
# - the path to urchin is passed via the command line.
|
||||||
# - the other utilties are NOT needed, so we skip the test for their existence.
|
# - the other utilities are NOT needed, so we skip the test for their existence.
|
||||||
URCHIN := urchin
|
URCHIN := urchin
|
||||||
ifeq ($(findstring /,$(URCHIN)),) # urchin path was NOT passed in.
|
ifeq ($(findstring /,$(URCHIN)),) # urchin path was NOT passed in.
|
||||||
# Add the local npm packages' bin folder to the PATH, so that `make` can find them, when invoked directly.
|
# Add the local npm packages' bin folder to the PATH, so that `make` can find them, when invoked directly.
|
||||||
export PATH := $(shell printf '%s' "$$(npm bin):$$PATH")
|
# Note that rather than using `$(npm bin)` the 'node_modules/.bin' path component is hard-coded, so that invocation works even from an environment
|
||||||
|
# where npm is (temporarily) unavailable due to having deactivated an nvm instance loaded into the calling shell in order to avoid interference with tests.
|
||||||
|
export PATH := $(shell printf '%s' "$$PWD/node_modules/.bin:$$PATH")
|
||||||
# The list of all supporting utilities, installed with `npm install`.
|
# The list of all supporting utilities, installed with `npm install`.
|
||||||
UTILS := $(URCHIN) replace semver
|
UTILS := $(URCHIN) replace semver
|
||||||
# Make sure that all required utilities can be located.
|
# Make sure that all required utilities can be located.
|
||||||
|
@ -17,9 +21,6 @@ SHELLS := sh bash dash zsh # ksh (#574)
|
||||||
# Generate 'test-<shell>' target names from specified shells.
|
# Generate 'test-<shell>' target names from specified shells.
|
||||||
# The embedded shell names are extracted on demand inside the recipes.
|
# The embedded shell names are extracted on demand inside the recipes.
|
||||||
SHELL_TARGETS := $(addprefix test-,$(SHELLS))
|
SHELL_TARGETS := $(addprefix test-,$(SHELLS))
|
||||||
# Determine if the installed Urchin version supports cross-shell testing, based on whether its usage information mentions the -s option.
|
|
||||||
HAVE_CROSS_SHELL_TESTS := $(shell PATH="$(PATH)" $(URCHIN) -h | grep -qE '(^|\s)-s\s' && echo 'yes')
|
|
||||||
NO_CROSS_SHELL_TESTS_WARNING := $(if $(HAVE_CROSS_SHELL_TESTS),,$(warning WARNING: This version of Urchin does not support cross-shell tests. All tests will run with 'sh'.))
|
|
||||||
# Define the default test suite(s). This can be overridden with `make TEST_SUITE=<...> <target>`.
|
# Define the default test suite(s). This can be overridden with `make TEST_SUITE=<...> <target>`.
|
||||||
# Test suites are the names of subfolders of './test'.
|
# Test suites are the names of subfolders of './test'.
|
||||||
TEST_SUITE := $(shell find ./test/* -type d -prune -exec basename {} \;)
|
TEST_SUITE := $(shell find ./test/* -type d -prune -exec basename {} \;)
|
||||||
|
@ -41,9 +42,8 @@ list:
|
||||||
$(SHELL_TARGETS):
|
$(SHELL_TARGETS):
|
||||||
@shell='$@'; shell=$${shell##*-}; which "$$shell" >/dev/null || { printf '\033[0;31m%s\033[0m\n' "WARNING: Cannot test with shell '$$shell': not found." >&2; exit 0; } && \
|
@shell='$@'; shell=$${shell##*-}; which "$$shell" >/dev/null || { printf '\033[0;31m%s\033[0m\n' "WARNING: Cannot test with shell '$$shell': not found." >&2; exit 0; } && \
|
||||||
printf '\n\033[0;34m%s\033[0m\n' "Running tests in $$shell"; \
|
printf '\n\033[0;34m%s\033[0m\n' "Running tests in $$shell"; \
|
||||||
[ -z "$$TRAVIS_BUILD_DIR" ] && for v in $$(export -p | awk -F'[ =]' '$$2 ~ "^NVM_" { print $$2 }'); do unset $$v; done && unset v; \
|
[ -z "$$TRAVIS_BUILD_DIR" ] && for v in $$(set | awk -F'=' '$$1 ~ "^NVM_" { print $$1 }'); do unset $$v; done && unset v; \
|
||||||
[ "$(HAVE_CROSS_SHELL_TESTS)" = 'yes' ] && targetShellOpt="-s $$shell" || targetShellOpt=; \
|
for suite in $(TEST_SUITE); do $(URCHIN) -f -s $$shell test/$$suite || exit; done
|
||||||
for suite in $(TEST_SUITE); do $(URCHIN) -f $$targetShellOpt test/$$suite || exit; done
|
|
||||||
|
|
||||||
# All-tests target: invokes the specified test suites for ALL shells defined in $(SHELLS).
|
# All-tests target: invokes the specified test suites for ALL shells defined in $(SHELLS).
|
||||||
.PHONY: test
|
.PHONY: test
|
||||||
|
|
Loading…
Reference in New Issue