Skip to content

Commit

Permalink
Do not exclude all sh tests when running under Valgrind Memcheck (Rob…
Browse files Browse the repository at this point in the history
  • Loading branch information
jamiesnape authored Jun 26, 2019
1 parent 0c37f47 commit ca52cf1
Show file tree
Hide file tree
Showing 20 changed files with 186 additions and 55 deletions.
2 changes: 2 additions & 0 deletions automotive/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -942,6 +942,8 @@ sh_test(
"--dry-run",
],
data = [":demo"],
# Valgrind Memcheck reports numerous leaks in the python executable.
tags = ["no_memcheck"],
)

add_lint_tests()
2 changes: 2 additions & 0 deletions bindings/pydrake/attic/systems/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ load(
"drake_py_unittest",
)
load("//bindings/pydrake:pydrake.bzl", "add_lint_tests_pydrake")
load("//tools/skylark:test_tags.bzl", "vtk_test_tags")

package(default_visibility = [
"//bindings/pydrake:__subpackages__",
Expand Down Expand Up @@ -102,6 +103,7 @@ drake_py_unittest(
data = [
"//systems/sensors:test_models",
],
tags = vtk_test_tags(),
deps = [
":sensors_py",
"//bindings/pydrake/systems:sensors_py",
Expand Down
2 changes: 2 additions & 0 deletions bindings/pydrake/systems/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ load(
"drake_py_unittest",
)
load("//bindings/pydrake:pydrake.bzl", "add_lint_tests_pydrake")
load("//tools/skylark:test_tags.bzl", "vtk_test_tags")

package(default_visibility = [
"//bindings/pydrake:__subpackages__",
Expand Down Expand Up @@ -483,6 +484,7 @@ drake_py_unittest(
data = [
"//systems/sensors:test_models",
],
tags = vtk_test_tags(),
deps = [":sensors_py"],
)

Expand Down
2 changes: 2 additions & 0 deletions common/test/drake_assert_test_compile_variants.sh
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#!/bin/bash

# This test should only be invoked via Bazel.
set -ex

Expand Down
6 changes: 4 additions & 2 deletions common/test_utilities/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -150,8 +150,8 @@ drake_cc_googletest(
],
)

# N.B. All sh_tests are excluded from dynamic_analysis (sanitizer and memcheck)
# build by default; these death tests are skipped under those configurations.
# N.B. All sh_tests are excluded from sanitizer builds by default; these death
# tests are therefore skipped under those configurations.
sh_test(
name = "limit_malloc_death_test",
srcs = [":limit_malloc_test"],
Expand All @@ -168,6 +168,8 @@ sh_test(
data = [
":limit_malloc_test",
],
# Fails to terminate when run under Valgrind Memcheck.
tags = ["no_memcheck"],
)

drake_cc_googletest(
Expand Down
7 changes: 5 additions & 2 deletions examples/schunk_wsg/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,11 @@ drake_cc_googletest(
# This test is prohibitively slow with --compilation_mode=dbg.
disable_in_compilation_mode_dbg = True,
# TODO(betsymcphail): Re-enable this test when it no longer
# causes timeouts in kcov.
tags = ["no_kcov"],
# causes timeouts in kcov and Valgrind Memcheck.
tags = [
"no_kcov",
"no_memcheck",
],
deps = [
"//attic/multibody:rigid_body_tree",
"//attic/multibody:rigid_body_tree_construction",
Expand Down
11 changes: 2 additions & 9 deletions geometry/dev/render/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ load(
"drake_cc_package_library",
)
load("//tools/lint:lint.bzl", "add_lint_tests")
load("//tools/skylark:test_tags.bzl", "vtk_test_tags")

package(default_visibility = ["//visibility:public"])

Expand Down Expand Up @@ -89,15 +90,7 @@ drake_cc_googletest(
data = [
"//systems/sensors:test_models",
],
# Mitigates driver-related issues when running under `bazel test`. For more
# information, see #7004.
local = 1,
# Disable under LeakSanitizer and Valgrind Memcheck due to driver-related
# leaks. For more information, see #7520.
tags = [
"no_lsan",
"no_memcheck",
],
tags = vtk_test_tags(),
deps = [
":render_engine_vtk",
"//common:find_resource",
Expand Down
14 changes: 2 additions & 12 deletions geometry/render/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ load(
"drake_cc_package_library",
)
load("//tools/lint:lint.bzl", "add_lint_tests")
load("//tools/skylark:test_tags.bzl", "vtk_test_tags")

package(default_visibility = ["//visibility:public"])

Expand Down Expand Up @@ -113,18 +114,7 @@ drake_cc_googletest(
data = [
"//systems/sensors:test_models",
],
# Mitigates driver-related issues when running under `bazel test`. For more
# information, see #7004.
local = 1,
tags = [
# Disable under LeakSanitizer and Valgrind Memcheck due to
# driver-related leaks. For more information, see #7520.
"no_lsan",
"no_memcheck",
# Mitigates driver-related issues when running under `bazel test`. For
# more information, see #7004.
"no-sandbox",
],
tags = vtk_test_tags(),
deps = [
":render_engine_vtk",
"//common:find_resource",
Expand Down
14 changes: 0 additions & 14 deletions multibody/parsing/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -193,13 +193,6 @@ drake_cc_googletest(
":test_models",
"//multibody/benchmarks/acrobot:models",
],
# TODO(sam.creasey) Write a printer function (or another
# workaround) for ModelLoadFunction so that gtest won't trigger
# memcheck. Related to
# https://github.com/google/googletest/issues/1610
tags = [
"no_memcheck",
],
deps = [
":test_loaders",
"//common/test_utilities",
Expand All @@ -213,13 +206,6 @@ drake_cc_googletest(
data = [
":test_models",
],
# TODO(sam.creasey) Write a printer function (or another
# workaround) for ModelLoadFunction so that gtest won't trigger
# memcheck. Related to
# https://github.com/google/googletest/issues/1610
tags = [
"no_memcheck",
],
deps = [
":test_loaders",
"//common/test_utilities",
Expand Down
1 change: 1 addition & 0 deletions setup/ubuntu/source_distribution/packages-bionic.txt
Original file line number Diff line number Diff line change
Expand Up @@ -63,5 +63,6 @@ python3-sphinx-rtd-theme
ruby
unzip
valgrind
valgrind-dbg
zip
zlib1g-dev
1 change: 1 addition & 0 deletions setup/ubuntu/source_distribution/packages-xenial.txt
Original file line number Diff line number Diff line change
Expand Up @@ -56,5 +56,6 @@ python-sphinx-rtd-theme
ruby
unzip
valgrind
valgrind-dbg
zip
zlib1g-dev
2 changes: 0 additions & 2 deletions solvers/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -1429,8 +1429,6 @@ drake_cc_googletest(
tags = gurobi_test_tags() + mosek_test_tags() + [
# Excluding asan because it is unreasonably slow (> 30 minutes).
"no_asan",
# Takes too long to run with Valgrind.
"no_memcheck",
# Excluding tsan because an assertion fails in LLVM code. Issue #6179.
"no_tsan",
],
Expand Down
1 change: 0 additions & 1 deletion systems/lcm/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,6 @@ drake_cc_googletest(
flaky = 1,
tags = [
"no_asan",
"no_memcheck",
"no_tsan",
"requires-network",
],
Expand Down
10 changes: 0 additions & 10 deletions systems/sensors/dev/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,6 @@ load("//tools/lint:lint.bzl", "add_lint_tests")

package(default_visibility = ["//visibility:public"])

vtk_test_tags = [
# Disable under LeakSanitizer and Valgrind Memcheck due to
# driver-related leaks. For more information, see #7520.
"no_lsan",
"no_memcheck",
# Mitigates driver-related issues when running under `bazel test`. For
# more information, see #7004.
"no-sandbox",
]

drake_cc_package_library(
name = "dev",
deps = [
Expand Down
5 changes: 3 additions & 2 deletions tools/dynamic_analysis/bazel.rc
Original file line number Diff line number Diff line change
Expand Up @@ -208,11 +208,12 @@ build:memcheck --copt -g
# https://sourceforge.net/p/valgrind/mailman/valgrind-developers/?viewmonth=201806&viewday=11&style=flat
build:memcheck --copt -O2
build:memcheck --run_under=//tools/dynamic_analysis:valgrind
build:memcheck --test_tag_filters=-gurobi,-mosek,-snopt,-no_memcheck
build:memcheck --test_lang_filters=-sh,-py
build:memcheck --test_lang_filters=-py
build:memcheck --test_tag_filters=-gurobi,-mosek,-snopt,-lint,-no_memcheck
# Slowdown factor can range from 5-100.
# See http://valgrind.org/info/about.html
build:memcheck --test_timeout=1500,7500,22500,90000 # 25x
test:memcheck --test_env=VALGRIND_OPTS

### Memcheck everything build. ###
build:memcheck_everything --build_tests_only
Expand Down
5 changes: 5 additions & 0 deletions tools/dynamic_analysis/valgrind.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,15 @@ export G_SLICE=always-malloc
export GTEST_DEATH_TEST_USE_FORK=1

valgrind \
--tool=memcheck \
--gen-suppressions=all \
--leak-check=full \
--suppressions="$mydir/valgrind.supp" \
--suppressions=/usr/lib/valgrind/debian.supp \
--suppressions=/usr/lib/valgrind/python.supp \
--error-exitcode=1 \
--trace-children=yes \
--trace-children-skip=/bin/cat,/bin/cp,/bin/mkdir,/bin/sed,/usr/bin/clang,/usr/bin/clang-6.0,/usr/bin/clang-format-6.0,/usr/bin/find,/usr/bin/gcc \
--track-origins=yes \
--show-leak-kinds=definite,possible \
--num-callers=16 \
Expand Down
145 changes: 145 additions & 0 deletions tools/dynamic_analysis/valgrind.supp
Original file line number Diff line number Diff line change
Expand Up @@ -399,3 +399,148 @@
fun:dmumps_c
fun:_ZN5Ipopt20MumpsSolverInterfaceC1Ev
}

{
bash: definite leak in set_default_locale
Memcheck:Leak
match-leak-kinds: definite
fun:malloc
fun:xmalloc
fun:set_default_locale
fun:main
}

{
bash: definite leak in reader_loop
Memcheck:Leak
match-leak-kinds: definite
fun:malloc
fun:xmalloc
...
fun:reader_loop
fun:main
}

# TODO(sam.creasey) Write a printer function (or another workaround) for
# drake::multibody::test::ModelLoadFunction so that gtest won't trigger
# memcheck. Related to https://github.com/google/googletest/issues/1610.
{
googletest: conditional jump or move depends on uninitialised value in PrintValue
Memcheck:Cond
...
fun:vfprintf
fun:vsnprintf
fun:snprintf
fun:*PrintByteSegmentInObjectTo*
fun:PrintBytesInObjectToImpl
fun:*PrintBytesInObjectTo*
fun:PrintValue
}

{
googletest: use of uninitialized value of size 8 in PrintValue
Memcheck:Value8
...
fun:vfprintf
fun:vsnprintf
fun:snprintf
fun:*PrintByteSegmentInObjectTo*
fun:PrintBytesInObjectToImpl
fun:*PrintBytesInObjectTo*
fun:PrintValue
}

{
nvidia-glcore: conditional jump or move depends on uninitialized value
Memcheck:Cond
...
obj:/usr/lib/x86_64-linux-gnu/libnvidia-glcore.so.*
}

{
python: invalid read of size 4 in PyObject_Free
Memcheck:Addr4
...
fun:PyObject_Free
}

{
python: invalid read of size 4 in PyObject_Free
Memcheck:Value4
...
fun:PyObject_Free
}

{
python: use of uninitialized value of size 8 in PyObject_Free
Memcheck:Addr8
...
fun:PyObject_Free
}

{
python: use of uninitialized value of size 8 in PyObject_Free
Memcheck:Value8
...
fun:PyObject_Free
}

{
python: conditional jump or move depends on uninitialized value in PyObject_Free
Memcheck:Cond
...
fun:PyObject_Free
}

{
python: invalid read of size 4 in PyObject_Realloc
Memcheck:Addr4
...
fun:PyObject_Realloc
}

{
python: invalid read of size 4 in PyObject_Realloc
Memcheck:Value4
...
fun:PyObject_Realloc
}

{
python: use of uninitialized value of size 8 in PyObject_Realloc
Memcheck:Addr8
...
fun:PyObject_Realloc
}

{
python: use of uninitialized value of size 8 in PyObject_Realloc
Memcheck:Value8
...
fun:PyObject_Realloc
}

{
python: conditional jump or move depends on uninitialized value in PyObject_Realloc
Memcheck:Cond
...
fun:PyObject_Realloc
}

{
swrast: conditional jump or move depends on uninitialized value in clone
Memcheck:Cond
...
obj:/usr/lib/x86_64-linux-gnu/dri/swrast_dri.so
fun:start_thread
fun:clone
}

{
swrast: use of uninitialized value of size 8 in clone
Memcheck:Value8
...
obj:/usr/lib/x86_64-linux-gnu/dri/swrast_dri.so
fun:start_thread
fun:clone
}
2 changes: 2 additions & 0 deletions tools/lint/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,8 @@ sh_test(
data = [
":clang-format-includes",
],
# Valgrind Memcheck reports numerous leaks in the python executable.
tags = ["no_memcheck"],
)

# Exercise `ignore` for `python_lint`.
Expand Down
Loading

0 comments on commit ca52cf1

Please sign in to comment.