Skip to content

Commit 5973b9c

Browse files
authored
Finalize Makefile for integration test rework. (#1878)
- Part of #1833. - Replace old targets with new ones. - Try increased parallelism after test tweaks in #1857. - Exclude test files from coverage analysis.
1 parent 4a79060 commit 5973b9c

3 files changed

Lines changed: 14 additions & 92 deletions

File tree

.github/workflows/common.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -103,11 +103,11 @@ jobs:
103103
104104
- name: Test the container project
105105
if: ${{ !inputs.coverage }}
106-
run: make APP_ROOT="${APP_ROOT}" LOG_ROOT="${LOG_ROOT}" test install-kernel integration integration-new
106+
run: make APP_ROOT="${APP_ROOT}" LOG_ROOT="${LOG_ROOT}" test install-kernel integration
107107

108108
- name: Test the container project with coverage
109109
if: ${{ inputs.coverage }}
110-
run: make APP_ROOT="${APP_ROOT}" LOG_ROOT="${LOG_ROOT}" install-kernel coverage-new
110+
run: make APP_ROOT="${APP_ROOT}" LOG_ROOT="${LOG_ROOT}" install-kernel coverage
111111

112112
- name: Extract coverage percentages
113113
if: ${{ inputs.coverage }}

Makefile

Lines changed: 12 additions & 72 deletions
Original file line numberDiff line numberDiff line change
@@ -170,6 +170,8 @@ TEST_BINARY = $(BUILD_BIN_DIR)/containerPackageTests.xctest/Contents/MacOS/conta
170170
# Set of files we do not want to get caught in the coverage generation
171171
LLVM_COV_IGNORE := \
172172
--ignore-filename-regex=".build/" \
173+
--ignore-filename-regex="/Tests/" \
174+
--ignore-filename-regex="/ContainerTestSupport/" \
173175
--ignore-filename-regex=".pb.swift" \
174176
--ignore-filename-regex=".proto" \
175177
--ignore-filename-regex=".grpc.swift"
@@ -194,12 +196,10 @@ define GENERATE_COV_REPORTS
194196
@cat $(COVERAGE_OUTPUT_DIR)/$(2)/coverage-percent.txt
195197
endef
196198

197-
# New integration test infrastructure.
198199
# PARALLEL_WIDTH controls --experimental-maximum-parallelization-width for the
199200
# concurrent pass. WARMUP_FILTER, CONCURRENT_FILTER, and GLOBAL_FILTER select
200-
# the three phases. Expand the filter lists as suites are migrated from CLITests.
201-
#PARALLEL_WIDTH ?= $(shell sysctl -n hw.physicalcpu)
202-
PARALLEL_WIDTH ?= 2
201+
# the three phases.
202+
PARALLEL_WIDTH ?= $(shell sysctl -n hw.physicalcpu)
203203
WARMUP_FILTER = ImageWarmup/
204204

205205
CONCURRENT_TEST_SUITES ?= $(sort $(addsuffix /,$(basename $(notdir \
@@ -264,27 +264,22 @@ define RUN_INTEGRATION
264264
}
265265
endef
266266

267-
.PHONY: integration-new
268-
integration-new: init-block
267+
.PHONY: integration
268+
integration: init-block
269269
$(RUN_INTEGRATION)
270270

271-
.PHONY: coverage-integration-new
272-
coverage-integration-new: INTEGRATION_SWIFT_EXTRA = --skip-build --enable-code-coverage
273-
coverage-integration-new: INTEGRATION_POST_TEST = cp $(COV_DATA_DIR)/*.profraw $(COVERAGE_OUTPUT_DIR)/integration/ ;
274-
coverage-integration-new: all
271+
.PHONY: coverage-integration
272+
coverage-integration: INTEGRATION_SWIFT_EXTRA = --skip-build --enable-code-coverage
273+
coverage-integration: INTEGRATION_POST_TEST = cp $(COV_DATA_DIR)/*.profraw $(COVERAGE_OUTPUT_DIR)/integration/ ;
274+
coverage-integration: all
275275
@mkdir -p $(COVERAGE_OUTPUT_DIR)/integration
276276
$(RUN_INTEGRATION)
277277

278-
INTEGRATION_TEST_SUITES ?= NoTests/
279-
280278
empty :=
281279
space := $(empty) $(empty)
282-
INTEGRATION_FILTER := $(subst $(space),|,$(strip $(INTEGRATION_TEST_SUITES)))
283280

284-
.PHONY: coverage-new
285-
# Merges unit coverage with integration-new coverage. Use this during migration;
286-
# replace coverage with coverage-new in CI until all legacy tests are removed.
287-
coverage-new: coverage-build coverage-unit coverage-integration-new
281+
.PHONY: coverage
282+
coverage: coverage-build coverage-unit coverage-integration
288283
@echo Merging integration coverage profdata...
289284
@xcrun llvm-profdata merge -sparse $(COVERAGE_OUTPUT_DIR)/integration/*.profraw -o $(COVERAGE_OUTPUT_DIR)/integration/default.profdata
290285
$(call GENERATE_COV_REPORTS,$(COVERAGE_OUTPUT_DIR)/integration/default.profdata,integration)
@@ -301,17 +296,6 @@ coverage-build:
301296
@echo Building tests with coverage instrumentation...
302297
@$(SWIFT) build --build-tests --enable-code-coverage -c $(BUILD_CONFIGURATION) $(SWIFT_CONFIGURATION)
303298

304-
.PHONY: coverage
305-
# Merge the raw coverage data generated from coverage-unit and coverage-integration into one unified report
306-
coverage: coverage-build coverage-unit coverage-integration
307-
@echo Merging combined coverage profdata...
308-
@mkdir -p $(COVERAGE_OUTPUT_DIR)/combined
309-
@xcrun llvm-profdata merge -sparse \
310-
$(COVERAGE_OUTPUT_DIR)/unit/default.profdata \
311-
$(COVERAGE_OUTPUT_DIR)/integration/default.profdata \
312-
-o $(COVERAGE_OUTPUT_DIR)/combined/default.profdata
313-
$(call GENERATE_COV_REPORTS,$(COVERAGE_OUTPUT_DIR)/combined/default.profdata,combined)
314-
315299
.PHONY: coverage-unit
316300
coverage-unit:
317301
@echo Running unit test coverage...
@@ -322,50 +306,6 @@ coverage-unit:
322306
@xcrun llvm-profdata merge -sparse $(COV_DATA_DIR)/*.profraw -o $(COVERAGE_OUTPUT_DIR)/unit/default.profdata
323307
$(call GENERATE_COV_REPORTS,$(COVERAGE_OUTPUT_DIR)/unit/default.profdata,unit)
324308

325-
.PHONY: coverage-integration
326-
coverage-integration: all
327-
@echo Ensuring apiserver stopped before the coverage integration tests...
328-
@bin/container system stop && sleep 3 && scripts/ensure-container-stopped.sh
329-
@echo Running integration test coverage...
330-
@rm -f $(COV_DATA_DIR)/*.profraw
331-
@mkdir -p $(COVERAGE_OUTPUT_DIR)/integration
332-
@bin/container --debug system start --timeout 60 $(SYSTEM_START_OPTS) && \
333-
echo "Starting CLI integration tests with coverage" && \
334-
{ \
335-
export CLITEST_LOG_ROOT=$(LOG_ROOT) ; \
336-
export CONTAINER_CLI_PATH=$(ROOT_DIR)/bin/container ; \
337-
$(SWIFT) test --skip-build --enable-code-coverage -c $(BUILD_CONFIGURATION) $(SWIFT_CONFIGURATION) --filter "$(INTEGRATION_FILTER)" ; \
338-
exit_code=$$? ; \
339-
cp $(COV_DATA_DIR)/*.profraw $(COVERAGE_OUTPUT_DIR)/integration/ ; \
340-
echo Ensuring apiserver stopped after the coverage integration tests ; \
341-
scripts/ensure-container-stopped.sh ; \
342-
exit $${exit_code} ; \
343-
}
344-
@echo Merging integration coverage profdata...
345-
@xcrun llvm-profdata merge -sparse $(COVERAGE_OUTPUT_DIR)/integration/*.profraw -o $(COVERAGE_OUTPUT_DIR)/integration/default.profdata
346-
$(call GENERATE_COV_REPORTS,$(COVERAGE_OUTPUT_DIR)/integration/default.profdata,integration)
347-
348-
.PHONY: integration
349-
integration: init-block
350-
@echo Ensuring apiserver stopped before the CLI integration tests...
351-
@bin/container system stop && sleep 3 && scripts/ensure-container-stopped.sh
352-
@if [ -n "$(APP_ROOT)" ]; then \
353-
echo "Clearing application data under $(APP_ROOT) (preserving kernels)..." ; \
354-
mkdir -p $(APP_ROOT) ; \
355-
find "$(APP_ROOT)" -mindepth 1 -maxdepth 1 ! -name kernels -exec rm -rf {} + ; \
356-
fi
357-
@echo Running the integration tests...
358-
@bin/container --debug system start --timeout 60 --enable-kernel-install $(SYSTEM_START_OPTS) && \
359-
echo "Starting CLI integration tests" && \
360-
{ \
361-
CLITEST_LOG_ROOT=$(LOG_ROOT) && export CLITEST_LOG_ROOT ; \
362-
CONTAINER_CLI_PATH=$(ROOT_DIR)/bin/container && export CONTAINER_CLI_PATH ; \
363-
$(SWIFT) test -c $(BUILD_CONFIGURATION) $(SWIFT_CONFIGURATION) --filter "$(INTEGRATION_FILTER)" ; \
364-
exit_code=$$? ; \
365-
echo Ensuring apiserver stopped after the CLI integration tests ; \
366-
scripts/ensure-container-stopped.sh ; \
367-
exit $${exit_code} ; \
368-
}
369309

370310
.PHONY: fmt
371311
fmt: swift-fmt update-licenses

Package.swift

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -101,24 +101,6 @@ let package = Package(
101101
],
102102
path: "Tests/IntegrationTests"
103103
),
104-
.testTarget(
105-
name: "CLITests",
106-
dependencies: [
107-
.product(name: "AsyncHTTPClient", package: "async-http-client"),
108-
.product(name: "Containerization", package: "containerization"),
109-
.product(name: "ContainerizationArchive", package: "containerization"),
110-
.product(name: "ContainerizationExtras", package: "containerization"),
111-
.product(name: "ContainerizationOS", package: "containerization"),
112-
.product(name: "TOML", package: "swift-toml"),
113-
"ContainerBuild",
114-
"ContainerLog",
115-
"ContainerPersistence",
116-
"ContainerResource",
117-
"MachineAPIClient",
118-
"Yams",
119-
],
120-
path: "Tests/CLITests"
121-
),
122104
.target(
123105
name: "ContainerCommands",
124106
dependencies: [

0 commit comments

Comments
 (0)