@@ -151,7 +151,7 @@ dsym:
151151
152152.PHONY : test
153153test :
154- @$(SWIFT ) test -c $(BUILD_CONFIGURATION ) $(SWIFT_CONFIGURATION ) --skip TestCLI
154+ @$(SWIFT ) test -c $(BUILD_CONFIGURATION ) $(SWIFT_CONFIGURATION ) --skip TestCLI --skip IntegrationTests
155155
156156.PHONY : install-kernel
157157install-kernel :
@@ -194,6 +194,56 @@ define GENERATE_COV_REPORTS
194194 @cat $(COVERAGE_OUTPUT_DIR ) /$(2 ) /coverage-percent.txt
195195endef
196196
197+ # New integration test infrastructure.
198+ # PARALLEL_WIDTH controls --experimental-maximum-parallelization-width for the
199+ # 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 ?= 2
202+ WARMUP_FILTER = ImageWarmup
203+ CONCURRENT_FILTER = DemoConcurrentTests
204+ GLOBAL_FILTER = DemoGlobalTests
205+
206+ INTEGRATION_SWIFT_EXTRA ?=
207+ INTEGRATION_POST_TEST ?=
208+
209+ define RUN_INTEGRATION
210+ @echo Ensuring apiserver stopped before the CLI integration tests...
211+ @bin/container system stop && sleep 3 && scripts/ensure-container-stopped.sh
212+ @if [ -n "$(APP_ROOT ) " ]; then \
213+ echo "Clearing application data under $(APP_ROOT ) (preserving kernels)..." ; \
214+ mkdir -p $(APP_ROOT ) ; \
215+ find "$(APP_ROOT ) " -mindepth 1 -maxdepth 1 ! -name kernels -exec rm -rf {} + ; \
216+ fi
217+ @echo Running the integration tests...
218+ @bin/container --debug system start --timeout 60 --enable-kernel-install $(SYSTEM_START_OPTS ) && \
219+ { \
220+ CLITEST_LOG_ROOT=$(LOG_ROOT ) && export CLITEST_LOG_ROOT ; \
221+ CONTAINER_CLI_PATH=$(ROOT_DIR ) /bin/container && export CONTAINER_CLI_PATH ; \
222+ echo "==> Warmup pass" && \
223+ $(SWIFT ) test $(INTEGRATION_SWIFT_EXTRA ) -c $(BUILD_CONFIGURATION ) $(SWIFT_CONFIGURATION ) --filter "$(WARMUP_FILTER ) " && \
224+ echo "==> Concurrent pass (width=$(PARALLEL_WIDTH ) )" && \
225+ $(SWIFT ) test $(INTEGRATION_SWIFT_EXTRA ) -c $(BUILD_CONFIGURATION ) $(SWIFT_CONFIGURATION ) --experimental-maximum-parallelization-width $(PARALLEL_WIDTH ) --filter "$(CONCURRENT_FILTER ) " && \
226+ echo "==> Global pass (serial)" && \
227+ $(SWIFT ) test $(INTEGRATION_SWIFT_EXTRA ) -c $(BUILD_CONFIGURATION ) $(SWIFT_CONFIGURATION ) --filter "$(GLOBAL_FILTER ) " ; \
228+ exit_code=$$? ; \
229+ $(INTEGRATION_POST_TEST ) \
230+ echo Ensuring apiserver stopped after the CLI integration tests ; \
231+ scripts/ensure-container-stopped.sh ; \
232+ exit $${exit_code} ; \
233+ }
234+ endef
235+
236+ .PHONY : integration-new
237+ integration-new : init-block
238+ $(RUN_INTEGRATION )
239+
240+ .PHONY : coverage-integration-new
241+ coverage-integration-new : INTEGRATION_SWIFT_EXTRA = --skip-build --enable-code-coverage
242+ coverage-integration-new : INTEGRATION_POST_TEST = cp $(COV_DATA_DIR ) /* .profraw $(COVERAGE_OUTPUT_DIR ) /integration/ ;
243+ coverage-integration-new : all
244+ @mkdir -p $(COVERAGE_OUTPUT_DIR ) /integration
245+ $(RUN_INTEGRATION )
246+
197247INTEGRATION_TEST_SUITES ?= \
198248 TestCLIHelp \
199249 TestCLIStatus \
@@ -228,6 +278,21 @@ empty :=
228278space := $(empty ) $(empty )
229279INTEGRATION_FILTER := $(subst $(space ) ,|,$(strip $(INTEGRATION_TEST_SUITES ) ) )
230280
281+ .PHONY : coverage-new
282+ # Merges unit coverage with integration-new coverage. Use this during migration;
283+ # replace coverage with coverage-new in CI until all legacy tests are removed.
284+ coverage-new : coverage-build coverage-unit coverage-integration-new
285+ @echo Merging integration coverage profdata...
286+ @xcrun llvm-profdata merge -sparse $(COVERAGE_OUTPUT_DIR ) /integration/* .profraw -o $(COVERAGE_OUTPUT_DIR ) /integration/default.profdata
287+ $(call GENERATE_COV_REPORTS,$(COVERAGE_OUTPUT_DIR ) /integration/default.profdata,integration)
288+ @echo Merging combined coverage profdata...
289+ @mkdir -p $(COVERAGE_OUTPUT_DIR ) /combined
290+ @xcrun llvm-profdata merge -sparse \
291+ $(COVERAGE_OUTPUT_DIR ) /unit/default.profdata \
292+ $(COVERAGE_OUTPUT_DIR ) /integration/default.profdata \
293+ -o $(COVERAGE_OUTPUT_DIR ) /combined/default.profdata
294+ $(call GENERATE_COV_REPORTS,$(COVERAGE_OUTPUT_DIR ) /combined/default.profdata,combined)
295+
231296.PHONY : coverage-build
232297coverage-build :
233298 @echo Building tests with coverage instrumentation...
@@ -249,7 +314,7 @@ coverage-unit:
249314 @echo Running unit test coverage...
250315 @rm -f $(COV_DATA_DIR ) /* .profraw
251316 @mkdir -p $(COVERAGE_OUTPUT_DIR ) /unit
252- @$(SWIFT ) test --skip-build --enable-code-coverage -c $(BUILD_CONFIGURATION ) $(SWIFT_CONFIGURATION ) --skip TestCLI
317+ @$(SWIFT ) test --skip-build --enable-code-coverage -c $(BUILD_CONFIGURATION ) $(SWIFT_CONFIGURATION ) --skip TestCLI --skip IntegrationTests
253318 @echo Merging unit coverage profdata...
254319 @xcrun llvm-profdata merge -sparse $(COV_DATA_DIR ) /* .profraw -o $(COVERAGE_OUTPUT_DIR ) /unit/default.profdata
255320 $(call GENERATE_COV_REPORTS,$(COVERAGE_OUTPUT_DIR ) /unit/default.profdata,unit)
0 commit comments