mirror of
https://github.com/openvswitch/ovs
synced 2025-08-22 09:58:01 +00:00
Add support for running the testsuite under 'valgrind'.
This commit is contained in:
parent
28447a186b
commit
b6fa444705
@ -95,6 +95,54 @@ check-lcov: all tests/atconfig tests/atlocal $(TESTSUITE) $(lcov_wrappers)
|
|||||||
cd tests && genhtml -q -o coverage.html coverage.info; \
|
cd tests && genhtml -q -o coverage.html coverage.info; \
|
||||||
exit $$rc
|
exit $$rc
|
||||||
|
|
||||||
|
# valgrind support
|
||||||
|
|
||||||
|
valgrind_wrappers = \
|
||||||
|
tests/valgrind/ovs-appctl \
|
||||||
|
tests/valgrind/ovs-vsctl \
|
||||||
|
tests/valgrind/ovsdb-client \
|
||||||
|
tests/valgrind/ovsdb-server \
|
||||||
|
tests/valgrind/ovsdb-tool \
|
||||||
|
tests/valgrind/test-aes128 \
|
||||||
|
tests/valgrind/test-classifier \
|
||||||
|
tests/valgrind/test-csum \
|
||||||
|
tests/valgrind/test-dhcp-client \
|
||||||
|
tests/valgrind/test-dir_name \
|
||||||
|
tests/valgrind/test-flows \
|
||||||
|
tests/valgrind/test-hash \
|
||||||
|
tests/valgrind/test-hmap \
|
||||||
|
tests/valgrind/test-json \
|
||||||
|
tests/valgrind/test-jsonrpc \
|
||||||
|
tests/valgrind/test-list \
|
||||||
|
tests/valgrind/test-lockfile \
|
||||||
|
tests/valgrind/test-ovsdb \
|
||||||
|
tests/valgrind/test-reconnect \
|
||||||
|
tests/valgrind/test-sha1 \
|
||||||
|
tests/valgrind/test-stp \
|
||||||
|
tests/valgrind/test-timeval \
|
||||||
|
tests/valgrind/test-type-props \
|
||||||
|
tests/valgrind/test-uuid \
|
||||||
|
tests/valgrind/test-vconn
|
||||||
|
|
||||||
|
$(valgrind_wrappers): tests/valgrind-wrapper.in
|
||||||
|
@test -d tests/valgrind || mkdir tests/valgrind
|
||||||
|
sed -e 's,[@]wrap_program[@],$@,' \
|
||||||
|
$(top_srcdir)/tests/valgrind-wrapper.in > $@.tmp
|
||||||
|
chmod +x $@.tmp
|
||||||
|
mv $@.tmp $@
|
||||||
|
CLEANFILES += $(valgrind_wrappers)
|
||||||
|
EXTRA_DIST += tests/valgrind-wrapper.in
|
||||||
|
|
||||||
|
VALGRIND = valgrind --log-file=valgrind.%p --leak-check=full \
|
||||||
|
--suppressions=$(abs_top_srcdir)/tests/openssl.supp --num-callers=20
|
||||||
|
EXTRA_DIST += tests/openssl.supp
|
||||||
|
check-valgrind: all tests/atconfig tests/atlocal $(TESTSUITE) $(valgrind_wrappers)
|
||||||
|
$(SHELL) '$(TESTSUITE)' -C tests CHECK_VALGRIND=true VALGRIND='$(VALGRIND)' AUTOTEST_PATH='tests/valgrind:$(AUTOTEST_PATH)' -d $(TESTSUITEFLAGS)
|
||||||
|
@echo
|
||||||
|
@echo '----------------------------------------------------------------------'
|
||||||
|
@echo 'Valgrind output can be found in tests/testsuite.dir/*/valgrind.*'
|
||||||
|
@echo '----------------------------------------------------------------------'
|
||||||
|
|
||||||
clean-local:
|
clean-local:
|
||||||
test ! -f '$(TESTSUITE)' || $(SHELL) '$(TESTSUITE)' -C tests --clean
|
test ! -f '$(TESTSUITE)' || $(SHELL) '$(TESTSUITE)' -C tests --clean
|
||||||
|
|
||||||
|
13
tests/openssl.supp
Normal file
13
tests/openssl.supp
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
# suppress OpenSSL errors from valgrind
|
||||||
|
|
||||||
|
{
|
||||||
|
BN_mod_inverse
|
||||||
|
Memcheck:Cond
|
||||||
|
fun:BN_mod_inverse
|
||||||
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
BN_div
|
||||||
|
Memcheck:Cond
|
||||||
|
fun:BN_div
|
||||||
|
}
|
36
tests/valgrind-wrapper.in
Executable file
36
tests/valgrind-wrapper.in
Executable file
@ -0,0 +1,36 @@
|
|||||||
|
#! /bin/sh
|
||||||
|
|
||||||
|
wrap_program=`basename '@wrap_program@'`
|
||||||
|
|
||||||
|
# Strip the first directory from $PATH that contains $wrap_program,
|
||||||
|
# so that below we run the real $wrap_program, not ourselves.
|
||||||
|
not_found=true
|
||||||
|
new_path=
|
||||||
|
first=true
|
||||||
|
save_IFS=$IFS
|
||||||
|
IFS=:
|
||||||
|
for dir in $PATH; do
|
||||||
|
IFS=$save_IFS
|
||||||
|
if $not_found && test -x "$dir/$wrap_program"; then
|
||||||
|
not_found=false
|
||||||
|
else
|
||||||
|
if $first; then
|
||||||
|
first=false
|
||||||
|
new_path=$dir
|
||||||
|
else
|
||||||
|
new_path=$new_path:$dir
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
IFS=$save_IFS
|
||||||
|
if $not_found; then
|
||||||
|
echo "$0: error: cannot find $wrap_program in \$PATH" >&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
PATH=$new_path
|
||||||
|
export PATH
|
||||||
|
|
||||||
|
: ${VALGRIND:=valgrind -q --log-file=valgrind.%p --leak-check=full}
|
||||||
|
exec $VALGRIND $wrap_program "$@"
|
||||||
|
echo "$0: failed to execute $VALGRIND $wrap_program" "$@" >&2
|
||||||
|
exit 1
|
Loading…
x
Reference in New Issue
Block a user