[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20240403135032.GB2524049@fedora>
Date: Wed, 3 Apr 2024 09:50:32 -0400
From: Stefan Hajnoczi <stefanha@...hat.com>
To: Eric Blake <eblake@...hat.com>
Cc: linux-block@...r.kernel.org, linux-kernel@...r.kernel.org,
Alasdair Kergon <agk@...hat.com>,
Mikulas Patocka <mpatocka@...hat.com>, dm-devel@...ts.linux.dev,
David Teigland <teigland@...hat.com>,
Mike Snitzer <snitzer@...nel.org>, Jens Axboe <axboe@...nel.dk>,
Christoph Hellwig <hch@....de>, Joe Thornber <ejt@...hat.com>
Subject: Re: [RFC 3/9] selftests: block_seek_hole: add loop block driver tests
On Thu, Mar 28, 2024 at 07:11:30PM -0500, Eric Blake wrote:
> On Thu, Mar 28, 2024 at 04:39:04PM -0400, Stefan Hajnoczi wrote:
> > Run the tests with:
> >
> > $ make TARGETS=block_seek_hole -C tools/selftests run_tests
> >
> > Signed-off-by: Stefan Hajnoczi <stefanha@...hat.com>
> > ---
> > tools/testing/selftests/Makefile | 1 +
> > .../selftests/block_seek_hole/Makefile | 17 +++
> > .../testing/selftests/block_seek_hole/config | 1 +
> > .../selftests/block_seek_hole/map_holes.py | 37 +++++++
> > .../testing/selftests/block_seek_hole/test.py | 103 ++++++++++++++++++
> > 5 files changed, 159 insertions(+)
> > create mode 100644 tools/testing/selftests/block_seek_hole/Makefile
> > create mode 100644 tools/testing/selftests/block_seek_hole/config
> > create mode 100755 tools/testing/selftests/block_seek_hole/map_holes.py
> > create mode 100755 tools/testing/selftests/block_seek_hole/test.py
> >
> > +++ b/tools/testing/selftests/block_seek_hole/test.py
>
> > +
> > +# Different data layouts to test
> > +
> > +def data_at_beginning_and_end(f):
> > + f.write(b'A' * 4 * KB)
> > + f.seek(256 * MB)
> > +
> > + f.write(b'B' * 64 * KB)
> > +
> > + f.seek(1024 * MB - KB)
> > + f.write(b'C' * KB)
> > +
> > +def holes_at_beginning_and_end(f):
> > + f.seek(128 * MB)
> > + f.write(b'A' * 4 * KB)
> > +
> > + f.seek(512 * MB)
> > + f.write(b'B' * 64 * KB)
> > +
> > + f.truncate(1024 * MB)
> > +
> > +def no_holes(f):
> > + # Just 1 MB so test file generation is quick
> > + mb = b'A' * MB
> > + f.write(mb)
> > +
> > +def empty_file(f):
> > + f.truncate(1024 * MB)
>
> Is it also worth attempting to test a (necessarily sparse!) file
> larger than 2GiB to prove that we are 64-bit clean, even on a 32-bit
> system where lseek is different than lseek64? (I honestly have no
> idea if python always uses 64-bit seek even on 32-bit systems,
> although I would be surprised if it were not)
Yes, it wouldn't hurt to add a test case for that. I'll do that.
Stefan
Download attachment "signature.asc" of type "application/pgp-signature" (489 bytes)
Powered by blists - more mailing lists