[Parted-commits] GNU Parted Official Repository: Changes to 'master'
Jim Meyering
meyering at alioth.debian.org
Wed Apr 28 16:28:19 UTC 2010
tests/Makefile.am | 1
tests/t3310-flags.sh | 68 +++++++++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 69 insertions(+)
New commits:
commit 97961ee49e8461458a0667137550608c993904c6
Author: Jim Meyering <meyering at redhat.com>
Date: Wed Apr 21 14:00:26 2010 +0200
tests: test all boolean flags
* tests/t3310-flags.sh: New test, suggested by Hans De Goede.
* tests/Makefile.am (TESTS): Add it.
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 6f7730d..2388ec3 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -27,6 +27,7 @@ TESTS = \
t3000-resize-fs.sh \
t3200-type-change.sh \
t3300-palo-prep.sh \
+ t3310-flags.sh \
t4000-sun-raid-type.sh \
t4001-sun-vtoc.sh \
t4100-msdos-partition-limits.sh \
diff --git a/tests/t3310-flags.sh b/tests/t3310-flags.sh
new file mode 100644
index 0000000..05d38ac
--- /dev/null
+++ b/tests/t3310-flags.sh
@@ -0,0 +1,68 @@
+#!/bin/sh
+# Exercise the exclusive, single-bit flags.
+
+# Copyright (C) 2010 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/>.
+
+if test "$VERBOSE" = yes; then
+ set -x
+ parted --version
+fi
+
+: ${srcdir=.}
+: ${abs_top_srcdir=$(cd .. && pwd)}
+. $srcdir/t-lib.sh
+ss=$sector_size_
+
+fail=0
+dev=dev-file
+
+# Extract all msdos flag names from the texinfo documentation.
+msdos_flags=$(sed -n '/^@node set/,/^@node/p' "$abs_top_srcdir/doc/parted.texi" \
+ | perl -00 -ne '/^\@item (\w+).*MS-DOS/s and print lc($1), "\n"')
+
+n_sectors=5000
+dd if=/dev/null of=$dev bs=$ss seek=$n_sectors || fail=1
+
+parted -s $dev mklabel msdos \
+ mkpart pri ext2 $((1*2048))s $((2*2048-1))s \
+ > out 2> err || fail=1
+compare out /dev/null || fail=1
+
+for mode in on_only on_and_off ; do
+ for flag in $msdos_flags; do
+
+ # Exclude the supplemental flags.
+ # These are not boolean, like the others.
+ case $flag in boot|lba|hidden) continue;; esac
+ echo $flag > exp || fail=1
+
+ # Turn on each flag, one at a time.
+ parted -m -s $dev set 1 $flag on u s print > raw 2> err || fail=1
+ perl -nle '/^1:2048s:4095s:2048s:::(\w+);$/ and print $1' raw > out
+ compare out exp || fail=1
+ compare err /dev/null || fail=1
+
+ if test $mode = on_and_off; then
+ # Turn it off
+ : > exp
+ parted -m -s $dev set 1 $flag off u s print > raw 2> err || fail=1
+ perl -nle '/^1:2048s:4095s:2048s:::.*;$/ and print $1' raw > out
+ compare err /dev/null || fail=1
+ fi
+ done
+done
+
+Exit $fail
More information about the Parted-commits
mailing list