* [PATCH v2] btrfs-progs: test/mkfs: Add test case for rootdir parameter
@ 2017-09-05 1:24 Qu Wenruo
2017-09-06 15:42 ` David Sterba
0 siblings, 1 reply; 2+ messages in thread
From: Qu Wenruo @ 2017-09-05 1:24 UTC (permalink / raw)
To: linux-btrfs; +Cc: dsterba
Add test case which checks if -r|--rootdir mount option can handle
softlink/char/block/fifo files.
Signed-off-by: Qu Wenruo <quwenruo.btrfs@gmx.com>
---
changelog:
v2:
Use mktemp instead of $$
Use default test device size
Remove unnecessary global prereq for basic tools like mkdir
Put option before parameter for rm command
All suggested by David.
---
.../009-special-files-for-rootdir/test.sh | 36 ++++++++++++++++++++++
1 file changed, 36 insertions(+)
create mode 100755 tests/mkfs-tests/009-special-files-for-rootdir/test.sh
diff --git a/tests/mkfs-tests/009-special-files-for-rootdir/test.sh b/tests/mkfs-tests/009-special-files-for-rootdir/test.sh
new file mode 100755
index 00000000..3cf91dee
--- /dev/null
+++ b/tests/mkfs-tests/009-special-files-for-rootdir/test.sh
@@ -0,0 +1,36 @@
+#!/bin/bash
+# Check if --rootdir can handle special files (socket/fifo/char/block) correctly
+#
+# --rootdir had a problem of filling dir items/indexes with wrong type
+# and caused btrfs check to report such error
+
+source "$TOP/tests/common"
+
+check_prereq mkfs.btrfs
+check_prereq btrfs
+
+setup_root_helper # For mknod
+prepare_test_dev
+
+# mknod can create FIFO/CHAR/BLOCK file but not SOCK.
+# No neat tool to create socket file, unless using python or similar.
+# So no SOCK is tested here
+check_global_prereq mknod
+
+# Also check regular file
+check_global_prereq dd
+
+tmp=$(mktemp -d --tmpdir btrfs-progs-mkfs.rootdirXXXXXXX)
+
+run_check mkdir $tmp/dir
+run_check mkdir -p $tmp/dir/in/dir
+run_check mknod $tmp/fifo p
+run_check $SUDO_HELPER mknod $tmp/char c 1 1
+run_check $SUDO_HELPER mknod $tmp/block b 1 1
+run_check dd if=/dev/zero bs=1M count=1 of=$tmp/regular
+
+run_check $SUDO_HELPER "$TOP/mkfs.btrfs" -f -r "$tmp" $TEST_DEV
+
+rm -rf "$tmp"
+
+run_check $SUDO_HELPER "$TOP/btrfs" check $TEST_DEV
--
2.14.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH v2] btrfs-progs: test/mkfs: Add test case for rootdir parameter
2017-09-05 1:24 [PATCH v2] btrfs-progs: test/mkfs: Add test case for rootdir parameter Qu Wenruo
@ 2017-09-06 15:42 ` David Sterba
0 siblings, 0 replies; 2+ messages in thread
From: David Sterba @ 2017-09-06 15:42 UTC (permalink / raw)
To: Qu Wenruo; +Cc: linux-btrfs, dsterba
On Tue, Sep 05, 2017 at 10:24:15AM +0900, Qu Wenruo wrote:
> Add test case which checks if -r|--rootdir mount option can handle
> softlink/char/block/fifo files.
>
> Signed-off-by: Qu Wenruo <quwenruo.btrfs@gmx.com>
Applied fix some fixups, thanks.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2017-09-06 15:44 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-09-05 1:24 [PATCH v2] btrfs-progs: test/mkfs: Add test case for rootdir parameter Qu Wenruo
2017-09-06 15:42 ` David Sterba
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).