@@ -228,7 +228,6 @@ TEST_PKGS := \
228228 ./packages/contracts-bedrock/scripts/checks/... \
229229 ./op-dripper/... \
230230 ./devnet-sdk/... \
231- ./op-acceptance-tests/... \
232231 ./kurtosis-devnet/... \
233232 ./op-devstack/... \
234233 ./op-deployer/pkg/deployer/artifacts/... \
@@ -252,6 +251,9 @@ RPC_TEST_PKGS := \
252251 ./op-deployer/pkg/deployer/pipeline/... \
253252 ./op-deployer/pkg/deployer/upgrade/...
254253
254+ # All test packages used by CI (combination of all package groups)
255+ ALL_TEST_PACKAGES := $(TEST_PKGS ) $(RPC_TEST_PKGS ) $(FRAUD_PROOF_TEST_PKGS )
256+
255257# Common test environment variables
256258# For setting PARALLEL, nproc is for linux, sysctl for Mac and then fallback to 4 if neither is available
257259define DEFAULT_TEST_ENV_VARS
@@ -284,34 +286,48 @@ go-tests-short: $(TEST_DEPS) ## Runs comprehensive Go tests with -short flag
284286 go test -short -parallel=$$ PARALLEL -timeout=$(TEST_TIMEOUT ) $(TEST_PKGS )
285287.PHONY : go-tests-short
286288
287- go-tests-short-ci : # # Runs short Go tests with gotestsum for CI (assumes deps built by CI)
289+ # Internal target for running Go tests with gotestsum for CI
290+ # Usage: make _go-tests-ci-internal GO_TEST_FLAGS="-short"
291+ _go-tests-ci-internal :
288292 @echo " Setting up test directories..."
289293 mkdir -p ./tmp/test-results ./tmp/testlogs
290294 @echo " Running Go tests with gotestsum..."
291295 $(DEFAULT_TEST_ENV_VARS ) && \
292296 $(CI_ENV_VARS ) && \
293- gotestsum --format=testname \
294- --junitfile=./tmp/test-results/results.xml \
295- --jsonfile=./tmp/testlogs/log.json \
296- --rerun-fails=3 \
297- --rerun-fails-max-failures=50 \
298- --packages=" $( TEST_PKGS) $( RPC_TEST_PKGS) $( FRAUD_PROOF_TEST_PKGS) " \
299- -- -parallel=$$ PARALLEL -coverprofile=coverage.out -short -timeout=$(TEST_TIMEOUT ) -tags=" ci"
297+ if [ -n " $$ CIRCLE_NODE_TOTAL" ] && [ " $$ CIRCLE_NODE_TOTAL" -gt 1 ]; then \
298+ export NODE_INDEX=$$ {CIRCLE_NODE_INDEX:-0} && \
299+ export NODE_TOTAL=$$ {CIRCLE_NODE_TOTAL:-1} && \
300+ export PARALLEL_PACKAGES=$$(echo "$(ALL_TEST_PACKAGES ) " | tr ' ' '\n' | awk -v idx=$$NODE_INDEX -v total=$$NODE_TOTAL 'NR % total == idx' | tr '\n' ' ' ) && \
301+ if [ -n " $$ PARALLEL_PACKAGES" ]; then \
302+ echo " Node $$ NODE_INDEX/$$ NODE_TOTAL running packages: $$ PARALLEL_PACKAGES" ; \
303+ gotestsum --format=testname \
304+ --junitfile=./tmp/test-results/results-$$ NODE_INDEX.xml \
305+ --jsonfile=./tmp/testlogs/log-$$ NODE_INDEX.json \
306+ --rerun-fails=3 \
307+ --rerun-fails-max-failures=50 \
308+ --packages=" $$ PARALLEL_PACKAGES" \
309+ -- -parallel=$$ PARALLEL -coverprofile=coverage-$$ NODE_INDEX.out $(GO_TEST_FLAGS ) -timeout=$(TEST_TIMEOUT ) -tags=" ci" ; \
310+ else \
311+ echo " ERROR: Node $$ NODE_INDEX/$$ NODE_TOTAL has no packages to run! Perhaps parallelism is set too high? (ALL_TEST_PACKAGES has $$ (echo '$( ALL_TEST_PACKAGES) ' | wc -w) packages)" ; \
312+ exit 1; \
313+ fi ; \
314+ else \
315+ gotestsum --format=testname \
316+ --junitfile=./tmp/test-results/results.xml \
317+ --jsonfile=./tmp/testlogs/log.json \
318+ --rerun-fails=3 \
319+ --rerun-fails-max-failures=50 \
320+ --packages=" $( ALL_TEST_PACKAGES) " \
321+ -- -parallel=$$ PARALLEL -coverprofile=coverage.out $(GO_TEST_FLAGS ) -timeout=$(TEST_TIMEOUT ) -tags=" ci" ; \
322+ fi
323+ .PHONY : _go-tests-ci-internal
324+
325+ go-tests-short-ci : # # Runs short Go tests with gotestsum for CI (assumes deps built by CI)
326+ $(MAKE ) _go-tests-ci-internal GO_TEST_FLAGS=" -short"
300327.PHONY : go-tests-short-ci
301328
302329go-tests-ci : # # Runs comprehensive Go tests with gotestsum for CI (assumes deps built by CI)
303- @echo " Setting up test directories..."
304- mkdir -p ./tmp/test-results ./tmp/testlogs
305- @echo " Running Go tests with gotestsum..."
306- $(DEFAULT_TEST_ENV_VARS ) && \
307- $(CI_ENV_VARS ) && \
308- gotestsum --format=testname \
309- --junitfile=./tmp/test-results/results.xml \
310- --jsonfile=./tmp/testlogs/log.json \
311- --rerun-fails=3 \
312- --rerun-fails-max-failures=50 \
313- --packages=" $( TEST_PKGS) $( RPC_TEST_PKGS) $( FRAUD_PROOF_TEST_PKGS) " \
314- -- -parallel=$$ PARALLEL -coverprofile=coverage.out -timeout=$(TEST_TIMEOUT ) -tags=" ci"
330+ $(MAKE ) _go-tests-ci-internal GO_TEST_FLAGS=" "
315331.PHONY : go-tests-ci
316332
317333go-tests-fraud-proofs-ci : # # Runs fraud proofs Go tests with gotestsum for CI (assumes deps built by CI)
0 commit comments