From: Timo Sirainen Date: Tue, 28 Nov 2017 14:07:12 +0000 (+0200) Subject: lib: Fix mempool unit tests to pass with 32bit OSes X-Git-Tag: 2.3.0.rc1~311 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c8d80ba718487eff6b69b1adcf576b5265d2cf82;p=thirdparty%2Fdovecot%2Fcore.git lib: Fix mempool unit tests to pass with 32bit OSes malloc(SSIZE_T_MAX) actually succeeds there, so we can't test it. --- diff --git a/src/lib/test-mempool-allocfree.c b/src/lib/test-mempool-allocfree.c index 856c18418b..1d0ba84857 100644 --- a/src/lib/test-mempool-allocfree.c +++ b/src/lib/test-mempool-allocfree.c @@ -114,10 +114,12 @@ enum fatal_test_state fatal_mempool_allocfree(unsigned int stage) (void)p_malloc(pool, SSIZE_T_MAX + 1ULL); return FATAL_TEST_FAILURE; +#if SSIZE_T_MAX > 2147483648 /* malloc(SSIZE_T_MAX) may succeed with 32bit */ case 2: /* physically impossible size */ test_expect_fatal_string("Out of memory"); (void)p_malloc(pool, SSIZE_T_MAX - 1024); return FATAL_TEST_FAILURE; +#endif /* Continue with other tests as follows: case 3: diff --git a/src/lib/test-mempool-alloconly.c b/src/lib/test-mempool-alloconly.c index d77f2435a4..2320e53d89 100644 --- a/src/lib/test-mempool-alloconly.c +++ b/src/lib/test-mempool-alloconly.c @@ -73,10 +73,12 @@ enum fatal_test_state fatal_mempool_alloconly(unsigned int stage) (void)p_malloc(pool, SSIZE_T_MAX + 1ULL); return FATAL_TEST_FAILURE; +#if SSIZE_T_MAX > 2147483648 /* malloc(SSIZE_T_MAX) may succeed with 32bit */ case 2: /* physically impossible size */ test_expect_fatal_string("Out of memory"); (void)p_malloc(pool, SSIZE_T_MAX - 1024); return FATAL_TEST_FAILURE; +#endif /* Continue with other tests as follows: case 3: