test: python asan

This commit is contained in:
Shengliang Guan 2022-11-20 21:26:54 +08:00
parent 4dc1b33414
commit 15c0bb9446
6 changed files with 18 additions and 8 deletions

View File

@ -162,6 +162,10 @@ class TDDnode:
def setAsan(self, value): def setAsan(self, value):
self.asan = value self.asan = value
if value: if value:
selfPath = os.path.dirname(os.path.realpath(__file__))
if ("community" in selfPath):
self.execPath = os.path.abspath(self.path + "/community/tests/script/sh/exec.sh")
else:
self.execPath = os.path.abspath(self.path + "/tests/script/sh/exec.sh") self.execPath = os.path.abspath(self.path + "/tests/script/sh/exec.sh")
def getDataSize(self): def getDataSize(self):
@ -670,6 +674,11 @@ class TDDnodes:
def setAsan(self, value): def setAsan(self, value):
self.asan = value self.asan = value
if value: if value:
selfPath = os.path.dirname(os.path.realpath(__file__))
if ("community" in selfPath):
self.stopDnodesPath = os.path.abspath(self.path + "/community/tests/script/sh/stop_dnodes.sh")
self.stopDnodesSigintPath = os.path.abspath(self.path + "/community/tests/script/sh/sigint_stop_dnodes.sh")
else:
self.stopDnodesPath = os.path.abspath(self.path + "/tests/script/sh/stop_dnodes.sh") self.stopDnodesPath = os.path.abspath(self.path + "/tests/script/sh/stop_dnodes.sh")
self.stopDnodesSigintPath = os.path.abspath(self.path + "/tests/script/sh/sigint_stop_dnodes.sh") self.stopDnodesSigintPath = os.path.abspath(self.path + "/tests/script/sh/sigint_stop_dnodes.sh")
tdLog.info("run in address sanitizer mode") tdLog.info("run in address sanitizer mode")

View File

@ -3,7 +3,7 @@
set +e set +e
#set -x #set -x
export LD_PRELOAD= unset LD_PRELOAD
SCRIPT_DIR=`dirname $0` SCRIPT_DIR=`dirname $0`
cd $SCRIPT_DIR/../ cd $SCRIPT_DIR/../
SCRIPT_DIR=`pwd` SCRIPT_DIR=`pwd`

View File

@ -11,7 +11,7 @@
set +e set +e
#set -x #set -x
export LD_PRELOAD= unset LD_PRELOAD
UNAME_BIN=`which uname` UNAME_BIN=`which uname`
OS_TYPE=`$UNAME_BIN` OS_TYPE=`$UNAME_BIN`

View File

@ -3,7 +3,7 @@
set +e set +e
#set -x #set -x
export LD_PRELOAD= unset LD_PRELOAD
UNAME_BIN=`which uname` UNAME_BIN=`which uname`
OS_TYPE=`$UNAME_BIN` OS_TYPE=`$UNAME_BIN`

View File

@ -3,7 +3,7 @@
set +e set +e
#set -x #set -x
export LD_PRELOAD= unset LD_PRELOAD
UNAME_BIN=`which uname` UNAME_BIN=`which uname`
OS_TYPE=`$UNAME_BIN` OS_TYPE=`$UNAME_BIN`

View File

@ -69,10 +69,11 @@ echo "ExcuteCmd:" $*
AsanFile=$ASAN_DIR/psim.asan AsanFile=$ASAN_DIR/psim.asan
echo "AsanFile:" $AsanFile echo "AsanFile:" $AsanFile
unset LD_PRELOAD
export LD_PRELOAD=libasan.so.5 export LD_PRELOAD=libasan.so.5
$* -a 2> $AsanFile $* -a 2> $AsanFile
export LD_PRELOAD= unset LD_PRELOAD
AsanFileLen=`cat $AsanFile | wc -l` AsanFileLen=`cat $AsanFile | wc -l`
while [ $AsanFileLen -lt 10 ] while [ $AsanFileLen -lt 10 ]
do do