github.com/blixtra/rkt@v0.8.1-0.20160204105720-ab0d1add1a43/tests/tests.mk (about)

     1  $(call setup-stamp-file,TST_SHORT_TESTS_STAMP,/short-tests)
     2  
     3  TST_DIRS_WITH_GOFILES := $(call go-find-directories,$(GO_TEST_PACKAGES),GoFiles)
     4  TST_DIRS_WITH_TESTGOFILES := $(call go-find-directories,$(GO_TEST_PACKAGES),TestGoFiles,tests)
     5  
     6  # gofmt takes list of directories
     7  TST_GOFMT_DIRS := $(foreach d,$(TST_DIRS_WITH_GOFILES),./$d)
     8  # go vet and go test take a list of packages
     9  TST_GO_VET_PACKAGES := $(foreach d,$(TST_DIRS_WITH_GOFILES),$(REPO_PATH)/$d)
    10  TST_GO_TEST_PACKAGES := $(foreach d,$(TST_DIRS_WITH_TESTGOFILES),$(REPO_PATH)/$d)
    11  
    12  $(call forward-vars,$(TST_SHORT_TESTS_STAMP), \
    13  	GOFMT TST_GOFMT_DIRS GO_ENV GO TST_GO_VET_PACKAGES RKT_TAGS \
    14  	TST_GO_TEST_PACKAGES)
    15  $(TST_SHORT_TESTS_STAMP):
    16  	$(VQ) \
    17  	set -e; \
    18  	$(call vb,vt,GOFMT,$(TST_GOFMT_DIRS)) \
    19  	res=$$($(GOFMT) -l $(TST_GOFMT_DIRS)); \
    20  	if [ -n "$${res}" ]; then echo -e "gofmt checking failed:\n$${res}"; exit 1; fi; \
    21  	$(call vb,vt,GO VET,$(TST_GO_VET_PACKAGES)) \
    22  	res=$$($(GO_ENV) "$(GO)" vet $(TST_GO_VET_PACKAGES)); \
    23  	if [ -n "$${res}" ]; then echo -e "govet checking failed:\n$${res}"; exit 1; fi; \
    24  	$(call vb,vt,(C) CHECK) \
    25  	res=$$( \
    26  		for file in $$(find . -type f -iname '*.go' ! -path './Godeps/*'); do \
    27  			head -n1 "$${file}" | grep -Eq "(Copyright|generated)" || echo -e "  $${file}"; \
    28  		done; \
    29  	); \
    30  	if [ -n "$${res}" ]; then echo -e "license header checking failed:\n$${res}"; exit 1; fi; \
    31  	$(call vb,vt,GO TEST,$(TST_GO_TEST_PACKAGES)) \
    32  	$(GO_ENV) "$(GO)" test -timeout 60s -cover $(RKT_TAGS) $(TST_GO_TEST_PACKAGES) --race
    33  
    34  TOPLEVEL_CHECK_STAMPS += $(TST_SHORT_TESTS_STAMP)
    35  TOPLEVEL_UNIT_CHECK_STAMPS += $(TST_SHORT_TESTS_STAMP)
    36  
    37  ifeq ($(RKT_RUN_FUNCTIONAL_TESTS),yes)
    38  
    39  $(call inc-one,functional.mk)
    40  
    41  else
    42  
    43  $(call setup-stamp-file,TST_FUNC_TESTS_DISABLED_STAMP,/func-test-disabled)
    44  
    45  TOPLEVEL_FUNCTIONAL_CHECK_STAMPS += $(TST_FUNC_TESTS_DISABLED_STAMP)
    46  
    47  $(TST_FUNC_TESTS_DISABLED_STAMP):
    48  	$(VQ) \
    49  	echo 'Functional tests are disabled, pass --enable-functional-tests to configure script to enable them.' >&2; \
    50  	false
    51  
    52  endif
    53  
    54  $(call undefine-namespaces,TST)