-
Notifications
You must be signed in to change notification settings - Fork 72
/
runtest.sh
executable file
·104 lines (90 loc) · 2.61 KB
/
runtest.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
90
91
92
93
94
95
96
97
98
99
100
101
102
103
#!/bin/bash
VIMRC_FILE="test/.vimrc"
DRIVER_FILE="test/_runner"
RESULT_FILE="test/test_result.log"
VIM_BUILD=1
VIM_INSTALL_DIR=`pwd`/local
if [ "${VERSION}" == "" ]; then
VERSION=3.2
fi
TSSERVER_PATH="$(pwd)/test/node_modules/typescript-${VERSION}/bin/tsserver"
echo "Run test with ${TSSERVER_PATH}"
if [ "${VIM_BUILD}" -eq 1 ]; then
echo "`date "+[%Y-%m-%dT%H:%M:%S]"` Use local Vim."
if [ ! -d "./local" ]; then
echo "`date "+[%Y-%m-%dT%H:%M:%S]"` Installing Vim"
if [ ! -d "./vim" ]; then
echo "`date "+[%Y-%m-%dT%H:%M:%S]"` Clonning Vim source from Github"
git clone --depth 1 https://github.com/vim/vim.git
fi
cd vim
./configure --prefix=${VIM_INSTALL_DIR}
if [ ! $? -eq 0 ]; then
exit $?
fi
make
if [ ! $? -eq 0 ]; then
exit $?
fi
make install
if [ ! $? -eq 0 ]; then
exit $?
fi
echo "`date "+[%Y-%m-%dT%H:%M:%S]"` Vim was created successfully."
cd ..
fi
VIM_CMD="${VIM_INSTALL_DIR}/bin/vim"
else
echo "`date "+[%Y-%m-%dT%H:%M:%S]"` Use system Vim."
VIM_CMD="vim"
fi
${VIM_CMD} --version
if [ ! -d "./neobundle.vim" ]; then
echo "`date "+[%Y-%m-%dT%H:%M:%S]"` Installing neobundle"
git clone --depth 1 https://github.com/Shougo/neobundle.vim
fi
if [ "${HIDE_VIM}" == "" ]; then
${VIM_CMD} -u ${VIMRC_FILE} -c NeoBundleInstall -c q
else
${VIM_CMD} -u ${VIMRC_FILE} -c NeoBundleInstall -c q > /dev/null
fi
if [ -f "${RESULT_FILE}" ]; then
rm ${RESULT_FILE}
fi
echo "`date "+[%Y-%m-%dT%H:%M:%S]"` Run vesting."
# In CI, displaying Vim UI is meaningless and it makes CI logs dirty.
# So hide Vim UI.
if [ "${HIDE_VIM}" == "" ]; then
${VIM_CMD} \
-c 'let g:tsuquyomi_use_local_typescript = 0' \
-c 'let g:tsuquyomi_use_dev_node_module = 2' \
-c "let g:tsuquyomi_tsserver_path = \"${TSSERVER_PATH}\"" \
-u ${VIMRC_FILE} \
-s ${DRIVER_FILE}
else
${VIM_CMD} \
-c 'let g:tsuquyomi_use_local_typescript = 0' \
-c 'let g:tsuquyomi_use_dev_node_module = 2' \
-c "let g:tsuquyomi_tsserver_path = \"${TSSERVER_PATH}\"" \
-u ${VIMRC_FILE} \
-s ${DRIVER_FILE} > /dev/null
fi
if [ $? -ne 0 ]; then
echo "Vim exited with non-zero status."
exit 1
fi
echo "`date "+[%Y-%m-%dT%H:%M:%S]"` Done."
echo "`date "+[%Y-%m-%dT%H:%M:%S]"` Result: (${RESULT_FILE})"
cat ${RESULT_FILE}
grep -E "\[Fail\]" ${RESULT_FILE} > /dev/null
if [ $? -eq 0 ]; then
echo "`date "+[%Y-%m-%dT%H:%M:%S]"` Test was failed."
exit 1
fi
grep -E "\[Error\]" ${RESULT_FILE} > /dev/null
if [ $? -eq 0 ]; then
echo "`date "+[%Y-%m-%dT%H:%M:%S]"` Test was failed."
exit 1
fi
echo "`date "+[%Y-%m-%dT%H:%M:%S]"` Test was succeeded."
exit 0