未验证 提交 bbda420d 编写于 作者: sangshuduo's avatar sangshuduo 提交者: GitHub

Feature/sangshuduo/td 3735 make test framework work on mac (#5761)

* [TD-3735]<feature>: make test framework work on mac

* [TD-3735]<feature>: make test framework work on mac

change cut fields to -f for mac compatibility.
上级 b2b514f8
...@@ -80,6 +80,7 @@ function runSimCaseOneByOne { ...@@ -80,6 +80,7 @@ function runSimCaseOneByOne {
fi fi
done < $1 done < $1
} }
function runSimCaseOneByOnefq { function runSimCaseOneByOnefq {
start=`sed -n "/$1-start/=" jenkins/basic.txt` start=`sed -n "/$1-start/=" jenkins/basic.txt`
...@@ -155,6 +156,7 @@ function runPyCaseOneByOne { ...@@ -155,6 +156,7 @@ function runPyCaseOneByOne {
fi fi
done < $1 done < $1
} }
function runPyCaseOneByOnefq() { function runPyCaseOneByOnefq() {
cd $tests_dir/pytest cd $tests_dir/pytest
if [[ $1 =~ full ]] ; then if [[ $1 =~ full ]] ; then
...@@ -202,13 +204,37 @@ function runPyCaseOneByOnefq() { ...@@ -202,13 +204,37 @@ function runPyCaseOneByOnefq() {
rm -rf ../../sim/case.log rm -rf ../../sim/case.log
} }
######################
# main entry
######################
unameOut="$(uname -s)"
case "${unameOut}" in
Linux*) OS=Linux;;
Darwin*) OS=Darwin;;
CYGWIN*) OS=Windows;;
*) OS=Unknown;;
esac
case "${OS}" in
Linux*) TAOSLIB=libtaos.so;;
Darwin*) TAOSLIB=libtaos.dylib;;
Windows*) TAOSLIB=taos.dll;;
Unknown) TAOSLIB="UNKNOWN:${unameOut}";;
esac
echo TAOSLIB is ${TAOSLIB}
totalFailed=0 totalFailed=0
totalPyFailed=0 totalPyFailed=0
totalJDBCFailed=0 totalJDBCFailed=0
totalUnitFailed=0 totalUnitFailed=0
totalExampleFailed=0 totalExampleFailed=0
corepath=`grep -oP '.*(?=core_)' /proc/sys/kernel/core_pattern||grep -oP '.*(?=core-)' /proc/sys/kernel/core_pattern` if [ "${OS}" == "Linux" ]; then
corepath=`grep -oP '.*(?=core_)' /proc/sys/kernel/core_pattern||grep -oP '.*(?=core-)' /proc/sys/kernel/core_pattern`
fi
if [ "$2" != "jdbc" ] && [ "$2" != "python" ] && [ "$2" != "unit" ] && [ "$2" != "example" ]; then if [ "$2" != "jdbc" ] && [ "$2" != "python" ] && [ "$2" != "unit" ] && [ "$2" != "example" ]; then
echo "### run TSIM test case ###" echo "### run TSIM test case ###"
cd $tests_dir/script cd $tests_dir/script
...@@ -290,11 +316,11 @@ if [ "$2" != "sim" ] && [ "$2" != "jdbc" ] && [ "$2" != "unit" ] && [ "$2" != " ...@@ -290,11 +316,11 @@ if [ "$2" != "sim" ] && [ "$2" != "jdbc" ] && [ "$2" != "unit" ] && [ "$2" != "
fi fi
TOP_DIR=`pwd` TOP_DIR=`pwd`
TAOSLIB_DIR=`find . -name "libtaos.so"|grep -w lib|head -n1` TAOSLIB_DIR=`find . -name "${TAOSLIB}"|grep -w lib|head -n1`
if [[ "$TAOSLIB_DIR" == *"$IN_TDINTERNAL"* ]]; then if [[ "$TAOSLIB_DIR" == *"$IN_TDINTERNAL"* ]]; then
LIB_DIR=`find . -name "libtaos.so"|grep -w lib|head -n1|cut -d '/' --fields=2,3,4,5` LIB_DIR=`find . -name "${TAOSLIB}"|grep -w lib|head -n1|cut -d '/' -f 2,3,4,5`
else else
LIB_DIR=`find . -name "libtaos.so"|grep -w lib|head -n1|cut -d '/' --fields=2,3,4` LIB_DIR=`find . -name "${TAOSLIB}"|grep -w lib|head -n1|cut -d '/' -f 2,3,4`
fi fi
export LD_LIBRARY_PATH=$TOP_DIR/$LIB_DIR:$LD_LIBRARY_PATH export LD_LIBRARY_PATH=$TOP_DIR/$LIB_DIR:$LD_LIBRARY_PATH
...@@ -499,7 +525,9 @@ if [ "$2" != "sim" ] && [ "$2" != "python" ] && [ "$2" != "jdbc" ] && [ "$2" != ...@@ -499,7 +525,9 @@ if [ "$2" != "sim" ] && [ "$2" != "python" ] && [ "$2" != "jdbc" ] && [ "$2" !=
echo -e "\n${RED} ### Total $totalExampleFailed examples failed! ### ${NC}" echo -e "\n${RED} ### Total $totalExampleFailed examples failed! ### ${NC}"
fi fi
dohavecore 1 if [ "${OS}" == "Linux" ]; then
dohavecore 1
fi
fi fi
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册