diff --git a/tests/script/sh/stop_dnodes.sh b/tests/script/sh/stop_dnodes.sh index da2083b013..96a1108893 100755 --- a/tests/script/sh/stop_dnodes.sh +++ b/tests/script/sh/stop_dnodes.sh @@ -7,13 +7,21 @@ unset LD_PRELOAD UNAME_BIN=`which uname` OS_TYPE=`$UNAME_BIN` +psby() { + if [ "$OS_TYPE" != "Darwin" ]; then + ps -C $1 + else + ps a -c + fi +} + PID=`ps -ef|grep /usr/bin/taosd | grep -v grep | awk '{print $2}'` if [ -n "$PID" ]; then echo systemctl stop taosd systemctl stop taosd fi -PID=`ps -ef|grep -w taosd | grep -v grep | grep -v taosanode | awk '{print $2}'` +PID=`psby taosd | grep -w "[t]aosd" | awk '{print $1}' | head -n 1` while [ -n "$PID" ]; do echo kill -9 $PID #pkill -9 taosd @@ -24,10 +32,10 @@ while [ -n "$PID" ]; do else lsof -nti:6030 | xargs kill -9 fi - PID=`ps -ef|grep -w taosd | grep -v grep | awk '{print $2}'` + PID=`psby taosd | grep -w "[t]aosd" | awk '{print $1}' | head -n 1` done -PID=`ps -ef|grep -w taos | grep -v grep | grep -v taosanode|awk '{print $2}'` +PID=`psby taos | grep -w "[t]aos" | awk '{print $1}' | head -n 1` while [ -n "$PID" ]; do echo kill -9 $PID #pkill -9 taos @@ -38,10 +46,10 @@ while [ -n "$PID" ]; do else lsof -nti:6030 | xargs kill -9 fi - PID=`ps -ef|grep -w taos | grep -v grep |grep -v taosanode| awk '{print $2}'` + PID=`psby taos | grep -w "[t]aos" | awk '{print $1}' | head -n 1` done -PID=`ps -ef|grep -w tmq_sim | grep -v grep | grep -v taosanode|awk '{print $2}'` +PID=`psby tmq_sim | grep -w "[t]mq_sim" | awk '{print $1}' | head -n 1` while [ -n "$PID" ]; do echo kill -9 $PID #pkill -9 tmq_sim @@ -52,5 +60,5 @@ while [ -n "$PID" ]; do else lsof -nti:6030 | xargs kill -9 fi - PID=`ps -ef|grep -w tmq_sim | grep -v grep | grep -v taosanode| awk '{print $2}'` -done \ No newline at end of file + PID=`psby tmq_sim | grep -w "[t]mq_sim" | awk '{print $1}' | head -n 1` +done diff --git a/tests/script/test.sh b/tests/script/test.sh index 26c01a6c09..b1588ac2e6 100755 --- a/tests/script/test.sh +++ b/tests/script/test.sh @@ -43,9 +43,9 @@ CODE_DIR=`pwd` IN_TDINTERNAL="community" if [[ "$CODE_DIR" == *"$IN_TDINTERNAL"* ]]; then - cd ../../.. + pushd ../../.. else - cd ../../ + pushd ../../ fi TOP_DIR=`pwd` @@ -119,6 +119,8 @@ ulimit -c unlimited #sudo sysctl -w kernel.core_pattern=$TOP_DIR/core.%p.%e +popd + if [ -n "$FILE_NAME" ]; then echo "------------------------------------------------------------------------" if [ $VALGRIND -eq 1 ]; then