Skip to content

Commit 0d91dcc

Browse files
Merge branch 'main' into main
2 parents 6b2252f + 3b724ae commit 0d91dcc

1 file changed

Lines changed: 8 additions & 6 deletions

File tree

Makefile

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -217,9 +217,14 @@ empty :=
217217
space := $(empty) $(empty)
218218
INTEGRATION_FILTER := $(subst $(space),|,$(strip $(INTEGRATION_TEST_SUITES)))
219219

220+
.PHONY: coverage-build
221+
coverage-build:
222+
@echo Building tests with coverage instrumentation...
223+
@$(SWIFT) build --build-tests --enable-code-coverage -c $(BUILD_CONFIGURATION) $(SWIFT_CONFIGURATION)
224+
220225
.PHONY: coverage
221226
# Merge the raw coverage data generated from coverage-unit and coverage-integration into one unified report
222-
coverage: coverage-unit coverage-integration
227+
coverage: coverage-build coverage-unit coverage-integration
223228
@echo Merging combined coverage profdata...
224229
@mkdir -p $(COVERAGE_OUTPUT_DIR)/combined
225230
@xcrun llvm-profdata merge -sparse \
@@ -233,12 +238,9 @@ coverage-unit:
233238
@echo Running unit test coverage...
234239
@rm -f $(COV_DATA_DIR)/*.profraw
235240
@mkdir -p $(COVERAGE_OUTPUT_DIR)/unit
236-
# Run the test suite with profiler (exclude integration tests)
237-
@$(SWIFT) test --enable-code-coverage -c $(BUILD_CONFIGURATION) $(SWIFT_CONFIGURATION) --skip TestCLI
238-
# Move the profiling data to a staging area for later consumption in full coverage aggregation
241+
@$(SWIFT) test --skip-build --enable-code-coverage -c $(BUILD_CONFIGURATION) $(SWIFT_CONFIGURATION) --skip TestCLI
239242
@echo Merging unit coverage profdata...
240243
@xcrun llvm-profdata merge -sparse $(COV_DATA_DIR)/*.profraw -o $(COVERAGE_OUTPUT_DIR)/unit/default.profdata
241-
# Generate both JSON (for machines) and html (for humans)
242244
$(call GENERATE_COV_REPORTS,$(COVERAGE_OUTPUT_DIR)/unit/default.profdata,unit)
243245

244246
.PHONY: coverage-integration
@@ -252,7 +254,7 @@ coverage-integration: all
252254
echo "Starting CLI integration tests with coverage" && \
253255
{ \
254256
export CLITEST_LOG_ROOT=$(LOG_ROOT) ; \
255-
$(SWIFT) test --enable-code-coverage -c $(BUILD_CONFIGURATION) $(SWIFT_CONFIGURATION) --filter "$(INTEGRATION_FILTER)" ; \
257+
$(SWIFT) test --skip-build --enable-code-coverage -c $(BUILD_CONFIGURATION) $(SWIFT_CONFIGURATION) --filter "$(INTEGRATION_FILTER)" ; \
256258
exit_code=$$? ; \
257259
cp $(COV_DATA_DIR)/*.profraw $(COVERAGE_OUTPUT_DIR)/integration/ ; \
258260
echo Ensuring apiserver stopped after the coverage integration tests ; \

0 commit comments

Comments
 (0)