diff --git a/Makefile b/Makefile index 170d64a2f..9b8fd2cc9 100644 --- a/Makefile +++ b/Makefile @@ -67,7 +67,7 @@ $(SCOPE_EXE) $(RUNSVINIT) lint tests shell prog/static.go: $(SCOPE_BACKEND_BUILD -v $(shell pwd)/.pkg:/go/pkg \ --net=host \ -e GOARCH -e GOOS -e CIRCLECI -e CIRCLE_BUILD_NUM -e CIRCLE_NODE_TOTAL \ - -e CIRCLE_NODE_INDEX -e COVERDIR -e SLOW \ + -e CIRCLE_NODE_INDEX -e COVERDIR -e SLOW -e TESTDIRS \ $(SCOPE_BACKEND_BUILD_IMAGE) SCOPE_VERSION=$(SCOPE_VERSION) GO_BUILD_INSTALL_DEPS=$(GO_BUILD_INSTALL_DEPS) $@ else diff --git a/tools/test b/tools/test index f8d76c56b..4ee4ca1a4 100755 --- a/tools/test +++ b/tools/test @@ -47,8 +47,15 @@ fi fail=0 -# NB: Relies on paths being prefixed with './'. -TESTDIRS=( $(git ls-files -- '*_test.go' | grep -vE '^(vendor|prog|experimental)/' | xargs -n1 dirname | sort -u | sed -e 's|^|./|') ) +if [ -z "$TESTDIRS" ]; then + # NB: Relies on paths being prefixed with './'. + TESTDIRS=( $(git ls-files -- '*_test.go' | grep -vE '^(vendor|prog|experimental)/' | xargs -n1 dirname | sort -u | sed -e 's|^|./|') ) +else + # TESTDIRS on the right side is not really an array variable, it + # is just a string with spaces, but it is written like that to + # shut up the shellcheck tool. + TESTDIRS=( $(for d in ${TESTDIRS[*]}; do echo "$d"; done) ) +fi # If running on circle, use the scheduler to work out what tests to run on what shard if [ -n "$CIRCLECI" ] && [ -z "$NO_SCHEDULER" ] && [ -x "$DIR/sched" ]; then