Skip to content

Commit

Permalink
Explicitly break unit-tests foreach into for loop.
Browse files Browse the repository at this point in the history
It seems that in some env if the path is large enough for the full list
of files, the full bash command in that target gets too big for bash and
hence will trigger an error ``too many arguments``.

Signed-off-by: Weilong Cui <cuiwl@google.com>
  • Loading branch information
Weil0ng committed Apr 3, 2020
1 parent b9d2105 commit 3b51a86
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions Makefile
Expand Up @@ -146,9 +146,14 @@ ifeq ($(SKIP_VET),"false")
endif
$(QUIET) echo "mode: count" > coverage-all-tmp.out
$(QUIET) echo "mode: count" > coverage.out
$(QUIET)$(foreach pkg,$(patsubst %,github.com/cilium/cilium/%,$(TESTPKGS)),\
$(_GO) test $(GOFLAGS) $(TEST_UNITTEST_LDFLAGS) $(pkg) $(GOTEST_BASE) $(GOTEST_COVER_OPTS) || exit 1; \
tail -n +2 coverage.out >> coverage-all-tmp.out;)
# It seems that in some env if the path is large enough for the full list
# of files, the full bash command in that target gets too big for bash and
# hence will trigger an error of too many arguments. As a workaround, we
# have to process these packages in different subshells.
for pkg in $(patsubst %,github.com/cilium/cilium/%,$(TESTPKGS)); do \
$(_GO) test $(GOFLAGS) $(TEST_UNITTEST_LDFLAGS) $$pkg $(GOTEST_BASE) $(GOTEST_COVER_OPTS) || exit 1; \
tail -n +2 coverage.out >> coverage-all-tmp.out; \
done
$(MAKE) generate-cov
@rmdir ./daemon/1 ./daemon/1_backup 2> /dev/null || true
$(MAKE) stop-kvstores
Expand Down

0 comments on commit 3b51a86

Please sign in to comment.