* [PATCH v2] loop: Add regression test for unsupported backing file fallocate
@ 2024-06-17 12:00 Cyril Hrubis
2024-06-18 0:48 ` Chaitanya Kulkarni
2024-06-20 7:35 ` Shinichiro Kawasaki
0 siblings, 2 replies; 4+ messages in thread
From: Cyril Hrubis @ 2024-06-17 12:00 UTC (permalink / raw)
To: linux-block
Cc: Christoph Hellwig, Chaitanya Kulkarni, Shin'ichiro Kawasaki,
Cyril Hrubis
Signed-off-by: Cyril Hrubis <chrubis@suse.cz>
---
v2:
- make use of grep -c instead of wc -l
- Add WRITE_ZEROES string to the grep regexp
tests/loop/011 | 37 +++++++++++++++++++++++++++++++++++++
tests/loop/011.out | 3 +++
2 files changed, 40 insertions(+)
create mode 100755 tests/loop/011
create mode 100644 tests/loop/011.out
diff --git a/tests/loop/011 b/tests/loop/011
new file mode 100755
index 0000000..baabe5c
--- /dev/null
+++ b/tests/loop/011
@@ -0,0 +1,37 @@
+#!/bin/bash
+# SPDX-License-Identifier: GPL-3.0+
+# Copyright (C) 2024 Cyril Hrubis
+#
+# Regression test for patch "loop: Disable fallocate() zero and discard if not supported".
+#
+
+. tests/loop/rc
+DESCRIPTION="Make sure unsupported backing file fallocate does not fill dmesg with errors"
+
+requires() {
+ _have_program mkfs.ext2
+}
+
+test() {
+ local loop_dev;
+ echo "Running ${TEST_NAME}"
+
+ mkdir "$TMPDIR/tmpfs"
+ mount -t tmpfs testfs "$TMPDIR/tmpfs"
+ dd if=/dev/zero of="$TMPDIR/tmpfs/disk.img" bs=1M count=100 &> /dev/null
+
+ if ! loop_dev="$(losetup -f --show "$TMPDIR/tmpfs/disk.img")"; then
+ return 1
+ fi
+
+ mkfs.ext2 /dev/loop0 &> /dev/null
+
+ errors=$(_dmesg_since_test_start |grep -c "operation not supported error, dev .*WRITE_ZEROES")
+
+ losetup -d "$loop_dev"
+ umount "$TMPDIR/tmpfs"
+
+ echo "Found $errors error(s) in dmesg"
+
+ echo "Test complete"
+}
diff --git a/tests/loop/011.out b/tests/loop/011.out
new file mode 100644
index 0000000..cd88fd5
--- /dev/null
+++ b/tests/loop/011.out
@@ -0,0 +1,3 @@
+Running loop/011
+Found 1 error(s) in dmesg
+Test complete
--
2.44.2
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH v2] loop: Add regression test for unsupported backing file fallocate
2024-06-17 12:00 [PATCH v2] loop: Add regression test for unsupported backing file fallocate Cyril Hrubis
@ 2024-06-18 0:48 ` Chaitanya Kulkarni
2024-06-20 7:35 ` Shinichiro Kawasaki
1 sibling, 0 replies; 4+ messages in thread
From: Chaitanya Kulkarni @ 2024-06-18 0:48 UTC (permalink / raw)
To: Cyril Hrubis, linux-block@vger.kernel.org
Cc: Christoph Hellwig, Shin'ichiro Kawasaki
On 6/17/24 05:00, Cyril Hrubis wrote:
> Signed-off-by: Cyril Hrubis <chrubis@suse.cz>
> ---
[...]
> +
> + errors=$(_dmesg_since_test_start |grep -c "operation not supported error, dev .*WRITE_ZEROES")
> +
nit:- space on the both side of '|' before grep would be nice, can be
done at
the time of applying the patch ...
Looks good.
Reviewed-by: Chaitanya Kulkarni <kch@nvidia.com>
-ck
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH v2] loop: Add regression test for unsupported backing file fallocate
2024-06-17 12:00 [PATCH v2] loop: Add regression test for unsupported backing file fallocate Cyril Hrubis
2024-06-18 0:48 ` Chaitanya Kulkarni
@ 2024-06-20 7:35 ` Shinichiro Kawasaki
2024-06-21 9:09 ` Cyril Hrubis
1 sibling, 1 reply; 4+ messages in thread
From: Shinichiro Kawasaki @ 2024-06-20 7:35 UTC (permalink / raw)
To: Cyril Hrubis
Cc: linux-block@vger.kernel.org, hch@infradead.org,
Chaitanya Kulkarni
On Jun 17, 2024 / 14:00, Cyril Hrubis wrote:
> Signed-off-by: Cyril Hrubis <chrubis@suse.cz>
> ---
>
> v2:
> - make use of grep -c instead of wc -l
> - Add WRITE_ZEROES string to the grep regexp
Thanks for the contribution. I've applied v2 patch.
Of note is that I folded in the changes below:
- Added some descriptions to the commit message and the test file header.
- The created loop device file path was hard coded as "/dev/loop0", which does
not work when the test environment has the device before the test case run.
I replaced it with "$loop_dev".
- Replaced short command line options with long options for robustness and
readability.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH v2] loop: Add regression test for unsupported backing file fallocate
2024-06-20 7:35 ` Shinichiro Kawasaki
@ 2024-06-21 9:09 ` Cyril Hrubis
0 siblings, 0 replies; 4+ messages in thread
From: Cyril Hrubis @ 2024-06-21 9:09 UTC (permalink / raw)
To: Shinichiro Kawasaki
Cc: linux-block@vger.kernel.org, hch@infradead.org,
Chaitanya Kulkarni
Hi!
> Of note is that I folded in the changes below:
>
> - Added some descriptions to the commit message and the test file header.
> - The created loop device file path was hard coded as "/dev/loop0", which does
> not work when the test environment has the device before the test case run.
> I replaced it with "$loop_dev".
That was actually a copy&paste error sorry for that and thanks for fixing it!
--
Cyril Hrubis
chrubis@suse.cz
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2024-06-21 9:09 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-06-17 12:00 [PATCH v2] loop: Add regression test for unsupported backing file fallocate Cyril Hrubis
2024-06-18 0:48 ` Chaitanya Kulkarni
2024-06-20 7:35 ` Shinichiro Kawasaki
2024-06-21 9:09 ` Cyril Hrubis
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox