From e6e0f1db4535179f25ebf8f6f0a59eb430d377ff Mon Sep 17 00:00:00 2001
From: "Brian C. Lane" <bcl@redhat.com>
Date: Thu, 23 Jan 2014 10:09:36 -0800
Subject: [PATCH] tests: Use mkfs.xfs to create files (#1036152)
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 36e7cdf..575ca24 100755
--- a/tests/t1700-probe-fs.sh
+++ b/tests/t1700-probe-fs.sh
@@ -31,8 +31,13 @@ for type in ext2 ext3 ext4 btrfs xfs nilfs2; do
*) n_sectors=$((257*1024)) force=;; esac
# create an $type file system
- dd if=/dev/zero of=$dev bs=$ss count=$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/zero of=$dev bs=$ss count=$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 ec6981d..88e452d 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/zero of=$fs bs=1MB count=2 seek=100 || 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 f03a85e..9350441 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/zero of=$fs bs=1MB count=2 seek=100 || 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.8.4.2