From eeb8b6aa9c72ec00b7564538442a86eeec04b23f Mon Sep 17 00:00:00 2001 From: Alistair Turnbull Date: Wed, 17 Oct 2018 17:12:14 +0100 Subject: [PATCH] To guarantee at least one failure while maintaining test coverage, use oomalloc on the first loop iteration and with 50% probability thereafter. Copied from Perforce Change: 195278 --- mps/code/fotest.c | 18 ++---------------- 1 file changed, 2 insertions(+), 16 deletions(-) diff --git a/mps/code/fotest.c b/mps/code/fotest.c index aed77a539bd..01a4d78cc24 100644 --- a/mps/code/fotest.c +++ b/mps/code/fotest.c @@ -99,7 +99,6 @@ static mps_res_t stress(size_t (*size)(unsigned long, mps_align_t), unsigned long i, k; int *ps[testSetSIZE]; size_t ss[testSetSIZE]; - Bool fs[testSetSIZE]; die(mps_ap_create(&ap, pool, mps_rank_exact()), "BufferCreate"); @@ -115,24 +114,11 @@ static mps_res_t stress(size_t (*size)(unsigned long, mps_align_t), *ps[i] = 1; /* Write something, so it gets swap. */ } - /* Decide on which iterations we're going to simulate failures. - * We want to be sure to fail at least once. We achieve this by - * deterministically filling an array of booleans, then shuffling it. */ - for (i=0; i0 && rnd() % 2) ? mfs_alloc : oomAlloc; /* shuffle all the objects */ for (i=0; i