[PATCH 05/10 v2] Add configure option --enable-helgrind
Mark Wielaard
mark@klomp.org
Wed Feb 12 13:31:12 GMT 2025
Hi Aaron,
On Tue, 2025-02-04 at 16:50 -0500, Aaron Merey wrote:
> Like --enable-valgrind but uses helgrind instead of memcheck.
>
> If both --enable-valgrind and --enable-helgrind are given then
> helgrind takes priority.
>
> --enable-helgrind requires --enable-valgrind-annotations.
>
> * configure.ac: Add --enable-helgrind option.
> * tests/Makefile.am: If USE_HELGRIND is true, then include
> --tool=helgrind in the valgrind command that tests are run
> under.
>
> Signed-off-by: Aaron Merey <amerey@redhat.com>
> ---
> v2 changes: Enabing helgrind now requires enabling annotations
This looks good. It will clash with your recent --track-fds=yes
changes. But that should be easy to resolve (--track-fds works with
both memcheck and helgrind, so you can simply add it to both
valgrind_cmd assignments.
Thanks,
Mark
> configure.ac | 16 ++++++++++++++--
> tests/Makefile.am | 6 +++++-
> 2 files changed, 19 insertions(+), 3 deletions(-)
>
> diff --git a/configure.ac b/configure.ac
> index e57d3927..bb1788d4 100644
> --- a/configure.ac
> +++ b/configure.ac
> @@ -363,10 +363,15 @@ if test "$use_address" = yes; then
> fi
> AM_CONDITIONAL(USE_ADDRESS_SANITIZER, test "$use_address" = yes)
>
> +AC_ARG_ENABLE([helgrind],
> +AS_HELP_STRING([--enable-helgrind],[run all tests under the valgrind tool helgrind]),
> +[use_helgrind=$enableval], [use_helgrind=no])
> +
> AC_ARG_ENABLE([valgrind],
> AS_HELP_STRING([--enable-valgrind],[run all tests under valgrind]),
> [use_valgrind=$enableval], [use_valgrind=no])
> -if test "$use_valgrind" = yes; then
> +if test "$use_valgrind" = yes -o "$use_helgrind" = yes; then
> +
> if test "$use_address" = yes; then
> AC_MSG_ERROR([cannot enable valgrind and sanitize address together])
> fi
> @@ -375,7 +380,8 @@ if test "$use_valgrind" = yes; then
> AC_MSG_ERROR([valgrind not found])
> fi
> fi
> -AM_CONDITIONAL(USE_VALGRIND, test "$use_valgrind" = yes)
> +AM_CONDITIONAL(USE_VALGRIND, test "$use_valgrind" = yes -o "$use_helgrind" = yes)
> +AM_CONDITIONAL(USE_HELGRIND, test "$use_helgrind" = yes)
>
> AC_ARG_WITH([valgrind],
> AS_HELP_STRING([--with-valgrind],[include directory for Valgrind headers]),
> @@ -394,6 +400,12 @@ fi
> AC_ARG_ENABLE([valgrind-annotations],
> AS_HELP_STRING([--enable-valgrind-annotations],[insert extra annotations for better valgrind support]),
> [use_vg_annotations=$enableval], [use_vg_annotations=no])
> +
> +# Helgrind requires Valgrind annotations.
> +if test "$use_vg_annotations" = no -a "$use_helgrind" = yes; then
> + AC_MSG_ERROR(["--enable-helgrind requires --enable-valgrind-annotations"])
> +fi
> +
> if test "$use_vg_annotations" = yes; then
> if test "x$HAVE_VALGRIND_HEADERS" != "xyes"; then
> AC_MSG_CHECKING([whether Valgrind headers are available])
> diff --git a/tests/Makefile.am b/tests/Makefile.am
> index 8f087798..e4fe72f0 100644
> --- a/tests/Makefile.am
> +++ b/tests/Makefile.am
> @@ -691,8 +691,12 @@ EXTRA_DIST = run-arextract.sh run-arsymtest.sh run-ar.sh \
> testfile-sysroot.tar.bz2 run-sysroot.sh run-debuginfod-seekable.sh
>
>
> +if USE_HELGRIND
> +valgrind_cmd=valgrind -q --tool=helgrind --error-exitcode=1
> +else
> if USE_VALGRIND
> -valgrind_cmd=valgrind -q --leak-check=full --error-exitcode=1
> +valgrind_cmd=valgrind -q --leak-check=full --error-exitcode=1
> +endif
> endif
>
>
More information about the Elfutils-devel
mailing list