diff options
| -rw-r--r-- | Makefile | 2 | ||||
| -rw-r--r-- | lib/utils/mu-test-utils.cc | 7 | ||||
| -rw-r--r-- | lib/utils/mu-test-utils.hh | 17 |
3 files changed, 26 insertions, 0 deletions
@@ -93,6 +93,7 @@ $(BUILDDIR_VALGRIND): vg_opts:=--enable-debuginfod=no --leak-check=full --error-exitcode=1 test-valgrind: export G_SLICE=always-malloc test-valgrind: export G_DEBUG=gc-friendly +test-valgrind: export MU_VALGRIND=memcheck test-valgrind: build-valgrind @$(MESON) test -C $(BUILDDIR_VALGRIND) \ --wrap="$(VALGRIND) $(vg_opts)" \ @@ -102,6 +103,7 @@ check-valgrind: test-valgrind # we do _not_ pass helgrind; but this seems to be a false-alarm # https://gitlab.gnome.org/GNOME/glib/-/issues/2662 +test-helgrind: export MU_VALGRIND=helgrind test-helgrind: $(BUILDDIR_VALGRIND) $(MESON) -C $(BUILDDIR_VALGRIND) test \ --wrap="$(VALGRIND) --tool=helgrind --error-exitcode=1" \ diff --git a/lib/utils/mu-test-utils.cc b/lib/utils/mu-test-utils.cc index 0d4a149..0a25859 100644 --- a/lib/utils/mu-test-utils.cc +++ b/lib/utils/mu-test-utils.cc @@ -42,6 +42,13 @@ Mu::mu_test_mu_hacker() { return !!g_getenv("MU_HACKER"); } + +bool +Mu::mu_test_mu_valgrind() +{ + return !!g_getenv("MU_VALGRIND"); +} + /* LCOV_EXCL_STOP*/ diff --git a/lib/utils/mu-test-utils.hh b/lib/utils/mu-test-utils.hh index 051230a..f6f5e78 100644 --- a/lib/utils/mu-test-utils.hh +++ b/lib/utils/mu-test-utils.hh @@ -44,6 +44,23 @@ void mu_test_init(int *argc, char ***argv); bool mu_test_mu_hacker(); /** + * Are we running under Valgrind? + * + * @return true or false + */ +bool mu_test_mu_valgrind(); + +/** + * Skip test when running under valgrind + */ +#define mu_test_skip_valgrind_return() do { \ + if (mu_test_mu_valgrind()) { \ + g_test_skip("skip (valgrind not supported)"); \ + return; \ + } \ + } while(0) + +/** * set the timezone * * @param tz timezone |
