mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-10-11 09:03:15 +02:00
itest: make parallel itest runner for litd itests
This commit is contained in:
7
Makefile
7
Makefile
@@ -228,6 +228,13 @@ itest-parallel: build-itest db-instance
|
|||||||
EXEC_SUFFIX=$(EXEC_SUFFIX) scripts/itest_parallel.sh $(ITEST_PARALLELISM) $(NUM_ITEST_TRANCHES) $(TEST_FLAGS) $(ITEST_FLAGS)
|
EXEC_SUFFIX=$(EXEC_SUFFIX) scripts/itest_parallel.sh $(ITEST_PARALLELISM) $(NUM_ITEST_TRANCHES) $(TEST_FLAGS) $(ITEST_FLAGS)
|
||||||
$(COLLECT_ITEST_COVERAGE)
|
$(COLLECT_ITEST_COVERAGE)
|
||||||
|
|
||||||
|
#? itest-litd-parallel: Build and run integration tests in parallel mode, running up to ITEST_PARALLELISM test tranches in parallel (default 4)
|
||||||
|
itest-litd-parallel: build-itest db-instance
|
||||||
|
@$(call print, "Running tests")
|
||||||
|
rm -rf itest/*.log itest/.logs-*; date
|
||||||
|
EXEC_SUFFIX=$(EXEC_SUFFIX) scripts/itest_litd_parallel.sh $(ITEST_PARALLELISM) $(NUM_ITEST_TRANCHES) $(TEST_FLAGS) $(ITEST_FLAGS)
|
||||||
|
$(COLLECT_ITEST_COVERAGE)
|
||||||
|
|
||||||
#? itest-clean: Kill all running itest processes
|
#? itest-clean: Kill all running itest processes
|
||||||
itest-clean:
|
itest-clean:
|
||||||
@$(call print, "Cleaning old itest processes")
|
@$(call print, "Cleaning old itest processes")
|
||||||
|
37
scripts/itest_litd_parallel.sh
Executable file
37
scripts/itest_litd_parallel.sh
Executable file
@@ -0,0 +1,37 @@
|
|||||||
|
#!/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<PROCESSES; i++)); do
|
||||||
|
scripts/itest_litd_part.sh $i $TRANCHES $TEST_FLAGS $ITEST_FLAGS &
|
||||||
|
pids+=($!)
|
||||||
|
done
|
||||||
|
|
||||||
|
|
||||||
|
# Wait for the processes created by xargs to finish.
|
||||||
|
for pid in "${pids[@]}"; do
|
||||||
|
wait $pid
|
||||||
|
|
||||||
|
# Once finished, grab its exit code.
|
||||||
|
current_exit_code=$?
|
||||||
|
|
||||||
|
# Overwrite the exit code if current itest doesn't return 0.
|
||||||
|
if [ $current_exit_code -ne 0 ]; then
|
||||||
|
# Only write the exit code of the first failing itest.
|
||||||
|
if [ $exit_code -eq 0 ]; then
|
||||||
|
exit_code=$current_exit_code
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
# Exit with the exit code of the first failing itest or 0.
|
||||||
|
exit $exit_code
|
Reference in New Issue
Block a user