diff options
| author | Dirk-Jan C. Binnema <djcb@djcbsoftware.nl> | 2025-05-24 19:18:10 +0300 |
|---|---|---|
| committer | Dirk-Jan C. Binnema <djcb@djcbsoftware.nl> | 2025-05-24 19:18:10 +0300 |
| commit | 452969355c19cfe5d90cee5d2507ed6d53b11a0c (patch) | |
| tree | db3c10e2602f8cd364ccd8e5145c6f7a1b3223bc /lib | |
| parent | 782e6cbe05f78ff95d86897b47aaec7a4f9fabaf (diff) | |
mu-test: add valgrind check
Make it a bit easier to skip some tests when running under valgrind.
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/utils/mu-test-utils.cc | 7 | ||||
| -rw-r--r-- | lib/utils/mu-test-utils.hh | 17 |
2 files changed, 24 insertions, 0 deletions
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 |
