Skip to content

Commit

Permalink
lib: Fix mempool unit tests to pass with 32bit OSes
Browse files Browse the repository at this point in the history
malloc(SSIZE_T_MAX) actually succeeds there, so we can't test it.
  • Loading branch information
sirainen committed Nov 28, 2017
1 parent 08259c1 commit c8d80ba
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/lib/test-mempool-allocfree.c
Expand Up @@ -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:
Expand Down
2 changes: 2 additions & 0 deletions src/lib/test-mempool-alloconly.c
Expand Up @@ -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:
Expand Down

0 comments on commit c8d80ba

Please sign in to comment.