From 7760f466c46e64e4f0878a4171c369ad4cd2a280 Mon Sep 17 00:00:00 2001 From: liuyq-617 Date: Thu, 29 Oct 2020 10:57:42 +0800 Subject: [PATCH] [TD-1836]add crash_gen valgrind case --- Jenkinsfile | 7 ++++++ tests/pytest/handle_crash_gen_val_log.sh | 32 ++++++++++++++++++++++++ 2 files changed, 39 insertions(+) create mode 100755 tests/pytest/handle_crash_gen_val_log.sh diff --git a/Jenkinsfile b/Jenkinsfile index 3968451d87..7895d9d2a1 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -86,6 +86,13 @@ pipeline { ./crash_gen.sh -a -p -t 4 -s 2000 ''' } + catchError(buildResult: 'SUCCESS', stageResult: 'FAILURE') { + sh ''' + cd ${WKC}/tests/pytest + ./crash_gen.sh --valgrind -p -t 10 -s 100 -b 4 + ./handle_crash_gen_val_log.sh + ''' + } sh ''' date cd ${WKC}/tests diff --git a/tests/pytest/handle_crash_gen_val_log.sh b/tests/pytest/handle_crash_gen_val_log.sh new file mode 100755 index 0000000000..1a4c12a16c --- /dev/null +++ b/tests/pytest/handle_crash_gen_val_log.sh @@ -0,0 +1,32 @@ +#!/bin/bash +# Color setting +RED='\033[0;31m' +GREEN='\033[1;32m' +GREEN_DARK='\033[0;32m' +GREEN_UNDERLINE='\033[4;32m' +NC='\033[0m' + +grep 'start to execute\|ERROR SUMMARY' valgrind.err|grep -v 'grep'|uniq|tee crash_gen_mem_err.log + +for memError in `grep 'ERROR SUMMARY' crash_gen_mem_err.log | awk '{print $4}'` +do +if [ -n "$memError" ]; then + if [ "$memError" -gt 12 ]; then + echo -e "${RED} ## Memory errors number valgrind reports is $memError.\ + More than our threshold! ## ${NC}" + fi +fi +done + +grep 'start to execute\|definitely lost:' valgrind.err|grep -v 'grep'|uniq|tee crash_gen-definitely-lost-out.log +for defiMemError in `grep 'definitely lost:' crash_gen-definitely-lost-out.log | awk '{print $7}'` +do + +if [ -n "$defiMemError" ]; then + if [ "$defiMemError" -gt 3 ]; then + echo -e "${RED} ## Memory errors number valgrind reports \ + Definitely lost is $defiMemError. More than our threshold! ## ${NC}" + exit 8 + fi +fi +done \ No newline at end of file -- GitLab