From: Stefan Hajnoczi <stefanha@redhat.com>
To: linux-block@vger.kernel.org
Cc: linux-kernel@vger.kernel.org, eblake@redhat.com,
Alasdair Kergon <agk@redhat.com>,
Mikulas Patocka <mpatocka@redhat.com>,
dm-devel@lists.linux.dev, David Teigland <teigland@redhat.com>,
Mike Snitzer <snitzer@kernel.org>, Jens Axboe <axboe@kernel.dk>,
Christoph Hellwig <hch@lst.de>, Joe Thornber <ejt@redhat.com>,
Stefan Hajnoczi <stefanha@redhat.com>
Subject: [RFC 7/9] selftests: block_seek_hole: add dm-linear test
Date: Thu, 28 Mar 2024 16:39:08 -0400 [thread overview]
Message-ID: <20240328203910.2370087-8-stefanha@redhat.com> (raw)
In-Reply-To: <20240328203910.2370087-1-stefanha@redhat.com>
The dm-linear linear target passes through SEEK_HOLE/SEEK_DATA. Extend
the test case to check that the same holes/data are reported as for the
underlying file.
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
---
tools/testing/selftests/block_seek_hole/test.py | 16 +++++++++++++++-
1 file changed, 15 insertions(+), 1 deletion(-)
diff --git a/tools/testing/selftests/block_seek_hole/test.py b/tools/testing/selftests/block_seek_hole/test.py
index 4f7c2d01ab3d3..6360b72aee338 100755
--- a/tools/testing/selftests/block_seek_hole/test.py
+++ b/tools/testing/selftests/block_seek_hole/test.py
@@ -45,6 +45,20 @@ def loop_device(file_path):
finally:
run(['losetup', '-d', loop_path])
+@contextmanager
+def dm_linear(file_path):
+ file_size = os.path.getsize(file_path)
+
+ with loop_device(file_path) as loop_path:
+ dm_name = f'test-{os.getpid()}'
+ run(['dmsetup', 'create', dm_name, '--table',
+ f'0 {file_size // 512} linear {loop_path} 0'])
+
+ try:
+ yield f'/dev/mapper/{dm_name}'
+ finally:
+ run(['dmsetup', 'remove', dm_name])
+
def test(layout, dev_context_manager):
with test_file(layout) as file_path, dev_context_manager(file_path) as dev_path:
cmd = run(['./map_holes.py', file_path])
@@ -99,5 +113,5 @@ if __name__ == '__main__':
holes_at_beginning_and_end,
no_holes,
empty_file]
- dev_context_managers = [loop_device]
+ dev_context_managers = [loop_device, dm_linear]
test_all(layouts, dev_context_managers)
--
2.44.0
next prev parent reply other threads:[~2024-03-28 20:40 UTC|newest]
Thread overview: 38+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-03-28 20:39 [RFC 0/9] block: add llseek(SEEK_HOLE/SEEK_DATA) support Stefan Hajnoczi
2024-03-28 20:39 ` [RFC 1/9] " Stefan Hajnoczi
2024-03-28 23:50 ` Eric Blake
2024-03-28 20:39 ` [RFC 2/9] loop: " Stefan Hajnoczi
2024-03-29 0:00 ` Eric Blake
2024-03-29 12:54 ` Stefan Hajnoczi
2024-03-28 20:39 ` [RFC 3/9] selftests: block_seek_hole: add loop block driver tests Stefan Hajnoczi
2024-03-29 0:11 ` Eric Blake
2024-04-03 13:50 ` Stefan Hajnoczi
2024-03-29 12:38 ` Eric Blake
2024-04-03 13:51 ` Stefan Hajnoczi
2024-03-28 20:39 ` [RFC 4/9] dm: add llseek(SEEK_HOLE/SEEK_DATA) support Stefan Hajnoczi
2024-03-29 0:38 ` Eric Blake
2024-04-03 14:11 ` Stefan Hajnoczi
2024-04-03 17:02 ` Eric Blake
2024-04-03 17:58 ` Stefan Hajnoczi
2024-04-03 19:28 ` Eric Blake
2024-03-28 20:39 ` [RFC 5/9] selftests: block_seek_hole: add dm-zero test Stefan Hajnoczi
2024-03-28 22:19 ` Eric Blake
2024-03-28 22:32 ` Stefan Hajnoczi
2024-03-28 20:39 ` [RFC 6/9] dm-linear: add llseek(SEEK_HOLE/SEEK_DATA) support Stefan Hajnoczi
2024-03-29 0:54 ` Eric Blake
2024-04-03 14:22 ` Stefan Hajnoczi
2024-03-28 20:39 ` Stefan Hajnoczi [this message]
2024-03-29 0:59 ` [RFC 7/9] selftests: block_seek_hole: add dm-linear test Eric Blake
2024-04-03 14:23 ` Stefan Hajnoczi
2024-03-28 20:39 ` [RFC 8/9] dm thin: add llseek(SEEK_HOLE/SEEK_DATA) support Stefan Hajnoczi
2024-03-29 1:31 ` Eric Blake
2024-04-03 15:03 ` Stefan Hajnoczi
2024-03-28 20:39 ` [RFC 9/9] selftests: block_seek_hole: add dm-thin test Stefan Hajnoczi
2024-03-28 22:16 ` [RFC 0/9] block: add llseek(SEEK_HOLE/SEEK_DATA) support Eric Blake
2024-03-28 22:29 ` Eric Blake
2024-03-28 23:09 ` Stefan Hajnoczi
2024-04-02 12:26 ` Christoph Hellwig
2024-04-02 13:04 ` Stefan Hajnoczi
2024-04-05 7:02 ` Christoph Hellwig
2024-04-02 13:31 ` Eric Blake
2024-04-05 7:02 ` Christoph Hellwig
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20240328203910.2370087-8-stefanha@redhat.com \
--to=stefanha@redhat.com \
--cc=agk@redhat.com \
--cc=axboe@kernel.dk \
--cc=dm-devel@lists.linux.dev \
--cc=eblake@redhat.com \
--cc=ejt@redhat.com \
--cc=hch@lst.de \
--cc=linux-block@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mpatocka@redhat.com \
--cc=snitzer@kernel.org \
--cc=teigland@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®