[parted-devel] [PATCH] Initial btrfs support, only recognize it for now

Luca Bruno lucab at debian.org
Sun Mar 15 10:44:44 UTC 2009


Otavio Salvador scrisse:

> > Still a lot of work to be done I guess.  Its a very good idea
> > implment this early, this will increase btrfs testing and such.
> > Guess this is a good candidate for the master branch
> 
> I agree but I also belive is it not yet ready for master or next yet;
> I'd like to give it a try and would be also nice to cook a small set
> of tests to cover it. After that we need to get the copyright
> assigment so we can merge it.

As I've already said to Otavio privately, the copyright issue exposed
in this thread was just a cut'n'paste mistake and the correct year is of
course 2009. 
As I was waiting, I used the occasion to take confidence with
tests mechanism and cooked a small btrfs-probing one, inlined here below.
Cheers, Luca

###

commit 7d5d938b4645a456991b649c0944fa5882d9560d
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

-- 
 .''`.  ** Debian GNU/Linux **  | Luca Bruno (kaeso)
: :'  :   The Universal O.S.    | lucab (AT) debian.org
`. `'`  			| GPG Key ID: 3BFB9FB3
  `-     http://www.debian.org 	| Debian GNU/Linux Developer
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 197 bytes
Desc: not available
Url : http://lists.alioth.debian.org/pipermail/parted-devel/attachments/20090315/8c2085d2/attachment.pgp 


More information about the parted-devel mailing list