[parted-devel] [PATCH 2/2] Test the correctness of btrfs probing

Luca Bruno lucab at debian.org
Tue Mar 24 09:48:44 UTC 2009


commit 7b7ffc2234792e9848bae9264a0fce7fdab72b0c
Author: Luca Bruno <lucab at debian.org>
Date:   Sun Mar 15 10:54:03 2009 +0100

    Test the correctness of btrfs probing
    
    Create a simple btrfs file system (no subvolumes nor
    multidevices) and check if it's correctly recognized.
    Minimum size forced, as mkfs.btrfs can't currently
    create file systems smaller than 256MB.
    
    Signed-off-by: Luca Bruno <lucab at debian.org>

diff --git a/tests/Makefile.am b/tests/Makefile.am
index 0beedd4..d1d52f8 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -7,6 +7,7 @@ TESTS = \
   t1100-busy-label.sh \
   t1500-small-ext2.sh \
   t1700-ext-probe.sh \
+  t1800-btrfs-probe.sh \
   t2000-mkfs.sh \
   t2100-mkswap.sh \
   t2200-dos-label-recog.sh \
diff --git a/tests/t1800-btrfs-probe.sh b/tests/t1800-btrfs-probe.sh
new file mode 100755
index 0000000..0f25244
--- /dev/null
+++ b/tests/t1800-btrfs-probe.sh
@@ -0,0 +1,42 @@
+#!/bin/sh
+
+# Copyright (C) 2009 Free Software Foundation, Inc.
+
+# 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/>.
+
+test_description='Probe Btrfs file systems.'
+
+: ${srcdir=.}
+. $srcdir/test-lib.sh
+
+dev=loop-file
+
+type=btrfs
+
+( test -x `which mkfs.$type` ) ||
+  { echo "no $type support; skipping that test"; }
+
+# Note that mkfs.btrfs doesn't currently work on target 
+# files smaller than 256MB.
+test_expect_success \
+    "create a $type file system" '
+    dd if=/dev/zero of=$dev bs=1M count=256 >/dev/null &&
+    mkfs -t $type $dev >/dev/null'
+
+test_expect_success \
+    "probe the $type file system" '
+    parted -s $dev print >out 2>1
+    grep -w $type out'
+
+test_done




More information about the parted-devel mailing list