aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThiago de Arruda <tpadilha84@gmail.com>2015-07-08 07:42:23 -0300
committerThiago de Arruda <tpadilha84@gmail.com>2015-07-08 07:42:23 -0300
commitba2f7a9310bf3d3d0b028ad38e9724553e68c064 (patch)
tree268080a2698bd451766fb5a0402a3e4f44061209
parentb165145084ab2cf5671af07944bc8b353c21ef95 (diff)
parentbe39fc9151b9ffc4ec2c5830ff3a12a98cc0d0a0 (diff)
downloadrneovim-ba2f7a9310bf3d3d0b028ad38e9724553e68c064.tar.gz
rneovim-ba2f7a9310bf3d3d0b028ad38e9724553e68c064.tar.bz2
rneovim-ba2f7a9310bf3d3d0b028ad38e9724553e68c064.zip
Merge PR #2938 'Travis: Refactor CI files, use container infrastructure'
-rwxr-xr-x.ci/after_success.sh10
-rwxr-xr-x.ci/before_cache.sh24
-rwxr-xr-x.ci/before_install.sh13
-rwxr-xr-x.ci/before_script.sh34
-rw-r--r--.ci/clang.sh73
-rwxr-xr-x.ci/clint.sh3
-rw-r--r--.ci/common.sh74
-rw-r--r--.ci/common/build.sh79
-rw-r--r--.ci/common/test.sh85
-rw-r--r--.ci/gcc-32.sh37
-rw-r--r--.ci/gcc.sh42
-rwxr-xr-x.ci/install.sh20
-rw-r--r--.ci/mingw.sh18
-rwxr-xr-x.ci/run_tests.sh26
-rwxr-xr-x.ci/script.sh21
-rw-r--r--.travis.yml180
-rw-r--r--cmake/i386-linux-gnu.toolchain.cmake4
-rw-r--r--third-party/CMakeLists.txt6
18 files changed, 439 insertions, 310 deletions
diff --git a/.ci/after_success.sh b/.ci/after_success.sh
new file mode 100755
index 0000000000..e2602eac83
--- /dev/null
+++ b/.ci/after_success.sh
@@ -0,0 +1,10 @@
+#!/usr/bin/env bash
+
+set -e
+set -o pipefail
+
+if [[ -n "${CI_TARGET}" ]]; then
+ exit
+fi
+
+coveralls --gcov "$(which "${GCOV}")" --encoding iso-8859-1 || echo 'coveralls upload failed.'
diff --git a/.ci/before_cache.sh b/.ci/before_cache.sh
new file mode 100755
index 0000000000..8925da92f3
--- /dev/null
+++ b/.ci/before_cache.sh
@@ -0,0 +1,24 @@
+#!/usr/bin/env bash
+
+set -e
+set -o pipefail
+
+if [[ "${TRAVIS_OS_NAME}" != linux ]]; then
+ # Caches are only enabled for Travis's Linux container infrastructure,
+ # but this script is still executed on OS X.
+ exit
+fi
+
+# Don't cache pip's log and selfcheck.
+rm -rf "${HOME}/.cache/pip/log"
+rm -f "${HOME}/.cache/pip/selfcheck.json"
+
+# Update the third-party dependency cache only if the build was successful.
+if [[ -f "${SUCCESS_MARKER}" ]]; then
+ if [[ ! -f "${CACHE_MARKER}" ]] || [[ "${BUILD_NVIM_DEPS}" == true ]]; then
+ echo "Updating third-party dependency cache."
+ rm -rf "${HOME}/.cache/nvim-deps"
+ mv -T "${DEPS_INSTALL_PREFIX}" "${HOME}/.cache/nvim-deps"
+ touch "${CACHE_MARKER}"
+ fi
+fi
diff --git a/.ci/before_install.sh b/.ci/before_install.sh
new file mode 100755
index 0000000000..e70654c9be
--- /dev/null
+++ b/.ci/before_install.sh
@@ -0,0 +1,13 @@
+#!/usr/bin/env bash
+
+set -e
+set -o pipefail
+
+if [[ -n "${CI_TARGET}" ]]; then
+ exit
+fi
+
+if [[ "${TRAVIS_OS_NAME}" == osx ]]; then
+ brew update
+fi
+pip install --user --upgrade pip
diff --git a/.ci/before_script.sh b/.ci/before_script.sh
new file mode 100755
index 0000000000..026ab0afc9
--- /dev/null
+++ b/.ci/before_script.sh
@@ -0,0 +1,34 @@
+#!/usr/bin/env bash
+
+set -e
+set -o pipefail
+
+if [[ -n "${CI_TARGET}" ]]; then
+ exit
+fi
+
+CI_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
+source "${CI_DIR}/common/build.sh"
+
+# Test some of the configuration variables.
+if [[ -n "${GCOV}" ]] && [[ ! $(type -P "${GCOV}") ]]; then
+ echo "\$GCOV: '${GCOV}' is not executable."
+ exit 1
+fi
+if [[ -n "${LLVM_SYMBOLIZER}" ]] && [[ ! $(type -P "${LLVM_SYMBOLIZER}") ]]; then
+ echo "\$LLVM_SYMBOLIZER: '${LLVM_SYMBOLIZER}' is not executable."
+ exit 1
+fi
+
+if [[ "${TRAVIS_OS_NAME}" == osx ]]; then
+ # Adds user to a dummy group.
+ # That allows to test changing the group of the file by `os_fchown`.
+ sudo dscl . -create /Groups/chown_test
+ sudo dscl . -append /Groups/chown_test GroupMembership "${USER}"
+else
+ # Compile dependencies.
+ build_deps
+fi
+
+rm -rf "${LOG_DIR}"
+mkdir -p "${LOG_DIR}"
diff --git a/.ci/clang.sh b/.ci/clang.sh
deleted file mode 100644
index 70ed7d4764..0000000000
--- a/.ci/clang.sh
+++ /dev/null
@@ -1,73 +0,0 @@
-. "$CI_SCRIPTS/common.sh"
-
-sudo pip install cpp-coveralls
-
-# Use custom Clang and enable sanitizers on Linux.
-if [ "$TRAVIS_OS_NAME" = "linux" ]; then
- if [ -z "$CLANG_SANITIZER" ]; then
- echo "CLANG_SANITIZER not set."
- exit 1
- fi
-
- clang_version=3.6
- echo "Installing Clang $clang_version..."
-
- sudo add-apt-repository "deb http://ppa.launchpad.net/ubuntu-toolchain-r/test/ubuntu precise main"
- sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys BA9EF27F
-
- sudo add-apt-repository "deb http://llvm.org/apt/precise/ llvm-toolchain-precise-$clang_version main"
- wget -q -O - http://llvm.org/apt/llvm-snapshot.gpg.key | sudo apt-key add -
-
- sudo apt-get update -qq
- sudo apt-get install -y -q clang-$clang_version
-
- export CC=/usr/bin/clang-$clang_version
- symbolizer=/usr/bin/llvm-symbolizer-$clang_version
- export ASAN_SYMBOLIZER_PATH=$symbolizer
- export MSAN_SYMBOLIZER_PATH=$symbolizer
- export ASAN_OPTIONS="detect_leaks=1:log_path=$tmpdir/asan"
- export TSAN_OPTIONS="external_symbolizer_path=$symbolizer log_path=$tmpdir/tsan"
- export UBSAN_OPTIONS="log_path=$tmpdir/ubsan" # not sure if this works
- CMAKE_EXTRA_FLAGS="-DTRAVIS_CI_BUILD=ON \
- -DUSE_GCOV=ON \
- -DBUSTED_OUTPUT_TYPE=plainTerminal \
- -DCLANG_${CLANG_SANITIZER}=ON"
-else
- CMAKE_EXTRA_FLAGS="-DTRAVIS_CI_BUILD=ON \
- -DUSE_GCOV=ON \
- -DBUSTED_OUTPUT_TYPE=plainTerminal"
-fi
-
-setup_deps x64
-
-# Build and output version info.
-$MAKE_CMD CMAKE_EXTRA_FLAGS="$CMAKE_EXTRA_FLAGS" nvim
-build/bin/nvim --version
-
-# Run unittests.
-make unittest
-
-# Run functional tests.
-# FIXME (fwalch): Disabled for MSAN because of SIGPIPE error.
-if [ "$TRAVIS_OS_NAME" = linux ] && ! [ "$CLANG_SANITIZER" = MSAN ]; then
- if ! $MAKE_CMD test; then
- asan_check "$tmpdir"
- exit 1
- fi
- asan_check "$tmpdir"
-fi
-
-# Run legacy tests.
-if ! $MAKE_CMD oldtest; then
- reset
- asan_check "$tmpdir"
- exit 1
-fi
-asan_check "$tmpdir"
-
-coveralls --encoding iso-8859-1 || echo 'coveralls upload failed.'
-
-# Test if correctly installed.
-sudo -E $MAKE_CMD install
-/usr/local/bin/nvim --version
-/usr/local/bin/nvim -e -c "quit"
diff --git a/.ci/clint.sh b/.ci/clint.sh
deleted file mode 100755
index 53769a2552..0000000000
--- a/.ci/clint.sh
+++ /dev/null
@@ -1,3 +0,0 @@
-#!/bin/sh
-
-make lint
diff --git a/.ci/common.sh b/.ci/common.sh
deleted file mode 100644
index 4894c0d5ad..0000000000
--- a/.ci/common.sh
+++ /dev/null
@@ -1,74 +0,0 @@
-set -eu
-
-valgrind_check() {
- check_logs "$1" "valgrind-*"
-}
-
-asan_check() {
- check_logs "$1" "*san.*"
-}
-
-check_logs() {
- local err=""
- check_core_dumps
- # Iterate through each log to remove an useless warning
- for log in $(find "$1" -type f -name "$2"); do
- sed -i "$log" \
- -e '/Warning: noted but unhandled ioctl/d' \
- -e '/could cause spurious value errors to appear/d' \
- -e '/See README_MISSING_SYSCALL_OR_IOCTL for guidance/d'
- done
- # Now do it again, but only consider files with size > 0
- for log in $(find "$1" -type f -name "$2" -size +0); do
- cat "$log"
- err=1
- done
- if [ -n "$err" ]; then
- echo "Runtime errors detected"
- exit 1
- fi
-}
-
-check_core_dumps() {
- sleep 2
-
- if [ "$TRAVIS_OS_NAME" = "osx" ]; then
- cores="$(find /cores/ -type f -print)"
- dbg="lldb -Q -o bt -f build/bin/nvim -c"
- else
- # TODO(fwalch): Will trigger if a file named core.* exists outside of .deps.
- cores="$(find ./ -type f -not -path '*.deps*' -name 'core.*' -print)"
- dbg="gdb -n -batch -ex bt build/bin/nvim"
- fi
-
- if [ -z "$cores" ]; then
- return
- fi
- for c in $cores; do
- $dbg $c
- done
- exit 1
-}
-
-setup_deps() {
- sudo pip install --upgrade pip
- sudo pip install neovim
-
- # For pip3
- # https://github.com/travis-ci/travis-ci/issues/1528
- # sudo apt-get install -q python3.3-dev
- # curl -Ss http://python-distribute.org/distribute_setup.py | sudo python3
- # curl -Ss https://raw.github.com/pypa/pip/master/contrib/get-pip.py | sudo python3
- # sudo pip3.3 install neovim
-
- if [ "$BUILD_NVIM_DEPS" != "true" ]; then
- eval "$(curl -Ss https://raw.githubusercontent.com/neovim/bot-ci/master/scripts/travis-setup.sh) deps-${1}"
- elif [ "$TRAVIS_OS_NAME" = "linux" ]; then
- sudo apt-get install libtool
- fi
-}
-
-tmpdir="$(pwd)/tmp"
-rm -rf "$tmpdir"
-mkdir -p "$tmpdir"
-suppressions="$(pwd)/.valgrind.supp"
diff --git a/.ci/common/build.sh b/.ci/common/build.sh
new file mode 100644
index 0000000000..0140be3637
--- /dev/null
+++ b/.ci/common/build.sh
@@ -0,0 +1,79 @@
+build_deps() {
+ if [[ "${BUILD_32BIT}" == ON ]]; then
+ if [[ "${BUILD_MINGW}" == ON ]]; then
+ >&2 echo "32-bit MinGW builds not supported."
+ exit 1
+ fi
+
+ DEPS_CMAKE_FLAGS="${DEPS_CMAKE_FLAGS} ${CMAKE_FLAGS_32BIT}"
+ fi
+ if [[ "${BUILD_MINGW}" == ON ]]; then
+ DEPS_CMAKE_FLAGS="${DEPS_CMAKE_FLAGS} ${CMAKE_FLAGS_MINGW}"
+ fi
+
+ rm -rf "${DEPS_INSTALL_PREFIX}"
+
+ # 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
+ echo "Using third-party dependencies from Travis's cache (last updated: $(stat -c '%y' "${CACHE_MARKER}"))."
+
+ mkdir -p "$(dirname "${DEPS_INSTALL_PREFIX}")"
+ ln -Ts "${HOME}/.cache/nvim-deps" "${DEPS_INSTALL_PREFIX}"
+ return
+ fi
+
+ mkdir -p "${DEPS_BUILD_DIR}"
+ cd "${DEPS_BUILD_DIR}"
+ echo "Configuring with '${DEPS_CMAKE_FLAGS}'."
+ cmake ${DEPS_CMAKE_FLAGS} "${TRAVIS_BUILD_DIR}/third-party/"
+
+ if ! ${MAKE_CMD}; then
+ exit 1
+ fi
+
+ cd "${TRAVIS_BUILD_DIR}"
+}
+
+build_nvim() {
+ if [[ -n "${CLANG_SANITIZER}" ]]; then
+ CMAKE_FLAGS="${CMAKE_FLAGS} -DCLANG_${CLANG_SANITIZER}=ON"
+ fi
+ if [[ "${BUILD_32BIT}" == ON ]]; then
+ if [[ "${BUILD_MINGW}" == ON ]]; then
+ >&2 echo "32-bit MinGW builds not supported."
+ exit 1
+ fi
+
+ CMAKE_FLAGS="${CMAKE_FLAGS} ${CMAKE_FLAGS_32BIT}"
+ fi
+ if [[ "${BUILD_MINGW}" == ON ]]; then
+ CMAKE_FLAGS="${CMAKE_FLAGS} ${CMAKE_FLAGS_MINGW}"
+ fi
+
+ mkdir -p "${BUILD_DIR}"
+ cd "${BUILD_DIR}"
+ echo "Configuring with '${CMAKE_FLAGS}'."
+ cmake ${CMAKE_FLAGS} "${TRAVIS_BUILD_DIR}"
+
+ echo "Building nvim."
+ if ! ${MAKE_CMD} nvim; then
+ exit 1
+ fi
+
+ echo "Building libnvim."
+ if ! ${MAKE_CMD} libnvim; then
+ exit 1
+ fi
+
+ echo "Building nvim-test."
+ if ! ${MAKE_CMD} nvim-test; then
+ exit 1
+ fi
+
+ # Invoke nvim to trigger *San early.
+ bin/nvim --version
+ bin/nvim -u NONE -e -c ':qall'
+
+ cd "${TRAVIS_BUILD_DIR}"
+}
diff --git a/.ci/common/test.sh b/.ci/common/test.sh
new file mode 100644
index 0000000000..2eaaf0b2b1
--- /dev/null
+++ b/.ci/common/test.sh
@@ -0,0 +1,85 @@
+check_core_dumps() {
+ sleep 2
+
+ if [[ "${TRAVIS_OS_NAME}" == osx ]]; then
+ local cores="$(find /cores/ -type f -print)"
+ local dbg_cmd="lldb -Q -o bt -f ${BUILD_DIR}/bin/nvim -c"
+ else
+ # FIXME (fwalch): Will trigger if a file named core.* exists outside of $DEPS_BUILD_DIR.
+ local cores="$(find ./ -type f -not -path "*${DEPS_BUILD_DIR}*" -name 'core.*' -print)"
+ local dbg_cmd="gdb -n -batch -ex bt ${BUILD_DIR}/bin/nvim"
+ fi
+
+ if [ -z "${cores}" ]; then
+ return
+ fi
+ for core in $cores; do
+ ${dbg_cmd} "${core}"
+ done
+ exit 1
+}
+
+check_logs() {
+ # Iterate through each log to remove an useless warning.
+ for log in $(find "${1}" -type f -name "${2}"); do
+ sed -i "${log}" \
+ -e '/Warning: noted but unhandled ioctl/d' \
+ -e '/could cause spurious value errors to appear/d' \
+ -e '/See README_MISSING_SYSCALL_OR_IOCTL for guidance/d'
+ done
+
+ # Now do it again, but only consider files with size > 0.
+ local err=""
+ for log in $(find "${1}" -type f -name "${2}" -size +0); do
+ cat "${log}"
+ err=1
+ done
+ if [[ -n "${err}" ]]; then
+ echo "Runtime errors detected."
+ exit 1
+ fi
+}
+
+valgrind_check() {
+ check_logs "${1}" "valgrind-*"
+}
+
+asan_check() {
+ check_logs "${1}" "*san.*"
+}
+
+run_unittests() {
+ ${MAKE_CMD} -C "${BUILD_DIR}" unittest
+}
+
+run_functionaltests() {
+ if ! ${MAKE_CMD} -C "${BUILD_DIR}" functionaltest; then
+ asan_check "${LOG_DIR}"
+ valgrind_check "${LOG_DIR}"
+ exit 1
+ fi
+ asan_check "${LOG_DIR}"
+ valgrind_check "${LOG_DIR}"
+}
+
+run_oldtests() {
+ if ! make -C "${TRAVIS_BUILD_DIR}/src/nvim/testdir"; then
+ reset
+ asan_check "${LOG_DIR}"
+ valgrind_check "${LOG_DIR}"
+ exit 1
+ fi
+ asan_check "${LOG_DIR}"
+ valgrind_check "${LOG_DIR}"
+}
+
+install_nvim() {
+ ${MAKE_CMD} -C "${BUILD_DIR}" install
+
+ "${INSTALL_PREFIX}/bin/nvim" --version
+ "${INSTALL_PREFIX}/bin/nvim" -u NONE -e -c ':help' -c ':qall' || {
+ echo "Running ':help' in the installed nvim failed."
+ echo "Maybe the helptags have not been generated properly."
+ exit 1
+ }
+}
diff --git a/.ci/gcc-32.sh b/.ci/gcc-32.sh
deleted file mode 100644
index f1b2627fee..0000000000
--- a/.ci/gcc-32.sh
+++ /dev/null
@@ -1,37 +0,0 @@
-. "$CI_SCRIPTS/common.sh"
-
-sudo apt-get install gcc-multilib g++-multilib
-
-setup_deps x86
-
-CMAKE_EXTRA_FLAGS="-DTRAVIS_CI_BUILD=ON \
- -DCMAKE_SYSTEM_PROCESSOR=i386 \
- -DCMAKE_SYSTEM_LIBRARY_PATH=/lib32:/usr/lib32:/usr/local/lib32 \
- -DFIND_LIBRARY_USE_LIB64_PATHS=OFF \
- -DCMAKE_IGNORE_PATH=/lib:/usr/lib:/usr/local/lib \
- -DCMAKE_TOOLCHAIN_FILE=$TRAVIS_BUILD_DIR/cmake/i386-linux-gnu.toolchain.cmake \
- -DBUSTED_OUTPUT_TYPE=plainTerminal"
-
-# Build and output version info.
-$MAKE_CMD DEPS_CMAKE_FLAGS="$CMAKE_EXTRA_FLAGS" \
- CMAKE_EXTRA_FLAGS="$CMAKE_EXTRA_FLAGS" nvim
-build/bin/nvim --version
-
-# Build library.
-$MAKE_CMD CMAKE_EXTRA_FLAGS="$CMAKE_EXTRA_FLAGS" libnvim
-
-# Run unittests.
-$MAKE_CMD unittest
-
-# Run functional tests.
-$MAKE_CMD test
-check_core_dumps
-
-# Run legacy tests.
-$MAKE_CMD oldtest
-check_core_dumps
-
-# Test if correctly installed.
-sudo -E $MAKE_CMD install
-/usr/local/bin/nvim --version
-/usr/local/bin/nvim -e -c "quit"
diff --git a/.ci/gcc.sh b/.ci/gcc.sh
deleted file mode 100644
index 2e760c7b68..0000000000
--- a/.ci/gcc.sh
+++ /dev/null
@@ -1,42 +0,0 @@
-. "$CI_SCRIPTS/common.sh"
-
-sudo pip install cpp-coveralls
-
-# FIXME: Valgrind temporarily disabled (Timeouts on Travis).
-# if [ "$TRAVIS_OS_NAME" = "linux" ]; then
-# sudo apt-get install valgrind
-# export VALGRIND=1
-# export VALGRIND_LOG="$tmpdir/valgrind-%p.log"
-# fi
-
-setup_deps x64
-
-CMAKE_EXTRA_FLAGS="-DTRAVIS_CI_BUILD=ON \
- -DUSE_GCOV=ON \
- -DBUSTED_OUTPUT_TYPE=plainTerminal"
-
-# Build and output version info.
-$MAKE_CMD CMAKE_EXTRA_FLAGS="$CMAKE_EXTRA_FLAGS" nvim
-build/bin/nvim --version
-
-# Build library.
-$MAKE_CMD CMAKE_EXTRA_FLAGS="$CMAKE_EXTRA_FLAGS" libnvim
-
-# Run unittests.
-make unittest
-
-# Run functional tests.
-if ! $MAKE_CMD test; then
- valgrind_check "$tmpdir"
- exit 1
-fi
-valgrind_check "$tmpdir"
-
-# Run legacy tests.
-if ! $MAKE_CMD oldtest; then
- valgrind_check "$tmpdir"
- exit 1
-fi
-valgrind_check "$tmpdir"
-
-coveralls --encoding iso-8859-1 || echo 'coveralls upload failed.'
diff --git a/.ci/install.sh b/.ci/install.sh
new file mode 100755
index 0000000000..42c8026396
--- /dev/null
+++ b/.ci/install.sh
@@ -0,0 +1,20 @@
+#!/usr/bin/env bash
+
+set -e
+set -o pipefail
+
+if [[ -n "${CI_TARGET}" ]]; then
+ exit
+fi
+
+if [[ "${TRAVIS_OS_NAME}" == osx ]]; then
+ brew install gettext
+elif [[ "${BUILD_MINGW}" == ON ]]; then
+ # TODO: When Travis gets a recent version of Mingw-w64 use packages:
+ # binutils-mingw-w64-i686 gcc-mingw-w64-i686 g++-mingw-w64-i686 mingw-w64-dev mingw-w64-tools
+
+ echo "Downloading MinGW..."
+ wget -q -O - "http://downloads.sourceforge.net/project/mingw-w64/Toolchains%20targetting%20Win32/Personal%20Builds/rubenvb/gcc-4.8-release/i686-w64-mingw32-gcc-4.8.0-linux64_rubenvb.tar.xz" | tar xJf - -C "${HOME}/.local"
+fi
+
+pip install --user --upgrade cpp-coveralls neovim
diff --git a/.ci/mingw.sh b/.ci/mingw.sh
deleted file mode 100644
index e1372cecc9..0000000000
--- a/.ci/mingw.sh
+++ /dev/null
@@ -1,18 +0,0 @@
-. "$CI_SCRIPTS/common.sh"
-
-# FIXME: When Travis gets a recent version of Mingw-w64 use this
-#sudo apt-get install binutils-mingw-w64-i686 gcc-mingw-w64-i686 g++-mingw-w64-i686 mingw-w64-dev mingw-w64-tools
-#sudo apt-get install wine
-sudo apt-get install libc6-dev-i386
-
-# mingw-w64 build from http://sourceforge.net/projects/mingw-w64/files/Toolchains%20targetting%20Win32/Personal%20Builds/rubenvb/gcc-4.8-release/
-wget "http://downloads.sourceforge.net/project/mingw-w64/Toolchains%20targetting%20Win32/Personal%20Builds/rubenvb/gcc-4.8-release/i686-w64-mingw32-gcc-4.8.0-linux64_rubenvb.tar.xz" -O mingw.tar.xz
-sudo tar -axf mingw.tar.xz -C /opt
-export PATH=$PATH:/opt/mingw32/bin
-
-# Build third-party
-mkdir .deps
-cd .deps
-cmake -DCMAKE_TOOLCHAIN_FILE=../cmake/mingw32-w64-cross-travis.toolchain.cmake ../third-party/
-cmake --build .
-cd ..
diff --git a/.ci/run_tests.sh b/.ci/run_tests.sh
new file mode 100755
index 0000000000..f3a6466c5e
--- /dev/null
+++ b/.ci/run_tests.sh
@@ -0,0 +1,26 @@
+#!/usr/bin/env bash
+
+set -e
+set -o pipefail
+
+# TODO: Stop here for MinGW builds,
+# building Neovim doesn't work yet.
+if [[ "${BUILD_MINGW}" == ON ]]; then
+ echo "Neovim doesn't build on MinGW yet; stopping build."
+ touch "${SUCCESS_MARKER}"
+ exit
+fi
+
+CI_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
+source "${CI_DIR}/common/build.sh"
+source "${CI_DIR}/common/test.sh"
+
+build_nvim
+
+run_unittests
+run_functionaltests
+run_oldtests
+
+install_nvim
+
+touch "${SUCCESS_MARKER}"
diff --git a/.ci/script.sh b/.ci/script.sh
new file mode 100755
index 0000000000..4d0666ec0e
--- /dev/null
+++ b/.ci/script.sh
@@ -0,0 +1,21 @@
+#!/usr/bin/env bash
+
+set -e
+set -o pipefail
+
+if [[ -n "${CI_TARGET}" ]]; then
+ make lint
+ exit 0
+fi
+
+# This will pass the environment variables down to a bash process which runs
+# as $USER, while retaining the environment variables defined and belonging
+# to secondary groups given above in usermod.
+if [[ "${TRAVIS_OS_NAME}" == osx ]]; then
+ # Set up precompiled third-party dependencies.
+ eval "$(curl -Ss https://raw.githubusercontent.com/neovim/bot-ci/master/scripts/travis-setup.sh) deps-x64"
+
+ sudo -E su "${USER}" -c ".ci/run_tests.sh"
+else
+ .ci/run_tests.sh
+fi
diff --git a/.travis.yml b/.travis.yml
index 509b13eec8..becc7e8d3d 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -1,80 +1,142 @@
-sudo: required
+sudo: false
language: c
-os:
- - linux
-branches:
- except:
- - nightly
+
env:
global:
- - CI_SCRIPTS=$TRAVIS_BUILD_DIR/.ci
# To build third-party dependencies, set this to 'true'.
+ # TODO: Change deps caching to detect updated dependencies automatically, but
+ # still don't rebuild deps every time.
- BUILD_NVIM_DEPS=false
- # Travis reports back that it has 32-cores via /proc/cpuinfo, but it's not
- # what we really have available. According to their documentation, it only has
- # 1.5 virtual cores.
- # See
- # http://docs.travis-ci.com/user/speeding-up-the-build/#Paralellizing-your-build-on-one-VM
- # for more information.
+ # Travis has 1.5 virtual cores according to
+ # http://docs.travis-ci.com/user/speeding-up-the-build/#Paralellizing-your-build-on-one-VM
- MAKE_CMD="make -j2"
+ # Update PATH for pip and MinGW.
+ - PATH="$(python -c 'import site; print(site.getuserbase())')/bin:$HOME/.local/mingw32/bin:$PATH"
+ # LLVM symbolizer path.
+ - LLVM_SYMBOLIZER="$(which llvm-symbolizer-3.6)"
# Force verification of DLOG macros.
- - CFLAGS='-DMIN_LOG_LEVEL=0'
- matrix:
- - CI_TARGET=gcc
- - CI_TARGET=gcc-32
- - CI_TARGET=clint
- - CI_TARGET=mingw
+ - CFLAGS="-DMIN_LOG_LEVEL=0"
+ # Build directory for Neovim.
+ - BUILD_DIR="$TRAVIS_BUILD_DIR/build"
+ # Build directory for third-party dependencies.
+ - DEPS_BUILD_DIR="$TRAVIS_BUILD_DIR/deps-build"
+ # Directory where compiled third-party dependencies are stored.
+ - DEPS_INSTALL_PREFIX="$HOME/nvim-deps-install"
+ # Install directory for Neovim.
+ - INSTALL_PREFIX="$HOME/nvim-install"
+ # Log directory for Clang sanitizers and Valgrind.
+ - LOG_DIR="$BUILD_DIR/log"
+ # Default CMake flags.
+ - CMAKE_FLAGS="-DTRAVIS_CI_BUILD=ON
+ -DCMAKE_BUILD_TYPE=Debug
+ -DCMAKE_INSTALL_PREFIX:PATH=$INSTALL_PREFIX
+ -DUSE_GCOV=ON
+ -DBUSTED_OUTPUT_TYPE=plainTerminal
+ -DDEPS_PREFIX=$DEPS_INSTALL_PREFIX"
+ - DEPS_CMAKE_FLAGS="-DDEPS_INSTALL_DIR:PATH=$DEPS_INSTALL_PREFIX"
+ # Additional CMake flags for 32-bit builds.
+ - CMAKE_FLAGS_32BIT="-DCMAKE_SYSTEM_LIBRARY_PATH=/lib32:/usr/lib32:/usr/local/lib32
+ -DCMAKE_IGNORE_PATH=/lib:/usr/lib:/usr/local/lib
+ -DCMAKE_TOOLCHAIN_FILE=$TRAVIS_BUILD_DIR/cmake/i386-linux-gnu.toolchain.cmake"
+ # Additional CMake flags for MinGW builds.
+ - CMAKE_FLAGS_MINGW="-DCMAKE_TOOLCHAIN_FILE=$TRAVIS_BUILD_DIR/cmake/mingw32-w64-cross-travis.toolchain.cmake"
+ # Environment variables for Clang sanitizers.
+ - ASAN_OPTIONS="detect_leaks=1:check_initialization_order=1:log_path=$LOG_DIR/asan"
+ - ASAN_SYMBOLIZER_PATH="$LLVM_SYMBOLIZER"
+ - MSAN_SYMBOLIZER_PATH="$LLVM_SYMBOLIZER"
+ - TSAN_OPTIONS="external_symbolizer_path=$LLVM_SYMBOLIZER log_path=$LOG_DIR/tsan"
+ - UBSAN_OPTIONS="log_path=$LOG_DIR/ubsan"
+ # Environment variables for Valgrind.
+ - VALGRIND_LOG="$LOG_DIR/valgrind-%p.log"
+ # Cache marker for third-party dependencies cache.
+ # If this file exists, we know that the cache contains compiled
+ # dependencies and we can use it.
+ - CACHE_MARKER="$HOME/.cache/nvim-deps/.travis_cache_marker"
+ # Test success marker. If this file exists, we know that all tests
+ # were successful. Required because we only want to update the cache
+ # if the tests were successful, but don't have this information
+ # available in before_cache (which is run before after_success).
+ - SUCCESS_MARKER="$BUILD_DIR/.tests_successful"
+
matrix:
include:
- os: linux
- env: CI_TARGET=clang CLANG_SANITIZER=ASAN_UBSAN
+ env: CI_TARGET=clint
+ - os: linux
+ compiler: gcc-5
+ env: GCOV=gcov-5
+ - os: linux
+ # Travis creates a cache per compiler.
+ # Set a different value here to store 32-bit
+ # dependencies in a separate cache.
+ compiler: gcc-5 -m32
+ env: GCOV=gcov-5 BUILD_32BIT=ON
- os: linux
- env: CI_TARGET=clang CLANG_SANITIZER=MSAN
- # FIXME: Re-enable TSan when tests run successfully.
+ compiler: clang-3.6
+ env: GCOV=llvm-cov-3.6 CLANG_SANITIZER=ASAN_UBSAN
+ - os: linux
+ compiler: clang-3.6
+ env: GCOV=llvm-cov-3.6 CLANG_SANITIZER=MSAN
+ # FIXME (tarruda): Uncomment when TSan tests don't hang anymore.
#- os: linux
- # env: CI_TARGET=clang CLANG_SANITIZER=TSAN
+ # compiler: clang-3.6
+ # env: GCOV=llvm-cov-3.6 CLANG_SANITIZER=TSAN
- os: osx
- env: CI_TARGET=clang
compiler: clang
+ env: GCOV=gcov
- os: osx
- env: CI_TARGET=gcc
compiler: gcc-4.9
+ env: GCOV=gcov-4.9
+ - os: linux
+ env: BUILD_MINGW=ON
fast_finish: true
allow_failures:
- - env: CI_TARGET=clang CLANG_SANITIZER=MSAN
-before_install:
- # Pins the version of the java package installed on the Travis VMs
- # and avoids a lengthy upgrade process for them.
- - if [ $TRAVIS_OS_NAME = linux ]; then
- sudo apt-mark hold oracle-java7-installer oracle-java8-installer;
- sudo apt-get update;
- elif [ $TRAVIS_OS_NAME = osx ]; then
- brew update;
- fi
-install:
- - if [ $TRAVIS_OS_NAME = linux ]; then
- sudo apt-get install xclip gdb;
- elif [ $TRAVIS_OS_NAME = osx ]; then
- brew install gettext;
- fi
-before_script:
- # Adds user to a dummy group.
- # That allows to test changing the group of the file by `os_fchown`.
- # Need xvfb for running some tests with xclip
- - if [ $TRAVIS_OS_NAME = linux ]; then
- sudo groupadd chown_test;
- sudo usermod -a -G chown_test $USER;
- export DISPLAY=:99.0;
- sh -e /etc/init.d/xvfb start;
- elif [ $TRAVIS_OS_NAME = osx ]; then
- sudo dscl . -create /Groups/chown_test;
- sudo dscl . -append /Groups/chown_test GroupMembership $USER;
- fi
-script:
- # This will pass the environment variables down to a bash process which runs
- # as $USER, while retaining the environment variables defined and belonging
- # to secondary groups given above in usermod.
- - sudo -E su $USER -c "sh -e \"$CI_SCRIPTS/$CI_TARGET.sh\""
+ # TODO: Remove when all MSan errors have been fixed.
+ - env: GCOV=llvm-cov-3.6 CLANG_SANITIZER=MSAN
+
+before_install: .ci/before_install.sh
+install: .ci/install.sh
+before_script: .ci/before_script.sh
+script: .ci/script.sh
+before_cache: .ci/before_cache.sh
+after_success: .ci/after_success.sh
+
+addons:
+ apt:
+ sources:
+ - llvm-toolchain-precise-3.6
+ - ubuntu-toolchain-r-test
+ packages:
+ # Basic Neovim/test dependencies.
+ - autoconf
+ - automake
+ - build-essential
+ - cmake
+ - gdb
+ - libtool
+ - pkg-config
+ - unzip
+ - xclip
+ # Additional compilers/tools.
+ - clang-3.6
+ - g++-5-multilib
+ - g++-multilib
+ - gcc-5-multilib
+ - gcc-multilib
+ - libc6-dev-i386
+ - llvm-3.6-dev
+ - valgrind
+
+branches:
+ except:
+ - nightly
+
+cache:
+ apt: true
+ directories:
+ - "$HOME/.cache/pip"
+ - "$HOME/.cache/nvim-deps"
+
notifications:
webhooks:
urls:
diff --git a/cmake/i386-linux-gnu.toolchain.cmake b/cmake/i386-linux-gnu.toolchain.cmake
index 5b3e02d18d..089e37e5e8 100644
--- a/cmake/i386-linux-gnu.toolchain.cmake
+++ b/cmake/i386-linux-gnu.toolchain.cmake
@@ -1,5 +1,7 @@
set(CMAKE_SYSTEM_PROCESSOR i386)
set(CMAKE_SYSTEM_NAME Linux)
set(CMAKE_SYSTEM_VERSION gnu)
-set(CMAKE_C_COMPILER gcc)
+if(NOT ${CMAKE_C_COMPILER})
+ set(CMAKE_C_COMPILER gcc)
+endif()
set(CMAKE_C_COMPILER_ARG1 "-m32")
diff --git a/third-party/CMakeLists.txt b/third-party/CMakeLists.txt
index c04e17985a..50f610008d 100644
--- a/third-party/CMakeLists.txt
+++ b/third-party/CMakeLists.txt
@@ -5,9 +5,9 @@ project(NEOVIM_DEPS)
# Point CMake at any custom modules we may ship
list(APPEND CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/cmake")
-set(DEPS_INSTALL_DIR "${CMAKE_BINARY_DIR}/usr")
-set(DEPS_BIN_DIR "${CMAKE_BINARY_DIR}/usr/bin")
-set(DEPS_LIB_DIR "${CMAKE_BINARY_DIR}/usr/lib")
+set(DEPS_INSTALL_DIR "${CMAKE_BINARY_DIR}/usr" CACHE PATH "Dependencies install directory.")
+set(DEPS_BIN_DIR "${DEPS_INSTALL_DIR}/bin")
+set(DEPS_LIB_DIR "${DEPS_INSTALL_DIR}/lib")
set(DEPS_BUILD_DIR "${CMAKE_BINARY_DIR}/build")
set(DEPS_DOWNLOAD_DIR "${DEPS_BUILD_DIR}/downloads")