Skip to content
Myr

Merge pull request #568 from mklement0/fix_make_file

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Fixed Urchin invocation problem in zsh and dash. Makefile "future-proofed" to take advantage of true cross-shell testing with Urchin, once available.

authored by Jordan Harband · committed by Jordan Harband · parents 6ec62fc, 781f72c · Browse files · 1 file+7 added−2 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

1 file+7 added−2 removed

  • other:+7 added−2 removed

1 file+7 added−2 removed

modified:Makefile+7 added-2 removed
15 unmodified lines
16SHELLS := sh bash dash ksh zsh17 # Generate 'test-<shell>' target names from specified shells.18 # The embedded shell names are extracted on demand inside the recipes.19SHELL_TARGETS := $(addprefix test-,$(SHELLS))20 # Determine if the installed Urchin version supports cross-shell testing, based on whether its usage information mentions the -s option.21HAVE_CROSS_SHELL_TESTS := $(shell PATH="$(PATH)" $(URCHIN) -h | grep -qE '(^|\s)-s\s' && echo 'yes')22NO_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'.))23 # Define the default test suite(s). This can be overridden with `make TEST_SUITE=<...> <target>`.24 # Test suites are the names of subfolders of './test'.22TEST_SUITE := $(shell find ./test -type d -mindepth 1 -maxdepth 1 -exec basename {} +)25TEST_SUITE := $(shell find ./test/* -type d -prune -exec basename {} \;)262728# Default target (by virtue of being the first non '.'-prefixed in the file).29.PHONY: _no-target-specified30_no-target-specified:31 $(error Please specify the target to make - `make list` shows targets. Alternatively, use `npm test` to run the default tests; `npm run` shows all tests)
9 unmodified lines
41$(SHELL_TARGETS):42 @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; } && \43 printf '\n\033[0;34m%s\033[0m\n' "Running tests in $$shell"; \44 [ -z "$$TRAVIS_BUILD_DIR" ] && for v in $$(export -p | awk -F'[ =]' '$$2 ~ "^NVM_" { print $$2 }'); do unset $$v; done && unset v; \45 [ "$(HAVE_CROSS_SHELL_TESTS)" = 'yes' ] && targetShellOpt="-s $$shell" || targetShellOpt=; \41 for suite in $(TEST_SUITE); do $$shell $(URCHIN) -f test/$$suite || exit; done46 for suite in $(TEST_SUITE); do $(URCHIN) -f $$targetShellOpt test/$$suite || exit; done4748# All-tests target: invokes the specified test suites for ALL shells defined in $(SHELLS).49.PHONY: test50test: $(SHELL_TARGETS)
27 unmodified lines