[10/15] Add configure option --enable-helgrind

Message ID 20250120032041.280173-10-amerey@redhat.com
State Superseded
Headers
Series [01/15] Add eu_search_tree_init |

Commit Message

Aaron Merey Jan. 20, 2025, 3:20 a.m. UTC
  Like --enable-valgrind but uses helgrind instead of memcheck.  If both
--enable-valgrind and --enable-helgrind are given then helgrind takes
priority.

	* 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>

---
 configure.ac      | 10 ++++++++--
 tests/Makefile.am |  6 +++++-
 2 files changed, 13 insertions(+), 3 deletions(-)
  

Comments

Mark Wielaard Jan. 24, 2025, 2:15 p.m. UTC | #1
Hi Aaron,

On Sun, 2025-01-19 at 22:20 -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.
> 
> 	* 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.

Looks good. Should --enable-helgrind imply --enable-valgrind-
annotations ?

Cheers,

Mark

> Signed-off-by: Aaron Merey <amerey@redhat.com>
> 
> ---
>  configure.ac      | 10 ++++++++--
>  tests/Makefile.am |  6 +++++-
>  2 files changed, 13 insertions(+), 3 deletions(-)
> 
> diff --git a/configure.ac b/configure.ac
> index 1da2a12c..a78cd36f 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]),
> 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
>  
>
  

Patch

diff --git a/configure.ac b/configure.ac
index 1da2a12c..a78cd36f 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]),
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