valgrind: fixed ASAN/Valgrind options

Patch for not running tests if ASAN and
Valgrind options are both enabled.

Fixes #2422

Signed-off-by: Kamil Godzwon <kamilx.godzwon@intel.com>
Change-Id: I50c91bede687f0aee571c1f2540530a7fafcb49c
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/11998
Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Konrad Sztyber <konrad.sztyber@intel.com>
Reviewed-by: Karol Latecki <karol.latecki@intel.com>
Community-CI: Mellanox Build Bot
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
This commit is contained in:
Kamil Godzwon 2022-03-21 13:38:24 -04:00 committed by Tomasz Zawadzki
parent a6eafd95d4
commit 492cd95440
2 changed files with 13 additions and 4 deletions

View File

@ -347,10 +347,6 @@ function unittest_build() {
$MAKE $MAKEFLAGS
}
if [ $SPDK_RUN_VALGRIND -eq 1 ]; then
run_test "valgrind" echo "using valgrind"
fi
if [ $SPDK_RUN_ASAN -eq 1 ]; then
run_test "asan" echo "using asan"
fi

View File

@ -137,6 +137,11 @@ function unittest_init() {
$valgrind $testdir/lib/init/subsystem.c/subsystem_ut
}
if [ $SPDK_RUN_VALGRIND -eq 1 ] && [ $SPDK_RUN_ASAN -eq 1 ]; then
echo "ERR: Tests cannot be run if both SPDK_RUN_VALGRIND and SPDK_RUN_ASAN options are selected simultaneously"
exit 1
fi
# if ASAN is enabled, use it. If not use valgrind if installed but allow
# the env variable to override the default shown below.
if [ -z ${valgrind+x} ]; then
@ -146,6 +151,14 @@ if [ -z ${valgrind+x} ]; then
valgrind=''
fi
fi
if [ $SPDK_RUN_VALGRIND -eq 1 ]; then
if [ -n "$valgrind" ]; then
run_test "valgrind" echo "Using valgrind for unit tests"
else
echo "ERR: SPDK_RUN_VALGRIND option is enabled but valgrind is not available"
exit 1
fi
fi
# setup local unit test coverage if cov is available
# lcov takes considerable time to process clang coverage.