From c7ac4a303473b44741a1ea76713c2338c0dc63e5 Mon Sep 17 00:00:00 2001 From: Devon Estes Date: Tue, 24 Dec 2019 11:57:33 +0100 Subject: [PATCH] Allow running a single test file from make One thing I've found myself wanting quite a lot when working on Elixir is the ability to run single tests, or at least single test files, easily with `make test_stdlib` or something. With this change this is now possible - you can run `make test_stdlib TEST_FILES=macro_test.exs` to just run that file, or `make test_ex_unit TEST_FILE=ex_unit/formatter_test.exs`. --- Makefile | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index 98ff8848184..600cbb64ff5 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,5 @@ PREFIX ?= /usr/local +TEST_FILES ?= "*_test.exs" SHARE_PREFIX ?= $(PREFIX)/share MAN_PREFIX ?= $(SHARE_PREFIX)/man CANONICAL := master/ # master/ or vMAJOR.MINOR/ @@ -45,7 +46,7 @@ lib/$(1)/ebin/Elixir.$(2).beam: $(wildcard lib/$(1)/lib/*.ex) $(wildcard lib/$(1 test_$(1): compile $(1) @ echo "==> $(1) (ex_unit)" - $(Q) cd lib/$(1) && ../../bin/elixir -r "test/test_helper.exs" -pr "test/**/*_test.exs"; + $(Q) cd lib/$(1) && ../../bin/elixir -r "test/test_helper.exs" -pr "test/**/$(TEST_FILES)"; endef define WRITE_SOURCE_DATE_EPOCH @@ -281,9 +282,9 @@ test_stdlib: compile @ echo "==> elixir (ex_unit)" $(Q) exec epmd & exit $(Q) if [ "$(OS)" = "Windows_NT" ]; then \ - cd lib/elixir && cmd //C call ../../bin/elixir.bat -r "test/elixir/test_helper.exs" -pr "test/elixir/**/*_test.exs"; \ + cd lib/elixir && cmd //C call ../../bin/elixir.bat -r "test/elixir/test_helper.exs" -pr "test/elixir/**/$(TEST_FILES)"; \ else \ - cd lib/elixir && ../../bin/elixir -r "test/elixir/test_helper.exs" -pr "test/elixir/**/*_test.exs"; \ + cd lib/elixir && ../../bin/elixir -r "test/elixir/test_helper.exs" -pr "test/elixir/**/$(TEST_FILES)"; \ fi #==> Dialyzer tasks