[Parted-commits] GNU Parted Official Repository: Changes to 'master'

Otavio Salvador otavio at alioth.debian.org
Wed May 9 19:04:34 UTC 2007


 parted/parted.c     |    2 +-
 tests/Makefile.am   |    3 ++-
 tests/t2000-mkfs.sh |   45 +++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 48 insertions(+), 2 deletions(-)

New commits:
commit 20fd17ca725b0705e462d59604951ad7ea34497c
Author: Otavio Salvador <otavio at ossystems.com.br>
Date:   Wed May 9 16:03:39 2007 -0300

    [parted] Fix script mode support on mkfs commandline command
    
    Parted was lacking support to script mode on do_mkfs method hence
    always failing.
    
    Note: tests/t2000-mkfs.sh was created to avoid it to happen again
    
    Signed-off-by: Otavio Salvador <otavio at ossystems.com.br>

diff --git a/parted/parted.c b/parted/parted.c
index 99b9f28..d16ad96 100644
--- a/parted/parted.c
+++ b/parted/parted.c
@@ -646,7 +646,7 @@ do_mkfs (PedDevice** dev)
         if (!disk)
                 goto error;
 
-        if  (!_partition_warn_loss())
+        if  (!opt_script_mode && !_partition_warn_loss())
                 goto error_destroy_disk;
 
         if (!command_line_get_partition (_("Partition number?"), disk, &part))
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 044e126..2948ae2 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -1,6 +1,7 @@
 TESTS = \
   t0000-basic.sh \
-  t1000-mkpartfs.sh
+  t1000-mkpartfs.sh \
+  t2000-mkfs.sh
 
 TESTS_ENVIRONMENT = \
   PATH="`pwd`/../parted$(PATH_SEPARATOR)$$PATH"
diff --git a/tests/t2000-mkfs.sh b/tests/t2000-mkfs.sh
new file mode 100755
index 0000000..e47da8f
--- /dev/null
+++ b/tests/t2000-mkfs.sh
@@ -0,0 +1,45 @@
+#!/bin/sh
+
+# Copyright (C) 2007 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 2 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, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+# 02110-1301, USA.
+
+test_description='Create some file systems using mkfs.'
+
+. $srcdir/test-lib.sh
+
+N=40M
+dev=loop-file
+test_expect_success \
+    'create a file large enough to hold a fat32 file system' \
+    'dd if=/dev/zero of=$dev bs=$N count=1 2> /dev/null'
+
+test_expect_success \
+    'label the test disk' \
+    'parted -s $dev mklabel msdos > out 2>&1'
+test_expect_success 'expect no output' '$compare out /dev/null'
+
+test_expect_success \
+    'create an partition' \
+    'parted -s $dev mkpart primary 1 40 > out 2>&1'
+
+test_expect_success \
+    'create an msdos file system' \
+    'parted -s $dev mkfs 1 fat32 > out 2>&1'
+
+test_expect_success 'expect no output' '$compare out /dev/null'
+
+test_done



More information about the Parted-commits mailing list