-
Notifications
You must be signed in to change notification settings - Fork 5k
Expand file tree
/
Copy pathrun_case.sh
More file actions
executable file
·120 lines (104 loc) · 3.42 KB
/
run_case.sh
File metadata and controls
executable file
·120 lines (104 loc) · 3.42 KB
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
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
#!/bin/bash
function usage() {
echo "$0"
echo -e "\t -d execution dir"
echo -e "\t -c command"
echo -e "\t -e enterprise edition"
echo -e "\t -o default timeout value"
echo -e "\t -h help"
}
ent=0
while getopts "d:c:o:eh" opt; do
case $opt in
d)
exec_dir=$OPTARG
;;
c)
cmd=$OPTARG
;;
o)
TIMEOUT_CMD="timeout $OPTARG"
;;
e)
ent=1
;;
h)
usage
exit 0
;;
\?)
echo "Invalid option: -$OPTARG"
usage
exit 0
;;
esac
done
if [ -z "$exec_dir" ]; then
usage
exit 0
fi
if [ -z "$cmd" ]; then
usage
exit 0
fi
# handle the exec_dir is "." specially
if [ "$exec_dir" = "." ]; then
target_dir="test"
else
target_dir="test/$exec_dir"
fi
if [ $ent -eq 0 ]; then
export PATH=$PATH:/home/TDengine/debug/build/bin
export LD_LIBRARY_PATH=/home/TDengine/debug/build/lib
ln -s /home/TDengine/debug/build/lib/libtaos.so /usr/lib/libtaos.so 2>/dev/null
ln -s /home/TDengine/debug/build/lib/libtaos.so /usr/lib/libtaos.so.1 2>/dev/null
ln -s /home/TDengine/include/client/taos.h /usr/include/taos.h 2>/dev/null
ln -s /home/TDengine/include/common/taosdef.h /usr/include/taosdef.h 2>/dev/null
ln -s /home/TDengine/include/util/taoserror.h /usr/include/taoserror.h 2>/dev/null
ln -s /home/TDengine/include/libs/function/taosudf.h /usr/include/taosudf.h 2>/dev/null
CONTAINER_TESTDIR=/home/TDengine
else
export PATH=$PATH:/home/TDinternal/debug/build/bin
export LD_LIBRARY_PATH=/home/TDinternal/debug/build/lib
ln -s /home/TDinternal/debug/build/lib/libtaos.so /usr/lib/libtaos.so 2>/dev/null
ln -s /home/TDinternal/debug/build/lib/libtaos.so /usr/lib/libtaos.so.1 2>/dev/null
ln -s /home/TDinternal/community/include/client/taos.h /usr/include/taos.h 2>/dev/null
ln -s /home/TDinternal/community/include/common/taosdef.h /usr/include/taosdef.h 2>/dev/null
ln -s /home/TDinternal/community/include/util/taoserror.h /usr/include/taoserror.h 2>/dev/null
ln -s /home/TDinternal/community/include/libs/function/taosudf.h /usr/include/taosudf.h 2>/dev/null
CONTAINER_TESTDIR=/home/TDinternal/community
fi
mkdir -p /var/lib/taos/subscribe
mkdir -p /var/log/taos
mkdir -p /var/lib/taos
mkdir -p /etc/taos
cd $CONTAINER_TESTDIR/$target_dir || {
echo "Can't enter the target dirctory: ${CONTAINER_TESTDIR}/${target_dir}";
exit 1;
}
ulimit -c unlimited
# get python connector and update: taospy 2.8.9 taos-ws-py 0.6.6
pip3 install taospy==2.8.9
pip3 install taos-ws-py==0.6.6
pip3 install pyotp
$TIMEOUT_CMD $cmd
RET=$?
echo "cmd exit code: $RET"
if [ -d "/var/log/taos" ]; then
mkdir -p /home/TDinternal/sim/var_taoslog/
cp /var/log/taos/* /home/TDinternal/sim/var_taoslog/ >/dev/null 2>&1
fi
if [ -f "${CONTAINER_TESTDIR}/docs/examples/JDBC/JDBCDemo/jdbc-out.log" ]; then
mkdir -p /home/TDinternal/sim/var_taoslog/
cp ${CONTAINER_TESTDIR}/docs/examples/JDBC/JDBCDemo/jdbc-out.log \
/home/TDinternal/sim/var_taoslog/ >/dev/null 2>&1
fi
if [ -f "${CONTAINER_TESTDIR}/docs/examples/c/docs-c-test-out.log" ]; then
mkdir -p /home/TDinternal/sim/var_taoslog/
cp ${CONTAINER_TESTDIR}/docs/examples/c/docs-c-test-out.log \
/home/TDinternal/sim/var_taoslog/ >/dev/null 2>&1
fi
if [ $RET -ne 0 ]; then
pwd
fi
exit $RET