提交 3d22af62 编写于 作者: N Nikos Armenatzoglou

Fix broken zlib unittests

上级 c32cf0e6
......@@ -80,11 +80,13 @@ test__bfz_zlib_init__palloc_write(void **state)
bfz.mode = BFZ_MODE_APPEND;
bfz.fd = -1;
Size beforeAlloc = MemoryContextGetPeakSpace(TopMemoryContext);
Size beforeAlloc = MemoryContextGetPeakSpace(TopTransactionContext);
assert_true(TopTransactionContext != CurrentMemoryContext);
bfz_zlib_init(&bfz);
Size afterAlloc = MemoryContextGetPeakSpace(TopMemoryContext);
Size afterAlloc = MemoryContextGetPeakSpace(TopTransactionContext);
assert_true(TopTransactionContext != CurrentMemoryContext);
int memZlib = zlib_memory_needed(true /* isWrite */);
......@@ -100,11 +102,13 @@ test__bfz_zlib_init__palloc_read(void **state)
bfz.mode = BFZ_MODE_SCAN;
bfz.fd = -1;
Size beforeAlloc = MemoryContextGetPeakSpace(TopMemoryContext);
Size beforeAlloc = MemoryContextGetPeakSpace(TopTransactionContext);
assert_true(TopTransactionContext != CurrentMemoryContext);
bfz_zlib_init(&bfz);
Size afterAlloc = MemoryContextGetPeakSpace(TopMemoryContext);
Size afterAlloc = MemoryContextGetPeakSpace(TopTransactionContext);
assert_true(TopTransactionContext != CurrentMemoryContext);
int memZlib = zlib_memory_needed(false /* isWrite */);
......@@ -116,6 +120,13 @@ main(int argc, char* argv[])
{
cmockery_parse_arguments(argc, argv);
TopTransactionContext =
AllocSetContextCreate(TopMemoryContext,
"TopTransactionContext",
ALLOCSET_DEFAULT_MINSIZE,
ALLOCSET_DEFAULT_INITSIZE,
ALLOCSET_DEFAULT_MAXSIZE);
const UnitTest tests[] = {
unit_test(test__bfz_zlib_init__palloc_write),
unit_test(test__bfz_zlib_init__palloc_read)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册