-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathtest
executable file
·84 lines (69 loc) · 1.41 KB
/
test
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
#!/bin/bash
if [ -z "$WHARFRAT_NAME" ] && [ -z "$WM_HOST_BUILD" ]; then
exec wr "$0" "$@"
fi
ret=0
export WITHMOCK_TEST_MAIN="true"
if [ -n "$1" ]; then
stdlib="$(cd "stdlib"; pwd)"
export GOROOT="${stdlib}/$1/go"
export PATH="$GOROOT/bin:$PATH"
if ! [ -d "${GOROOT}" ]; then
echo -e "\e[31;1mERROR - No such version: $1\e[0m"
exit 1
fi
fi
./build
if [ $? -ne 0 ]; then
ret=1
fi
# stop if install failed
if [ $ret -ne 0 ]; then
exit $ret
fi
echo
./scenarios/test
if [ $? -ne 0 ]; then
ret=1
fi
echo
echo -e "\e[33;1mexample\e[0m"
echo -e "======="
echo -n "withmock: "
echo "=== withmock ===" > example/test.log
(cd example && ./test) >> example/test.log 2>&1
if [ $? -ne 0 ]; then
echo -e "\e[31;1mFAIL\e[0m"
ret=1
else
echo -e "\e[32;1mPASS\e[0m"
fi
echo -n "mocktest: "
echo "=== mocktest ===" >> example/test.log
mocktest ./example >> example/test.log 2>&1
if [ $? -ne 0 ]; then
echo -e "\e[31;1mFAIL\e[0m"
ret=1
else
echo -e "\e[32;1mPASS\e[0m"
fi
echo
echo -e "\e[33;1mgo test\e[0m"
echo -e "======="
for path in lib; do
echo -n "$path: "
go test -v ./$path > $path/test.log 2>&1
if [ $? -ne 0 ]; then
echo -e "\e[31;1mFAIL\e[0m"
ret=1
else
echo -e "\e[32;1mPASS\e[0m"
fi
done
echo -ne "\nOverall: "
if [ $ret -eq 0 ]; then
echo -e "\e[32;1mPASS\e[0m"
else
echo -e "\e[31;1mFAIL\e[0m"
fi
exit $ret