Run tests in parallel

This commit is contained in:
w0rp 2017-12-07 20:07:45 +00:00
parent 7a71186d62
commit b6efb5649e
2 changed files with 42 additions and 21 deletions

View File

@ -11,7 +11,6 @@
current_image_id=d5a1b5915b09 current_image_id=d5a1b5915b09
image=w0rp/ale image=w0rp/ale
exit_code=0
tests='test/*.vader test/*/*.vader test/*/*/*.vader test/*/*/*.vader' tests='test/*.vader test/*/*.vader test/*/*/*.vader test/*/*/*.vader'
# These flags are forwarded to the script for running Vader tests. # These flags are forwarded to the script for running Vader tests.
@ -91,20 +90,50 @@ find test -name '*.swp' -delete
docker images -q w0rp/ale | grep "^$current_image_id" > /dev/null \ docker images -q w0rp/ale | grep "^$current_image_id" > /dev/null \
|| docker pull "$image" || docker pull "$image"
output_dir=$(mktemp -d 2>/dev/null || mktemp -d -t 'mytmpdir')
trap '{ rm -rf "$output_dir"; }' EXIT
file_number=0
pid_list=''
for vim in $(docker run --rm "$image" ls /vim-build/bin | grep '^neovim\|^vim' ); do for vim in $(docker run --rm "$image" ls /vim-build/bin | grep '^neovim\|^vim' ); do
if [[ $vim =~ ^neovim ]] && ((run_neovim_tests)); then if ((run_vim_tests)) || [[ $vim =~ ^neovim ]] && ((run_neovim_tests)); then
test/script/run-vader-tests $quiet_flag $verbose_flag "$vim" "$tests" || exit_code=$? echo "Starting Vim: $vim..."
elif ((run_vim_tests)); then file_number=$((file_number+1))
test/script/run-vader-tests $quiet_flag $verbose_flag "$vim" "$tests" || exit_code=$? test/script/run-vader-tests $quiet_flag $verbose_flag "$vim" "$tests" \
> "$output_dir/$file_number" 2>&1 &
pid_list="$pid_list $!"
fi fi
done done
if ((run_vint)); then if ((run_vint)); then
test/script/run-vint || exit_code=$? echo "Starting Vint..."
file_number=$((file_number+1))
test/script/run-vint > "$output_dir/$file_number" 2>&1 &
pid_list="$pid_list $!"
fi fi
if ((run_custom_checks)); then if ((run_custom_checks)); then
test/script/custom-checks || exit_code=$? echo "Starting Custom checks..."
file_number=$((file_number+1))
test/script/custom-checks &> "$output_dir/$file_number" 2>&1 &
pid_list="$pid_list $!"
fi fi
exit $exit_code echo
failed=0
index=0
for pid in $pid_list; do
index=$((index+1))
if ! wait "$pid"; then
failed=1
fi
cat "$output_dir/$index"
done
exit $failed

View File

@ -106,18 +106,10 @@ echo "Running tests for $vim"
echo '========================================' echo '========================================'
echo echo
if [[ $vim =~ ^neovim ]]; then set -o pipefail
set -o pipefail docker run -a stderr -e VADER_OUTPUT_FILE=/dev/stderr "${docker_flags[@]}" \
docker run -it -e VADER_OUTPUT_FILE=/dev/stderr "${docker_flags[@]}" \ "/vim-build/bin/$vim" -u test/vimrc \
"/vim-build/bin/$vim" -u test/vimrc \ "+Vader! $tests" 2>&1 | filter-vader-output | color-vader-output || exit_code=$?
--headless "+Vader! $tests" | filter-vader-output | color-vader-output || exit_code=$? set +o pipefail
set +o pipefail
else
set -o pipefail
docker run -a stderr -e VADER_OUTPUT_FILE=/dev/stderr "${docker_flags[@]}" \
"/vim-build/bin/$vim" -u test/vimrc \
"+Vader! $tests" 2>&1 | filter-vader-output | color-vader-output || exit_code=$?
set +o pipefail
fi
exit "$exit_code" exit "$exit_code"