aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorBenjamin Feng <benjamin.feng@glassdoor.com>2019-12-05 19:31:49 -0600
committerBenjamin Feng <benjamin.feng@glassdoor.com>2019-12-05 19:31:49 -0600
commitf2b0dbea748ecc927a9c2482dbb1dad8843cf9f8 (patch)
treec458fc86bf6e34a52a9adf24993d583635c67bed /lib
parent694616adb549fc0dc2d7416e120e17992087e75c (diff)
downloadzig-f2b0dbea748ecc927a9c2482dbb1dad8843cf9f8.tar.gz
zig-f2b0dbea748ecc927a9c2482dbb1dad8843cf9f8.zip
Resolve tests to work with or skip WasmPageAllocator
Diffstat (limited to 'lib')
-rw-r--r--lib/std/heap.zig11
1 files changed, 6 insertions, 5 deletions
diff --git a/lib/std/heap.zig b/lib/std/heap.zig
index 7c0ea4174c..e7fab637c0 100644
--- a/lib/std/heap.zig
+++ b/lib/std/heap.zig
@@ -794,8 +794,10 @@ test "PageAllocator" {
const allocator = page_allocator;
try testAllocator(allocator);
try testAllocatorAligned(allocator, 16);
- try testAllocatorLargeAlignment(allocator);
- try testAllocatorAlignedShrink(allocator);
+ if (!std.Target.current.isWasm()) {
+ try testAllocatorLargeAlignment(allocator);
+ try testAllocatorAlignedShrink(allocator);
+ }
if (builtin.os == .windows) {
// Trying really large alignment. As mentionned in the implementation,
@@ -832,7 +834,7 @@ test "ArenaAllocator" {
try testAllocatorAlignedShrink(&arena_allocator.allocator);
}
-var test_fixed_buffer_allocator_memory: [80000 * @sizeOf(u64)]u8 = undefined;
+var test_fixed_buffer_allocator_memory: [800000 * @sizeOf(u64)]u8 = undefined;
test "FixedBufferAllocator" {
var fixed_buffer_allocator = FixedBufferAllocator.init(test_fixed_buffer_allocator_memory[0..]);
@@ -955,8 +957,7 @@ fn testAllocatorAligned(allocator: *mem.Allocator, comptime alignment: u29) !voi
fn testAllocatorLargeAlignment(allocator: *mem.Allocator) mem.Allocator.Error!void {
//Maybe a platform's page_size is actually the same as or
// very near usize?
- //if (mem.page_size << 2 > maxInt(usize)) return;
- if (mem.page_size << 2 > 32768) return;
+ if (mem.page_size << 2 > maxInt(usize)) return;
const USizeShift = @IntType(false, std.math.log2(usize.bit_count));
const large_align = @as(u29, mem.page_size << 2);