aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZyX <kp-pav@yandex.ru>2017-04-24 22:14:32 +0300
committerZyX <kp-pav@yandex.ru>2017-04-24 22:37:36 +0300
commit85903cb0e6a2428c5a071ed78b12a9f95e56792b (patch)
tree5859115cfa78a3617106d58e355a11f196397839
parent4ccef05829bc9956207299215672c2e8c3e51c43 (diff)
downloadrneovim-85903cb0e6a2428c5a071ed78b12a9f95e56792b.tar.gz
rneovim-85903cb0e6a2428c5a071ed78b12a9f95e56792b.tar.bz2
rneovim-85903cb0e6a2428c5a071ed78b12a9f95e56792b.zip
ci: Make scripts in common be dash-compatible
`ulimit` may still be not present: dash and busybox support it, but posh does not.
-rw-r--r--ci/common/build.sh31
-rw-r--r--ci/common/suite.sh4
-rw-r--r--ci/common/test.sh72
3 files changed, 62 insertions, 45 deletions
diff --git a/ci/common/build.sh b/ci/common/build.sh
index 129622b522..56c24bb3fb 100644
--- a/ci/common/build.sh
+++ b/ci/common/build.sh
@@ -7,10 +7,10 @@ build_make() {
}
build_deps() {
- if [[ "${BUILD_32BIT}" == ON ]]; then
+ if test "x${BUILD_32BIT}" = xON ; then
DEPS_CMAKE_FLAGS="${DEPS_CMAKE_FLAGS} ${CMAKE_FLAGS_32BIT}"
fi
- if [[ "${FUNCTIONALTEST}" == "functionaltest-lua" ]]; then
+ if test "x${FUNCTIONALTEST}" = "xfunctionaltest-lua" ; then
DEPS_CMAKE_FLAGS="${DEPS_CMAKE_FLAGS} -DUSE_BUNDLED_LUA=ON"
fi
@@ -18,16 +18,15 @@ build_deps() {
# If there is a valid cache and we're not forced to recompile,
# use cached third-party dependencies.
- if [[ -f "${CACHE_MARKER}" ]] && [[ "${BUILD_NVIM_DEPS}" != true ]]; then
- if [[ "${TRAVIS_OS_NAME}" == osx ]]; then
- local statcmd="stat -f '%Sm'"
- else
- local statcmd="stat -c '%y'"
+ if test -f "${CACHE_MARKER}" && test "x${BUILD_NVIM_DEPS}" != xtrue ; then
+ local statcmd="stat -c '%y'"
+ if test "x${TRAVIS_OS_NAME}" = xosx ; then
+ statcmd="stat -f '%Sm'"
fi
echo "Using third-party dependencies from Travis's cache (last updated: $(${statcmd} "${CACHE_MARKER}"))."
- mkdir -p "$(dirname "${DEPS_BUILD_DIR}")"
- mv "${HOME}/.cache/nvim-deps" "${DEPS_BUILD_DIR}"
+ mkdir -p "$(dirname "${DEPS_BUILD_DIR}")"
+ mv "${HOME}/.cache/nvim-deps" "${DEPS_BUILD_DIR}"
else
mkdir -p "${DEPS_BUILD_DIR}"
fi
@@ -46,10 +45,10 @@ build_deps() {
}
prepare_build() {
- if [[ -n "${CLANG_SANITIZER}" ]]; then
+ if test -n "${CLANG_SANITIZER}" ; then
CMAKE_FLAGS="${CMAKE_FLAGS} -DCLANG_${CLANG_SANITIZER}=ON"
fi
- if [[ "${BUILD_32BIT}" == ON ]]; then
+ if test "x${BUILD_32BIT}" = xON ; then
CMAKE_FLAGS="${CMAKE_FLAGS} ${CMAKE_FLAGS_32BIT}"
fi
@@ -61,24 +60,24 @@ prepare_build() {
build_nvim() {
echo "Building nvim."
- if ! top_make nvim; then
+ if ! top_make nvim ; then
exit 1
fi
- if [ "$CLANG_SANITIZER" != "TSAN" ]; then
+ if test "x$CLANG_SANITIZER" != xTSAN ; then
echo "Building libnvim."
- if ! top_make libnvim; then
+ if ! top_make libnvim ; then
exit 1
fi
echo "Building nvim-test."
- if ! top_make nvim-test; then
+ if ! top_make nvim-test ; then
exit 1
fi
fi
# Invoke nvim to trigger *San early.
- if ! (bin/nvim --version && bin/nvim -u NONE -e -c ':qall'); then
+ if ! (bin/nvim --version && bin/nvim -u NONE -e -c ':qall') ; then
asan_check "${LOG_DIR}"
exit 1
fi
diff --git a/ci/common/suite.sh b/ci/common/suite.sh
index c4120c8584..9eba5ca664 100644
--- a/ci/common/suite.sh
+++ b/ci/common/suite.sh
@@ -151,12 +151,12 @@ run_test_wd() {
}
ended_successfully() {
- if [[ -f "${FAIL_SUMMARY_FILE}" ]]; then
+ if test -f "${FAIL_SUMMARY_FILE}" ; then
echo 'Test failed, complete summary:'
cat "${FAIL_SUMMARY_FILE}"
return 1
fi
- if ! [[ -f "${END_MARKER}" ]] ; then
+ if ! test -f "${END_MARKER}" ; then
echo 'ended_successfully called before end marker was touched'
return 1
fi
diff --git a/ci/common/test.sh b/ci/common/test.sh
index d911d9bc18..0958e0505d 100644
--- a/ci/common/test.sh
+++ b/ci/common/test.sh
@@ -1,5 +1,5 @@
-source "${CI_DIR}/common/build.sh"
-source "${CI_DIR}/common/suite.sh"
+. "${CI_DIR}/common/build.sh"
+. "${CI_DIR}/common/suite.sh"
print_core() {
local app="$1"
@@ -9,7 +9,7 @@ print_core() {
return 0
fi
echo "======= Core file $core ======="
- if [[ "${TRAVIS_OS_NAME}" == osx ]]; then
+ if test "x${TRAVIS_OS_NAME}" = xosx ; then
lldb -Q -o "bt all" -f "${app}" -c "${core}"
else
gdb -n -batch -ex 'thread apply all bt full' "${app}" -c "${core}"
@@ -23,13 +23,13 @@ check_core_dumps() {
shift
fi
local app="${1:-${BUILD_DIR}/bin/nvim}"
- if [[ "${TRAVIS_OS_NAME}" == osx ]]; then
+ if test "x${TRAVIS_OS_NAME}" = xosx ; then
local cores="$(find /cores/ -type f -print)"
else
local cores="$(find ./ -type f -name 'core.*' -print)"
fi
- if [ -z "${cores}" ]; then
+ if test -z "${cores}" ; then
return
fi
local core
@@ -61,7 +61,7 @@ check_logs() {
cat "${log}"
err=1
done
- if [[ -n "${err}" ]]; then
+ if test -n "${err}" ; then
fail 'logs' E 'Runtime errors detected.'
fi
}
@@ -76,7 +76,7 @@ asan_check() {
run_unittests() {(
enter_suite unittests
- ulimit -c unlimited
+ ulimit -c unlimited || true
if ! build_make unittest ; then
fail 'unittests' F 'Unit tests failed'
fi
@@ -86,7 +86,7 @@ run_unittests() {(
run_functionaltests() {(
enter_suite functionaltests
- ulimit -c unlimited
+ ulimit -c unlimited || true
if ! build_make ${FUNCTIONALTEST}; then
fail 'functionaltests' F 'Functional tests failed'
fi
@@ -98,7 +98,7 @@ run_functionaltests() {(
run_oldtests() {(
enter_suite oldtests
- ulimit -c unlimited
+ ulimit -c unlimited || true
if ! make -C "${TRAVIS_BUILD_DIR}/src/nvim/testdir"; then
reset
fail 'oldtests' F 'Legacy tests failed'
@@ -109,6 +109,26 @@ run_oldtests() {(
exit_suite
)}
+check_runtime_files() {(
+ local test_name="$1" ; shift
+ local message="$1" ; shift
+ local tst="$1" ; shift
+
+ cd runtime
+ for file in $(git ls-files "$@") ; do
+ # Check that test is not trying to work with files with spaces/etc
+ # Prefer failing the build over using more robust construct because files
+ # with IFS are not welcome.
+ if ! test -e "$file" ; then
+ fail "$test_name" E \
+ "It appears that $file is only a part of the file name"
+ fi
+ if ! test "$tst" "$INSTALL_PREFIX/share/nvim/runtime/$file" ; then
+ fail "$test_name" F "$(printf "$message" "$file")"
+ fi
+ done
+)}
+
install_nvim() {(
enter_suite 'install_nvim'
if ! build_make install ; then
@@ -117,34 +137,32 @@ install_nvim() {(
fi
"${INSTALL_PREFIX}/bin/nvim" --version
- "${INSTALL_PREFIX}/bin/nvim" -u NONE -e -c ':help' -c ':qall' || {
+ if ! "${INSTALL_PREFIX}/bin/nvim" -u NONE -e -c ':help' -c ':qall' ; then
echo "Running ':help' in the installed nvim failed."
echo "Maybe the helptags have not been generated properly."
fail 'help' F 'Failed running :help'
- }
+ fi
- local genvimsynf=syntax/vim/generated.vim
# Check that all runtime files were installed
- for file in doc/tags $genvimsynf $(
- cd runtime ; git ls-files | grep -e '.vim$' -e '.ps$' -e '.dict$' -e '.py$' -e '.tutor$'
- ) ; do
- if ! test -e "${INSTALL_PREFIX}/share/nvim/runtime/$file" ; then
- fail 'runtime-install' F "It appears that $file is not installed."
- fi
- done
+ check_runtime_files \
+ 'runtime-install' \
+ 'It appears that %s is not installed.' \
+ -e \
+ '*.vim' '*.ps' '*.dict' '*.py' '*.tutor'
+
+ # Check that some runtime files are installed and are executables
+ check_runtime_files \
+ 'not-exe' \
+ 'It appears that %s is not installed or is not executable.' \
+ -x \
+ '*.awk' '*.sh' '*.bat'
# Check that generated syntax file has function names, #5060.
+ local genvimsynf=syntax/vim/generated.vim
local gpat='syn keyword vimFuncName .*eval'
- if ! grep -q "$gpat" "${INSTALL_PREFIX}/share/nvim/runtime/$genvimsynf"; then
+ if ! grep -q "$gpat" "${INSTALL_PREFIX}/share/nvim/runtime/$genvimsynf" ; then
fail 'funcnames' F "It appears that $genvimsynf does not contain $gpat."
fi
- for file in $(
- cd runtime ; git ls-files | grep -e '.awk$' -e '.sh$' -e '.bat$'
- ) ; do
- if ! test -x "${INSTALL_PREFIX}/share/nvim/runtime/$file" ; then
- fail 'not-exe' F "It appears that $file is not installed or is not executable."
- fi
- done
exit_suite
)}