]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
lib: Fix mempool unit tests to pass with 32bit OSes
authorTimo Sirainen <timo.sirainen@dovecot.fi>
Tue, 28 Nov 2017 14:07:12 +0000 (16:07 +0200)
committerTimo Sirainen <timo.sirainen@dovecot.fi>
Tue, 28 Nov 2017 15:48:14 +0000 (17:48 +0200)
malloc(SSIZE_T_MAX) actually succeeds there, so we can't test it.

src/lib/test-mempool-allocfree.c
src/lib/test-mempool-alloconly.c

index 856c18418b39a899f892dcd55b90176ab6ab146b..1d0ba8485711dc464ad7b3a3f52841dfbfe4c34a 100644 (file)
@@ -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:
index d77f2435a4b75e5285a415c8df4d239ebccf4fb8..2320e53d89b919272bf97a9a003db30fae76dcdb 100644 (file)
@@ -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: