Message ID | 1513679423-13067-1-git-send-email-yangx.jy@cn.fujitsu.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
xiao yang <yangx.jy@cn.fujitsu.com> writes: > +requires() { > + _have_program mkfs.ext3 > +} [...] > + # Format > + mkfs.ext3 -F "$TEST_DEV" >> "$FULL" 2>&1 What's the reason to limit the test case to ext3 only? Can you switch it to the generic 'mkfs' command? IIRC we require 'util-linux' to be present for blktests but mkfs.ext3 is (at least in SUSE based distros) in the e2fsprogs package. apart from that: Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de>
On Tue, Dec 19, 2017 at 11:47:09AM +0100, Johannes Thumshirn wrote: > xiao yang <yangx.jy@cn.fujitsu.com> writes: > > > +requires() { > > + _have_program mkfs.ext3 > > +} > [...] > > + # Format > > + mkfs.ext3 -F "$TEST_DEV" >> "$FULL" 2>&1 > > What's the reason to limit the test case to ext3 only? Can you switch it > to the generic 'mkfs' command? IIRC we require 'util-linux' to be > present for blktests but mkfs.ext3 is (at least in SUSE based distros) > in the e2fsprogs package. I'm fine with only testing one specific filesystem, since we're really testing generic functionality and not any filesystem code. And according to the manpage, bare mkfs is deprecated. I'm fine with requiring e2fsprogs for this test, and xiao yang added the _have_program there for it. > apart from that: > Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de> -- To unsubscribe from this list: send the line "unsubscribe fstests" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
On Tue, Dec 19, 2017 at 06:30:23PM +0800, xiao yang wrote: > If the entire block device is formatted with a filesystem and > mounted, running "blockdev --rereadpt" should fail and return > EBUSY instead of pass. > > Signed-off-by: xiao yang <yangx.jy@cn.fujitsu.com> Thanks, applied (with some slight modifications to make it easier to diagnose a failure). -- To unsubscribe from this list: send the line "unsubscribe fstests" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Omar Sandoval <osandov@osandov.com> writes: > On Tue, Dec 19, 2017 at 11:47:09AM +0100, Johannes Thumshirn wrote: >> xiao yang <yangx.jy@cn.fujitsu.com> writes: >> >> > +requires() { >> > + _have_program mkfs.ext3 >> > +} >> [...] >> > + # Format >> > + mkfs.ext3 -F "$TEST_DEV" >> "$FULL" 2>&1 >> >> What's the reason to limit the test case to ext3 only? Can you switch it >> to the generic 'mkfs' command? IIRC we require 'util-linux' to be >> present for blktests but mkfs.ext3 is (at least in SUSE based distros) >> in the e2fsprogs package. > > I'm fine with only testing one specific filesystem, since we're really > testing generic functionality and not any filesystem code. And according > to the manpage, bare mkfs is deprecated. I'm fine with requiring > e2fsprogs for this test, and xiao yang added the _have_program there for > it. what about something like (totally untested): if _have_program mkfs.ext3; then mkfs_prog="mkfs.ext3" return 1 elif _have_program mkfs.xfs; then mkfs_prog="mkfs.xfs" return 1 elif _have_program mkfs.brtfs; then mkfs_prog="mkfs.brtfs" return 1 else retrun 0 fi
diff --git a/tests/block/013 b/tests/block/013 new file mode 100755 index 0000000..77ae55c --- /dev/null +++ b/tests/block/013 @@ -0,0 +1,62 @@ +#!/bin/bash +# +# If the entire block device is formatted with a filesystem and +# mounted, running "blockdev --rereadpt" should fail and return +# EBUSY. On buggy kernel, it passes unexpectedly. +# +# Regression test for commit 77032ca66f86 ("Return EBUSY from +# BLKRRPART for mounted whole-dev fs"). +# +# Copyright (c) 2017 FUJITSU LIMITED. All rights reserved. +# Author: Xiao Yang <yangx.jy@cn.fujitsu.com> +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see <http://www.gnu.org/licenses/>. + +DESCRIPTION="test return EBUSY from BLKRRPART for mounted whole-dev" +QUICK=1 + +requires() { + _have_program mkfs.ext3 +} + +test_device() { + echo "Running ${TEST_NAME}" + + rm -f "$FULL" + mkdir "$TMPDIR/mntpoint" + + # Format + mkfs.ext3 -F "$TEST_DEV" >> "$FULL" 2>&1 + + # Mount + mount "$TEST_DEV" "$TMPDIR/mntpoint" + + # Check mounted whole-dev + local out=$(blockdev --rereadpt "$TEST_DEV" 2>&1) + echo $out | grep -q "Device or resource busy" + if [ $? -eq 0 ]; then + echo "Return EBUSY for mounted whole-dev" + else + echo "Don't return EBUSY for mounted whole-dev" + fi + + echo $out >> "$FULL" + + # Umount + umount "$TMPDIR/mntpoint" + + rm -rf "$TMPDIR/mntpoint" + + echo "Test complete" +} diff --git a/tests/block/013.out b/tests/block/013.out new file mode 100644 index 0000000..74d1d08 --- /dev/null +++ b/tests/block/013.out @@ -0,0 +1,3 @@ +Running block/013 +Return EBUSY for mounted whole-dev +Test complete
If the entire block device is formatted with a filesystem and mounted, running "blockdev --rereadpt" should fail and return EBUSY instead of pass. Signed-off-by: xiao yang <yangx.jy@cn.fujitsu.com> --- tests/block/013 | 62 +++++++++++++++++++++++++++++++++++++++++++++++++++++ tests/block/013.out | 3 +++ 2 files changed, 65 insertions(+) create mode 100755 tests/block/013 create mode 100644 tests/block/013.out