git-lfs/t/Makefile
Taylor Blau f8147219fd t/Makefile: mark test sources as .PHONY
We have used 'make' in the testing directory 't' to help run integration
tests, including starting and stopping a Git LFS test server, and
environmental setup bits.

We do so by writing a recipe that matches all testing files that we'd
want to run, and then running commands based on which one we picked.

Since we don't generate a file that was missing when running one of
these sources, 'make' will say that the file is up-to-date, unless we
run with 'make -B' (to force a re-make).

This is annoying to type, and can be avoided by marking the test targets
as .PHONY, indicating that they don't produce a file, and are instead
synthetic targets that can be run repeatedly without `make`'s up-to-date
checking.
2018-09-05 10:57:00 -04:00

44 lines
1.0 KiB
Makefile

RM ?= rm -f
PROVE ?= prove
PROVE_EXTRA_ARGS =
DEFAULT_TEST_TARGET ?= test
GO ?= go
X =
TEST_CMDS =
TEST_CMDS += ../bin/git-credential-lfsnoop$X
TEST_CMDS += ../bin/git-credential-lfstest$X
TEST_CMDS += ../bin/lfs-askpass$X
TEST_CMDS += ../bin/lfs-ssh-echo$X
TEST_CMDS += ../bin/lfs-ssh-proxy-test$X
TEST_CMDS += ../bin/lfstest-count-tests$X
TEST_CMDS += ../bin/lfstest-customadapter$X
TEST_CMDS += ../bin/lfstest-gitserver$X
TEST_CMDS += ../bin/lfstest-standalonecustomadapter$X
TEST_CMDS += ../bin/lfstest-testutils$X
TEST_SRCS = $(wildcard t-*.sh)
all : $(DEFAULT_TEST_TARGET)
test : $(TEST_CMDS)
$(RM) -r remote test_count{,.lock}
@GIT_LFS_NO_TEST_COUNT= bash -c '. ./testenv.sh && setup'
$(PROVE) $(PROVE_EXTRA_ARGS) ./t-*.sh
@GIT_LFS_NO_TEST_COUNT= bash -c '. ./testenv.sh && shutdown'
.PHONY : $(TEST_SRCS)
$(TEST_SRCS) : $(TEST_CMDS)
$(RM) -r remote test_count{,.lock}
$(PROVE) -v $(PROVE_EXTRA_ARGS) $@
.PHONY : clean
clean :
$(RM) -r remote
$(RM) $(TEST_CMDS)
../bin/%$X : cmd/%.go
go build -o $@ $^