OSDN Git Service

tests: exercise the "GPT vs other-sized partition entry arrays" fixes
authorJim Meyering <meyering@redhat.com>
Thu, 3 Nov 2011 10:09:47 +0000 (11:09 +0100)
committerJim Meyering <meyering@redhat.com>
Fri, 4 Nov 2011 08:50:34 +0000 (09:50 +0100)
* tests/t0210-gpt-resized-partition-entry-array.sh: New file.
* tests/Makefile.am (TESTS): Add it.
(EXTRA_DIST): Add gpt-header-munge.

tests/Makefile.am
tests/t0210-gpt-resized-partition-entry-array.sh [new file with mode: 0755]

index 9638248..71787e5 100644 (file)
@@ -19,6 +19,7 @@ TESTS = \
   t0206-gpt-print-with-corrupt-primary-clobbers-pmbr.sh \
   t0207-IEC-binary-notation.sh \
   t0208-mkpart-end-in-IEC.sh \
+  t0210-gpt-resized-partition-entry-array.sh \
   t0220-gpt-msftres.sh \
   t0250-gpt.sh \
   t0280-gpt-corrupt.sh \
@@ -62,7 +63,7 @@ TESTS = \
 
 EXTRA_DIST = \
   $(TESTS) lvm-utils.sh t-local.sh t-lvm.sh \
-  init.cfg init.sh t-lib-helpers.sh
+  init.cfg init.sh t-lib-helpers.sh gpt-header-munge
 
 check_PROGRAMS = print-align print-max dup-clobber duplicate
 LDADD = \
diff --git a/tests/t0210-gpt-resized-partition-entry-array.sh b/tests/t0210-gpt-resized-partition-entry-array.sh
new file mode 100755 (executable)
index 0000000..c3d3ee2
--- /dev/null
@@ -0,0 +1,40 @@
+#!/bin/sh
+# exercise GPT handling of n_partition_array_entries != 128
+
+# Copyright (C) 2009-2011 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/>.
+
+. "${srcdir=.}/init.sh"; path_prepend_ ../parted $srcdir
+
+ss=$sector_size_
+
+N=2M
+dev=loop-file
+# create a file large enough to hold a GPT partition table
+dd if=/dev/null of=$dev bs=1 seek=$N || framework_failure
+
+# create a GPT partition table
+parted -s $dev mklabel gpt > out 2>&1 || fail=1
+# expect no output
+compare out /dev/null || fail=1
+
+gpt-header-munge --sector-size=$ss --n=9 $dev || fail=1
+
+parted -m -s $dev u s p > out 2>&1 || fail=1
+sed 's/.*:gpt:/:gpt:/' out > k && mv k out
+printf 'BYT;\n:gpt:;\n' > exp || fail=1
+compare out exp || fail=1
+
+Exit $fail