From aab7037de426729ad582e7b2c9e67c943e17a540 Mon Sep 17 00:00:00 2001 From: Evgeny Vereshchagin Date: Wed, 10 May 2017 08:47:39 +0000 Subject: [PATCH 1/2] test-sigbus: use posix_fallocate rather than fallocate Some filesystems do not support fallocate, so we need to fall back on something like posix_fallocate. Closes #5833 --- src/test/test-sigbus.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/test/test-sigbus.c b/src/test/test-sigbus.c index 02b8e243086..2c8fc1c589b 100644 --- a/src/test/test-sigbus.c +++ b/src/test/test-sigbus.c @@ -38,7 +38,7 @@ int main(int argc, char *argv[]) { assert_se((fd = mkostemp(template, O_RDWR|O_CREAT|O_EXCL)) >= 0); assert_se(unlink(template) >= 0); - assert_se(fallocate(fd, 0, 0, page_size() * 8) >= 0); + assert_se(posix_fallocate(fd, 0, page_size() * 8) >= 0); p = mmap(NULL, page_size() * 16, PROT_READ|PROT_WRITE, MAP_SHARED, fd, 0); assert_se(p != MAP_FAILED); From af02b15a9ddfbfc88f9927e38436bc93d7f888aa Mon Sep 17 00:00:00 2001 From: Evgeny Vereshchagin Date: Wed, 10 May 2017 08:54:52 +0000 Subject: [PATCH 2/2] test-sigbus: skip the test under valgrind --- src/test/test-sigbus.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/test/test-sigbus.c b/src/test/test-sigbus.c index 2c8fc1c589b..7a4a8a6636c 100644 --- a/src/test/test-sigbus.c +++ b/src/test/test-sigbus.c @@ -22,6 +22,9 @@ #include "fd-util.h" #include "sigbus.h" #include "util.h" +#ifdef HAVE_VALGRIND_VALGRIND_H +#include +#endif int main(int argc, char *argv[]) { _cleanup_close_ int fd = -1; @@ -29,6 +32,11 @@ int main(int argc, char *argv[]) { void *addr = NULL; uint8_t *p; +#ifdef HAVE_VALGRIND_VALGRIND_H + if (RUNNING_ON_VALGRIND) + return EXIT_TEST_SKIP; +#endif + #ifdef __SANITIZE_ADDRESS__ return EXIT_TEST_SKIP; #endif