-
Notifications
You must be signed in to change notification settings - Fork 0
/
test_setup.sh
48 lines (39 loc) · 1021 Bytes
/
test_setup.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
#!/bin/bash
OS_LIST=(\
"MINGW_00x" \
"Linux" \
"Darwin" \
"unko" \
)
OS_LIST_EXPECTED_RESULT=(\
0 \
0 \
0 \
1 \
)
function check_result() {
local expected_ret="$1"
local actual_ret="$2"
if [[ ${expected_ret} -eq ${actual_ret} ]]; then
echo 0
else
echo 1
fi
}
LOGFILE="$(dirname $0)/$(basename $0).log"
if [[ -f ${LOGFILE} ]]; then
rm -fv ${LOGFILE}
fi
for ((i=0; i<${#OS_LIST[@]}; ++i)); {
echo -e "--- $(basename $0): OS(${OS_LIST[$i]}) ---"
echo -e "--- $(basename $0): OS(${OS_LIST[$i]}) ---" >> ${LOGFILE}
bash dotfiles/setup.sh -d ${OS_LIST[${i}]}; RETVAL=$?
RESULT=$(check_result ${OS_LIST_EXPECTED_RESULT[${i}]} ${RETVAL})
if [[ ${RESULT} -eq 0 ]]; then
echo -e "--- $(basename $0): OK. ---\n"
echo -e "--- $(basename $0): OK. ---\n" >> ${LOGFILE}
else
echo -e "--- $(basename $0): NG. EXPECTED=${OS_LIST_EXPECTED_RESULT[${i}]}, RETVAL=${RETVAL} ---\n"
echo -e "--- $(basename $0): NG. EXPECTED=${OS_LIST_EXPECTED_RESULT[${i}]}, RETVAL=${RETVAL} ---\n" >> ${LOGFILE}
fi
}