diff --git a/Makefile b/Makefile index e31c0adde..a6ca526ba 100644 --- a/Makefile +++ b/Makefile @@ -174,7 +174,7 @@ itest-race: build-itest-race itest-only itest-parallel: build-itest db-instance @$(call print, "Running tests") rm -rf itest/*.log itest/.logs-*; date - EXEC_SUFFIX=$(EXEC_SUFFIX) echo "$$(seq 0 $$(expr $(ITEST_PARALLELISM) - 1))" | xargs -P $(ITEST_PARALLELISM) -n 1 -I {} scripts/itest_part.sh {} $(NUM_ITEST_TRANCHES) $(TEST_FLAGS) $(ITEST_FLAGS) + EXEC_SUFFIX=$(EXEC_SUFFIX) scripts/itest_parallel.sh $(ITEST_PARALLELISM) $(NUM_ITEST_TRANCHES) $(TEST_FLAGS) $(ITEST_FLAGS) itest-clean: @$(call print, "Cleaning old itest processes") diff --git a/scripts/itest_parallel.sh b/scripts/itest_parallel.sh new file mode 100755 index 000000000..e540a02ec --- /dev/null +++ b/scripts/itest_parallel.sh @@ -0,0 +1,38 @@ +#!/bin/bash + +# Get all the variables. +PROCESSES=$1 +TRANCHES=$2 +TEST_FLAGS=$3 +ITEST_FLAGS=$4 + +# Create a variable to hold the final exit code. +exit_code=0 + +# Run commands using xargs in parallel and capture their PIDs +pids=() +for ((i=0; i