diff options
author | Jussi Kivilinna <jussi.kivilinna@iki.fi> | 2021-01-31 17:28:59 +0200 |
---|---|---|
committer | Jussi Kivilinna <jussi.kivilinna@iki.fi> | 2021-02-03 18:30:03 +0200 |
commit | f46a6bd9b3d7ef7d1a72c5b6da5cf34ace2ff156 (patch) | |
tree | f0e5aa64d2b87ccb800b640de91792676f9861f5 | |
parent | 8716e4b2ada21456802aee67c2bc8edfec78f820 (diff) | |
download | libgcrypt-f46a6bd9b3d7ef7d1a72c5b6da5cf34ace2ff156.tar.gz |
tests: allow running 'make check' with ASAN
* tests/t-secmem.c (main): Skip test if environment variable
GCRYPT_IN_ASAN_TEST is defined.
* tests/t-sexp.c (main): Do not initialize secmem if environment
variable GCRYPT_IN_ASAN_TEST is defined.
--
ASAN and mlock are incompatible, so add GCRYPT_IN_ASAN_TEST
environment variant for skipping tests failing as result.
This allows easier automation of ASAN checks.
Signed-off-by: Jussi Kivilinna <jussi.kivilinna@iki.fi>
-rw-r--r-- | tests/t-secmem.c | 8 | ||||
-rw-r--r-- | tests/t-sexp.c | 9 |
2 files changed, 16 insertions, 1 deletions
diff --git a/tests/t-secmem.c b/tests/t-secmem.c index c4d8c66d..2b769134 100644 --- a/tests/t-secmem.c +++ b/tests/t-secmem.c @@ -120,6 +120,14 @@ main (int argc, char **argv) long int pgsize_val = -1; size_t pgsize; + if (getenv ("GCRYPT_IN_ASAN_TEST")) + { + /* 'mlock' is not available when build with address sanitizer, + * so skip test. */ + fputs ("Note: " PGM " skipped because running with ASAN.\n", stdout); + return 0; + } + #if HAVE_MMAP # if defined(HAVE_SYSCONF) && defined(_SC_PAGESIZE) pgsize_val = sysconf (_SC_PAGESIZE); diff --git a/tests/t-sexp.c b/tests/t-sexp.c index 4285ffd8..96d5f97e 100644 --- a/tests/t-sexp.c +++ b/tests/t-sexp.c @@ -1312,7 +1312,14 @@ main (int argc, char **argv) if (debug) xgcry_control ((GCRYCTL_SET_DEBUG_FLAGS, 1u, 0)); xgcry_control ((GCRYCTL_DISABLE_SECMEM_WARN)); - xgcry_control ((GCRYCTL_INIT_SECMEM, 16384, 0)); + if (getenv ("GCRYPT_IN_ASAN_TEST")) + { + fputs ("Note: " PGM " not using secmem as running with ASAN.\n", stdout); + } + else + { + xgcry_control ((GCRYCTL_INIT_SECMEM, 16384, 0)); + } if (!gcry_check_version (GCRYPT_VERSION)) die ("version mismatch"); /* #include "../src/gcrypt-int.h" indicates that internal interfaces |