Skip to content

Commit

Permalink
Generalize test targets in Makefile
Browse files Browse the repository at this point in the history
Only a single recipe is defined for running go test or the sharness
tests. The short/expensive/race variants of the tests are defined
using target-specific variable values.
  • Loading branch information
torarnv committed Apr 7, 2015
1 parent 675e2c7 commit 7acee02
Showing 1 changed file with 20 additions and 19 deletions.
39 changes: 20 additions & 19 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,11 +1,4 @@

ifeq ($(TEST_NO_FUSE),1)
go_test=go test -tags nofuse
else
go_test=go test
endif


all:
# no-op. try:
# make install
Expand Down Expand Up @@ -34,27 +27,35 @@ nofuse:

test: test_expensive

test_short: build test_go_short test_sharness_short
test_short: test_go_short test_sharness_short

test_expensive: build test_go_expensive test_sharness_expensive
test_expensive: test_go_expensive test_sharness_expensive

test_3node:
cd test/3nodetest && make

test_go_short:
$(go_test) -test.short ./...
ifeq ($(TEST_NO_FUSE),1)
GO_TEST_FLAGS = -tags nofuse
endif

test_go_short: GO_TEST_FLAGS += -test.short
test_go_short: test_go

test_go_expensive: test_go

test_go_race: GO_TEST_FLAGS += -race
test_go_race: test_go

test_go_expensive:
$(go_test) ./...
test_go: build
go test $(GO_TEST_FLAGS) ./...

test_go_race:
$(go_test) ./... -race
test_sharness_short: test_sharness

test_sharness_short:
cd test/sharness/ && make
test_sharness_expensive: SHARNESS_MAKE_FLAGS += TEST_EXPENSIVE=1
test_sharness_expensive: test_sharness

test_sharness_expensive:
cd test/sharness/ && TEST_EXPENSIVE=1 make
test_sharness: build
cd test/sharness/ && $(MAKE) $(SHARNESS_MAKE_FLAGS)

test_all_commits:
@echo "testing all commits between origin/master..HEAD"
Expand Down

0 comments on commit 7acee02

Please sign in to comment.