On Tue, May 16, 2023 at 05:24:58PM +0100, Richard W.M. Jones wrote:
 > > +
 > > +# If we read subsets they should match the contents of the buffer.
 > > +buf1 = h.pread(1000, 1000)
 > > +assert(buf1 == buf[1000:2000])
 > > +
 > > +buf1 = h.pread(10000, 999)
 > > +assert(buf1 == buf[999:10999])
 > 
 > Should we also assert that there is at least one stuck bit in those
 > two ranges, and/or pick a different or larger range to improve the
 > chances of that being the case?
 
 So I think you mean pick a range where we know there is a stuck bit
 before doing the read + assert.  I will see.  With a 1:800,000 chance,
 it's not likely the ranges as written would have stuck bits so we're
 comparing zeroes ... 
Engineering tradeoffs - we can run a test with a pinned seed to
deterministically know where the stuck bits will be, but it has to be
separate from tests where we want the pseudo-random behavior to differ
between runs but still demonstrate that our approximations are getting
around the ratio of set bits that we expected.
-- 
Eric Blake, Principal Software Engineer
Red Hat, Inc.           +1-919-301-3266
Virtualization:  
qemu.org | 
libvirt.org