summaryrefslogtreecommitdiff
path: root/tests/buf/oom.c
diff options
context:
space:
mode:
authorPatrick Steinhardt <ps@pks.im>2018-10-26 14:54:25 +0200
committerGitHub <noreply@github.com>2018-10-26 14:54:25 +0200
commit32dc763c116999240440b5054798208d97b4c562 (patch)
tree8348a99862938d5d4ced1b8540c7674522489c1b /tests/buf/oom.c
parent2bd9b6b67706c8cb84d367f699cc9c48c2719dff (diff)
parent3b6e006e38ab0c41968f4135104162861fa3f984 (diff)
downloadlibgit2-maint/v0.26.tar.gz
Merge pull request #4865 from pks-t/pks/v0.26.8v0.26.8maint/v0.26
Release v0.26.8
Diffstat (limited to 'tests/buf/oom.c')
-rw-r--r--tests/buf/oom.c18
1 files changed, 15 insertions, 3 deletions
diff --git a/tests/buf/oom.c b/tests/buf/oom.c
index b9fd29cbb..16a03cc1a 100644
--- a/tests/buf/oom.c
+++ b/tests/buf/oom.c
@@ -1,10 +1,22 @@
#include "clar_libgit2.h"
#include "buffer.h"
-#if defined(GIT_ARCH_64)
-#define TOOBIG 0xffffffffffffff00
+/*
+ * We want to use some ridiculous size that `malloc` will fail with
+ * but that does not otherwise interfere with testing. On Linux, choose
+ * a number that is large enough to fail immediately but small enough
+ * that valgrind doesn't believe it to erroneously be a negative number.
+ * On macOS, choose a number that is large enough to fail immediately
+ * without having libc print warnings to stderr.
+ */
+#if defined(GIT_ARCH_64) && defined(__linux__)
+# define TOOBIG 0x0fffffffffffffff
+#elif defined(__linux__)
+# define TOOBIG 0x0fffffff
+#elif defined(GIT_ARCH_64)
+# define TOOBIG 0xffffffffffffff00
#else
-#define TOOBIG 0xffffff00
+# define TOOBIG 0xffffff00
#endif
/**