Commit 43b8f03d authored by Clemens Backes's avatar Clemens Backes Committed by Commit Bot

[wasm][test] Fix memory64 test

There are fives bytes total which are expected to be different from
zero. We were only handling one of them when checking random positions
in the array. This was leading to random failures.

R=manoskouk@chromium.org

Bug: v8:11621
Change-Id: Iac231d8b35fcbfbbc837c8e9134401cb8a2519ac
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2810783Reviewed-by: 's avatarManos Koukoutos <manoskouk@chromium.org>
Commit-Queue: Clemens Backes <clemensb@chromium.org>
Cr-Commit-Position: refs/heads/master@{#73860}
parent 9e391185
......@@ -50,11 +50,16 @@ function BasicMemory64Tests(num_pages) {
store(kStoreOffset, 11);
assertEquals(11, load(kStoreOffset));
// Now check 100 random positions. All except for kStoreOffset should be zero.
// Now check 100 random positions.
for (let i = 0; i < 100; ++i) {
let position = Math.floor(Math.random() * num_bytes);
if (position == kStoreOffset) continue;
assertEquals(0, array[position]);
let expected = 0;
if (position == kStoreOffset) {
expected = 11;
} else if (num_bytes - position <= 4) {
expected = [0x12, 0x34, 0x56, 0x78][num_bytes - position - 1];
}
assertEquals(expected, array[position]);
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment