Skip to content

Commit e325a5a

Browse files
authored
fix: update shared_heap_test to use os_getpagesize for memory size calculations (#4852)
1 parent 968fbbb commit e325a5a

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

tests/unit/shared-heap/shared_heap_test.cc

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -262,7 +262,7 @@ TEST_F(shared_heap_test, test_preallocated_shared_runtime_api)
262262
}
263263

264264
size = (uint64_t)UINT32_MAX + 0x2000;
265-
printf("offset %lx size: %lx\n", offset, size);
265+
printf("offset %llx size: %llx\n", offset, size);
266266
ASSERT_EQ(false, wasm_runtime_validate_app_addr(
267267
tmp_module_env.wasm_module_inst, offset, size));
268268

@@ -1336,7 +1336,7 @@ TEST_F(shared_heap_test, test_shared_heap_chain_addr_conv_oob)
13361336
FAIL() << "Failed to register natives";
13371337
}
13381338

1339-
args.size = 4096;
1339+
args.size = os_getpagesize();
13401340
shared_heap = wasm_runtime_create_shared_heap(&args);
13411341
if (!shared_heap) {
13421342
FAIL() << "Failed to create shared heap";
@@ -1358,14 +1358,14 @@ TEST_F(shared_heap_test, test_shared_heap_chain_addr_conv_oob)
13581358
}
13591359

13601360
/* test wasm */
1361-
argv[0] = 0xFFFFFFFF - BUF_SIZE - 4096;
1361+
argv[0] = 0xFFFFFFFF - BUF_SIZE - os_getpagesize();
13621362
EXPECT_NONFATAL_FAILURE(test_shared_heap(shared_heap_chain,
13631363
"test_addr_conv.wasm",
13641364
"test_preallocated", 1, argv),
13651365
"Exception: out of bounds memory access");
13661366

13671367
/* test aot */
1368-
argv[0] = 0xFFFFFFFF - BUF_SIZE - 4096;
1368+
argv[0] = 0xFFFFFFFF - BUF_SIZE - os_getpagesize();
13691369
EXPECT_NONFATAL_FAILURE(test_shared_heap(shared_heap_chain,
13701370
"test_addr_conv_chain.aot",
13711371
"test_preallocated", 1, argv),

0 commit comments

Comments
 (0)