ale/run-tests

280 lines
7.1 KiB
Plaintext
Raw Permalink Normal View History

#!/usr/bin/env bash
# Author: w0rp <devw0rp@gmail.com>
#
# This script runs tests for the ALE project. Run `./run-tests --help` for
# options, or read the output below.
#
3560 add vim 8.2 and nvim 0.4 to ci tests (#3561) * Add vim82 and neovim04 to CI tests. * Fix test_sign_column_hightlighting test. In vim82 with verbose=1 the output of highlight command changes breaking the ale#sign#SetUpDefaultColumnWithoutErrorsHighlight(). This commit forces verbose=0 when the method starts and restores the previous value before exiting. * No return values in vim82 returns a numeric value instead of a empty string. * Fix test_reek_handler test The FuzzyJSONDecode() method catches E474 when it fails to parse the input as JSON but Vim8.2 throws E491 instead. This commit modifies the function to catch both E474 or E491. * Fix perl6 handler test. Perl6 handler catches json parse errors using the E474 error but in Vim82 it changed to E491. This commit modifies the handler so both errors are considered. * Fix list opening tests. In Vim 8.2 the call `range(1, bufnr('$'))` always returns quickfix buffers no matter if they are closed or not. Using `ls` does not show them but the above range will always include them. This new behavior breaks the ale#list#IsQuickfixOpen() method that in turn breaks many other things. This commit fixes this by using the getqflist() and getloclist() methods instead. * Fix test updates loclist test. For some reason in Vim 8.2 the sign offset seems to not reset between tests causing the sign_id to not match in the Assert. When the test is run individually it passes but when run as part of the whole suite the sign_id is off by one. Forcing the offset in the test setup seems to fix the issue. * Fix omnifunc completion test. For unknown reasons the SetCompletionResponse tests fail in Neovim 0.2 and 0.4. Unfortunatelly the only solution I found is to disable them for neovim. * Fix linter warnings * Fix smoker test. Add vim 8.2 to the list of versions that need some retires due to randomly failing tests. * Add docker image build job. Trying some clever trick to build the docker image if not available locally or in Docker hub. It uses the Dockerfile md5 checksum as tag so only when changes on that file occur will the image be downloaded or build. * Add labels to Docker image * Remove tests for middle versions 8.1 and 0.3.5 * Use same vader commit as appveyor * Implement image push to Docker Hub Co-authored-by: Horacio Sanson <horacio@allm.inc>
2021-01-27 19:52:24 +00:00
image=denseanalysis/ale
# Create docker image tag based on Dockerfile contents
if [ -n "$(command -v md5)" ]; then
image_tag=$(md5 -q Dockerfile)
else
image_tag=$(md5sum Dockerfile | cut -d' ' -f1)
fi
3560 add vim 8.2 and nvim 0.4 to ci tests (#3561) * Add vim82 and neovim04 to CI tests. * Fix test_sign_column_hightlighting test. In vim82 with verbose=1 the output of highlight command changes breaking the ale#sign#SetUpDefaultColumnWithoutErrorsHighlight(). This commit forces verbose=0 when the method starts and restores the previous value before exiting. * No return values in vim82 returns a numeric value instead of a empty string. * Fix test_reek_handler test The FuzzyJSONDecode() method catches E474 when it fails to parse the input as JSON but Vim8.2 throws E491 instead. This commit modifies the function to catch both E474 or E491. * Fix perl6 handler test. Perl6 handler catches json parse errors using the E474 error but in Vim82 it changed to E491. This commit modifies the handler so both errors are considered. * Fix list opening tests. In Vim 8.2 the call `range(1, bufnr('$'))` always returns quickfix buffers no matter if they are closed or not. Using `ls` does not show them but the above range will always include them. This new behavior breaks the ale#list#IsQuickfixOpen() method that in turn breaks many other things. This commit fixes this by using the getqflist() and getloclist() methods instead. * Fix test updates loclist test. For some reason in Vim 8.2 the sign offset seems to not reset between tests causing the sign_id to not match in the Assert. When the test is run individually it passes but when run as part of the whole suite the sign_id is off by one. Forcing the offset in the test setup seems to fix the issue. * Fix omnifunc completion test. For unknown reasons the SetCompletionResponse tests fail in Neovim 0.2 and 0.4. Unfortunatelly the only solution I found is to disable them for neovim. * Fix linter warnings * Fix smoker test. Add vim 8.2 to the list of versions that need some retires due to randomly failing tests. * Add docker image build job. Trying some clever trick to build the docker image if not available locally or in Docker hub. It uses the Dockerfile md5 checksum as tag so only when changes on that file occur will the image be downloaded or build. * Add labels to Docker image * Remove tests for middle versions 8.1 and 0.3.5 * Use same vader commit as appveyor * Implement image push to Docker Hub Co-authored-by: Horacio Sanson <horacio@allm.inc>
2021-01-27 19:52:24 +00:00
git_version=$(git describe --always --tags)
# Used in all test scripts for running the selected Docker image.
DOCKER_RUN_IMAGE="$image:$image_tag"
export DOCKER_RUN_IMAGE
tests='test/*.vader test/*/*.vader test/*/*/*.vader'
# These flags are forwarded to the script for running Vader tests.
verbose_flag=''
quiet_flag=''
run_neovim_06_tests=1
run_neovim_08_tests=1
2018-07-23 19:41:06 +00:00
run_vim_80_tests=1
run_vim_90_tests=1
run_linters=1
while [ $# -ne 0 ]; do
case $1 in
-v)
verbose_flag='-v'
shift
;;
-q)
quiet_flag='-q'
shift
;;
3560 add vim 8.2 and nvim 0.4 to ci tests (#3561) * Add vim82 and neovim04 to CI tests. * Fix test_sign_column_hightlighting test. In vim82 with verbose=1 the output of highlight command changes breaking the ale#sign#SetUpDefaultColumnWithoutErrorsHighlight(). This commit forces verbose=0 when the method starts and restores the previous value before exiting. * No return values in vim82 returns a numeric value instead of a empty string. * Fix test_reek_handler test The FuzzyJSONDecode() method catches E474 when it fails to parse the input as JSON but Vim8.2 throws E491 instead. This commit modifies the function to catch both E474 or E491. * Fix perl6 handler test. Perl6 handler catches json parse errors using the E474 error but in Vim82 it changed to E491. This commit modifies the handler so both errors are considered. * Fix list opening tests. In Vim 8.2 the call `range(1, bufnr('$'))` always returns quickfix buffers no matter if they are closed or not. Using `ls` does not show them but the above range will always include them. This new behavior breaks the ale#list#IsQuickfixOpen() method that in turn breaks many other things. This commit fixes this by using the getqflist() and getloclist() methods instead. * Fix test updates loclist test. For some reason in Vim 8.2 the sign offset seems to not reset between tests causing the sign_id to not match in the Assert. When the test is run individually it passes but when run as part of the whole suite the sign_id is off by one. Forcing the offset in the test setup seems to fix the issue. * Fix omnifunc completion test. For unknown reasons the SetCompletionResponse tests fail in Neovim 0.2 and 0.4. Unfortunatelly the only solution I found is to disable them for neovim. * Fix linter warnings * Fix smoker test. Add vim 8.2 to the list of versions that need some retires due to randomly failing tests. * Add docker image build job. Trying some clever trick to build the docker image if not available locally or in Docker hub. It uses the Dockerfile md5 checksum as tag so only when changes on that file occur will the image be downloaded or build. * Add labels to Docker image * Remove tests for middle versions 8.1 and 0.3.5 * Use same vader commit as appveyor * Implement image push to Docker Hub Co-authored-by: Horacio Sanson <horacio@allm.inc>
2021-01-27 19:52:24 +00:00
--build-image)
run_vim_80_tests=0
run_vim_90_tests=0
run_neovim_06_tests=0
run_neovim_08_tests=0
3560 add vim 8.2 and nvim 0.4 to ci tests (#3561) * Add vim82 and neovim04 to CI tests. * Fix test_sign_column_hightlighting test. In vim82 with verbose=1 the output of highlight command changes breaking the ale#sign#SetUpDefaultColumnWithoutErrorsHighlight(). This commit forces verbose=0 when the method starts and restores the previous value before exiting. * No return values in vim82 returns a numeric value instead of a empty string. * Fix test_reek_handler test The FuzzyJSONDecode() method catches E474 when it fails to parse the input as JSON but Vim8.2 throws E491 instead. This commit modifies the function to catch both E474 or E491. * Fix perl6 handler test. Perl6 handler catches json parse errors using the E474 error but in Vim82 it changed to E491. This commit modifies the handler so both errors are considered. * Fix list opening tests. In Vim 8.2 the call `range(1, bufnr('$'))` always returns quickfix buffers no matter if they are closed or not. Using `ls` does not show them but the above range will always include them. This new behavior breaks the ale#list#IsQuickfixOpen() method that in turn breaks many other things. This commit fixes this by using the getqflist() and getloclist() methods instead. * Fix test updates loclist test. For some reason in Vim 8.2 the sign offset seems to not reset between tests causing the sign_id to not match in the Assert. When the test is run individually it passes but when run as part of the whole suite the sign_id is off by one. Forcing the offset in the test setup seems to fix the issue. * Fix omnifunc completion test. For unknown reasons the SetCompletionResponse tests fail in Neovim 0.2 and 0.4. Unfortunatelly the only solution I found is to disable them for neovim. * Fix linter warnings * Fix smoker test. Add vim 8.2 to the list of versions that need some retires due to randomly failing tests. * Add docker image build job. Trying some clever trick to build the docker image if not available locally or in Docker hub. It uses the Dockerfile md5 checksum as tag so only when changes on that file occur will the image be downloaded or build. * Add labels to Docker image * Remove tests for middle versions 8.1 and 0.3.5 * Use same vader commit as appveyor * Implement image push to Docker Hub Co-authored-by: Horacio Sanson <horacio@allm.inc>
2021-01-27 19:52:24 +00:00
run_linters=0
shift
;;
--neovim-only)
2018-07-23 19:41:06 +00:00
run_vim_80_tests=0
run_vim_90_tests=0
run_linters=0
shift
;;
--neovim-06-only)
run_neovim_08_tests=0
2018-07-23 19:41:06 +00:00
run_vim_80_tests=0
run_vim_90_tests=0
run_linters=0
shift
;;
--neovim-08-only)
run_neovim_06_tests=0
2018-07-23 19:41:06 +00:00
run_vim_80_tests=0
run_vim_90_tests=0
run_linters=0
shift
;;
--vim-only)
run_neovim_06_tests=0
run_neovim_08_tests=0
run_linters=0
shift
;;
2018-07-23 19:41:06 +00:00
--vim-80-only)
run_neovim_06_tests=0
run_neovim_08_tests=0
run_vim_90_tests=0
2018-07-23 19:41:06 +00:00
run_linters=0
shift
;;
--vim-90-only)
run_neovim_06_tests=0
run_neovim_08_tests=0
2018-07-23 19:41:06 +00:00
run_vim_80_tests=0
run_linters=0
shift
;;
--linters-only)
2018-07-23 19:41:06 +00:00
run_vim_80_tests=0
run_vim_90_tests=0
run_neovim_06_tests=0
run_neovim_08_tests=0
shift
;;
--fast)
run_vim_80_tests=0
run_vim_90_tests=0
run_neovim_06_tests=0
run_neovim_08_tests=1
shift
;;
--help)
echo 'Usage: ./run-tests [OPTION]... [FILE]...'
echo
echo 'Filenames can be given as arguments to run a subset of tests.'
echo 'For example: ./run-tests test/test_ale_var.vader'
echo
echo 'Options:'
echo ' -v Enable verbose output'
echo ' -q Hide output for successful tests'
3560 add vim 8.2 and nvim 0.4 to ci tests (#3561) * Add vim82 and neovim04 to CI tests. * Fix test_sign_column_hightlighting test. In vim82 with verbose=1 the output of highlight command changes breaking the ale#sign#SetUpDefaultColumnWithoutErrorsHighlight(). This commit forces verbose=0 when the method starts and restores the previous value before exiting. * No return values in vim82 returns a numeric value instead of a empty string. * Fix test_reek_handler test The FuzzyJSONDecode() method catches E474 when it fails to parse the input as JSON but Vim8.2 throws E491 instead. This commit modifies the function to catch both E474 or E491. * Fix perl6 handler test. Perl6 handler catches json parse errors using the E474 error but in Vim82 it changed to E491. This commit modifies the handler so both errors are considered. * Fix list opening tests. In Vim 8.2 the call `range(1, bufnr('$'))` always returns quickfix buffers no matter if they are closed or not. Using `ls` does not show them but the above range will always include them. This new behavior breaks the ale#list#IsQuickfixOpen() method that in turn breaks many other things. This commit fixes this by using the getqflist() and getloclist() methods instead. * Fix test updates loclist test. For some reason in Vim 8.2 the sign offset seems to not reset between tests causing the sign_id to not match in the Assert. When the test is run individually it passes but when run as part of the whole suite the sign_id is off by one. Forcing the offset in the test setup seems to fix the issue. * Fix omnifunc completion test. For unknown reasons the SetCompletionResponse tests fail in Neovim 0.2 and 0.4. Unfortunatelly the only solution I found is to disable them for neovim. * Fix linter warnings * Fix smoker test. Add vim 8.2 to the list of versions that need some retires due to randomly failing tests. * Add docker image build job. Trying some clever trick to build the docker image if not available locally or in Docker hub. It uses the Dockerfile md5 checksum as tag so only when changes on that file occur will the image be downloaded or build. * Add labels to Docker image * Remove tests for middle versions 8.1 and 0.3.5 * Use same vader commit as appveyor * Implement image push to Docker Hub Co-authored-by: Horacio Sanson <horacio@allm.inc>
2021-01-27 19:52:24 +00:00
echo ' --build-image Run docker image build only.'
echo ' --neovim-only Run tests only for NeoVim'
echo ' --neovim-06-only Run tests only for NeoVim 0.2'
echo ' --neovim-08-only Run tests only for NeoVim 0.8'
3560 add vim 8.2 and nvim 0.4 to ci tests (#3561) * Add vim82 and neovim04 to CI tests. * Fix test_sign_column_hightlighting test. In vim82 with verbose=1 the output of highlight command changes breaking the ale#sign#SetUpDefaultColumnWithoutErrorsHighlight(). This commit forces verbose=0 when the method starts and restores the previous value before exiting. * No return values in vim82 returns a numeric value instead of a empty string. * Fix test_reek_handler test The FuzzyJSONDecode() method catches E474 when it fails to parse the input as JSON but Vim8.2 throws E491 instead. This commit modifies the function to catch both E474 or E491. * Fix perl6 handler test. Perl6 handler catches json parse errors using the E474 error but in Vim82 it changed to E491. This commit modifies the handler so both errors are considered. * Fix list opening tests. In Vim 8.2 the call `range(1, bufnr('$'))` always returns quickfix buffers no matter if they are closed or not. Using `ls` does not show them but the above range will always include them. This new behavior breaks the ale#list#IsQuickfixOpen() method that in turn breaks many other things. This commit fixes this by using the getqflist() and getloclist() methods instead. * Fix test updates loclist test. For some reason in Vim 8.2 the sign offset seems to not reset between tests causing the sign_id to not match in the Assert. When the test is run individually it passes but when run as part of the whole suite the sign_id is off by one. Forcing the offset in the test setup seems to fix the issue. * Fix omnifunc completion test. For unknown reasons the SetCompletionResponse tests fail in Neovim 0.2 and 0.4. Unfortunatelly the only solution I found is to disable them for neovim. * Fix linter warnings * Fix smoker test. Add vim 8.2 to the list of versions that need some retires due to randomly failing tests. * Add docker image build job. Trying some clever trick to build the docker image if not available locally or in Docker hub. It uses the Dockerfile md5 checksum as tag so only when changes on that file occur will the image be downloaded or build. * Add labels to Docker image * Remove tests for middle versions 8.1 and 0.3.5 * Use same vader commit as appveyor * Implement image push to Docker Hub Co-authored-by: Horacio Sanson <horacio@allm.inc>
2021-01-27 19:52:24 +00:00
echo ' --vim-only Run tests only for Vim'
echo ' --vim-80-only Run tests only for Vim 8.2'
echo ' --vim-90-only Run tests only for Vim 9.0'
echo ' --linters-only Run only Vint and custom checks'
echo ' --fast Run only the fastest Vim and custom checks'
echo ' --help Show this help text'
echo ' -- Stop parsing options after this'
exit 0
;;
--)
shift
break
;;
-?*)
echo "Invalid argument: $1" 1>&2
exit 1
;;
*)
break
;;
esac
done
# Allow tests to be passed as arguments.
if [ $# -ne 0 ]; then
# This doesn't perfectly handle work splitting, but none of our files
# have spaces in the names.
tests="$*"
# Don't run other tools when targeting tests.
run_linters=0
fi
# Delete .swp files in the test directory, which cause Vim 8 to hang.
find test -name '*.swp' -delete
set -eu
3560 add vim 8.2 and nvim 0.4 to ci tests (#3561) * Add vim82 and neovim04 to CI tests. * Fix test_sign_column_hightlighting test. In vim82 with verbose=1 the output of highlight command changes breaking the ale#sign#SetUpDefaultColumnWithoutErrorsHighlight(). This commit forces verbose=0 when the method starts and restores the previous value before exiting. * No return values in vim82 returns a numeric value instead of a empty string. * Fix test_reek_handler test The FuzzyJSONDecode() method catches E474 when it fails to parse the input as JSON but Vim8.2 throws E491 instead. This commit modifies the function to catch both E474 or E491. * Fix perl6 handler test. Perl6 handler catches json parse errors using the E474 error but in Vim82 it changed to E491. This commit modifies the handler so both errors are considered. * Fix list opening tests. In Vim 8.2 the call `range(1, bufnr('$'))` always returns quickfix buffers no matter if they are closed or not. Using `ls` does not show them but the above range will always include them. This new behavior breaks the ale#list#IsQuickfixOpen() method that in turn breaks many other things. This commit fixes this by using the getqflist() and getloclist() methods instead. * Fix test updates loclist test. For some reason in Vim 8.2 the sign offset seems to not reset between tests causing the sign_id to not match in the Assert. When the test is run individually it passes but when run as part of the whole suite the sign_id is off by one. Forcing the offset in the test setup seems to fix the issue. * Fix omnifunc completion test. For unknown reasons the SetCompletionResponse tests fail in Neovim 0.2 and 0.4. Unfortunatelly the only solution I found is to disable them for neovim. * Fix linter warnings * Fix smoker test. Add vim 8.2 to the list of versions that need some retires due to randomly failing tests. * Add docker image build job. Trying some clever trick to build the docker image if not available locally or in Docker hub. It uses the Dockerfile md5 checksum as tag so only when changes on that file occur will the image be downloaded or build. * Add labels to Docker image * Remove tests for middle versions 8.1 and 0.3.5 * Use same vader commit as appveyor * Implement image push to Docker Hub Co-authored-by: Horacio Sanson <horacio@allm.inc>
2021-01-27 19:52:24 +00:00
# Check if docker un image is available locally
has_image=$(docker images --quiet "${image}:${image_tag}" | wc -l)
arch=$(docker info -f '{{ .Architecture }}')
3560 add vim 8.2 and nvim 0.4 to ci tests (#3561) * Add vim82 and neovim04 to CI tests. * Fix test_sign_column_hightlighting test. In vim82 with verbose=1 the output of highlight command changes breaking the ale#sign#SetUpDefaultColumnWithoutErrorsHighlight(). This commit forces verbose=0 when the method starts and restores the previous value before exiting. * No return values in vim82 returns a numeric value instead of a empty string. * Fix test_reek_handler test The FuzzyJSONDecode() method catches E474 when it fails to parse the input as JSON but Vim8.2 throws E491 instead. This commit modifies the function to catch both E474 or E491. * Fix perl6 handler test. Perl6 handler catches json parse errors using the E474 error but in Vim82 it changed to E491. This commit modifies the handler so both errors are considered. * Fix list opening tests. In Vim 8.2 the call `range(1, bufnr('$'))` always returns quickfix buffers no matter if they are closed or not. Using `ls` does not show them but the above range will always include them. This new behavior breaks the ale#list#IsQuickfixOpen() method that in turn breaks many other things. This commit fixes this by using the getqflist() and getloclist() methods instead. * Fix test updates loclist test. For some reason in Vim 8.2 the sign offset seems to not reset between tests causing the sign_id to not match in the Assert. When the test is run individually it passes but when run as part of the whole suite the sign_id is off by one. Forcing the offset in the test setup seems to fix the issue. * Fix omnifunc completion test. For unknown reasons the SetCompletionResponse tests fail in Neovim 0.2 and 0.4. Unfortunatelly the only solution I found is to disable them for neovim. * Fix linter warnings * Fix smoker test. Add vim 8.2 to the list of versions that need some retires due to randomly failing tests. * Add docker image build job. Trying some clever trick to build the docker image if not available locally or in Docker hub. It uses the Dockerfile md5 checksum as tag so only when changes on that file occur will the image be downloaded or build. * Add labels to Docker image * Remove tests for middle versions 8.1 and 0.3.5 * Use same vader commit as appveyor * Implement image push to Docker Hub Co-authored-by: Horacio Sanson <horacio@allm.inc>
2021-01-27 19:52:24 +00:00
download_image() {
if [[ $arch != x86_64 ]]; then
echo "Pre-built docker image is not available for architecture ${arch}"
return 1
fi
3560 add vim 8.2 and nvim 0.4 to ci tests (#3561) * Add vim82 and neovim04 to CI tests. * Fix test_sign_column_hightlighting test. In vim82 with verbose=1 the output of highlight command changes breaking the ale#sign#SetUpDefaultColumnWithoutErrorsHighlight(). This commit forces verbose=0 when the method starts and restores the previous value before exiting. * No return values in vim82 returns a numeric value instead of a empty string. * Fix test_reek_handler test The FuzzyJSONDecode() method catches E474 when it fails to parse the input as JSON but Vim8.2 throws E491 instead. This commit modifies the function to catch both E474 or E491. * Fix perl6 handler test. Perl6 handler catches json parse errors using the E474 error but in Vim82 it changed to E491. This commit modifies the handler so both errors are considered. * Fix list opening tests. In Vim 8.2 the call `range(1, bufnr('$'))` always returns quickfix buffers no matter if they are closed or not. Using `ls` does not show them but the above range will always include them. This new behavior breaks the ale#list#IsQuickfixOpen() method that in turn breaks many other things. This commit fixes this by using the getqflist() and getloclist() methods instead. * Fix test updates loclist test. For some reason in Vim 8.2 the sign offset seems to not reset between tests causing the sign_id to not match in the Assert. When the test is run individually it passes but when run as part of the whole suite the sign_id is off by one. Forcing the offset in the test setup seems to fix the issue. * Fix omnifunc completion test. For unknown reasons the SetCompletionResponse tests fail in Neovim 0.2 and 0.4. Unfortunatelly the only solution I found is to disable them for neovim. * Fix linter warnings * Fix smoker test. Add vim 8.2 to the list of versions that need some retires due to randomly failing tests. * Add docker image build job. Trying some clever trick to build the docker image if not available locally or in Docker hub. It uses the Dockerfile md5 checksum as tag so only when changes on that file occur will the image be downloaded or build. * Add labels to Docker image * Remove tests for middle versions 8.1 and 0.3.5 * Use same vader commit as appveyor * Implement image push to Docker Hub Co-authored-by: Horacio Sanson <horacio@allm.inc>
2021-01-27 19:52:24 +00:00
echo "Downloading run image ${image}:${image_tag}"
docker pull "${image}:${image_tag}" &> /dev/null
}
2023-02-13 04:24:54 +00:00
if [ "$has_image" -eq 0 ] && ! download_image; then
echo "Building run image ${image}:${image_tag}"
3560 add vim 8.2 and nvim 0.4 to ci tests (#3561) * Add vim82 and neovim04 to CI tests. * Fix test_sign_column_hightlighting test. In vim82 with verbose=1 the output of highlight command changes breaking the ale#sign#SetUpDefaultColumnWithoutErrorsHighlight(). This commit forces verbose=0 when the method starts and restores the previous value before exiting. * No return values in vim82 returns a numeric value instead of a empty string. * Fix test_reek_handler test The FuzzyJSONDecode() method catches E474 when it fails to parse the input as JSON but Vim8.2 throws E491 instead. This commit modifies the function to catch both E474 or E491. * Fix perl6 handler test. Perl6 handler catches json parse errors using the E474 error but in Vim82 it changed to E491. This commit modifies the handler so both errors are considered. * Fix list opening tests. In Vim 8.2 the call `range(1, bufnr('$'))` always returns quickfix buffers no matter if they are closed or not. Using `ls` does not show them but the above range will always include them. This new behavior breaks the ale#list#IsQuickfixOpen() method that in turn breaks many other things. This commit fixes this by using the getqflist() and getloclist() methods instead. * Fix test updates loclist test. For some reason in Vim 8.2 the sign offset seems to not reset between tests causing the sign_id to not match in the Assert. When the test is run individually it passes but when run as part of the whole suite the sign_id is off by one. Forcing the offset in the test setup seems to fix the issue. * Fix omnifunc completion test. For unknown reasons the SetCompletionResponse tests fail in Neovim 0.2 and 0.4. Unfortunatelly the only solution I found is to disable them for neovim. * Fix linter warnings * Fix smoker test. Add vim 8.2 to the list of versions that need some retires due to randomly failing tests. * Add docker image build job. Trying some clever trick to build the docker image if not available locally or in Docker hub. It uses the Dockerfile md5 checksum as tag so only when changes on that file occur will the image be downloaded or build. * Add labels to Docker image * Remove tests for middle versions 8.1 and 0.3.5 * Use same vader commit as appveyor * Implement image push to Docker Hub Co-authored-by: Horacio Sanson <horacio@allm.inc>
2021-01-27 19:52:24 +00:00
build_args=( --build-arg GIT_VERSION="$git_version" )
if [[ $arch != x86_64 ]]; then
echo "Building testbed/vim:24 for $arch"
2023-02-13 04:24:54 +00:00
testbed_vim_ref=902917c4caa50db2f2e80009b839605602f9f014
docker build -t "testbed/vim:$testbed_vim_ref" "https://github.com/Vimjas/vim-testbed.git#$testbed_vim_ref"
2023-02-13 04:24:54 +00:00
build_args+=( --build-arg TESTBED_VIM_VERSION="$testbed_vim_ref" )
fi
docker build "${build_args[@]}" -t "${image}:${image_tag}" .
docker tag "${image}:${image_tag}" "${image}:latest"
2023-02-13 04:24:54 +00:00
if [[ -z "${DOCKER_HUB_USER:-}" || -z "${DOCKER_HUB_PASS:-}" ]]; then
echo "Docker Hub credentials not set, skip push"
else
echo "Push ${image}:${image_tag} to Docker Hub"
echo "$DOCKER_HUB_PASS" | docker login -u "$DOCKER_HUB_USER" --password-stdin
docker push "${image}:${image_tag}"
3560 add vim 8.2 and nvim 0.4 to ci tests (#3561) * Add vim82 and neovim04 to CI tests. * Fix test_sign_column_hightlighting test. In vim82 with verbose=1 the output of highlight command changes breaking the ale#sign#SetUpDefaultColumnWithoutErrorsHighlight(). This commit forces verbose=0 when the method starts and restores the previous value before exiting. * No return values in vim82 returns a numeric value instead of a empty string. * Fix test_reek_handler test The FuzzyJSONDecode() method catches E474 when it fails to parse the input as JSON but Vim8.2 throws E491 instead. This commit modifies the function to catch both E474 or E491. * Fix perl6 handler test. Perl6 handler catches json parse errors using the E474 error but in Vim82 it changed to E491. This commit modifies the handler so both errors are considered. * Fix list opening tests. In Vim 8.2 the call `range(1, bufnr('$'))` always returns quickfix buffers no matter if they are closed or not. Using `ls` does not show them but the above range will always include them. This new behavior breaks the ale#list#IsQuickfixOpen() method that in turn breaks many other things. This commit fixes this by using the getqflist() and getloclist() methods instead. * Fix test updates loclist test. For some reason in Vim 8.2 the sign offset seems to not reset between tests causing the sign_id to not match in the Assert. When the test is run individually it passes but when run as part of the whole suite the sign_id is off by one. Forcing the offset in the test setup seems to fix the issue. * Fix omnifunc completion test. For unknown reasons the SetCompletionResponse tests fail in Neovim 0.2 and 0.4. Unfortunatelly the only solution I found is to disable them for neovim. * Fix linter warnings * Fix smoker test. Add vim 8.2 to the list of versions that need some retires due to randomly failing tests. * Add docker image build job. Trying some clever trick to build the docker image if not available locally or in Docker hub. It uses the Dockerfile md5 checksum as tag so only when changes on that file occur will the image be downloaded or build. * Add labels to Docker image * Remove tests for middle versions 8.1 and 0.3.5 * Use same vader commit as appveyor * Implement image push to Docker Hub Co-authored-by: Horacio Sanson <horacio@allm.inc>
2021-01-27 19:52:24 +00:00
fi
else
echo "Docker run image ${image}:${image_tag} ready"
fi
docker tag "${image}:${image_tag}" "${image}:latest"
2017-12-07 20:07:45 +00:00
output_dir=$(mktemp -d 2>/dev/null || mktemp -d -t 'mytmpdir')
trap '{ rm -rf "$output_dir"; }' EXIT
file_number=0
pid_list=''
# Used for killing tests when you kill the script.
cancel_tests() {
set +e
if [ -n "$pid_list" ]; then
for pid in $pid_list; do
kill "$pid"
wait "$pid"
done
fi
# shellcheck disable=SC2046
docker kill $(docker ps -a -q --filter ancestor="$image" --format='{{.ID}}') &> /dev/null
if [ -d "$output_dir" ]; then
rm -rf "$output_dir"
fi
echo
exit 1
}
trap cancel_tests INT TERM
for vim in $(docker run --rm "$DOCKER_RUN_IMAGE" ls /vim-build/bin | grep '^neovim\|^vim' ); do
2018-07-23 19:41:06 +00:00
if ( [[ $vim =~ ^vim-v8.0 ]] && ((run_vim_80_tests)) ) \
|| ( [[ $vim =~ ^vim-v9.0 ]] && ((run_vim_90_tests)) ) \
|| ( [[ $vim =~ ^neovim-v0.6 ]] && ((run_neovim_06_tests)) ) \
|| ( [[ $vim =~ ^neovim-v0.8 ]] && ((run_neovim_08_tests)) ); then
2017-12-07 20:07:45 +00:00
echo "Starting Vim: $vim..."
file_number=$((file_number+1))
test/script/run-vader-tests $quiet_flag $verbose_flag "$vim" "$tests" \
> "$output_dir/$file_number" 2>&1 &
pid_list="$pid_list $!"
fi
done
if ((run_linters)); then
2017-12-07 20:07:45 +00:00
echo "Starting Vint..."
file_number=$((file_number+1))
test/script/run-vint > "$output_dir/$file_number" 2>&1 &
pid_list="$pid_list $!"
2017-12-07 20:07:45 +00:00
echo "Starting Custom checks..."
file_number=$((file_number+1))
test/script/custom-checks &> "$output_dir/$file_number" 2>&1 &
pid_list="$pid_list $!"
fi
2017-12-07 20:07:45 +00:00
echo
failed=0
index=0
for pid in $pid_list; do
this_failed=0
2017-12-07 20:07:45 +00:00
index=$((index+1))
if ! wait "$pid"; then
failed=1
this_failed=1
2017-12-07 20:07:45 +00:00
fi
# Hide output for things that passed if -q is set.
if [ "$quiet_flag" != '-q' ] || ((this_failed)); then
cat "$output_dir/$index"
fi
2017-12-07 20:07:45 +00:00
done
if ((failed)); then
echo 'Something went wrong!'
else
echo 'All tests passed!'
fi
2017-12-07 20:07:45 +00:00
exit $failed