-
Notifications
You must be signed in to change notification settings - Fork 76
/
.travis.sh
executable file
·89 lines (76 loc) · 1.99 KB
/
.travis.sh
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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
#!/usr/bin/env bash
set -o nounset
set -o errexit
declare -r build_status="$(mktemp)"
declare -r otp_name='OTP_R16B02_basho10'
declare -r otp_build_log_dir="$HOME/.kerl/builds/$otp_name"
declare -r otp_install_dir="$HOME/otp-basho"
declare -r kerl_activate="$otp_install_dir/activate"
function onexit
{
rm -f "$build_status"
}
trap onexit EXIT
function build_ticker
{
local status="$(< $build_status)"
while [[ $status == 'true' ]]
do
echo '------------------------------------------------------------------------------------------------------------------------------------------------'
echo "$(date) building $otp_name ..."
if ls $otp_build_log_dir/otp_build*.log > /dev/null
then
tail $otp_build_log_dir/otp_build*.log
fi
sleep 10
status="$(< $build_status)"
done
echo '.'
}
function build_otp
{
if [[ -f $otp_install_dir/activate ]]
then
echo "Found $otp_name installation at $otp_install_dir"
else
export KERL_CONFIGURE_OPTIONS='--enable-hipe --enable-smp-support --enable-threads --enable-kernel-poll --without-odbc'
rm -rf "$otp_install_dir"
mkdir -p "$otp_install_dir"
echo -n 'true' > "$build_status"
build_ticker &
kerl build git https://github.com/basho/otp.git "$otp_name" "$otp_name"
echo -n 'false' > "$build_status"
wait
kerl install "$otp_name" "$otp_install_dir"
fi
exit 0
}
function do_tests
{
if ! hash escript
then
if [[ -f $kerl_activate ]]
then
set +o nounset
set +o errexit
source "$kerl_activate"
set -o nounset
set -o errexit
else
echo "Did not find $kerl_activate, exiting" 1>&2
exit 1
fi
fi
make
make test
}
if [[ $1 == 'build' ]]
then
build_otp
elif [[ $1 == 'test' ]]
then
do_tests
else
echo 'script argument must be "build" or "test"' 1>&2
exit 1
fi