authorgravatar for benjamin.feng@glassdoor.comBenjamin Feng <benjamin.feng@glassdoor.com> 2019-12-05 19:31:49-06:00
committergravatar for benjamin.feng@glassdoor.comBenjamin Feng <benjamin.feng@glassdoor.com> 2019-12-05 19:31:49-06:00
logf2b0dbea748ecc927a9c2482dbb1dad8843cf9f8
treec458fc86bf6e34a52a9adf24993d583635c67bed
parent694616adb549fc0dc2d7416e120e17992087e75c

Resolve tests to work with or skip WasmPageAllocator


1 files changed, 6 insertions(+), 5 deletions(-)

lib/std/heap.zig+6-5
......@@ -794,8 +794,10 @@ test "PageAllocator" {
794794 const allocator = page_allocator;
795795 try testAllocator(allocator);
796796 try testAllocatorAligned(allocator, 16);
797 try testAllocatorLargeAlignment(allocator);
798 try testAllocatorAlignedShrink(allocator);
797 if (!std.Target.current.isWasm()) {
798 try testAllocatorLargeAlignment(allocator);
799 try testAllocatorAlignedShrink(allocator);
800 }
799801
800802 if (builtin.os == .windows) {
801803 // Trying really large alignment. As mentionned in the implementation,
......@@ -832,7 +834,7 @@ test "ArenaAllocator" {
832834 try testAllocatorAlignedShrink(&arena_allocator.allocator);
833835}
834836
835var test_fixed_buffer_allocator_memory: [80000 * @sizeOf(u64)]u8 = undefined;
837var test_fixed_buffer_allocator_memory: [800000 * @sizeOf(u64)]u8 = undefined;
836838test "FixedBufferAllocator" {
837839 var fixed_buffer_allocator = FixedBufferAllocator.init(test_fixed_buffer_allocator_memory[0..]);
838840
......@@ -955,8 +957,7 @@ fn testAllocatorAligned(allocator: *mem.Allocator, comptime alignment: u29) !voi
955957fn testAllocatorLargeAlignment(allocator: *mem.Allocator) mem.Allocator.Error!void {
956958 //Maybe a platform's page_size is actually the same as or
957959 // very near usize?
958 //if (mem.page_size << 2 > maxInt(usize)) return;
959 if (mem.page_size << 2 > 32768) return;
960 if (mem.page_size << 2 > maxInt(usize)) return;
960961
961962 const USizeShift = @IntType(false, std.math.log2(usize.bit_count));
962963 const large_align = @as(u29, mem.page_size << 2);