- Use mkfs.xfs to create files (#1101112)

This commit is contained in:
Brian C. Lane 2014-05-27 07:59:20 -07:00
parent 5dcb73843d
commit 64daa79b38
3 changed files with 98 additions and 23 deletions

View File

@ -1,4 +1,4 @@
From f988537d99ae18e9307f99821de8f71953ad8d4f Mon Sep 17 00:00:00 2001
From c5fb010cc1cb3e93de2aa8e339f09979575cb619 Mon Sep 17 00:00:00 2001
From: "Brian C. Lane" <bcl@redhat.com>
Date: Thu, 17 Apr 2014 12:14:48 -0700
Subject: [PATCH] tests: Add ntfs vfat hfsplus to t1700 probe test
@ -9,14 +9,14 @@ name doesn't have to match the type.
* tests/t1700-probe-fs.sh: Add new filesystems to test
---
tests/t1700-probe-fs.sh | 19 ++++++++++++++-----
1 file changed, 14 insertions(+), 5 deletions(-)
tests/t1700-probe-fs.sh | 20 ++++++++++++++------
1 file changed, 14 insertions(+), 6 deletions(-)
diff --git a/tests/t1700-probe-fs.sh b/tests/t1700-probe-fs.sh
index bf6ad9c..695f9ef 100755
index bf6ad9c..e090a5a 100755
--- a/tests/t1700-probe-fs.sh
+++ b/tests/t1700-probe-fs.sh
@@ -23,28 +23,37 @@ dev=loop-file
@@ -23,14 +23,21 @@ dev=loop-file
ss=$sector_size_
n_sectors=$((257*1024))
@ -41,24 +41,26 @@ index bf6ad9c..695f9ef 100755
+ esac
# create an $type file system
+ [ -e $dev ] && rm -f $dev
dd if=/dev/null of=$dev bs=$ss seek=$n_sectors >/dev/null || fail=1
mkfs.$type $force $dev || { warn_ $ME: mkfs.$type failed; fail=1; continue; }
@@ -38,8 +45,8 @@ for type in ext2 ext3 ext4 btrfs xfs nilfs2; do
# probe the $type file system
parted -m -s $dev u s print >out 2>&1 || fail=1
- grep '^1:.*:'$type'::;$' out || { cat out; fail=1; }
-
+ grep '^1:.*:'$fsname'::;$' out || { cat out; fail=1; }
+ rm -f $dev
done
# Some features should indicate ext4 by themselves.
for feature in uninit_bg flex_bg; do
# create an ext3 file system
+ [ -e $dev ] && rm -f $dev
dd if=/dev/null of=$dev bs=1024 seek=4096 >/dev/null || fail=1
mkfs.ext3 -F $dev >/dev/null || skip_ "mkfs.ext3 failed"
@@ -54,6 +61,7 @@ for feature in uninit_bg flex_bg; do
# probe the file system, which should now be ext4
parted -m -s $dev u s print >out 2>&1 || fail=1
grep '^1:.*:ext4::;$' out || fail=1
+ rm $dev
done
Exit $fail
--
1.9.0

View File

@ -0,0 +1,69 @@
From 5800abc0b2162b4145ab2091acc8e9a3ecdb3c88 Mon Sep 17 00:00:00 2001
From: "Brian C. Lane" <bcl@redhat.com>
Date: Tue, 27 May 2014 07:38:36 -0700
Subject: [PATCH] tests: Use mkfs.xfs to create files (#1101112)
On s390 there is a bug with mkfs.xfs and pre-existing files. Work around
it by creating the file directly with mkfs.xfs. This also works on other
arches.
* tests/t1700-probe-fs.sh: Check for xfs and use direct file creation
* tests/t4100-dvh-partition-limits.sh: Use mkfs.xfs -dfile
* tests/t4100-msdos-partition-limits.sh: Use mkfs.xfs -dfile
---
tests/t1700-probe-fs.sh | 9 +++++++--
tests/t4100-dvh-partition-limits.sh | 3 +--
tests/t4100-msdos-partition-limits.sh | 3 +--
3 files changed, 9 insertions(+), 6 deletions(-)
diff --git a/tests/t1700-probe-fs.sh b/tests/t1700-probe-fs.sh
index e090a5a..4cd3b8d 100755
--- a/tests/t1700-probe-fs.sh
+++ b/tests/t1700-probe-fs.sh
@@ -40,8 +40,13 @@ for type in ext2 ext3 ext4 btrfs xfs nilfs2 ntfs vfat hfsplus; do
esac
# create an $type file system
- dd if=/dev/null of=$dev bs=$ss seek=$n_sectors >/dev/null || fail=1
- mkfs.$type $force $dev || { warn_ $ME: mkfs.$type failed; fail=1; continue; }
+ if [ "$type" == "xfs" ]; then
+ # Work around a problem with s390
+ mkfs.xfs -ssize=$ss -dfile,name=$dev,size=${n_sectors}s || fail=1
+ else
+ dd if=/dev/null of=$dev bs=$ss seek=$n_sectors >/dev/null || fail=1
+ mkfs.$type $force $dev || { warn_ $ME: mkfs.$type failed; fail=1; continue; }
+ fi
# probe the $type file system
parted -m -s $dev u s print >out 2>&1 || fail=1
diff --git a/tests/t4100-dvh-partition-limits.sh b/tests/t4100-dvh-partition-limits.sh
index fb10025..781f792 100755
--- a/tests/t4100-dvh-partition-limits.sh
+++ b/tests/t4100-dvh-partition-limits.sh
@@ -37,8 +37,7 @@ mp=`pwd`/mount-point
n=4096
# create an XFS file system
-dd if=/dev/null of=$fs bs=1MB seek=50 || fail=1
-mkfs.xfs -f -q $fs || fail=1
+mkfs.xfs -dfile,name=$fs,size=100m || fail=1
mkdir "$mp" || fail=1
# Unmount upon interrupt, failure, etc., as well as upon normal completion.
diff --git a/tests/t4100-msdos-partition-limits.sh b/tests/t4100-msdos-partition-limits.sh
index af7907f..c7a611e 100755
--- a/tests/t4100-msdos-partition-limits.sh
+++ b/tests/t4100-msdos-partition-limits.sh
@@ -37,8 +37,7 @@ mp=`pwd`/mount-point
n=4096
# create an XFS file system
-dd if=/dev/null of=$fs bs=1MB seek=50 || fail=1
-mkfs.xfs -f -q $fs || fail=1
+mkfs.xfs -dfile,name=$fs,size=100m || fail=1
mkdir "$mp" || fail=1
# Unmount upon interrupt, failure, etc., as well as upon normal completion.
--
1.9.0

View File

@ -4,7 +4,7 @@
Summary: The GNU disk partition manipulation program
Name: parted
Version: 3.1
Release: 24%{?dist}
Release: 25%{?dist}
License: GPLv3+
Group: Applications/System
URL: http://www.gnu.org/software/parted
@ -126,15 +126,16 @@ Patch0100: 0100-GPT-strings-are-UCS-2LE-not-UTF-16.patch
Patch0101: 0101-libparted-remove-last_usable_if_grown.patch
Patch0102: 0102-tests-fix-t2310-dos-extended-2-sector-min-offset.sh.patch
Patch0103: 0103-Fix-filesystem-detection-on-non-512-byte-sectors.patch
Patch0200: 0104-libparted-don-t-detect-fat-and-ntfs-boot-sectors-as-.patch
Patch0201: 0105-libparted-remove-old-partitions-first-before-adding-.patch
Patch0202: 0106-libparted-remove-all-old-partitions-even-if-new-labe.patch
Patch0203: 0107-libparted-fix-loop-labels-to-not-vanish.patch
Patch0204: 0108-libparted-don-t-create-partition-on-loop-label.patch
Patch0205: 0109-partprobe-do-not-skip-loop-labels.patch
Patch0206: 0110-libparted-give-correct-partition-device-name-on-loop.patch
Patch0207: 0111-libparted-don-t-trash-filesystem-when-writing-loop-l.patch
Patch0208: 0112-tests-test-loop-labels.patch
Patch0104: 0104-libparted-don-t-detect-fat-and-ntfs-boot-sectors-as-.patch
Patch0105: 0105-libparted-remove-old-partitions-first-before-adding-.patch
Patch0106: 0106-libparted-remove-all-old-partitions-even-if-new-labe.patch
Patch0107: 0107-libparted-fix-loop-labels-to-not-vanish.patch
Patch0108: 0108-libparted-don-t-create-partition-on-loop-label.patch
Patch0109: 0109-partprobe-do-not-skip-loop-labels.patch
Patch0110: 0110-libparted-give-correct-partition-device-name-on-loop.patch
Patch0111: 0111-libparted-don-t-trash-filesystem-when-writing-loop-l.patch
Patch0112: 0112-tests-test-loop-labels.patch
Patch0113: 0113-tests-Use-mkfs.xfs-to-create-files-1101112.patch
Buildroot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
BuildRequires: e2fsprogs-devel
@ -273,6 +274,9 @@ fi
%changelog
* Tue May 27 2014 Brian C. Lane <bcl@redhat.com> 3.1-25
- Use mkfs.xfs to create files (#1101112)
* Thu May 22 2014 Brian C. Lane <bcl@redhat.com> 3.1-24
- Add some missing patches from master and the loop label fixes
- tests: test loop labels (psusi)