aboutsummaryrefslogtreecommitdiff
path: root/.ci/common.sh
blob: 4894c0d5ad478cb48bcdf8af937d517f6bb0191e (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
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"