From 7f373dc6806a229589958d540fe91df4219300d7 Mon Sep 17 00:00:00 2001 From: Zijian Date: Thu, 3 Oct 2024 20:59:31 +0000 Subject: [PATCH] Reduce unit test time --- Makefile | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/Makefile b/Makefile index d1736d240c8..83a6e200652 100644 --- a/Makefile +++ b/Makefile @@ -654,11 +654,11 @@ cover_profile: $Q echo Running special test cases without race detector: $Q go test ./cmd/server/cadence/ $Q echo Running package tests: - $Q for dir in $(PKG_TEST_DIRS); do \ - mkdir -p $(BUILD)/"$$dir"; \ - go test "$$dir" $(TEST_ARG) -coverprofile=$(BUILD)/"$$dir"/coverage.out || exit 1; \ - (cat $(BUILD)/"$$dir"/coverage.out | grep -v "^mode: \w\+" >> $(UNIT_COVER_FILE)) || true; \ - done; + $Q echo $(PKG_TEST_DIRS) | tr ' ' '\n' | xargs -P $(shell nproc) -I {} sh -c \ + 'mkdir -p $(BUILD)/"{}" && go test "{}" $(TEST_ARG) -coverprofile=$(BUILD)/"{}"/coverage.out || exit 1' + $Q echo Merging coverage profiles: + $Q find $(BUILD) -name coverage.out | xargs cat | grep -v "^mode:" >> $(UNIT_COVER_FILE) + cover_integration_profile: $Q mkdir -p $(BUILD)